Setup and blade pitch control

Dear everyone,

I’m planning to develop a reinforcement learning (RL)-based blade pitch controller in Simulink with OpenFAST.
I downloaded a ZIP file from GitHub and opened the OpenLoop example to see if it worked. However, I received an error message: “An error has occurred while reading the gravity value.” I checked the .fst file (for the 5MW OC buoy), and everything seemed fine.

I wonder if this error occurred because I missed a step. Do we need to download and include the files shown in the figure below? (I did not download them.)

Here are the steps I followed:

  1. Downloaded the ZIP file and the binary (bin) file.
  2. Set the path to the bin.
  3. Moved the OpenLoop files to the directory where all the .fst and .dat files are located.
  4. Ran the simulation — but then the gravity error occurred.

Could anyone please advise me on how to fix this issue and also provide some guidance or steps on how to implement an RL-based pitch angle controller?

Best regards,
Hyeon

Dear @Hyeon.Cha,

Can you clarify what zip and bin you downloaded? Can you also clarify where you obtained the OpenFAST input files (.fst and .dat) you are using?

And as with any input file processing error, I would enable the Echo option to debug errors in input file formatting.

Best regards,

Dear Jonkman,

Thanks for replying.
I enabled the Echo option.

I downloaded a file from GitHub - OpenFAST/openfast: Main repository for the NREL-supported OpenFAST whole-turbine and FAST.Farm wind farm simulation codes. by clicking the code. But when I downloaded the reg_tests/r-test file was empty so I downloaded individually and pasted in r-test.

And for the bin I used this link: GitHub - sido28/OpenFAST-build-folder-: OpenFAST build folder for co-simulation between Matlab and OpenFAST.

And for the fst file, I used the 5MW_OC3spar_DLL_WTurb_Waveslrr fst
openfast-main/reg_tests/r-test/glue-codes/openfast/5MW_OC3spar_DLL_WTurb_Waveslrr

Best regards,
Hyeon

This is the echo file:

This file of echoed input was generated by OpenFAST on 26-May-2025 at 19:14:52.

Data from OpenFAST primary input file “C:\openfast-main\reg_tests\r-test\glue-codes\openfast\5MW_OC3Spar_DLL_WTurb_WavesIrr/5MW_OC3Spar_DLL_WTurb_WavesIrr.fst”:

           FTitle         - File Header: File Description (line 2)

“FAST Certification Test #24: NREL 5.0 MW Baseline Wind Turbine with OC3 Hywind Configuration, for use in offshore analysis”

        T  Echo           - Echo input data to <RootName>.ech (flag)
           AbortLevel     - Error level when simulation should abort (string)

“FATAL”
6.0000E+01 TMax - Total run time (s)
1.2500E-02 DT - Recommended module time step (s)
1 InterpOrder - Interpolation order for inputs and outputs {0=nearest neighbor ,1=linear, 2=quadratic} (-)
0 NumCrctn - Number of corrections{0=explicit calculation, i.e., no corrections} (-)
1.5000E+00 DT_UJac - Time between calls to get Jacobians (s)
1.0000E+06 UJacSclFact - Scaling factor used in Jacobians (-)

        1  CompElast      - Compute structural dynamics (switch) {1=ElastoDyn; 2=ElastoDyn + BeamDyn for blades}
        1  CompInflow     - inflow wind velocities (switch) {0=still air; 1=InflowWind}
        2  CompAero       - Compute aerodynamic loads (switch) {0=None; 1=AeroDyn}
        1  CompServo      - Compute control and electrical-drive dynamics (switch) {0=None; 1=ServoDyn}
        1  CompHydro      - Compute hydrodynamic loads (switch) {0=None; 1=HydroDyn}
        1  CompSub        - Compute sub-structural dynamics (switch) {0=None; 1=SubDyn}
        0  CompMooring    - Compute mooring system (switch) {0=None; 1=MAP; 2=FEAMooring; 3=MoorDyn; 4=OrcaFlex}
        1  CompIce        - Compute ice loads (switch) {0=None; 1=IceFloe}
        0  MHK            - MHK turbine type (switch) {0=Not an MHK turbine; 1=Fixed MHK turbine; 2=Floating MHK turbine}

This is the fst file

