-
Notifications
You must be signed in to change notification settings - Fork 92
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added autodocumentation template for all examples
- Loading branch information
1 parent
541fe81
commit df133ee
Showing
28 changed files
with
1,022 additions
and
1,014 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,46 +1,53 @@ | ||
''' | ||
----------- 02_ccblade -------------- | ||
Run CCblade, save a rotor performance text file | ||
------------------------------------- | ||
""" | ||
02_ccblade | ||
-------------- | ||
Run CCblade, save a rotor performance text file. | ||
In this example: | ||
- Read .yaml input file | ||
- Load an openfast turbine model | ||
- Run ccblade to get rotor performance properties | ||
- Write a text file with rotor performance properties | ||
''' | ||
* Read .yaml input file | ||
* Load an openfast turbine model | ||
* Run ccblade to get rotor performance properties | ||
* Write a text file with rotor performance properties | ||
""" | ||
|
||
# Python modules | ||
import os | ||
# ROSCO toolbox modules | ||
from rosco.toolbox import turbine as ROSCO_turbine | ||
from rosco.toolbox.utilities import write_rotor_performance | ||
from rosco.toolbox.inputs.validation import load_rosco_yaml | ||
# Initialize parameter dictionaries | ||
turbine_params = {} | ||
control_params = {} | ||
|
||
this_dir = os.path.dirname(os.path.abspath(__file__)) | ||
example_out_dir = os.path.join(this_dir,'examples_out') | ||
if not os.path.isdir(example_out_dir): | ||
os.makedirs(example_out_dir) | ||
|
||
# Load yaml file | ||
this_dir = os.path.dirname(os.path.abspath(__file__)) | ||
tune_dir = os.path.join(this_dir,'Tune_Cases') | ||
parameter_filename = os.path.join(tune_dir,'NREL5MW.yaml') | ||
inps = load_rosco_yaml(parameter_filename) | ||
path_params = inps['path_params'] | ||
turbine_params = inps['turbine_params'] | ||
controller_params = inps['controller_params'] | ||
|
||
# Load turbine data from openfast model | ||
turbine = ROSCO_turbine.Turbine(turbine_params) | ||
turbine.load_from_fast( | ||
path_params['FAST_InputFile'], | ||
os.path.join(tune_dir,path_params['FAST_directory']), | ||
rot_source='cc-blade', | ||
txt_filename=None) | ||
|
||
# Write rotor performance text file | ||
txt_filename = os.path.join(example_out_dir,'02_Cp_Ct_Cq.Ex03.txt') | ||
write_rotor_performance(turbine,txt_filename=txt_filename) | ||
|
||
def main(): | ||
# Initialize parameter dictionaries | ||
turbine_params = {} | ||
control_params = {} | ||
|
||
this_dir = os.path.dirname(os.path.abspath(__file__)) | ||
example_out_dir = os.path.join(this_dir,'examples_out') | ||
if not os.path.isdir(example_out_dir): | ||
os.makedirs(example_out_dir) | ||
|
||
# Load yaml file | ||
this_dir = os.path.dirname(os.path.abspath(__file__)) | ||
tune_dir = os.path.join(this_dir,'Tune_Cases') | ||
parameter_filename = os.path.join(tune_dir,'NREL5MW.yaml') | ||
inps = load_rosco_yaml(parameter_filename) | ||
path_params = inps['path_params'] | ||
turbine_params = inps['turbine_params'] | ||
controller_params = inps['controller_params'] | ||
|
||
# Load turbine data from openfast model | ||
turbine = ROSCO_turbine.Turbine(turbine_params) | ||
turbine.load_from_fast( | ||
path_params['FAST_InputFile'], | ||
os.path.join(tune_dir,path_params['FAST_directory']), | ||
rot_source='cc-blade', | ||
txt_filename=None) | ||
|
||
# Write rotor performance text file | ||
txt_filename = os.path.join(example_out_dir,'02_Cp_Ct_Cq.Ex03.txt') | ||
write_rotor_performance(turbine,txt_filename=txt_filename) | ||
|
||
if __name__ == "__main__": | ||
main() | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.