From 26182de19f97f72ffa4072c460d965c3204a3176 Mon Sep 17 00:00:00 2001 From: Nikhar Abbas Date: Fri, 13 Sep 2019 11:58:52 -0600 Subject: [PATCH] Ease changes in step wind increments --- examples/example_06.py | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/examples/example_06.py b/examples/example_06.py index e0f792d45..19f72c83a 100644 --- a/examples/example_06.py +++ b/examples/example_06.py @@ -1,7 +1,6 @@ # Example_06 # Step wind simulation - from WTC_toolbox import turbine as wtc_turbine from WTC_toolbox import sim as wtc_sim from WTC_toolbox import control_interface as ci @@ -9,9 +8,6 @@ import matplotlib.pyplot as plt import os -# ensure proper directory location --- this is annoying and should be fixed -path = os.getcwd() -os.chdir('%s/examples'%path) # ensure proper directory location os.chdir('/Users/nabbas/Documents/WindEnergyToolbox/WTC_toolbox/examples') @@ -39,12 +35,14 @@ # Define a wind speed history dt = 0.1 -t= np.arange(0,200,dt) -ws = np.ones_like(t) * 9. -ws[t>100.] = 10. +tlen = 400 # length of time to simulate (s) +ws0 = 9 # initial wind speed (m/s) +t= np.arange(0,tlen,dt) +ws = np.ones_like(t) * ws0 +# add steps at every 100s +for i in range(len(t)): + ws[i] = ws[i] + t[i]//100 -# fig, ax = plt.subplots() -# ax.plot(t,ws) -# plt.show() -sim.sim_ws_series(t,ws) \ No newline at end of file +# Run simulator +sim.sim_ws_series(t,ws)