Edit on Gitlab Launch with Binder

Wind turbines

[1]:
# setup site used in this tutorial
import matplotlib.pyplot as plt
import numpy as np
from dynamiks.utils import doc_utils # use cached animations in sphinx documentation
from dynamiks.sites.turbulence_fields import MannTurbulenceField
from dynamiks.utils.test_utils import tfp, DemoSite
from dynamiks.sites._site import TurbulenceFieldSite
from py_wake.utils.plotting import setup_plot

ws = 10
ti = 0.06
site = DemoSite(ws,ti)

Actuator disk wind turbines

Simple actuator disk wind turbines are defined in terms of

  • Position

  • Name

  • Diameter

  • Hubheight

  • Power curve

  • Ct curve

This turbine type is really fast but does not model the blades or structural loads

Actuator disk wind turbines can e.g. be generated from PyWake wind turbines (predefined, generic or custom)

[2]:
# instantiate a V80 and a generic 3.4MW PyWake wind turbines
from py_wake.wind_turbines import WindTurbines
from py_wake.examples.data.hornsrev1 import V80
from py_wake.wind_turbines.generic_wind_turbines import GenericWindTurbine
v80 = V80()
generic = GenericWindTurbine("Generic 3.4MW", diameter=130, hub_height=110, power_norm=3400, turbulence_intensity=.1)

# collect the two turbines in one WindTurbines object
pywake_windTurbines = WindTurbines.from_WindTurbine_lst([v80,generic])
[3]:
# plot power and ct curves
axes = plt.subplots(1,2, figsize=(10,4))[1]
for t, ax in zip(pywake_windTurbines.types(), axes):
    plt.sca(ax)
    pywake_windTurbines.plot_power_ct(type=t)
    plt.tight_layout()
../_images/notebooks_WindTurbines_5_0.png
[4]:
# instantiate a dynamiks WindTurbines object
from dynamiks.wind_turbines import PyWakeWindTurbines

wts = PyWakeWindTurbines(x=[0,500,1000], y=[0,0,0],   # x and y position of two wind turbines
                         windTurbine=pywake_windTurbines,
                         types=[0,1,0])

# print diameter and hub height
for i,(xyz) in enumerate(wts.positions_east_north.T):
    print(f'WT{i}, diameter: {wts[i].diameter()}, hub height: {wts[i].hub_height()}, position: {tuple(xyz)}')
WT0, diameter: [80.], hub height: [70.], position: (np.float64(0.0), np.float64(0.0), np.float64(0.0))
WT1, diameter: [130.], hub height: [110.], position: (np.float64(500.0), np.float64(0.0), np.float64(0.0))
WT2, diameter: [80.], hub height: [70.], position: (np.float64(1000.0), np.float64(0.0), np.float64(0.0))
[5]:
from dynamiks.dwm.dwm_flow_simulation import DWMFlowSimulation
from dynamiks.dwm.particle_deficit_profiles.ainslie import jDWMAinslieGenerator
from dynamiks.views import XYView

fs = DWMFlowSimulation(site=site, windTurbines=wts, particleDeficitGenerator=jDWMAinslieGenerator(), dt=1)
fs.run(10)
[6]:
ax = plt.figure(figsize=(10,4)).gca()
view = XYView(z=70, x=np.linspace(-200,1200), y=np.linspace(-200,200), ax=ax)
fs.visualize(fs.time+100, view=view, id='WindTurbines_AD')
[6]:

Output from wind turbines

Wind turbines has a sensor object with a set of predefined sensors. Additional sensors can be added by the method windTurbines.add_sensor

[7]:
help(wts.add_sensor)
Help on method add_sensor in module dynamiks.wind_turbines._windTurbines:

add_sensor(name, getter=None, setter=None, expose=False, ext_lst=None) method of dynamiks.wind_turbines.pywake_windturbines.PyWakeWindTurbines instance
    add a wind turbine sensor

    Sensor values available using: windTurbines.sensors.<name>

    Parameters
    ----------
    name : str
        Name of sensor. Cannot contain spaces
    getter : function
        function, f(wt) -> sensor_value
    setter : function, optional
        function, f(wt, value) -> None,
    expose : boolean, optional
        if True, the getter/setter is exposed to the wind turbine enabling e.g. wt.yaw as a shorthand for wt.sensors.yaw
    ext_lst : list or None
        List of sensor name extensions in case the sensor returns more than one value,
        e.g. the u,v and w components of the wind, see examples
    Examples
    --------
    windTurbines.add_sensor('power', lambda wt: wt.power())
    windTurbines.add_sensor('ws', ext_lst=['u','v','w'])" # adds the three sensors: ws_u, ws_v, ws_w

An xarray data array with all sensor data can be obtained as follows

[8]:
fs.run(200)
da = wts.sensors.to_xarray()
for sensor in da.sensor:
    plt.figure(figsize=(6,3))
    for wt in da.wt:
        da.sel(sensor=sensor, wt=wt).plot(label=f'wt {wt.item()}')
    setup_plot(title=sensor.item(), xlabel='Time [s]')
../_images/notebooks_WindTurbines_12_0.png
../_images/notebooks_WindTurbines_12_1.png
../_images/notebooks_WindTurbines_12_2.png
../_images/notebooks_WindTurbines_12_3.png
../_images/notebooks_WindTurbines_12_4.png
../_images/notebooks_WindTurbines_12_5.png
../_images/notebooks_WindTurbines_12_6.png
../_images/notebooks_WindTurbines_12_7.png
../_images/notebooks_WindTurbines_12_8.png
../_images/notebooks_WindTurbines_12_9.png

HAWC2 wind turbine

The HAWC2 wind turbine provides a higher fidelity model that combines a multibody structural formulation with aerodynamic forces acting on the rotating blades. This model captures structural loads and handles wind speed variations over the rotor, but the computational costs are higher than the actuator disk models.

To use the HAWC2 wind turbines you need:

  • h2lib: A library version of HAWC2. It can be installed by pip install dynamiks[hawc2], see installation.

  • A valid license

  • HAWC2 models of the wind turbines

HAWC2-DWM (HAWC2Farm)

HAWC2 is capable of simulating one wind turbine and therefore multiple HAWC2 instances are needed to simulate a wind farm in Dynamiks.

When coupling HAWC2 with the DWM wind farm flow model, the wind speed module of HAWC2 is bypassed. Instead the turbulent wind speeds including mean wind, shear, gusts, wakes etc. are calculated by Dynamiks on a 3D grid covering an aera around each wind turbine and passed to the corresponding HAWC2 instance.

Each HAWC2 instance will use the provided wind speeds to calculate the aerodynamic forces on the blades, the induction and the structural response.

Finally Dynamiks receives the induction and structural states which is used by the DWM model to calculate the wakes.

HAWC2-DWM_coupling

[9]:
from dynamiks.wind_turbines.hawc2_windturbine import HAWC2WindTurbines
from h2lib_tests.test_files import tfp as h2lib_tfp
htc_filename_lst = [h2lib_tfp + "DTU_10_MW/htc/DTU_10MW_RWT.htc",
                    h2lib_tfp + "IEA-15-240-RWT-Onshore/htc/IEA_15MW_RWT_Onshore_simple.htc"]
wts = HAWC2WindTurbines(x=[0,500,1000], y=[0,0,0],
                        htc_filename_lst=htc_filename_lst,
                        types=[0, 1, 0],
                        case_name='MyTestCase', # subfolder name in the htc, res and log folders
                        suppress_output=False # don't show hawc2 output in console
                       )
