Dear Jason,
Thanks for the information. For the turbine model, I guess it might be better for me to use the simulation result from OpenFAST as the input for the simulink model first (Generator Power, Generator Torque and Pitch Angle). I have checked that the OutData file that those variables are available to the workspace. When I try to use the Demux module to split the OutData, it seems like the demux module is incompatible. May I have your adivse on this matter?
Thank you.
Best regards,
Jacky
Dear @Jacky.Cheung,
Iām sorry, but I donāt really understand your question.
Best regards,
Dear Jason,
Since the OpenFAST can be simualte without the external control from the Simulink, I would like to disable the control from simulink, and use the simulation result as the input to my model.

I want to use the generator power (an output from the OpenFAST) as the input the the synchronous machine for the simulink model. May I know the method of separating the OutData for simulation use?
Thank you.
Best regards,
Jacky
Dear @Jacky.Cheung,
If I understand correctly, you want to run the OpenFAST simulation within Simulink, but use any of the Simulink-defined inputs to the OpenFAST S-Function block. Rather, you want to use built-in control options for torque and pitch within the OpenFAST S-Function block for speed regulation. And you plan to output the generator power from the OutData array and feed that to your Simulink model of the synchronous machine. Effectively, this results in a one-way coupling (OpenFAST ā Simulink). Is that correct?
You should be able to use the MATLAB function strmatch
to extract OutData, e.g., u(strmatch(āGenPwrā,OutList))
.
Best regards,
Dear Jason,
Yes, you are right. I want to extract the GenPwr array and feed into the sunchronous machine module from time to time. Is that possible to do it in Simulink with any component?
For the MATLAB function, do you mean that I should add the MATLAB function module and use the above code to separate the data from the OutData port?
Thanks a lot for the prompt reply.
Best regards,
Jacky
Dear @Jacky.Cheung,
Exactly. The following Simulink model shows a simple example where OutData is extracted: openfast/Test01_SIG.mdl at main Ā· OpenFAST/openfast Ā· GitHub.
Best regards,
Dear Jaosn,
Thanks for the information. I have just tried to copy the module for my model, but I have encountered the following error:
Input ("u") index must be a positive integer in the expression: u(strmatch('GenPwr',OutList))
in 'Full_system_with_OpenFAST/Wind Turbine/Wind Turbine Type 4/Fcn'
when used for code generation
As I remember that the Outlist only contains numbers in the file, may I know if you could advise on how to fix this error?
Thank you.
Best regarsd,
Jacky
Dear @Jacky.Cheung,
It looks like a similar question was asked and answered in the following forum topic: Creating a DLL from Simulink model.
Best regards,
Dear Jason,
Thansk for the link. I have understood the limitation of Fcn module, and replaced the Fcn module by MATALB function instead to obtain the data from the OutData.

