Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/CI_rosco-compile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ jobs:
strategy:
fail-fast: false #true
matrix:
os: ["ubuntu-latest", "macOS-13", "macOS-14", "windows-latest"] #mac-13 intel, mac-14 arm
os: ["ubuntu-latest", "macOS-14", "macOS-latest", "windows-latest"] #mac-13 intel, mac-14 arm
python-version: ["3.11", "3.12"]

steps:
Expand Down
10 changes: 1 addition & 9 deletions .github/workflows/Publish_ROSCO.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-13, macos-14, macos-15]
os: [ubuntu-latest, windows-latest, macos-14, macos-15]

steps:
- name: Set up QEMU
Expand Down Expand Up @@ -64,14 +64,6 @@ jobs:
CC: ${{ steps.install_cc.outputs.cc }}
CXX: ${{ steps.install_cc.outputs.cxx }}

- name: Build wheels mac-13
if: contains( matrix.os, 'macos-13')
uses: pypa/cibuildwheel@v2.23.3
env:
CC: ${{ steps.install_cc.outputs.cc }}
CXX: ${{ steps.install_cc.outputs.cxx }}
CIBW_ENVIRONMENT_MACOS: MACOSX_DEPLOYMENT_TARGET="13.0"

- name: Build wheels mac-14
if: contains( matrix.os, 'macos-14')
uses: pypa/cibuildwheel@v2.23.3
Expand Down
37 changes: 26 additions & 11 deletions Examples/02_ccblade.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,38 +16,53 @@
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
import matplotlib.pyplot as plt


this_dir = os.path.dirname(os.path.abspath(__file__))
tune_dir = os.path.join(this_dir,'Tune_Cases')

example_out_dir = os.path.join(this_dir,'examples_out')
if not os.path.isdir(example_out_dir):
os.makedirs(example_out_dir)


def main():
# Inputs: tuning yaml (will point to openfast model file for generating Cp surface)
parameter_filename = os.path.join(tune_dir,'IEA15MW.yaml')

# Output: rotor performance text file
txt_filename = os.path.join(example_out_dir,'02_Cp_Ct_Cq.Ex03.txt')

# 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']),
os.path.join(os.path.dirname(parameter_filename),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)

# plot rotor performance
print('Plotting Cp data')
turbine.Cp.plot_performance()

if False:
plt.show()
else:
plt.savefig(os.path.join(example_out_dir,'01_NREL5MW_Cp.png'))

if __name__ == "__main__":
main()

34 changes: 20 additions & 14 deletions Examples/03_tune_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,38 +25,46 @@
from rosco.toolbox.utilities import write_DISCON
from rosco.toolbox.inputs.validation import load_rosco_yaml

this_dir = os.path.dirname(os.path.abspath(__file__))
tune_dir = os.path.join(this_dir,'Tune_Cases')
example_out_dir = os.path.join(this_dir,'examples_out')
os.makedirs(example_out_dir, exist_ok=True)

def main():
# Inputs: tuning yaml (will point to openfast model file)
parameter_filename = os.path.join(tune_dir,'IEA15MW.yaml')

# Output: controller DISCON input file
param_file = os.path.join(example_out_dir,'IEA15MW_DISCON.IN')

# 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']
yaml_dir = os.path.dirname(parameter_filename)

# Instantiate turbine, controller, and file processing classes
turbine = ROSCO_turbine.Turbine(turbine_params)
controller = ROSCO_controller.Controller(controller_params)

# Load turbine data from OpenFAST and rotor performance text file
cp_filename = os.path.join(tune_dir,path_params['rotor_performance_filename'])
cp_filename = os.path.join(yaml_dir,path_params['rotor_performance_filename'])
turbine.load_from_fast(
path_params['FAST_InputFile'],
os.path.join(tune_dir,path_params['FAST_directory']),
os.path.join(yaml_dir,path_params['FAST_directory']),
rot_source='txt',txt_filename= cp_filename
)

# Tune controller
controller.tune_controller(turbine)

# Write parameter input file
example_out_dir = os.path.join(this_dir,'examples_out')
param_file = os.path.join(example_out_dir,'03_DISCON.IN')
write_DISCON(turbine,controller,
param_file=param_file,
txt_filename=cp_filename
)
write_DISCON(
turbine,controller,
param_file=param_file,
txt_filename=cp_filename
)

# Plot gain schedule
fig, ax = plt.subplots(2,2,constrained_layout=True,sharex=True)
Expand All @@ -76,9 +84,7 @@ def main():
ax[3].set_ylabel('Integral Gain')

plt.suptitle('Pitch Controller Gains')