License verified - OK
License verified - OK
License verified - OK
 Opening main command file:
 Opening main command file:
 Opening main command file:
 /usr/local/lib/python3.11/site-packages/h2lib_tests/test_files/DTU_10_MW/htc/My
 /usr/local/lib/python3.11/site-packages/h2lib_tests/test_files/DTU_10_MW/htc/My
 /usr/local/lib/python3.11/site-packages/h2lib_tests/test_files/IEA-15-240-RWT-O
 TestCase/DTU_10MW_RWT_wt0.htc
 TestCase/DTU_10MW_RWT_wt2.htc
 nshore/htc/MyTestCase/IEA_15MW_RWT_Onshore_simple_wt1.htc
 Current directory is
 /usr/local/lib/python3.11/site-packages/h2lib_tests/test_files/DTU_10_MW
 Current directory is
 Current directory is
 /usr/local/lib/python3.11/site-packages/h2lib_tests/test_files/DTU_10_MW
 /usr/local/lib/python3.11/site-packages/h2lib_tests/test_files/IEA-15-240-RWT-O
 nshore
 Continue on no convergence = true
 Continue on no convergence = true
 Continue on no convergence = true
 Newmark commands read with succes
 Newmark commands read with succes
 Simulation commands read with succes
 Newmark commands read with succes
 Simulation commands read with succes
 Simulation commands read with succes
 Reading data of main body : tower
 Reading data of main body : tower
 Reading data of main body : tower
 Succes opening ./data/IEA_15MW_RWT_Tower_st.dat
 Succes opening ./data/DTU_10MW_RWT_Tower_st.dat
 Succes opening ./data/DTU_10MW_RWT_Tower_st.dat
 timoschenko input commands read with succes
 timoschenko input commands read with succes
 topologi_c2def_inputs read with succes
 topologi_c2def_inputs read with succes
 Topologi main body tower commands read with succes
 Topologi main body tower commands read with succes
 Reading data of main body : towertop
 Reading data of main body : towertop
 Succes opening ./data/DTU_10MW_RWT_Towertop_st.dat
 Succes opening ./data/DTU_10MW_RWT_Towertop_st.dat
 timoschenko input commands read with succes
 timoschenko input commands read with succes
 topologi_c2def_inputs read with succes
 Topologi main body towertop commands read with succes
 topologi_c2def_inputs read with succes
 Topologi main body towertop commands read with succes
 Reading data of main body : shaft
 Reading data of main body : shaft
 Succes opening ./data/DTU_10MW_RWT_Shaft_st.dat
 Succes opening ./data/DTU_10MW_RWT_Shaft_st.dat
 timoschenko input commands read with succes
 timoschenko input commands read with succes
 topologi_c2def_inputs read with succes
 Topologi main body shaft commands read with succes
 topologi_c2def_inputs read with succes
 Topologi main body shaft commands read with succes
 Reading data of main body : hub1
 Reading data of main body : hub1
 Succes opening ./data/DTU_10MW_RWT_Hub_st.dat
 Succes opening ./data/DTU_10MW_RWT_Hub_st.dat
 timoschenko input commands read with succes
 topologi_c2def_inputs read with succes
 Topologi main body hub1 commands read with succes
 Reading data of main body : hub2
 timoschenko input commands read with succes
 topologi_c2def_inputs read with succes
 Topologi main body hub1 commands read with succes
 Reading data of main body : hub2
 Topologi main body hub2 commands read with succes
 Topologi main body hub2 commands read with succes
 Reading data of main body : hub3
 Topologi main body hub3 commands read with succes
 Reading data of main body : hub3
 Reading data of main body : blade1
 Topologi main body hub3 commands read with succes
 Succes opening ./data/DTU_10MW_RWT_Blade_st.dat
 Reading data of main body : blade1
 Succes opening ./data/DTU_10MW_RWT_Blade_st.dat
 timoschenko input commands read with succes
 topologi_c2def_inputs read with succes
 Topologi main body tower commands read with succes
 Reading data of main body : towertop
 Succes opening ../IEA-15-240-RWT/IEA_15MW_RWT_Dummy_st.dat
 timoschenko input commands read with succes
 timoschenko input commands read with succes
 topologi_c2def_inputs read with succes
 Topologi main body blade1 commands read with succes
 topologi_c2def_inputs read with succes
 Topologi main body blade1 commands read with succes
 Reading data of main body : blade2
 Topologi main body blade2 commands read with succes
 Reading data of main body : blade3
 Topologi main body blade3 commands read with succes
 Reading data of main body : blade2
 Base orientation input commands read with succes
 Topologi main body blade2 commands read with succes
 relative orientation input commands read with succes
 relative orientation input commands read with succes
 relative orientation input commands read with succes
 relative orientation input commands read with succes
 relative orientation input commands read with succes
 relative orientation input commands read with succes
 relative orientation input commands read with succes
 relative orientation input commands read with succes
 Orientation input commands read with succes
 Reading data of main body : blade3
 Fix0 constraint input commands read with succes
 Topologi main body blade3 commands read with succes
 Fix1 constraint input commands read with succes
 Bearing1 constraint input commands read with succes
 Fix1 constraint input commands read with succes
 Fix1 constraint input commands read with succes
 Fix1 constraint input commands read with succes
 Base orientation input commands read with succes
 relative orientation input commands read with succes
 relative orientation input commands read with succes
 relative orientation input commands read with succes
 relative orientation input commands read with succes
 relative orientation input commands read with succes
 relative orientation input commands read with succes
 relative orientation input commands read with succes
 relative orientation input commands read with succes
 Orientation input commands read with succes
 Fix0 constraint input commands read with succes
 Fix1 constraint input commands read with succes
 Bearing1 constraint input commands read with succes
 Fix1 constraint input commands read with succes
 Fix1 constraint input commands read with succes
 bearing2 constraint input commands read with succes
 Fix1 constraint input commands read with succes
 bearing2 constraint input commands read with succes
 bearing2 constraint input commands read with succes
 constraint input commands read with succes
 Topologi commands read with succes
 bearing2 constraint input commands read with succes
 timoschenko input commands read with succes
 topologi_c2def_inputs read with succes
 Topologi main body towertop commands read with succes
 Reading data of main body : connector
 bearing2 constraint input commands read with succes
 bearing2 constraint input commands read with succes
 Succes opening ../IEA-15-240-RWT/IEA_15MW_RWT_Dummy_st.dat
 constraint input commands read with succes
 Topologi commands read with succes
 timoschenko input commands read with succes
 topologi_c2def_inputs read with succes
 Topologi main body connector commands read with succes
 Reading data of main body : shaft
 Succes opening ../IEA-15-240-RWT/IEA_15MW_RWT_Shaft_st.dat
 timoschenko input commands read with succes
 topologi_c2def_inputs read with succes
 Topologi main body shaft commands read with succes
 Reading data of main body : hub1
 Succes opening ../IEA-15-240-RWT/IEA_15MW_RWT_Dummy_st.dat
 timoschenko input commands read with succes
 topologi_c2def_inputs read with succes
 Topologi main body hub1 commands read with succes
 Reading data of main body : hub2
 Topologi main body hub2 commands read with succes
 Reading data of main body : hub3
 Topologi main body hub3 commands read with succes
 Reading data of main body : blade1
 Succes opening ../IEA-15-240-RWT/IEA_15MW_RWT_Blade_st_noFPM.st
 timoschenko input commands read with succes
 topologi_c2def_inputs read with succes
 Topologi main body blade1 commands read with succes
 Reading data of main body : blade2
 Topologi main body blade2 commands read with succes
 Reading data of main body : blade3
 Topologi main body blade3 commands read with succes
 Base orientation input commands read with succes
 relative orientation input commands read with succes
 relative orientation input commands read with succes
 relative orientation input commands read with succes
 relative orientation input commands read with succes
 relative orientation input commands read with succes
 relative orientation input commands read with succes
 relative orientation input commands read with succes
 relative orientation input commands read with succes
 relative orientation input commands read with succes
 Orientation input commands read with succes
 Fix0 constraint input commands read with succes
 Fix1 constraint input commands read with succes
 Fix1 constraint input commands read with succes
 Bearing1 constraint input commands read with succes
 Fix1 constraint input commands read with succes
 Fix1 constraint input commands read with succes
 Fix1 constraint input commands read with succes
 bearing2 constraint input commands read with succes
 bearing2 constraint input commands read with succes
 bearing2 constraint input commands read with succes
 constraint input commands read with succes
 Topologi commands read with succes
 Wind commands read with succes
