Skip to content

Commit

Permalink
Squashed 'ROSCO/' changes from 7fa1ae25e..6c2807a9e
Browse files Browse the repository at this point in the history
6c2807a9e Merge remote-tracking branch 'upstream/develop' into v2.9.0_prep
4cdef25d4 Merge pull request #300 from NREL/smart_lib_path
b1c943ea0 fixes for windows
8c39105a3 hopefully caught everything
2d0525830 switch to cmake-build-extension and logic for finding rosco library path

git-subtree-dir: ROSCO
git-subtree-split: 6c2807a9ece26b4b94bc0a78bc4ca8388fba60b0
  • Loading branch information
dzalkind committed Jan 12, 2024
1 parent 8fab9a3 commit 5912bf5
Show file tree
Hide file tree
Showing 31 changed files with 187 additions and 321 deletions.
11 changes: 2 additions & 9 deletions Examples/04_simple_sim.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,9 @@
# Python modules
import matplotlib.pyplot as plt
import numpy as np
import os, platform
import os
# ROSCO toolbox modules
from rosco import discon_lib_path as lib_name
from rosco.toolbox import controller as ROSCO_controller
from rosco.toolbox import turbine as ROSCO_turbine
from rosco.toolbox import sim as ROSCO_sim
Expand All @@ -43,14 +44,6 @@
example_out_dir = os.path.join(this_dir,'examples_out')
os.makedirs(example_out_dir,exist_ok=True)

if platform.system() == 'Windows':
sfx = 'dll'
elif platform.system() == 'Darwin':
sfx = 'dylib'
else:
sfx = 'so'
lib_name = os.path.join(rosco_dir, 'lib', 'libdiscon.'+sfx)

# # Load turbine model from saved pickle
turbine = ROSCO_turbine.Turbine
turbine = turbine.load(os.path.join(example_out_dir,'01_NREL5MW_saved.p'))
Expand Down
6 changes: 3 additions & 3 deletions Examples/05_openfast_sim.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@
Note - you will need to have a compiled controller in ROSCO/build/
'''
# Python Modules
import yaml
#import yaml
import os
import numpy as np
import matplotlib.pyplot as plt
#import numpy as np
#import matplotlib.pyplot as plt
# ROSCO toolbox modules
from rosco.toolbox import controller as ROSCO_controller
from rosco.toolbox import turbine as ROSCO_turbine
Expand Down
2 changes: 1 addition & 1 deletion Examples/07_openfast_outputs.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
'''

# Python Modules
import numpy as np
#import numpy as np
import matplotlib.pyplot as plt
# ROSCO toolbox modules
from rosco.toolbox.ofTools.fast_io import output_processing
Expand Down
2 changes: 1 addition & 1 deletion Examples/12_tune_ipc.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
'''
# Python Modules
import os, platform
import os
import matplotlib.pyplot as plt

# ROSCO toolbox modules
Expand Down
14 changes: 3 additions & 11 deletions Examples/14_open_loop_control.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,12 @@
'''
# Python Modules
import yaml, os, platform
import os
import numpy as np
import matplotlib.pyplot as plt

# ROSCO toolbox modules
from rosco import discon_lib_path
from rosco.toolbox import controller as ROSCO_controller
from rosco.toolbox import turbine as ROSCO_turbine
from rosco.toolbox import utilities as ROSCO_utilities
Expand Down Expand Up @@ -89,17 +90,8 @@
ROSCO_utilities.write_DISCON(turbine,controller,param_file=param_file, txt_filename=path_params['rotor_performance_filename'])

### Run OpenFAST using aeroelasticse tools

if platform.system() == 'Windows':
sfx = 'dll'
elif platform.system() == 'Darwin':
sfx = 'dylib'
else:
sfx = 'so'
rosco_dll = os.path.join(rosco_dir, 'lib', 'libdiscon.'+sfx)

case_inputs = {}
case_inputs[('ServoDyn','DLL_FileName')] = {'vals': [rosco_dll], 'group': 0}
case_inputs[('ServoDyn','DLL_FileName')] = {'vals': [discon_lib_path], 'group': 0}