if not os.path.isdir(example_out_dir):
os.makedirs(example_out_dir)


if False:
plt.show()
Expand Down
13 changes: 8 additions & 5 deletions Examples/06_peak_shaving.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
# Python modules
import matplotlib.pyplot as plt
import os
import numpy as np
# ROSCO toolbox modules
from rosco.toolbox import controller as ROSCO_controller
from rosco.toolbox import turbine as ROSCO_turbine
Expand All @@ -45,6 +46,8 @@ def main():

# Load yaml file
parameter_filename = os.path.join(tune_dir,'NREL5MW.yaml')
yaml_dir = os.path.dirname(parameter_filename)

inps = load_rosco_yaml(parameter_filename)
path_params = inps['path_params']
turbine_params = inps['turbine_params']
Expand All @@ -61,19 +64,19 @@ def main():
# Load turbine data from OpenFAST and rotor performance text file
turbine.load_from_fast(
path_params['FAST_InputFile'],
os.path.join(tune_dir,path_params['FAST_directory']),
rot_source='txt',txt_filename=os.path.join(tune_dir,path_params['rotor_performance_filename'])
os.path.join(yaml_dir,path_params['FAST_directory']),
rot_source='txt',txt_filename=os.path.join(yaml_dir,path_params['rotor_performance_filename'])
)
# Tune controller
controller.tune_controller(turbine)

# Plot minimum pitch schedule
fig, ax = plt.subplots(1,1)
ax.plot(controller.v, controller.pitch_op,label='Steady State Operation')
ax.plot(controller.v, controller.ps_min_bld_pitch, label='Minimum Pitch Schedule')
ax.plot(controller.v, np.degrees(controller.pitch_op), label='Steady State Operation')
ax.plot(controller.v, np.degrees(controller.ps_min_bld_pitch), label='Minimum Pitch Schedule')
ax.legend()
ax.set_xlabel('Wind speed (m/s)')
ax.set_ylabel('Blade pitch (rad)')
ax.set_ylabel('Blade pitch (deg)')

if False:
plt.show()
Expand Down
6 changes: 3 additions & 3 deletions Examples/Test_Cases/BAR_10/BAR_10_DISCON.IN
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
! Controller parameter input file for the BAR_10 wind turbine
! - File written using ROSCO version 2.10.0 controller tuning logic on 09/08/25
! - File written using ROSCO version 2.10.1 controller tuning logic on 11/26/25

!------- SIMULATION CONTROL ------------------------------------------------------------
1 ! LoggingLevel - 0: write no debug files, 1: write standard output .dbg-file, 2: LoggingLevel 1 + ROSCO LocalVars (.dbg2) 3: LoggingLevel 2 + complete avrSWAP-array (.dbg3)
Expand Down Expand Up @@ -101,7 +101,7 @@

!------- SETPOINT SMOOTHER ---------------------------------------------
1.00000 ! SS_VSGain - Variable speed torque controller setpoint smoother gain, [-].
0.00100 ! SS_PCGain - Collective pitch controller setpoint smoother gain, [-].
0.05000 ! SS_PCGain - Collective pitch controller setpoint smoother gain, [-].

!------- POWER REFERENCE TRACKING --------------------------------------
0 ! PRC_Comm - Power reference communication mode when PRC_Mode = 2, 0- use constant DISCON inputs, 1- use open loop inputs, 2- use ZMQ inputs
Expand Down Expand Up @@ -163,7 +163,7 @@
200.0000 100.0000 ! SU_LoadHoldDuration - Array containing duration to hold the partial loads during startup [s]

!------- SHUTDOWN -----------------------------------------------------------
0 ! SD_TimeActivate - Time to acitvate shutdown modes, [s]
0 ! SD_TimeActivate - Time to acitvate shutdown modes; no shutdown events will occur before this time. [s]
0 ! SD_EnablePitch - Shutdown when collective blade pitch exceeds a threshold, [-]
0 ! SD_EnableYawError - Shutdown when yaw error exceeds a threshold, [-]
0 ! SD_EnableGenSpeed - Shutdown when generator speed exceeds a threshold, [-]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
! Controller parameter input file for the IEA-15-240-RWT-Monopile wind turbine
! - File written using ROSCO version 2.10.0 controller tuning logic on 09/08/25
! - File written using ROSCO version 2.10.1 controller tuning logic on 11/26/25

!------- SIMULATION CONTROL ------------------------------------------------------------
1 ! LoggingLevel - 0: write no debug files, 1: write standard output .dbg-file, 2: LoggingLevel 1 + ROSCO LocalVars (.dbg2) 3: LoggingLevel 2 + complete avrSWAP-array (.dbg3)
Expand Down Expand Up @@ -101,7 +101,7 @@