MATLAB Function Code
function y = fcn(OutData, OutList)
%index = strmatch('GenPwr',OutList))
y = OutData(46);
In the above MATLAB function, I tried to introduce the OutList from the workspace and use as an input to the MATLAB function to return the index of the desried variable for the model (i.e. GenPwr, Gen,Speed, etc.). However, I got the following error:
Unsupported input format for From Workspace block 'Full_system_with_OpenFAST/Wind Turbine/Wind Turbine Type 4/From Workspace'. Available formats are double non-complex matrix, a structure with or without time, or a structure with MATLAB timeseries as leaf nodes. All formats require the data to be finite (not Inf or NaN).
Since the error prompt out, I tried another method of using the direct index (GenPwr = 46) to obtain the desired data, and it works.
I noticed that the OutList is a series of cell, but I am not so sure why it cannot be introduced with the āFrom Worksapceā module to the simulink model. Is there any method to introduce the OutList to the simulink model to return the index for the obtaining the desired data with the index rather than the hardcode one (i.e. GenPwr = 46)?
Best regards,
Jacky
Dear @Jacky.Cheung,
It has been many years since Iāve used Simulink myself, so, Iām not sure. Perhaps someone else can comment. At least it sounds like it is working for you now anyway.
Best regards,
Dear Jason,
During the simulation of 5MW_OC4Semi_WSt_WavesWN with OpenFAST, I observed that the wind turbine takes around 100s to reach the steady state. May I know if there is any method to shorten the time required for reaching the steady state?
Also, I have tried to modify the Inflowwind input by changing the HWindSpeed in NRELOffshrBsline5MW_InflowWind_Steady13mps.dat from 13 to 12 m/s, but there are some ripples observed in the simualtion plot. Cna you suggest a method to manipulate the input wind speed?
Thank you.
Best regards,
Jacky
Dear @Jacky.Cheung,
To minimize start-up transients in OpenFAST simulations, it is generally recommend to initialize both the rotor speed and blade-pitch angles to their expected (mean) values based on the mean hub-height wind speed being simulated. For floating wind turbines, furthermore, it is also generally recommend to initialize the platform surge and platform pitch to their expected (mean) values based on the mean hub-height wind speed being simulated.
Iām not sure I understand your second question, but perhaps this is tied to the question and setting proper initial conditions is the likely solution again.
Best regards,
Dear Jason,
For the setting of the initial condition, may I know the corresponding input file (.fst and .dat) that I should work on?
Besides, I would like to simulate the behaviour of the wind turbine under random wind speed with mean wind speed at 12 m/s, and another scenario with IEC class A turbluence. Cab you suggest the method of doing so?
Thank you.
Best regards,
Jacky
Dear @Jacky.Cheung,
The initial conditions of rotor speed, blade-pitch angles, platform surge, and platform pitch are all defined within the ElastoDyn input file.
You can use TurbSim to generate full-field turbulence for with OpenFAST.
Best regards,
Dear Jason,
I have tried to modify the initial condition as per your recommendation, and I observed that the 4 variables will fluctuate with time and requires several hundread seconds to damp down. Do I need to modify the other initial parameter as well for a better performance?
---------------------- INITIAL CONDITIONS --------------------------------------
0 OoPDefl - Initial out-of-plane blade-tip displacement (meters)
0 IPDefl - Initial in-plane blade-tip deflection (meters)
5.1 BlPitch(1) - Blade 1 initial pitch (degrees)
5.1 BlPitch(2) - Blade 2 initial pitch (degrees)
5.1 BlPitch(3) - Blade 3 initial pitch (degrees) [unused for 2 blades]
0 TeetDefl - Initial or fixed teeter angle (degrees) [unused for 3 blades]
0 Azimuth - Initial azimuth angle for blade 1 (degrees)
12.1 RotSpeed - Initial or fixed rotor speed (rpm)
0 NacYaw - Initial or fixed nacelle-yaw angle (degrees)
0 TTDspFA - Initial fore-aft tower-top displacement (meters)
0 TTDspSS - Initial side-to-side tower-top displacement (meters)
7.2 PtfmSurge - Initial or fixed horizontal surge translational displacement of platform (meters)
0 PtfmSway - Initial or fixed horizontal sway translational displacement of platform (meters)
0 PtfmHeave - Initial or fixed vertical heave translational displacement of platform (meters)
0 PtfmRoll - Initial or fixed roll tilt rotational displacement of platform (degrees)
2.968 PtfmPitch - Initial or fixed pitch tilt rotational displacement of platform (degrees)
0 PtfmYaw - Initial or fixed yaw rotational displacement of platform (degrees)
Thank you.
Best regards,
Jacky
Dear @Jacky.Cheung,
How are you deriving these initial conditions? For the given wind speed you are simulating, are you running a simulation until it reaches steady state; recording the steady-state values of rotor speed, blade-pitch angle, platform surge, and platform pitch; and starting the next simulation with those values as initial conditions? This should drastically reduce the start-up transient, though it wont eliminate it completely. (We still recommend neglecting the first 30 seconds or so of simulation resultsāor however long the start-up transient lastsābefore post-processing.)
Best regards,
Dear Jason,
I have tried to set the initial condition and the response of the wind turbine was successfully reach to steady state in a short period of time.
I have tried to introduce an electrical fault to the terninal of the wind turbine model to observe the behavior of the wind turbinbe.
During the simulation, the generator speed from the simulink module shows some vibration, which is the result I want to obtain. When I check the output of the OpenFAST, it shows no change at all, and I guess it might be due to there is no input from the simulink model to the OpenFAST.
As I want to observe the behavior of the OpenFAST model, may I know if there is any input that I should introduce to the OpenFAST via Fast Sfucntion?
Besdies, the provision of torque controller enables user to control the generator power and generator torque in Simulink. May I know if this can be used for MPPT tracking in low wind speed region?
Thank you.
Best regards,
Jacky
Dear @Jacky.Cheung,
Iām not really following; are you inducing the fault by setting the generator torque, generator power, and blade-pitch inputs to the OpenFAST S-Function?
You should be able to implement whatever user-defined control actions you like in Simulink, as long as they can be based on the inputs and outputs available in the OpenFAST S-Function.
Best regards,
Dear Jason,
Iām using a three-phase fault module to introduce a grid fault to the simulink model only, but not the OpenFAST S-Function. In such case, I cannot observe any change in the OpenFAST output. I can only see the generator speed of my generator module varies when the fault is applied, but not the generator speed from OpenFAST output. Is there any thing I should do to change the input of the OpenFAST S-Function?
Thank you.
Best regards,
Jacky
Dear Jason,
Apart from the question above, I also got another question on the time step (DT) of the OpenFAST input. I noticed that the time step (DT) can be configure in the OpenFAST .fst file, and it would be inherit to other OpenFAST module. Is that the case that I could change the time step in that file for the whole simulation?
Best regards,
Jacky