In mann module: Dont scale applied - turbulence scalings are bypassed
In mann module: Dont scale applied - turbulence scalings are bypassed
*** WARNING *** The default advection direction of turbulence has been reversed in HAWC2 version 13.1.
*** WARNING *** The default advection direction of turbulence has been reversed in HAWC2 version 13.1.
The default advection direction complies with the Mann turbulence model, and turbulence boxes generated with HAWC2.
The default advection direction complies with the Mann turbulence model, and turbulence boxes generated with HAWC2.
See the release notes for HAWC2 version 13.1 and the manual for more details.
Mann commands read with succes
See the release notes for HAWC2 version 13.1 and the manual for more details.
Mann commands read with succes
 aerodrag element commands read with succes
 aerodrag element commands read with succes
 Aerodrag commands read with succes
 Aerodynamic commands read with succes
 Tower shadow (potential2 flow) commands read with succes
 Tower shadow (potential2 flow) commands read with succes
 Wind commands read with succes
 aerodrag element commands read with succes
 aerodrag element commands read with succes
 Aerodrag commands read with succes
 Aerodynamic commands read with succes
 Wind commands read with succes
 aerodrag element commands read with succes
 aerodrag element commands read with succes
 Aerodrag commands read with succes
 Aerodynamic commands read with succes
 output commands read with succes
 output commands read with succes
 Output commands read
 Output commands read
 Dll type2 input commands read with succes
 Dll type2 input commands read with succes
 output commands read with succes
 Output commands read
 output commands read with succes
 Output commands read
 Actions commands read
 Dll type2 input commands read with succes
 output commands read with succes
 Output commands read
 Dll type2 input commands read with succes
 Actions commands read
 Dll type2 input commands read with succes
 output commands read with succes
 Output commands read
 Actions commands read
 Dll type2 input commands read with succes
 output commands read with succes
 Output commands read
 Actions commands read
 Dll type2 input commands read with succes
 output commands read with succes
 Output commands read
 Actions commands read
 Dll type2 input commands read with succes
 output commands read with succes
 Output commands read
 Actions commands read
 Dll type2 input commands read with succes
 output commands read with succes
 output commands read with succes
 Output commands read
 Dll type2 input commands read with succes
 DLL commands read with succes
 Output commands read
 Actions commands read
 Dll type2 input commands read with succes
 output commands read with succes
 Output commands read
 Dll type2 input commands read with succes
 DLL commands read with succes
 output commands read with succes
 Output commands read
 Actions commands read
 Dll type2 input commands read with succes
 output commands read with succes
 Output commands read
 Actions commands read
 Dll type2 input commands read with succes
 output commands read with succes
 Output commands read
 Dll type2 input commands read with succes
 DLL commands read with succes
 output commands read with succes
 Output commands read
 output commands read with succes
 Output commands read
 output commands read with succes
 Output commands read
 Initialization of structure
 Initialization of structure
 Initialization of structure
*** WARNING *** The default advection direction of turbulence has been reversed in HAWC2 version 13.1.
*** WARNING *** The default advection direction of turbulence has been reversed in HAWC2 version 13.1.
 Initializing of aero rotor...
 Initializing of aero rotor...
 Initializing of aero rotor...
 Initialization of rotor aerodynamics
 Initialization of rotor aerodynamics
 Initialization of rotor aerodynamics
 Succes opening ../IEA-15-240-RWT/IEA_15MW_RWT_ae.dat
 Succes opening ./data/DTU_10MW_RWT_ae.dat
 Succes opening ./data/DTU_10MW_RWT_ae.dat
 Succes opening ../IEA-15-240-RWT/IEA_15MW_RWT_pc_OpenFASTpolars_3dcorr.dat
 Succes opening ./data/DTU_10MW_RWT_pc.dat
 Succes opening ./data/DTU_10MW_RWT_pc.dat
 Initialization of rotor induction
 Initialization of rotor induction
 Initialization of wind
 Initialization of wind
 Initialization of external type2 DLL
 External DLL ./control/dtu_we_controller.dll is attempted to open
 Initialization of external type2 DLL
 External DLL ./control/dtu_we_controller.dll is attempted to open
DLL loaded with success /usr/local/lib/python3.11/site-packages/h2lib_tests/test_files/DTU_10_MW/./control/dtu_we_controller.so
DLL loaded with success /usr/local/lib/python3.11/site-packages/h2lib_tests/test_files/DTU_10_MW/./control/dtu_we_controller.so
Symbol not found in dll: set_parent_pid
Symbol not found in dll: set_parent_pid
Using /usr/local/lib/python3.11/site-packages/h2lib_tests/test_files/DTU_10_MW/./control/dtu_we_controller.so, version: 0.5-2-g885d71c
 DLL subroutine init init_regulation_advanced is called
Using /usr/local/lib/python3.11/site-packages/h2lib_tests/test_files/DTU_10_MW/./control/dtu_we_controller.so, version: 0.5-2-g885d71c
 DLL subroutine init init_regulation_advanced is called
 In initialization call of ./control/dtu_we_controller.dll Output is
 In initialization call of ./control/dtu_we_controller.dll Output is
  0.000000000000000E+000
  0.000000000000000E+000
*** WARNING *** Symbol not found in dll: message
 *** INFO *** The DLL subroutine message could not be loaded - bypassed!
 Initialization of external type2 DLL
 External DLL ./control/generator_servo.dll is attempted to open
*** WARNING *** Symbol not found in dll: message
 *** INFO *** The DLL subroutine message could not be loaded - bypassed!
 Initialization of external type2 DLL
 External DLL ./control/generator_servo.dll is attempted to open
DLL loaded with success /usr/local/lib/python3.11/site-packages/h2lib_tests/test_files/DTU_10_MW/./control/generator_servo.so
DLL loaded with success /usr/local/lib/python3.11/site-packages/h2lib_tests/test_files/DTU_10_MW/./control/generator_servo.so
Symbol not found in dll: set_parent_pid
Symbol not found in dll: set_parent_pid
Using /usr/local/lib/python3.11/site-packages/h2lib_tests/test_files/DTU_10_MW/./control/generator_servo.so, version: 0.2
Using /usr/local/lib/python3.11/site-packages/h2lib_tests/test_files/DTU_10_MW/./control/generator_servo.so, version: 0.2
 DLL subroutine init init_generator_servo is called
 DLL subroutine init init_generator_servo is called
 In initialization call of ./control/generator_servo.dll Output is
 In initialization call of ./control/generator_servo.dll Output is
  0.000000000000000E+000
  0.000000000000000E+000