!------- SETPOINT SMOOTHER ---------------------------------------------
1.00000 ! SS_VSGain - Variable speed torque controller setpoint smoother gain, [-].
0.00100 ! SS_PCGain - Collective pitch controller setpoint smoother gain, [-].
0.05000 ! SS_PCGain - Collective pitch controller setpoint smoother gain, [-].

!------- POWER REFERENCE TRACKING --------------------------------------
0 ! PRC_Comm - Power reference communication mode when PRC_Mode = 2, 0- use constant DISCON inputs, 1- use open loop inputs, 2- use ZMQ inputs
Expand Down Expand Up @@ -163,7 +163,7 @@
200.0000 100.0000 ! SU_LoadHoldDuration - Array containing duration to hold the partial loads during startup [s]

!------- SHUTDOWN -----------------------------------------------------------
0 ! SD_TimeActivate - Time to acitvate shutdown modes, [s]
0 ! SD_TimeActivate - Time to acitvate shutdown modes; no shutdown events will occur before this time. [s]
0 ! SD_EnablePitch - Shutdown when collective blade pitch exceeds a threshold, [-]
0 ! SD_EnableYawError - Shutdown when yaw error exceeds a threshold, [-]
0 ! SD_EnableGenSpeed - Shutdown when generator speed exceeds a threshold, [-]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
! Controller parameter input file for the IEA-15-240-RWT-UMaineSemi wind turbine
! - File written using ROSCO version 2.10.0 controller tuning logic on 09/08/25
! - File written using ROSCO version 2.10.1 controller tuning logic on 11/26/25

!------- SIMULATION CONTROL ------------------------------------------------------------
2 ! LoggingLevel - 0: write no debug files, 1: write standard output .dbg-file, 2: LoggingLevel 1 + ROSCO LocalVars (.dbg2) 3: LoggingLevel 2 + complete avrSWAP-array (.dbg3)
Expand Down Expand Up @@ -101,7 +101,7 @@

!------- SETPOINT SMOOTHER ---------------------------------------------
1.00000 ! SS_VSGain - Variable speed torque controller setpoint smoother gain, [-].
0.00100 ! SS_PCGain - Collective pitch controller setpoint smoother gain, [-].
0.05000 ! SS_PCGain - Collective pitch controller setpoint smoother gain, [-].

!------- POWER REFERENCE TRACKING --------------------------------------
0 ! PRC_Comm - Power reference communication mode when PRC_Mode = 2, 0- use constant DISCON inputs, 1- use open loop inputs, 2- use ZMQ inputs
Expand Down Expand Up @@ -163,7 +163,7 @@
200.0000 100.0000 ! SU_LoadHoldDuration - Array containing duration to hold the partial loads during startup [s]

!------- SHUTDOWN -----------------------------------------------------------
0 ! SD_TimeActivate - Time to acitvate shutdown modes, [s]
0 ! SD_TimeActivate - Time to acitvate shutdown modes; no shutdown events will occur before this time. [s]
0 ! SD_EnablePitch - Shutdown when collective blade pitch exceeds a threshold, [-]
0 ! SD_EnableYawError - Shutdown when yaw error exceeds a threshold, [-]
0 ! SD_EnableGenSpeed - Shutdown when generator speed exceeds a threshold, [-]
Expand Down
6 changes: 3 additions & 3 deletions Examples/Test_Cases/MHK_RM1/MHK_RM1_DISCON.IN
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
! Controller parameter input file for the MHK_RM1_Floating wind turbine
! - File written using ROSCO version 2.10.0 controller tuning logic on 09/08/25
! - File written using ROSCO version 2.10.1 controller tuning logic on 11/26/25

!------- SIMULATION CONTROL ------------------------------------------------------------
2 ! LoggingLevel - 0: write no debug files, 1: write standard output .dbg-file, 2: LoggingLevel 1 + ROSCO LocalVars (.dbg2) 3: LoggingLevel 2 + complete avrSWAP-array (.dbg3)
Expand Down Expand Up @@ -101,7 +101,7 @@

!------- SETPOINT SMOOTHER ---------------------------------------------
1.00000 ! SS_VSGain - Variable speed torque controller setpoint smoother gain, [-].
0.00100 ! SS_PCGain - Collective pitch controller setpoint smoother gain, [-].
0.05000 ! SS_PCGain - Collective pitch controller setpoint smoother gain, [-].