# Apply all discon variables as case inputs
discon_vt = ROSCO_utilities.DISCON_dict(
Expand Down
9 changes: 1 addition & 8 deletions Examples/16_external_dll.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
'''

import os, platform
from rosco import discon_lib_path as lib_name
from rosco.toolbox.ofTools.case_gen.run_FAST import run_FAST_ROSCO
from rosco.toolbox.ofTools.case_gen import CaseLibrary as cl
import shutil
Expand All @@ -19,14 +20,6 @@
example_out_dir = os.path.join(this_dir,'examples_out')
os.makedirs(example_out_dir,exist_ok=True)

if platform.system() == 'Windows':
sfx = 'dll'
elif platform.system() == 'Darwin':
sfx = 'dylib'
else:
sfx = 'so'
lib_name = os.path.join(rosco_dir, 'lib', 'libdiscon.'+sfx)


def main():

Expand Down
12 changes: 2 additions & 10 deletions Examples/17a_zeromq_simple.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
'''


import platform
import os
import matplotlib.pyplot as plt
from rosco import discon_lib_path
from rosco.toolbox.inputs.validation import load_rosco_yaml
from rosco.toolbox.utilities import write_DISCON
from rosco.toolbox import control_interface as ROSCO_ci
Expand All @@ -32,14 +32,6 @@
example_out_dir = os.path.join(this_dir,'examples_out')
os.makedirs(example_out_dir,exist_ok=True)

if platform.system() == 'Windows':
sfx = 'dll'
elif platform.system() == 'Darwin':
sfx = 'dylib'
else:
sfx = 'so'
lib_name = os.path.join(rosco_dir, 'lib', 'libdiscon.'+sfx)

def run_zmq(logfile=None):
# Start the server at the following address
network_address = "tcp://*:5555"
Expand Down Expand Up @@ -118,7 +110,7 @@ def sim_rosco():

# Load controller library
controller_int = ROSCO_ci.ControllerInterface(
lib_name,
discon_lib_path,
param_filename=param_filename,
sim_name=os.path.join(sim_dir,'sim-zmq')
)
Expand Down
10 changes: 1 addition & 9 deletions Examples/18_pitch_offsets.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
'''

import os, platform
import os
from rosco.toolbox.ofTools.case_gen.run_FAST import run_FAST_ROSCO
from rosco.toolbox.ofTools.case_gen import CaseLibrary as cl
from rosco.toolbox.ofTools.fast_io import output_processing
Expand All @@ -20,14 +20,6 @@
example_out_dir = os.path.join(this_dir,'examples_out')
os.makedirs(example_out_dir,exist_ok=True)

if platform.system() == 'Windows':
sfx = 'dll'
elif platform.system() == 'Darwin':
sfx = 'dylib'
else:
sfx = 'so'
lib_name = os.path.join(rosco_dir, 'lib', 'libdiscon.'+sfx)


def main():

Expand Down
16 changes: 4 additions & 12 deletions Examples/20_active_wake_control.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,12 +153,12 @@
[2] - Frederik, Joeri A., et al. "The helix approach: Using dynamic individual pitch control to enhance wake mixing in wind farms." Wind Energy 23.8 (2020): 1739-1751.
'''

import os, platform
import os
from rosco.toolbox.ofTools.case_gen.run_FAST import run_FAST_ROSCO
from rosco.toolbox.ofTools.case_gen import CaseLibrary as cl
from rosco.toolbox.ofTools.fast_io import output_processing
from rosco.toolbox.utilities import read_DISCON, DISCON_dict
import numpy as np
#from rosco.toolbox.ofTools.fast_io import output_processing
from rosco.toolbox.utilities import read_DISCON #, DISCON_dict
#import numpy as np

# Choose your implementation method
AWC_Mode = 1 # 1 for SNL implementation, 2 for Coleman Transformation implementation
Expand All @@ -170,14 +170,6 @@
example_out_dir = os.path.join(this_dir,'examples_out')
os.makedirs(example_out_dir,exist_ok=True)

if platform.system() == 'Windows':
sfx = 'dll'
elif platform.system() == 'Darwin':
sfx = 'dylib'
else:
sfx = 'so'
lib_name = os.path.join(rosco_dir, 'lib', 'libdiscon.'+sfx)



def main():
Expand Down
21 changes: 7 additions & 14 deletions Examples/21_optional_inputs.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
to the current version
'''

import os, platform
import os
from rosco import discon_lib_path
from rosco.toolbox import control_interface as ROSCO_ci
from rosco.toolbox import sim as ROSCO_sim
#from rosco.toolbox import sim as ROSCO_sim
from rosco.toolbox import turbine as ROSCO_turbine
import numpy as np

#import numpy as np

#directories
this_dir = os.path.dirname(os.path.abspath(__file__))
Expand All @@ -18,15 +18,6 @@
example_in_dir = os.path.join(this_dir,'example_inputs')
os.makedirs(example_out_dir,exist_ok=True)

if platform.system() == 'Windows':
sfx = 'dll'
elif platform.system() == 'Darwin':
sfx = 'dylib'
else:
sfx = 'so'
rosco_dll = os.path.join(rosco_dir, 'lib', 'libdiscon.'+sfx)



def main():

Expand All @@ -42,7 +33,9 @@ def main():

avi_fail = []
for param_filename in param_filenames:
controller_int = ROSCO_ci.ControllerInterface(rosco_dll,param_filename=param_filename,sim_name='sim1')
controller_int = ROSCO_ci.ControllerInterface(discon_lib_path,
param_filename=param_filename,
sim_name='sim1')
controller_int.kill_discon()
avi_fail.append(controller_int.aviFAIL.value)

Expand Down
4 changes: 2 additions & 2 deletions Examples/22_cable_control.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
'''

import os, platform
import os
from rosco.toolbox.ofTools.case_gen.run_FAST import run_FAST_ROSCO
from rosco.toolbox.ofTools.case_gen import CaseLibrary as cl
from rosco.toolbox.ofTools.fast_io import output_processing
Expand Down Expand Up @@ -149,4 +149,4 @@ def main():


if __name__=="__main__":
main()
main()
13 changes: 2 additions & 11 deletions Examples/23_structural_control.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
'''

import os, platform
import os
from rosco.toolbox.ofTools.case_gen.run_FAST import run_FAST_ROSCO
from rosco.toolbox.ofTools.case_gen import CaseLibrary as cl
import numpy as np
#import numpy as np
from rosco.toolbox.ofTools.fast_io.FAST_reader import InputReader_OpenFAST
from rosco.toolbox.inputs.validation import load_rosco_yaml
from rosco.toolbox.controller import OpenLoopControl
Expand All @@ -35,15 +35,6 @@
example_out_dir = os.path.join(this_dir,'examples_out')
os.makedirs(example_out_dir,exist_ok=True)

if platform.system() == 'Windows':
sfx = 'dll'
elif platform.system() == 'Darwin':
sfx = 'dylib'
else:
sfx = 'so'
lib_name = os.path.join(rosco_dir, 'lib', 'libdiscon.'+sfx)



def main():

Expand Down
17 changes: 4 additions & 13 deletions Examples/24_floating_feedback.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@
'''

import os, platform
import os
from rosco.toolbox.ofTools.case_gen.run_FAST import run_FAST_ROSCO
from rosco.toolbox.ofTools.case_gen import CaseLibrary as cl
import numpy as np
from rosco.toolbox.ofTools.fast_io.FAST_reader import InputReader_OpenFAST
from rosco.toolbox.inputs.validation import load_rosco_yaml
from rosco.toolbox.controller import OpenLoopControl
#from rosco.toolbox.ofTools.fast_io.FAST_reader import InputReader_OpenFAST
#from rosco.toolbox.inputs.validation import load_rosco_yaml
#from rosco.toolbox.controller import OpenLoopControl
from rosco.toolbox.tune import yaml_to_objs
from rosco.toolbox.utilities import write_DISCON, read_DISCON
from rosco.toolbox import controller as ROSCO_controller
Expand All @@ -33,15 +33,6 @@
example_out_dir = os.path.join(this_dir,'examples_out')
os.makedirs(example_out_dir,exist_ok=True)

if platform.system() == 'Windows':
sfx = 'dll'
elif platform.system() == 'Darwin':
sfx = 'dylib'
else:
sfx = 'so'
lib_name = os.path.join(rosco_dir, 'lib', 'libdiscon.'+sfx)


def main():

# Input yaml and output directory
Expand Down
12 changes: 2 additions & 10 deletions Examples/25_rotor_position_control.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@
'''

import os, platform
import os
from rosco.toolbox.ofTools.case_gen.run_FAST import run_FAST_ROSCO
from rosco.toolbox.ofTools.case_gen import CaseLibrary as cl
from rosco.toolbox.ofTools.fast_io import output_processing
from rosco.toolbox.controller import OpenLoopControl
import numpy as np
import pandas as pd
#import pandas as pd
import matplotlib.pyplot as plt


Expand All @@ -23,14 +23,6 @@
example_out_dir = os.path.join(this_dir,'examples_out')
os.makedirs(example_out_dir,exist_ok=True)

if platform.system() == 'Windows':
sfx = 'dll'
elif platform.system() == 'Darwin':
sfx = 'dylib'
else:
sfx = 'so'
lib_name = os.path.join(rosco_dir, 'lib', 'libdiscon.'+sfx)


def main():

Expand Down
15 changes: 7 additions & 8 deletions Examples/26_marine_hydro.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,14 @@
'''

import os, platform
import os
from rosco.toolbox.ofTools.case_gen.run_FAST import run_FAST_ROSCO
from rosco.toolbox.ofTools.case_gen import CaseLibrary as cl
from rosco.toolbox.ofTools.fast_io import output_processing
import numpy as np
from rosco.toolbox.ofTools.fast_io.FAST_reader import InputReader_OpenFAST
from rosco.toolbox.inputs.validation import load_rosco_yaml
import matplotlib.pyplot as plt
from rosco.toolbox.controller import OpenLoopControl
#from rosco.toolbox.ofTools.fast_io import output_processing
#from rosco.toolbox.ofTools.fast_io.FAST_reader import InputReader_OpenFAST
#from rosco.toolbox.inputs.validation import load_rosco_yaml
#import matplotlib.pyplot as plt
#from rosco.toolbox.controller import OpenLoopControl

'''
Run MHK turbine in OpenFAST with ROSCO torque controller
Expand Down Expand Up @@ -83,4 +82,4 @@ def main():


if __name__=="__main__":
main()
main()
Loading

0 comments on commit 5912bf5

Please sign in to comment.