Skip to content

Commit

Permalink
update examples
Browse files Browse the repository at this point in the history
  • Loading branch information
paulf81 committed Aug 29, 2019
1 parent c1119c6 commit 82e53e5
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 8 deletions.
8 changes: 3 additions & 5 deletions examples/example_01.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,12 @@
# FAST_InputFile = '5MW_ITIBarge_DLL_WTurb_WavesIrr.fst'
# FAST_directory = 'example_fast_input/5MW_ITIBarge_DLL_WTurb_WavesIrr'



# Initialiize a turbine class
drivetrain_inertia = 40469564.444
turbine = wtc_turbine.Turbine(drivetrain_inertia=drivetrain_inertia)
turbine = wtc_turbine.Turbine()

# Load the turbine model from a FAST input folder
turbine.load_from_fast(FAST_InputFile,FAST_directory,dev_branch=True)
drivetrain_inertia = 40469564.444
turbine.load_from_fast(FAST_InputFile,FAST_directory,drivetrain_inertia=drivetrain_inertia,dev_branch=True)

# Display a little about the turbine
print(turbine)
Expand Down
33 changes: 30 additions & 3 deletions examples/example_02.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,34 @@
# Example_02
# Load controller parameter file, make some changes and save as new file
# Example_04
# Load a turbine model from saved pickle, make a quick cp plot


from WTC_toolbox import turbine as wtc_turbine
from WTC_toolbox import controller as wtc_controller
from WTC_toolbox import sim as wtc_sim
from WTC_toolbox import sim as wtc_sim
import numpy as np
import matplotlib.pyplot as plt

# Initialiize a turbine class
turbine = wtc_turbine.Turbine()

# Load quick from python
turbine.load('saved_turbine.p')

# Sweep TSR and fix pitch in two positions
fixed_rpm = 10. # RPM
fixed_pitch = 0.

tsr = np.arange(1,15,0.1)


cp_0 = np.array([turbine.cp_interp(t,0) for t in tsr])
cp_3 = np.array([turbine.cp_interp(t,3) for t in tsr])

fig, ax = plt.subplots()
ax.plot(tsr,cp_0,label='Pitch=0')
ax.plot(tsr,cp_3,label='Pitch=3')
ax.set_xlabel('TSR')
ax.set_ylabel('Cp')
ax.grid(True)
ax.legend()
plt.show()
7 changes: 7 additions & 0 deletions examples/example_03.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Example_03
# Load controller parameter file, make some changes and save as new file


from WTC_toolbox import turbine as wtc_turbine
from WTC_toolbox import controller as wtc_controller
from WTC_toolbox import sim as wtc_sim
13 changes: 13 additions & 0 deletions examples/example_04.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Example_04
# Load a turbine model and use to tune the controller


from WTC_toolbox import turbine as wtc_turbine
from WTC_toolbox import controller as wtc_controller
from WTC_toolbox import sim as wtc_sim

# Initialiize a turbine class
turbine = wtc_turbine.Turbine()

# Load quick from python
turbine.load('saved_turbine.p')

0 comments on commit 82e53e5

Please sign in to comment.