!------- POWER REFERENCE TRACKING --------------------------------------
0 ! PRC_Comm - Power reference communication mode when PRC_Mode = 2, 0- use constant DISCON inputs, 1- use open loop inputs, 2- use ZMQ inputs
Expand Down Expand Up @@ -163,7 +163,7 @@
200.0000 100.0000 ! SU_LoadHoldDuration - Array containing duration to hold the partial loads during startup [s]

!------- SHUTDOWN -----------------------------------------------------------
0 ! SD_TimeActivate - Time to acitvate shutdown modes, [s]
0 ! SD_TimeActivate - Time to acitvate shutdown modes; no shutdown events will occur before this time. [s]
0 ! SD_EnablePitch - Shutdown when collective blade pitch exceeds a threshold, [-]
0 ! SD_EnableYawError - Shutdown when yaw error exceeds a threshold, [-]
0 ! SD_EnableGenSpeed - Shutdown when generator speed exceeds a threshold, [-]
Expand Down
6 changes: 3 additions & 3 deletions Examples/Test_Cases/NREL-5MW/DISCON.IN
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
! Controller parameter input file for the NREL-5MW wind turbine
! - File written using ROSCO version 2.10.0 controller tuning logic on 09/08/25
! - File written using ROSCO version 2.10.1 controller tuning logic on 11/26/25

!------- SIMULATION CONTROL ------------------------------------------------------------
1 ! LoggingLevel - 0: write no debug files, 1: write standard output .dbg-file, 2: LoggingLevel 1 + ROSCO LocalVars (.dbg2) 3: LoggingLevel 2 + complete avrSWAP-array (.dbg3)
Expand Down Expand Up @@ -101,7 +101,7 @@

!------- SETPOINT SMOOTHER ---------------------------------------------
1.00000 ! SS_VSGain - Variable speed torque controller setpoint smoother gain, [-].
0.00100 ! SS_PCGain - Collective pitch controller setpoint smoother gain, [-].
0.05000 ! SS_PCGain - Collective pitch controller setpoint smoother gain, [-].

!------- POWER REFERENCE TRACKING --------------------------------------
0 ! PRC_Comm - Power reference communication mode when PRC_Mode = 2, 0- use constant DISCON inputs, 1- use open loop inputs, 2- use ZMQ inputs
Expand Down Expand Up @@ -163,7 +163,7 @@
200.0000 100.0000 ! SU_LoadHoldDuration - Array containing duration to hold the partial loads during startup [s]

!------- SHUTDOWN -----------------------------------------------------------
0 ! SD_TimeActivate - Time to acitvate shutdown modes, [s]
0 ! SD_TimeActivate - Time to acitvate shutdown modes; no shutdown events will occur before this time. [s]
0 ! SD_EnablePitch - Shutdown when collective blade pitch exceeds a threshold, [-]
0 ! SD_EnableYawError - Shutdown when yaw error exceeds a threshold, [-]
0 ! SD_EnableGenSpeed - Shutdown when generator speed exceeds a threshold, [-]
Expand Down
4 changes: 2 additions & 2 deletions Examples/Test_Cases/NREL_2p8_127/NREL-2p8-127_DISCON.IN
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
! Controller parameter input file for the NREL-2p8-127 wind turbine
! - File written using ROSCO version 2.10.0 controller tuning logic on 09/08/25
! - File written using ROSCO version 2.10.1 controller tuning logic on 11/26/25

!------- SIMULATION CONTROL ------------------------------------------------------------
2 ! LoggingLevel - 0: write no debug files, 1: write standard output .dbg-file, 2: LoggingLevel 1 + ROSCO LocalVars (.dbg2) 3: LoggingLevel 2 + complete avrSWAP-array (.dbg3)
Expand Down Expand Up @@ -163,7 +163,7 @@
200.0000 100.0000 ! SU_LoadHoldDuration - Array containing duration to hold the partial loads during startup [s]

!------- SHUTDOWN -----------------------------------------------------------
0 ! SD_TimeActivate - Time to acitvate shutdown modes, [s]
0 ! SD_TimeActivate - Time to acitvate shutdown modes; no shutdown events will occur before this time. [s]
0 ! SD_EnablePitch - Shutdown when collective blade pitch exceeds a threshold, [-]
0 ! SD_EnableYawError - Shutdown when yaw error exceeds a threshold, [-]
0 ! SD_EnableGenSpeed - Shutdown when generator speed exceeds a threshold, [-]
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "rosco"
version = "2.10.2"
version = "2.10.3"
description = "A reference open source controller toolset for wind turbine applications."
readme = "README.md"
requires-python = ">=3.9"
Expand Down
Loading
Loading