FAST_SFunc

Dear all,

Does anybody has the source code of “FAST_SFunc” block in Simulink for FAST v8 ? My problem is that when I want to open it, Matlab says that the S-Function source file cannot be found even though the simulation runs well.

Thank you

Best,
Sina

Dear Sina,

The source code for the FAST S-Function (FAST_SFunc) in the interface between Simulink and FAST v8 is written in C. The source file FAST_SFunc.c is included in the Simulink/Source directory of the FAST v8 archive.

Best regards,

Dear Dr. Jonkman,

Thanks for your response. Yes, I found this source code but it seems it is not a true/actual source code. If I don’t set the path to the address you mentioned, then I cannot open the FAST_SFunc.c in Simulink; on the other hand, when I set path to this address, I can open it but it seems this file does not have to anything with the simulation. It seems, it is a template file. I also wrote something wrong in it, then the simulation still runs well! Am I missing something?

Thanks
Best regards,
Sina

Dear Sina,

The FAST_SFunc.c source code is compiled into FAST_SFunc.mexw32 or FAST_SFunc.mexw64 (for 32-bit or 64-bit Windows versions of MATLAB, respectively), which ends up as the FAST S-Function block in Simulink.

Best regards,

hi
when we connect FAST to Simulink i want to know what S-Function does on parameters like Electrical Power or GenTrq,
Is there a theory for the S-Function in FAST 7? How can I find its source so that I can understand what is being done to the input and output parameters of the S-Function?

I have another question
When I run FAST via Simulink, I take the RotorTorque from the given outputs as feedback for the control loop and enter this parameter into the generator and then take the rotor speed from the generator. Can I enter this rotational speed into S-Function?
Is this method correct?

Dear @Ali.Rouhbakhsh,

The generator torque input to the FAST S-Function from Simulink is the torque that will be applied to the generator (on the high-speed shaft side), and equally and oppositely applied to the nacelle (the torque applied to the nacelle is multiplied by the the gearbox ratio, GBRatio). If this torque does not balance with the torque applied through the rotor (aerodynamic torque), the drivetrain will accelerate or decelerate.

The electrical power input to the FAST S-Function from Simulink is not really used by the FAST S-Function other than to be included in the OutList if output GenPwr is selected.

Simulink cannot directly prescribe the rotor speed as an input to the FAST S-Function.

Best regards,

Does this mean generator is inside the S-Function ?

Dear @Ali.Rouhbakhsh,

The rigid-body rotation degree of freedom of the generator, and the associated generator inertia, are in within the FAST S-Function. The calculation of the generator torque (and power) should be implemented in Simulink.

Best regards,

I have a Simulink file that simulates the whole turbine and has nothing to do with FAST and is not connected to FAST. And I want to connect this Simulink file to FAST via S-Function.

Can you help me which parts of the attached Simulink file to transfer to the Simulink file linked to FAST (via S-Function)?


Dear @Ali.Rouhbakhsh,

I can’t fully interpret your Simulink model. Regardless, I would say any structural or aerodynamic parts of the model should be handled by the FAST S-Function and the electrical and control aspects of the model should be implemented in Simulink.

Best regards,

hank you
I have another question
When I connect FAST to Simulink and get the GenPwr output, it looks like the attached image
I think this output is problematic because the power is negative
What is the problem?
(vertical axis=GenPwr Horizontal axis=time)

Dear Ali,

I have a Simulink model calculating the generator torque (input to the FAST). You can find the run file and Simulink in my Github:

Best regards,
Sina

Thank you very much Mr. Ameli

Can I email you if I have any other questions?

Dear Ali,

You are welcome! Sure. Hope this will help you.

Best regards,
Sina

Dear @Ali.Rouhbakhsh,

Again the generator power is computed within Simulink and input to the FAST S-Function, but the generator power is not used or modified by the S-Function other to output it. So, if the generator power output is not what you expect, I would ensure that it is computed as you want within Simulink.

Best regards,