*** WARNING *** Symbol not found in dll: message
*** WARNING *** Symbol not found in dll: message
 *** INFO *** The DLL subroutine message could not be loaded - bypassed!
 Initialization of external type2 DLL
 External DLL ./control/mech_brake.dll is attempted to open
 *** INFO *** The DLL subroutine message could not be loaded - bypassed!
 Initialization of external type2 DLL
 External DLL ./control/mech_brake.dll is attempted to open
 Initialization of rotor induction
 Initialization of wind
 Initialization of external type2 DLL
 External DLL ./control/dtu_we_controller.dll is attempted to open
DLL loaded with success /usr/local/lib/python3.11/site-packages/h2lib_tests/test_files/DTU_10_MW/./control/mech_brake.so
DLL loaded with success /usr/local/lib/python3.11/site-packages/h2lib_tests/test_files/DTU_10_MW/./control/mech_brake.so
Symbol not found in dll: set_parent_pid
Symbol not found in dll: set_parent_pid
Using /usr/local/lib/python3.11/site-packages/h2lib_tests/test_files/DTU_10_MW/./control/mech_brake.so, version: 0.2
Using /usr/local/lib/python3.11/site-packages/h2lib_tests/test_files/DTU_10_MW/./control/mech_brake.so, version: 0.2
 DLL subroutine init init_mech_brake is called
 DLL subroutine init init_mech_brake is called
 In initialization call of ./control/mech_brake.dll Output is
 In initialization call of ./control/mech_brake.dll Output is
  0.000000000000000E+000
  0.000000000000000E+000
*** WARNING *** Symbol not found in dll: message
 *** INFO *** The DLL subroutine message could not be loaded - bypassed!
 Initialization of external type2 DLL
 External DLL ./control/servo_with_limits.dll is attempted to open
*** WARNING *** Symbol not found in dll: message
 *** INFO *** The DLL subroutine message could not be loaded - bypassed!
 Initialization of external type2 DLL
 External DLL ./control/servo_with_limits.dll is attempted to open
DLL loaded with success /usr/local/lib/python3.11/site-packages/h2lib_tests/test_files/DTU_10_MW/./control/servo_with_limits.so
DLL loaded with success /usr/local/lib/python3.11/site-packages/h2lib_tests/test_files/DTU_10_MW/./control/servo_with_limits.so
Symbol not found in dll: set_parent_pid
Symbol not found in dll: set_parent_pid
Using /usr/local/lib/python3.11/site-packages/h2lib_tests/test_files/DTU_10_MW/./control/servo_with_limits.so, version: 1.2
Using /usr/local/lib/python3.11/site-packages/h2lib_tests/test_files/DTU_10_MW/./control/servo_with_limits.so, version: 1.2
 DLL subroutine init init_servo_with_limits is called
 DLL subroutine init init_servo_with_limits is called
 In initialization call of ./control/servo_with_limits.dll Output is
  0.000000000000000E+000
 In initialization call of ./control/servo_with_limits.dll Output is
  0.000000000000000E+000
*** WARNING *** Symbol not found in dll: message
 *** INFO *** The DLL subroutine message could not be loaded - bypassed!
 Initialization of external type2 DLL
 External DLL ./control/towerclearance_mblade.dll is attempted to open
*** WARNING *** Symbol not found in dll: message
 *** INFO *** The DLL subroutine message could not be loaded - bypassed!
 Initialization of external type2 DLL
 External DLL ./control/towerclearance_mblade.dll is attempted to open
DLL loaded with success /usr/local/lib/python3.11/site-packages/h2lib_tests/test_files/IEA-15-240-RWT-Onshore/./control/dtu_we_controller.so
Symbol not found in dll: set_parent_pid
Using /usr/local/lib/python3.11/site-packages/h2lib_tests/test_files/IEA-15-240-RWT-Onshore/./control/dtu_we_controller.so, version: 0.5-2-g885d71c
 DLL subroutine init init_regulation_advanced is called
 In initialization call of ./control/dtu_we_controller.dll Output is
  0.000000000000000E+000
*** WARNING *** Symbol not found in dll: message
 *** INFO *** The DLL subroutine message could not be loaded - bypassed!
 Initialization of external type2 DLL
 External DLL ./control/generator_servo.dll is attempted to open
DLL loaded with success /usr/local/lib/python3.11/site-packages/h2lib_tests/test_files/DTU_10_MW/./control/towerclearance_mblade.so
DLL loaded with success /usr/local/lib/python3.11/site-packages/h2lib_tests/test_files/DTU_10_MW/./control/towerclearance_mblade.so
Symbol not found in dll: set_parent_pid
Symbol not found in dll: set_parent_pid
Using /usr/local/lib/python3.11/site-packages/h2lib_tests/test_files/DTU_10_MW/./control/towerclearance_mblade.so, version: 1.0.1-1-g8e11be3
Using /usr/local/lib/python3.11/site-packages/h2lib_tests/test_files/DTU_10_MW/./control/towerclearance_mblade.so, version: 1.0.1-1-g8e11be3
 DLL subroutine init initialize is called
 DLL subroutine init initialize is called
 In initialization call of ./control/towerclearance_mblade.dll Output is
  0.000000000000000E+000
*** WARNING *** Symbol not found in dll: message
 *** INFO *** The DLL subroutine message could not be loaded - bypassed!
 Creating link between structure and aerodynamics
 In initialization call of ./control/towerclearance_mblade.dll Output is
  0.000000000000000E+000
*** WARNING *** Symbol not found in dll: message
 *** INFO *** The DLL subroutine message could not be loaded - bypassed!
 Creating link between structure and aerodynamics
 Creating link between structure and aerodrag
 Initialization of Aerodrag
 Creating link between structure and aerodrag
 Initialization of Aerodrag
DLL loaded with success /usr/local/lib/python3.11/site-packages/h2lib_tests/test_files/IEA-15-240-RWT-Onshore/./control/generator_servo.so
Symbol not found in dll: set_parent_pid
Using /usr/local/lib/python3.11/site-packages/h2lib_tests/test_files/IEA-15-240-RWT-Onshore/./control/generator_servo.so, version: 0.2
 DLL subroutine init init_generator_servo is called
 In initialization call of ./control/generator_servo.dll Output is
  0.000000000000000E+000
*** WARNING *** Symbol not found in dll: message
 *** INFO *** The DLL subroutine message could not be loaded - bypassed!
 Initialization of external type2 DLL
 External DLL ./control/mech_brake.dll is attempted to open
 ***********************************************************************
 *  Build information for dtu_we_controller.dll
 *  DTU Wind Energy Controller - main control dll
 *  Intel, version         2021 ,     20201112
 *  Linux
 ***********************************************************************
 *  GIT-TAG        = 0.5-2-g885d71c
 *  GIT-BRANCH     =
 *  BUILD_TYPE     = linux release
 *  BUILDER        = gitlab-runner
 *  COMPUTER_NAME  = runner-6s-xzdse-project-966-concurrent-0
 *  BUILD_DATE     = 2021-10-01
 ***********************************************************************
 ***********************************************************************
 *  Build information for dtu_we_controller.dll
 *  DTU Wind Energy Controller - main control dll
 *  Intel, version         2021 ,     20201112
 *  Linux
 ***********************************************************************
 *  GIT-TAG        = 0.5-2-g885d71c
 *  GIT-BRANCH     =
 *  BUILD_TYPE     = linux release
 *  BUILDER        = gitlab-runner
 *  COMPUTER_NAME  = runner-6s-xzdse-project-966-concurrent-0
 *  BUILD_DATE     = 2021-10-01
 ***********************************************************************
 Controller dll initialization is successed!!
 Controller dll initialization is successed!!
