Fast S_Function Error

Dear All,

I have a 2 Blade wind turbine (1.5MW) that errors out at t = 44 seconds. The error says:

’ Error in ToddSimulink/Fast Nonlinear WInd Turbine/S-Function’ while executing FORTRAN MEX s-function ‘Fast_SFunc’, flag=3 (output), at time 44.57. MATLAB error message: Closing program.

Is this error in the sfunction caused by my user error (missing a path), caused by the version of Matlab (2006a and 2007b), or is it something else?

Thank you for your time and help,


Hi, Todd.

Error message from SImulink tend to be pretty generic. Are there any messages written in the Matlab command window that indicate a problem with the simulation? (When FAST writes to the screen, the messages show up in Matlab’s Command Window.)

Thank you so much. I found the area you were taking about and was able to work through 4 different errors, but now I am experiencing the small angle assumption violated in subroutine SmllRotTrans() due to large blade deflections. Value of Rzero = 1.2755 must be smaller than 1 in xphi().

I have read the previous discussions on this topic. I have changed my DT time step in Fast, but for the error to not occur I need the time step to be 0.000125 This creates a memory allocation error after an hour of simulation.

I went through and turned off all the DOF and went through one by one and now I can have a DT of .0125 and have the simulation work if only the YawDOF and GenDOF are turned off. Do you have any suggestions on how to overcome this? After changing around some of the numbers in the .FST file, lowering DT to .00125 stops the two errors now, but takes a lot longer to run simulations.

  • Todd

Dear Todd,

There are many good topics on this forum explaining how to choose a proper time step (DT) for FAST. But basically, the highest natural frequency in your model determines the required DT. If you’ve identified that it is either the nacelle-yaw (YawDOF) or generator (GenDOF) DOF that forces a small DT, than you should ensure that you’ve set proper (i.e., physically realistic) values for the input parameters that would determine the nacelle-yaw and/or drivetrain natural frequencies. For example, are YawSpr, DTTorSpr, GBRatio, and GenIner all set accurately in your model?

Best regards,

I was modeling my Fast after the WindPACT CertTest where the YawDamp and YawSpr are zero, but once I added values to these two parameters I was able to get past the error onto many new errors that this blog was able to solve. Thank you both for your help!



Thank you so for all the help. I am able to get the model up and running for the 10 minutes of data. Unfortunately when I look at the SFunction output the GenPower starts out at 1.625 E3 for my 1.5MW and at 40 seconds, it goes to zero for 50 seconds, then stays at 21.3 for the remainder of the time at a wind speed of 17 m/s (For all wind speeds not just 17 m/s. The designed wind speed is 13 m/s). The generator torque is acting the same, but when it comes back from 0, the torque fluctuates around the 0.43 mark.

I believe this is all do to my RotSpeed. The rotor speed goes negative at this point. When it comes out of being negative, the rotor has a rpm of 5. Is this due to improperly designed blades? Or is there a switch that I could be overlooking? I am designing a 2 Bladed offshore downwind turbine that has an Omega of 43.765 rpm (initial conditions RotSpeed = 43.765)

Thank you for your time and help!

Dear Todd,

I’m afraid that I don’t think I know enough about your model to be able to explain why your simulation is behaving the way you describe. I suggest that you simplify the model as much as possible (i.e., by disabling features) to isolate the problem.

Best regards,