Skip to content

Commit

Permalink
Ease changes in step wind increments
Browse files Browse the repository at this point in the history
  • Loading branch information
nikhar-abbas committed Sep 13, 2019
1 parent 9752d39 commit 26182de
Showing 1 changed file with 9 additions and 11 deletions.
20 changes: 9 additions & 11 deletions examples/example_06.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,13 @@
# 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
import numpy as np
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')

Expand Down Expand Up @@ -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)
# Run simulator
sim.sim_ws_series(t,ws)

0 comments on commit 26182de

Please sign in to comment.