*** WARNING *** Symbol not found in dll: message
*** WARNING *** Symbol not found in dll: message
*** WARNING *** Symbol not found in dll: message
*** WARNING *** Symbol not found in dll: message
*** WARNING *** Symbol not found in dll: message
*** WARNING *** Symbol not found in dll: message
 Pitch Servo 1.2 loaded...
 Pitch Servo 1.2 loaded...
*** WARNING *** Symbol not found in dll: message
*** WARNING *** Symbol not found in dll: message
 ***********************************************************************
 *  Build information for dtu_we_controller.dll
 *  DTU Wind Energy Controller - main control dll
 *  Intel, version         2021 ,     20201112
 *  Linux
 ***********************************************************************
 *  GIT-TAG        = 0.5-2-g885d71c
 *  GIT-BRANCH     =
 *  BUILD_TYPE     = linux release
 *  BUILDER        = gitlab-runner
 *  COMPUTER_NAME  = runner-6s-xzdse-project-966-concurrent-0
 *  BUILD_DATE     = 2021-10-01
 ***********************************************************************
 Controller dll initialization is successed!!
*** WARNING *** Symbol not found in dll: message
 Tower clearance DLL (mblade, ver. 1.0) loaded...
*** WARNING *** Symbol not found in dll: message
 Tower clearance DLL (mblade, ver. 1.0) loaded...
*** WARNING *** Symbol not found in dll: message
*** WARNING *** Symbol not found in dll: message
DLL loaded with success /usr/local/lib/python3.11/site-packages/h2lib_tests/test_files/IEA-15-240-RWT-Onshore/./control/mech_brake.so
Symbol not found in dll: set_parent_pid
Using /usr/local/lib/python3.11/site-packages/h2lib_tests/test_files/IEA-15-240-RWT-Onshore/./control/mech_brake.so, version: 0.2
 DLL subroutine init init_mech_brake is called
 In initialization call of ./control/mech_brake.dll Output is
  0.000000000000000E+000
*** WARNING *** Symbol not found in dll: message
 *** INFO *** The DLL subroutine message could not be loaded - bypassed!
 Initialization of external type2 DLL
 External DLL ./control/servo_with_limits.dll is attempted to open
*** WARNING *** Symbol not found in dll: message
 Pitch Servo 1.2 loaded...
*** WARNING *** Symbol not found in dll: message
 Tower clearance DLL (mblade, ver. 1.0) loaded...
*** WARNING *** Symbol not found in dll: message
DLL loaded with success /usr/local/lib/python3.11/site-packages/h2lib_tests/test_files/IEA-15-240-RWT-Onshore/./control/servo_with_limits.so
Symbol not found in dll: set_parent_pid
Using /usr/local/lib/python3.11/site-packages/h2lib_tests/test_files/IEA-15-240-RWT-Onshore/./control/servo_with_limits.so, version: 1.2
 DLL subroutine init init_servo_with_limits is called
 In initialization call of ./control/servo_with_limits.dll Output is
  0.000000000000000E+000
*** WARNING *** Symbol not found in dll: message
 *** INFO *** The DLL subroutine message could not be loaded - bypassed!
 Initialization of external type2 DLL
 External DLL ./control/towerclearance_mblade.dll is attempted to open
DLL loaded with success /usr/local/lib/python3.11/site-packages/h2lib_tests/test_files/IEA-15-240-RWT-Onshore/./control/towerclearance_mblade.so
Symbol not found in dll: set_parent_pid
Using /usr/local/lib/python3.11/site-packages/h2lib_tests/test_files/IEA-15-240-RWT-Onshore/./control/towerclearance_mblade.so, version: 1.0.1-1-g8e11be3
 DLL subroutine init initialize is called
 In initialization call of ./control/towerclearance_mblade.dll Output is
  0.000000000000000E+000
*** WARNING *** Symbol not found in dll: message
 *** INFO *** The DLL subroutine message could not be loaded - bypassed!
 Creating link between structure and aerodynamics
 Creating link between structure and aerodrag
 Initialization of Aerodrag
[10]:
from dynamiks.dwm.dwm_flow_simulation import DWMFlowSimulation
from dynamiks.dwm.particle_deficit_profiles.ainslie import jDWMAinslieGenerator
from dynamiks.views import XYView
fs = DWMFlowSimulation(site=site, windTurbines=wts, particleDeficitGenerator=jDWMAinslieGenerator(), dt=1)
[11]:
# Add rotor speed and azimuth sensor
wts.add_sensor("rotor", "constraint bearing1 shaft_rot 2", ext_lst=['azi','speed']);
[12]:
ax = plt.figure(figsize=(10,4)).gca()
view = XYView(z=70, x=np.linspace(-200,1200), y=np.linspace(-200,200), ax=ax)
fs.visualize(fs.time+100, id='WindTurbines_H2', view=view)
[12]:

Output from HAWC2

Output form the HAWC2 instances can be obtained during the simulation by Dynamiks (with the Dynamiks time resolution) or from the HAWC2 result file (with the HAWC2 time resolution).

During simulation by Dynamiks

Output from HAWC2 can be obtained during simulation by Dynamiks. To use this option, the needed sensors must be added in advance, see code cell above where a rotor speed and azimuth sensor are added.

The HAWC2WindTurbine extends the add_sensor method, such that

  • the getter argument can be a HAWC2 sensor string

  • the setter argument can be a int, which is interpreted as the index of a general variable sensor to set. In this way, e.g. yaw or derating setpoints can be set

Note, that some sensors, e.g. aero_power, aero_thrust and rotor center wind speed are predefined.

[13]:
help(wts.add_sensor)
Help on method add_sensor in module dynamiks.wind_turbines.hawc2_windturbine:

add_sensor(name, getter=None, setter=None, expose=False, ext_lst=None) method of dynamiks.wind_turbines.hawc2_windturbine.HAWC2WindTurbines instance
    add a wind turbine sensor

    Sensor values available using: windTurbines.sensors.<name>

    Parameters
    ----------
    name : str
        Name of sensor. Cannot contain spaces
    getter : str, function
        if str: HAWC2 sensor string, e.g. "constraint bearing1 shaft_rot 2"
        if function: f(wt) -> sensor_value
    setter : int, function or None, optional
        if int, index of the HAWC2 'general variable' sensor to set
        if function, f(wt, value) -> None
    expose : boolean, optional
        if True, the getter/setter is exposed to the wind turbine enabling e.g. wt.yaw as a shorthand for wt.sensors.yaw
    ext_lst : list or None
        List of sensor name extensions in case the sensor returns more than one value,
        e.g. the u,v and w components of the wind. In this case "add_sensor('ws', ext_lst=['u','v','w'])" will add
        the three sensors: ws_u, ws_v, ws_w

[14]:
from dynamiks.utils.data_dumper import DataDumper

fs.run(fs.time+20, verbose=1) # run another 20s
Dynamic stall method:  2  used for entire rotor
   ... initialization of unified dynamic stall model.
Dynamic stall method:  2  used for entire rotor
   ... initialization of unified dynamic stall model.
