Skip to content

Commit 56cc77a

Browse files
committed
Turbine thrust calculation, platform external forces, !include yamls
-- Turbine class now has a properly working thrust calculation and saves the value in thrust property -- platform class will add up total thrust from all connected turbines and save in mean_loads dictionary under 'thrust' key - platform mean_loads dictioanry contains 'wind', 'wave', 'current', 'thrust' keys with values defaulting to 0 -- updated !include constructor in yaml loader to work for relative paths and situations when driver file is in different folder than yaml - !include constructor allows user to provide a yaml file name that will be included in the main yaml when read in. See OntologySample200m.yaml topsides section for example. -- updated examples to use !include instead of full definition for turbine raft definitions
1 parent 277bdd9 commit 56cc77a

File tree

12 files changed

+55
-8491
lines changed

12 files changed

+55
-8491
lines changed

examples/01_Visualization/08_3D-visual_turbine.yaml

Lines changed: 1 addition & 1052 deletions
Large diffs are not rendered by default.

examples/01_Visualization/11_2D-visual_all_options.yaml

Lines changed: 1 addition & 1052 deletions
Large diffs are not rendered by default.

examples/03_Frequency_Domain_Analysis_RAFT/02_FOWT.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""
2+
23
Simple driver file to create a RAFT model of a 2-platform array with turbines.
34
This file then adds a wave spectrum to run, analyzes that case, and plots the results.
45

examples/03_Frequency_Domain_Analysis_RAFT/02_FOWT.yaml

Lines changed: 1 addition & 1052 deletions
Large diffs are not rendered by default.

examples/OntologySample200m.yaml

Lines changed: 2 additions & 1055 deletions
Large diffs are not rendered by default.

examples/OntologySample200m_1turb.yaml

Lines changed: 1 addition & 1052 deletions
Large diffs are not rendered by default.

examples/OntologySample200m_uniformArray.yaml

Lines changed: 1 addition & 1052 deletions
Large diffs are not rendered by default.

examples/OntologySample200mbis_1turb.yaml

Lines changed: 1 addition & 1051 deletions
Large diffs are not rendered by default.

examples/OntologySample600m_shared.yaml

Lines changed: 2 additions & 1051 deletions
Large diffs are not rendered by default.

famodel/helpers.py

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,8 @@ def loadYAML(filename):
9090

9191
with open(filename) as file:
9292
loader = yaml.FullLoader
93+
# add a property to store the overall yaml path
94+
loader.path = os.path.dirname(os.path.realpath(filename))
9395
loader.add_constructor('!include',yamlInclude)
9496
project = yaml.load(file, Loader=loader)
9597
if not project:
@@ -113,14 +115,10 @@ def yamlInclude(loader, node):
113115
None.
114116
115117
'''
116-
# pull out f
118+
# pull out file name
117119
file_to_include = loader.construct_scalar(node)
118-
# pull out absolute path of file
119-
# if os.path.isabs(file_to_include):
120-
# included_yaml = file_to_include
121-
# else:
122-
# dir =
123-
included_yaml = os.path.abspath(file_to_include)
120+
# combine with saved loader path property (path to overall yaml)
121+
included_yaml = os.path.join(loader.path,file_to_include)#abspath(file_to_include)
124122
try:
125123
with open(included_yaml) as file:
126124
return(yaml.load(file,Loader=loader.__class__))

0 commit comments

Comments
 (0)