------- OpenFAST EXAMPLE INPUT FILE -------------------------------------------
FAST Certification Test #24: NREL 5.0 MW Baseline Wind Turbine with OC3 Hywind Configuration, for use in offshore analysis
---------------------- SIMULATION CONTROL --------------------------------------
True Echo - Echo input data to .ech (flag)
“FATAL” AbortLevel - Error level when simulation should abort (string) {“WARNING”, “SEVERE”, “FATAL”}
60 TMax - Total run time (s)
0.0125 DT - Recommended module time step (s)
1 InterpOrder - Interpolation order for input/output time history (-) {1=linear, 2=quadratic}
0 NumCrctn - Number of correction iterations (-) {0=explicit calculation, i.e., no corrections}
1.5 DT_UJac - Time between calls to get Jacobians (s)
1000000 UJacSclFact - Scaling factor used in Jacobians (-)
---------------------- FEATURE SWITCHES AND FLAGS ------------------------------
1 CompElast - Compute structural dynamics (switch) {1=ElastoDyn; 2=ElastoDyn + BeamDyn for blades; 3=Simplified ElastoDyn}
1 CompInflow - Compute inflow wind velocities (switch) {0=still air; 1=InflowWind; 2=external from ExtInflow}
2 CompAero - Compute aerodynamic loads (switch) {0=None; 1=AeroDisk; 2=AeroDyn; 3=ExtLoads}
1 CompServo - Compute control and electrical-drive dynamics (switch) {0=None; 1=ServoDyn}
1 CompSeaSt - Compute sea state information (switch) {0=None; 1=SeaState}
1 CompHydro - Compute hydrodynamic loads (switch) {0=None; 1=HydroDyn}
0 CompSub - Compute sub-structural dynamics (switch) {0=None; 1=SubDyn; 2=External Platform MCKF}
1 CompMooring - Compute mooring system (switch) {0=None; 1=MAP++; 2=FEAMooring; 3=MoorDyn; 4=OrcaFlex}
0 CompIce - Compute ice loads (switch) {0=None; 1=IceFloe; 2=IceDyn}
0 MHK - MHK turbine type (switch) {0=Not an MHK turbine; 1=Fixed MHK turbine; 2=Floating MHK turbine}
---------------------- ENVIRONMENTAL CONDITIONS --------------------------------
9.80665 Gravity - Gravitational acceleration (m/s^2)
1.225 AirDens - Air density (kg/m^3)
1025 WtrDens - Water density (kg/m^3)
1.464E-05 KinVisc - Kinematic viscosity of working fluid (m^2/s)
335 SpdSound - Speed of sound in working fluid (m/s)
103500 Patm - Atmospheric pressure ¶ [used only for an MHK turbine cavitation check]
1700 Pvap - Vapour pressure of working fluid ¶ [used only for an MHK turbine cavitation check]
320 WtrDpth - Water depth (m)
0 MSL2SWL - Offset between still-water level and mean sea level (m) [positive upward]
---------------------- INPUT FILES ---------------------------------------------
“NRELOffshrBsline5MW_OC3Hywind_ElastoDyn.dat” EDFile - Name of file containing ElastoDyn input parameters (quoted string)
“../5MW_Baseline/NRELOffshrBsline5MW_BeamDyn.dat” BDBldFile(1) - Name of file containing BeamDyn input parameters for blade 1 (quoted string)
“../5MW_Baseline/NRELOffshrBsline5MW_BeamDyn.dat” BDBldFile(2) - Name of file containing BeamDyn input parameters for blade 2 (quoted string)
“../5MW_Baseline/NRELOffshrBsline5MW_BeamDyn.dat” BDBldFile(3) - Name of file containing BeamDyn input parameters for blade 3 (quoted string)
“../5MW_Baseline/NRELOffshrBsline5MW_InflowWind_12mps.dat” InflowFile - Name of file containing inflow wind input parameters (quoted string)
“NRELOffshrBsline5MW_OC3Hywind_AeroDyn.dat” AeroFile - Name of file containing aerodynamic input parameters (quoted string)
“NRELOffshrBsline5MW_OC3Hywind_ServoDyn.dat” ServoFile - Name of file containing control and electrical-drive input parameters (quoted string)
“SeaState.dat” SeaStFile - Name of file containing sea state input parameters (quoted string)
“NRELOffshrBsline5MW_OC3Hywind_HydroDyn.dat” HydroFile - Name of file containing hydrodynamic input parameters (quoted string)
“unused” SubFile - Name of file containing sub-structural input parameters (quoted string)
“NRELOffshrBsline5MW_OC3Hywind_MAP.dat” MooringFile - Name of file containing mooring system input parameters (quoted string)
“unused” IceFile - Name of file containing ice input parameters (quoted string)
---------------------- OUTPUT --------------------------------------------------
False SumPrint - Print summary data to “.sum” (flag)
1 SttsTime - Amount of time between screen status messages (s)
99999 ChkptTime - Amount of time between creating checkpoint files for potential restart (s)
0.0125 DT_Out - Time step for tabular output (s) (or “default”)
0 TStart - Time to begin tabular output (s)
4 OutFileFmt - Format for tabular (time-marching) output file (switch) {1: text file [.out], 2: binary file [.outb], 3: both 1 and 2, 4: uncompressed binary [.outb, 5: both 1 and 4}
True TabDelim - Use tab delimiters in text tabular output file? (flag) {uses spaces if false}
“ES15.7E2” OutFmt - Format used for text tabular output, excluding the time channel. Resulting field should be 10 characters. (quoted string)
---------------------- LINEARIZATION -------------------------------------------
False Linearize - Linearization analysis (flag)
False CalcSteady - Calculate a steady-state periodic operating point before linearization? [unused if Linearize=False] (flag)
3 TrimCase - Controller parameter to be trimmed {1:yaw; 2:torque; 3:pitch} [used only if CalcSteady=True] (-)
0.001 TrimTol - Tolerance for the rotational speed convergence [used only if CalcSteady=True] (-)
0.01 TrimGain - Proportional gain for the rotational speed error (>0) [used only if CalcSteady=True] (rad/(rad/s) for yaw or pitch; Nm/(rad/s) for torque)
0 Twr_Kdmp - Damping factor for the tower [used only if CalcSteady=True] (N/(m/s))
0 Bld_Kdmp - Damping factor for the blades [used only if CalcSteady=True] (N/(m/s))
2 NLinTimes - Number of times to linearize (-) [>=1] [unused if Linearize=False]
30, 60 LinTimes - List of times at which to linearize (s) [1 to NLinTimes] [used only when Linearize=True and CalcSteady=False]
1 LinInputs - Inputs included in linearization (switch) {0=none; 1=standard; 2=all module inputs (debug)} [unused if Linearize=False]
1 LinOutputs - Outputs included in linearization (switch) {0=none; 1=from OutList(s); 2=all module outputs (debug)} [unused if Linearize=False]
False LinOutJac - Include full Jacobians in linearization output (for debug) (flag) [unused if Linearize=False; used only if LinInputs=LinOutputs=2]
False LinOutMod - Write module-level linearization output files in addition to output for full system? (flag) [unused if Linearize=False]
---------------------- VISUALIZATION ------------------------------------------
0 WrVTK - VTK visualization data output: (switch) {0=none; 1=initialization data only; 2=animation; 3=mode shapes}
2 VTK_type - Type of VTK visualization data: (switch) {1=surfaces; 2=basic meshes (lines/points); 3=all meshes (debug)} [unused if WrVTK=0]
false VTK_fields - Write mesh fields to VTK data files? (flag) {true/false} [unused if WrVTK=0]
15 VTK_fps - Frame rate for VTK output (frames per second){will use closest integer multiple of DT} [used only if WrVTK=2 or WrVTK=3]

Dear @Hyeon.Cha,

I’m not familiar with the sido28 organization, but that one is not managed by NREL. I would suggest accessing the precompiled binaries of OpenFAST from: Releases · OpenFAST/openfast · GitHub, including FAST_SFunc.mexw64 and OpenFAST-Simulink_x64.dll for the interface of OpenFAST with MATLAB/Simulink.

The issue I see is that your Echo file has input switch CompSeaSt but your primary input file does not, so every line after that is being read incorrectly. Your input files and OpenFAST executable must be compatible with the same release. Input file changes with each release of OpenFAST are documented here: 4.1.2. API changes between versions — OpenFAST v4.0.4 documentation.

Best regards,