Dynamic stall method:  2  used for entire rotor
   ... initialization of unified dynamic stall model.
   ... Unified dynamic stall model time constants
   ... Unified dynamic stall model time constants
   ... Attached flow A1 =   0.165000, A2 =   0.335000, A3 =   0.000000
   ... Unified dynamic stall model time constants
   ... Attached flow B1 =   0.045500, B2 =   0.300000, B3 =   0.300000
   ... Attached flow A1 =   0.165000, A2 =   0.335000, A3 =   0.000000
   ... Attached flow B1 =   0.045500, B2 =   0.300000, B3 =   0.300000
   ... Stalled flow taupre =   1.500000,  taubly =   6.000000
   ... Stalled flow taupre =   1.500000,  taubly =   6.000000
   ... Attached flow A1 =   0.165000, A2 =   0.335000, A3 =   0.000000
   ... Attached flow B1 =   0.045500, B2 =   0.300000, B3 =   0.300000
   ... Stalled flow taupre =   1.500000,  taubly =   6.000000
DS model deactivated: blade  1 at 0mm. Max f_sep=  0.00, dclda=  0.00, thickness=100.00. See manual to change limit values
DS model deactivated: blade  1 at 0mm. Max f_sep=  0.00, dclda=  0.00, thickness=100.00. See manual to change limit values
DS model deactivated: blade  1 at 0mm. Max f_sep=  0.00, dclda=  0.00, thickness=100.00. See manual to change limit values
DS model deactivated: blade  1 at 120mm. Max f_sep=  0.00, dclda=  0.00, thickness= 99.95. See manual to change limit values
DS model deactivated: blade  1 at 88mm. Max f_sep=  0.00, dclda=  0.00, thickness=100.00. See manual to change limit values
DS model deactivated: blade  1 at 88mm. Max f_sep=  0.00, dclda=  0.00, thickness=100.00. See manual to change limit values
DS model deactivated: blade  1 at 481mm. Max f_sep=  0.00, dclda=  0.00, thickness= 99.81. See manual to change limit values
DS model deactivated: blade  1 at 355mm. Max f_sep=  0.00, dclda=  0.00, thickness=100.00. See manual to change limit values
DS model deactivated: blade  1 at 1080mm. Max f_sep=  0.00, dclda=  0.00, thickness= 99.57. See manual to change limit values
DS model deactivated: blade  1 at 355mm. Max f_sep=  0.00, dclda=  0.00, thickness=100.00. See manual to change limit values
DS model deactivated: blade  1 at 797mm. Max f_sep=  0.00, dclda=  0.00, thickness=100.00. See manual to change limit values
DS model deactivated: blade  1 at 1916mm. Max f_sep=  0.00, dclda=  0.00, thickness= 99.23. See manual to change limit values
DS model deactivated: blade  1 at 1414mm. Max f_sep=  0.00, dclda=  0.00, thickness=100.00. See manual to change limit values
DS model deactivated: blade  1 at 797mm. Max f_sep=  0.00, dclda=  0.00, thickness=100.00. See manual to change limit values
DS model deactivated: blade  1 at 1414mm. Max f_sep=  0.00, dclda=  0.00, thickness=100.00. See manual to change limit values
DS model deactivated: blade  1 at 2984mm. Max f_sep=  1.00, dclda=  0.05, thickness= 98.80. See manual to change limit values
DS model deactivated: blade  1 at 2203mm. Max f_sep=  4.24, dclda=  0.00, thickness= 99.77. See manual to change limit values
DS model deactivated: blade  1 at 4281mm. Max f_sep=  1.00, dclda=  0.24, thickness= 97.85. See manual to change limit values
DS model deactivated: blade  1 at 2203mm. Max f_sep=  4.24, dclda=  0.00, thickness= 99.77. See manual to change limit values
DS model deactivated: blade  1 at 3160mm. Max f_sep=  4.24, dclda=  0.01, thickness= 98.69. See manual to change limit values
DS model deactivated: blade  1 at 5802mm. Max f_sep=  1.00, dclda=  1.14, thickness= 93.02. See manual to change limit values
DS model deactivated: blade  1 at 3160mm. Max f_sep=  4.24, dclda=  0.01, thickness= 98.69. See manual to change limit values
DS model deactivated: blade  1 at 4282mm. Max f_sep=  4.24, dclda=  0.01, thickness= 97.41. See manual to change limit values
DS model deactivated: blade  1 at 7539mm. Max f_sep=  1.00, dclda=  2.15, thickness= 87.50. See manual to change limit values
DS model deactivated: blade  1 at 4282mm. Max f_sep=  4.24, dclda=  0.01, thickness= 97.41. See manual to change limit values
DS model deactivated: blade  1 at 5565mm. Max f_sep=  4.24, dclda=  0.02, thickness= 94.83. See manual to change limit values
DS model deactivated: blade  1 at 5565mm. Max f_sep=  4.24, dclda=  0.02, thickness= 94.83. See manual to change limit values
DS model deactivated: blade  1 at 7002mm. Max f_sep=  4.24, dclda=  0.04, thickness= 90.40. See manual to change limit values
DS model deactivated: blade  1 at 8588mm. Max f_sep=  4.24, dclda=  0.07, thickness= 84.54. See manual to change limit values
DS model deactivated: blade  1 at 7002mm. Max f_sep=  4.24, dclda=  0.04, thickness= 90.40. See manual to change limit values
DS model deactivated: blade  1 at 10317mm. Max f_sep=  4.24, dclda=  0.10, thickness= 77.35. See manual to change limit values
DS model deactivated: blade  1 at 8588mm. Max f_sep=  4.24, dclda=  0.07, thickness= 84.54. See manual to change limit values
DS model deactivated: blade  1 at 12181mm. Max f_sep=  4.24, dclda=  0.14, thickness= 69.22. See manual to change limit values
DS model deactivated: blade  1 at 10317mm. Max f_sep=  4.24, dclda=  0.10, thickness= 77.35. See manual to change limit values
DS model deactivated: blade  1 at 14172mm. Max f_sep=  4.24, dclda=  0.18, thickness= 60.80. See manual to change limit values
DS model deactivated: blade  1 at 12181mm. Max f_sep=  4.24, dclda=  0.14, thickness= 69.22. See manual to change limit values
DS model deactivated: blade  1 at 16283mm. Max f_sep=  1.12, dclda=  2.62, thickness= 53.05. See manual to change limit values
DS model deactivated: blade  1 at 14172mm. Max f_sep=  4.24, dclda=  0.18, thickness= 60.80. See manual to change limit values
DS model deactivated: blade  1 at 16283mm. Max f_sep=  1.12, dclda=  2.62, thickness= 53.05. See manual to change limit values
DS model deactivated: blade  2 at 0mm. Max f_sep=  0.00, dclda=  0.00, thickness=100.00. See manual to change limit values
DS model deactivated: blade  2 at 120mm. Max f_sep=  0.00, dclda=  0.00, thickness= 99.95. See manual to change limit values
DS model deactivated: blade  2 at 481mm. Max f_sep=  0.00, dclda=  0.00, thickness= 99.81. See manual to change limit values
DS model deactivated: blade  2 at 1080mm. Max f_sep=  0.00, dclda=  0.00, thickness= 99.57. See manual to change limit values
DS model deactivated: blade  2 at 1916mm. Max f_sep=  0.00, dclda=  0.00, thickness= 99.23. See manual to change limit values
DS model deactivated: blade  2 at 2984mm. Max f_sep=  1.00, dclda=  0.05, thickness= 98.80. See manual to change limit values
DS model deactivated: blade  2 at 4281mm. Max f_sep=  1.00, dclda=  0.24, thickness= 97.85. See manual to change limit values
DS model deactivated: blade  2 at 5802mm. Max f_sep=  1.00, dclda=  1.14, thickness= 93.02. See manual to change limit values
DS model deactivated: blade  2 at 7539mm. Max f_sep=  1.00, dclda=  2.15, thickness= 87.50. See manual to change limit values
DS model deactivated: blade  2 at 0mm. Max f_sep=  0.00, dclda=  0.00, thickness=100.00. See manual to change limit values
DS model deactivated: blade  2 at 88mm. Max f_sep=  0.00, dclda=  0.00, thickness=100.00. See manual to change limit values
DS model deactivated: blade  2 at 0mm. Max f_sep=  0.00, dclda=  0.00, thickness=100.00. See manual to change limit values
DS model deactivated: blade  2 at 355mm. Max f_sep=  0.00, dclda=  0.00, thickness=100.00. See manual to change limit values
DS model deactivated: blade  2 at 88mm. Max f_sep=  0.00, dclda=  0.00, thickness=100.00. See manual to change limit values
DS model deactivated: blade  2 at 797mm. Max f_sep=  0.00, dclda=  0.00, thickness=100.00. See manual to change limit values
DS model deactivated: blade  2 at 355mm. Max f_sep=  0.00, dclda=  0.00, thickness=100.00. See manual to change limit values
DS model deactivated: blade  2 at 1414mm. Max f_sep=  0.00, dclda=  0.00, thickness=100.00. See manual to change limit values
DS model deactivated: blade  2 at 797mm. Max f_sep=  0.00, dclda=  0.00, thickness=100.00. See manual to change limit values
DS model deactivated: blade  2 at 1414mm. Max f_sep=  0.00, dclda=  0.00, thickness=100.00. See manual to change limit values
DS model deactivated: blade  2 at 2203mm. Max f_sep=  4.24, dclda=  0.00, thickness= 99.77. See manual to change limit values
DS model deactivated: blade  2 at 2203mm. Max f_sep=  4.24, dclda=  0.00, thickness= 99.77. See manual to change limit values
DS model deactivated: blade  2 at 3160mm. Max f_sep=  4.24, dclda=  0.01, thickness= 98.69. See manual to change limit values
DS model deactivated: blade  2 at 3160mm. Max f_sep=  4.24, dclda=  0.01, thickness= 98.69. See manual to change limit values
DS model deactivated: blade  2 at 4282mm. Max f_sep=  4.24, dclda=  0.01, thickness= 97.41. See manual to change limit values
DS model deactivated: blade  2 at 4282mm. Max f_sep=  4.24, dclda=  0.01, thickness= 97.41. See manual to change limit values
DS model deactivated: blade  2 at 5565mm. Max f_sep=  4.24, dclda=  0.02, thickness= 94.83. See manual to change limit values
DS model deactivated: blade  2 at 5565mm. Max f_sep=  4.24, dclda=  0.02, thickness= 94.83. See manual to change limit values
DS model deactivated: blade  2 at 7002mm. Max f_sep=  4.24, dclda=  0.04, thickness= 90.40. See manual to change limit values
DS model deactivated: blade  2 at 7002mm. Max f_sep=  4.24, dclda=  0.04, thickness= 90.40. See manual to change limit values
DS model deactivated: blade  2 at 8588mm. Max f_sep=  4.24, dclda=  0.07, thickness= 84.54. See manual to change limit values
DS model deactivated: blade  2 at 8588mm. Max f_sep=  4.24, dclda=  0.07, thickness= 84.54. See manual to change limit values
DS model deactivated: blade  2 at 10317mm. Max f_sep=  4.24, dclda=  0.10, thickness= 77.35. See manual to change limit values
DS model deactivated: blade  2 at 10317mm. Max f_sep=  4.24, dclda=  0.10, thickness= 77.35. See manual to change limit values
DS model deactivated: blade  2 at 12181mm. Max f_sep=  4.24, dclda=  0.14, thickness= 69.22. See manual to change limit values
DS model deactivated: blade  2 at 12181mm. Max f_sep=  4.24, dclda=  0.14, thickness= 69.22. See manual to change limit values
DS model deactivated: blade  2 at 14172mm. Max f_sep=  4.24, dclda=  0.18, thickness= 60.80. See manual to change limit values
DS model deactivated: blade  2 at 14172mm. Max f_sep=  4.24, dclda=  0.18, thickness= 60.80. See manual to change limit values
DS model deactivated: blade  2 at 16283mm. Max f_sep=  1.12, dclda=  2.62, thickness= 53.05. See manual to change limit values
DS model deactivated: blade  2 at 16283mm. Max f_sep=  1.12, dclda=  2.62, thickness= 53.05. See manual to change limit values
DS model deactivated: blade  3 at 0mm. Max f_sep=  0.00, dclda=  0.00, thickness=100.00. See manual to change limit values
DS model deactivated: blade  3 at 120mm. Max f_sep=  0.00, dclda=  0.00, thickness= 99.95. See manual to change limit values
DS model deactivated: blade  3 at 481mm. Max f_sep=  0.00, dclda=  0.00, thickness= 99.81. See manual to change limit values
DS model deactivated: blade  3 at 1080mm. Max f_sep=  0.00, dclda=  0.00, thickness= 99.57. See manual to change limit values
DS model deactivated: blade  3 at 1916mm. Max f_sep=  0.00, dclda=  0.00, thickness= 99.23. See manual to change limit values
DS model deactivated: blade  3 at 2984mm. Max f_sep=  1.00, dclda=  0.05, thickness= 98.80. See manual to change limit values
DS model deactivated: blade  3 at 4281mm. Max f_sep=  1.00, dclda=  0.24, thickness= 97.85. See manual to change limit values
DS model deactivated: blade  3 at 5802mm. Max f_sep=  1.00, dclda=  1.14, thickness= 93.02. See manual to change limit values
DS model deactivated: blade  3 at 7539mm. Max f_sep=  1.00, dclda=  2.15, thickness= 87.50. See manual to change limit values
DS model deactivated: blade  3 at 0mm. Max f_sep=  0.00, dclda=  0.00, thickness=100.00. See manual to change limit values
DS model deactivated: blade  3 at 88mm. Max f_sep=  0.00, dclda=  0.00, thickness=100.00. See manual to change limit values
DS model deactivated: blade  3 at 355mm. Max f_sep=  0.00, dclda=  0.00, thickness=100.00. See manual to change limit values
DS model deactivated: blade  3 at 0mm. Max f_sep=  0.00, dclda=  0.00, thickness=100.00. See manual to change limit values
DS model deactivated: blade  3 at 797mm. Max f_sep=  0.00, dclda=  0.00, thickness=100.00. See manual to change limit values
DS model deactivated: blade  3 at 88mm. Max f_sep=  0.00, dclda=  0.00, thickness=100.00. See manual to change limit values
DS model deactivated: blade  3 at 1414mm. Max f_sep=  0.00, dclda=  0.00, thickness=100.00. See manual to change limit values
DS model deactivated: blade  3 at 355mm. Max f_sep=  0.00, dclda=  0.00, thickness=100.00. See manual to change limit values
DS model deactivated: blade  3 at 797mm. Max f_sep=  0.00, dclda=  0.00, thickness=100.00. See manual to change limit values
DS model deactivated: blade  3 at 2203mm. Max f_sep=  4.24, dclda=  0.00, thickness= 99.77. See manual to change limit values
DS model deactivated: blade  3 at 1414mm. Max f_sep=  0.00, dclda=  0.00, thickness=100.00. See manual to change limit values
DS model deactivated: blade  3 at 3160mm. Max f_sep=  4.24, dclda=  0.01, thickness= 98.69. See manual to change limit values
DS model deactivated: blade  3 at 2203mm. Max f_sep=  4.24, dclda=  0.00, thickness= 99.77. See manual to change limit values
DS model deactivated: blade  3 at 4282mm. Max f_sep=  4.24, dclda=  0.01, thickness= 97.41. See manual to change limit values
DS model deactivated: blade  3 at 3160mm. Max f_sep=  4.24, dclda=  0.01, thickness= 98.69. See manual to change limit values
DS model deactivated: blade  3 at 4282mm. Max f_sep=  4.24, dclda=  0.01, thickness= 97.41. See manual to change limit values
DS model deactivated: blade  3 at 5565mm. Max f_sep=  4.24, dclda=  0.02, thickness= 94.83. See manual to change limit values
DS model deactivated: blade  3 at 5565mm. Max f_sep=  4.24, dclda=  0.02, thickness= 94.83. See manual to change limit values
DS model deactivated: blade  3 at 7002mm. Max f_sep=  4.24, dclda=  0.04, thickness= 90.40. See manual to change limit values
DS model deactivated: blade  3 at 8588mm. Max f_sep=  4.24, dclda=  0.07, thickness= 84.54. See manual to change limit values
DS model deactivated: blade  3 at 7002mm. Max f_sep=  4.24, dclda=  0.04, thickness= 90.40. See manual to change limit values
DS model deactivated: blade  3 at 10317mm. Max f_sep=  4.24, dclda=  0.10, thickness= 77.35. See manual to change limit values
DS model deactivated: blade  3 at 8588mm. Max f_sep=  4.24, dclda=  0.07, thickness= 84.54. See manual to change limit values
DS model deactivated: blade  3 at 12181mm. Max f_sep=  4.24, dclda=  0.14, thickness= 69.22. See manual to change limit values
DS model deactivated: blade  3 at 10317mm. Max f_sep=  4.24, dclda=  0.10, thickness= 77.35. See manual to change limit values
DS model deactivated: blade  3 at 14172mm. Max f_sep=  4.24, dclda=  0.18, thickness= 60.80. See manual to change limit values
DS model deactivated: blade  3 at 12181mm. Max f_sep=  4.24, dclda=  0.14, thickness= 69.22. See manual to change limit values
DS model deactivated: blade  3 at 16283mm. Max f_sep=  1.12, dclda=  2.62, thickness= 53.05. See manual to change limit values
DS model deactivated: blade  3 at 14172mm. Max f_sep=  4.24, dclda=  0.18, thickness= 60.80. See manual to change limit values
DS model deactivated: blade  3 at 16283mm. Max f_sep=  1.12, dclda=  2.62, thickness= 53.05. See manual to change limit values

An xarray dataarray with the sensor data can be obtained by:

[15]:
da = wts.sensors.to_xarray()
da.head(time=1)
[15]:
<xarray.DataArray 'data' (time: 1, wt: 3, sensor: 13)> Size: 312B
array([[[ 0.        ,  0.        , 10.19769278,  0.34039266,
         -0.12009186,  9.8198888 ,  0.08939756, -0.1043076 ,
          9.8198888 ,  0.08939756, -0.1043076 , 11.45097315,
          1.90899537],
        [ 0.        ,  0.        ,  8.87425767, -0.50321482,
          0.0887476 ,  9.99069778, -0.03992162, -0.21001935,
          9.99069778, -0.03992162, -0.21001935, 11.43910497,
          1.90657242],
        [ 0.        ,  0.        , 10.16975826, -0.08874848,
         -0.24468422, 10.3989547 , -0.12491694, -0.35079413,
         10.3989547 , -0.12491694, -0.35079413, 11.45097315,
          1.90899537]]])
Coordinates:
  * time     (time) float64 8B 1.0
  * wt       (wt) int64 24B 0 1 2
  * sensor   (sensor) <U22 1kB 'aero_power' 'aero_thrust' ... 'rotor_speed'
[16]:
for sensor in da.sensor:
    plt.figure(figsize=(6,3))
    for wt in da.wt:
        da.sel(sensor=sensor, wt=wt).plot(label=f'WT{wt.item()}')
    setup_plot(title=sensor.item())
../_images/notebooks_WindTurbines_25_0.png
../_images/notebooks_WindTurbines_25_1.png
../_images/notebooks_WindTurbines_25_2.png
../_images/notebooks_WindTurbines_25_3.png
../_images/notebooks_WindTurbines_25_4.png
../_images/notebooks_WindTurbines_25_5.png
../_images/notebooks_WindTurbines_25_6.png
../_images/notebooks_WindTurbines_25_7.png
../_images/notebooks_WindTurbines_25_8.png
../_images/notebooks_WindTurbines_25_9.png
../_images/notebooks_WindTurbines_25_10.png
../_images/notebooks_WindTurbines_25_11.png
../_images/notebooks_WindTurbines_25_12.png

HAWC2 result file

Output from HAWC2 can be obtained from a HAWC2 result file, when that file is written. When the file is written depends on

  • htc.simulation.time_stop (result file output stops at time_stop, note, time_stop is overridden by htc.output.time)

  • htc.output.data_format (gtsdf, gtsdf64 and hawc_ascii are written during simulation while hawc_binary and flex_int are written at time stop)

  • htc.output.buffer (gtsdf, gtsdf64 and hawc_ascii every buffer time steps))

  • htc.output.time

In this case, a result file has been written for all wind turbines

[17]:
!ls C:\mmpe\gitlab\DYNAMIKS\.py311_dynamiks_jupyter7\Lib\site-packages\h2lib_tests\test_files\DTU_10_MW\res\MyTestCase
ls: cannot access 'C:mmpegitlabDYNAMIKS.py311_dynamiks_jupyter7Libsite-packagesh2lib_teststest_filesDTU_10_MWresMyTestCase': No such file or directory
[18]:
# copy and overwrite cached result files at cwd
if 0:
    import shutil
    import os
    os.makedirs('res/MyTestCase', exist_ok=True)
    for i in [0,1,2]:
        f = wts.htc_lst[i].output.filename.values[0] + ".hdf5"
        print (os.path.abspath(wts.htc_lst[i].modelpath + f))
        shutil.copy(os.path.abspath(wts.htc_lst[i].modelpath + f), os.path.abspath(f))
[19]:
from wetb.gtsdf import gtsdf
plt.figure()
for i in [0,1,2]:
    f = wts.htc_lst[i].output.filename.values[0] + ".hdf5"
    time, data, info = gtsdf.load(f)
    n = 13 # output sensor number
    plt.plot(time, data[:,n], label=f"WT{i}, {info['attribute_names'][n]}")
plt.legend();
../_images/notebooks_WindTurbines_29_0.png
[20]:
wts.h2.close()
 Creating file folder res/
Folder "res/" created.
Creating file/folder MyTestCase
Created folder: 'MyTestCase'
 Closing of external type2 DLL
 Closing of external type2 DLL
 Closing of external type2 DLL
 Closing of external type2 DLL
 Closing of external type2 DLL
 Elapsed time :    40.00000
 Creating file folder res/
Folder "res/" created.
Creating file/folder MyTestCase
Created folder: 'MyTestCase'
 Closing of external type2 DLL
 Closing of external type2 DLL
 Closing of external type2 DLL
 Closing of external type2 DLL
 Closing of external type2 DLL
 Elapsed time :    39.71094
 Creating file folder res/
Creating file/folder MyTestCase
Created folder: 'MyTestCase'
 Closing of external type2 DLL
 Closing of external type2 DLL
 Closing of external type2 DLL
 Closing of external type2 DLL
 Closing of external type2 DLL
 Elapsed time :    40.07422