Beginner Guide for MATLAB Simulink and FAST


First, thanks for the nice thread.
I’ve followed every single step in FAST USER’s Guide but I cannot run even the simulink file. I’m getting the problem that S-Function ‘FAST_SFunction’ does not exits. A snapshot of the error message is attached.

When I’m asked to “Enter the name of the FAST input file to read”, I entered C:…\NRELOffshrBsline5MW_Onshore.fst as an input file. After that data has been loaded and when I run the simulink, I got the error message.

I think the problem is in the FAST_SFunc block in Simulink that call FAST_SFunc file.

any hint?

Thanks in advance


I am not sure about it, but it seems that you have not added the correct folder in MATLAB as written in the FAST user’s guide. Have you followed that guide (see page 35 and expecially 36 of the guide) before following my steps?

Have a nice day,

There are typically two things that could cause Simulink to say it can’t find FAST_SFunc:

  • Your FAST_SFunc.mexw* file is not on the MATLAB search path, or
  • You’re running 64-bit MATLAB and using FAST_SFunc.mexw32 (or vice versa: 32-bit MATLAB with FAST_SFunc.mexw64)

It looks like you’ve got the 32-bit version of the mex function in your current folder, so my guess is you’re running a 64-bit version of MATLAB.

The FAST v7.02.00d-bjj archive on the web contains only the 32-bit compiled version. If you need a 64-bit version of the mex function, you can find it here: … 2.00d-bjj/


I forgot to thank you Bonnie. So sorry :frowning:

The problem was that I’m using a 64-bit version of MATLAB, and the default S-Function file was in 32-bit.

Thanks again.

Hi ,friends
I read the paper And in regin 2,the generator torque control,it said that :
Simulating this control, we use step winds to excite the FAST turbine model. These step
winds cause the turbine operating point to begin in Region 2, pass through Region 2½,
and end in Region 3. In the FAST model the only DOF switched on for this simulation is
generator speed. Figure 3.5 shows the resulting generator torque versus generator speed
for this simulation. In this plot, the red curve is the FAST simulated generator torque and
the blue curve is the targeted generator torque from these equations. The results are
identical, showing that we have implemented the desired controller in FAST.
I want to ask how to simulate the step wind. And there is an example of wind input file in the appendix A.
Where can I find the wind input file in a software? Because I always simulate the wind with TurbSim. Thank you very much.

Dear Yiqing,

For simple wind time histories, such as step changs in the wind speed, AeroDyn’s simple “hub-height” format wind data file can be used in place of wind files generated by TurbSim. Please find an example of such a file attached.

Best regards,
PwrCrvJumpFastUp.wnd.txt (1.77 KB)

Hello Guys;

I have a question about MATLAB Compiling; I’m sure that it is kind of a beginner one; but I want to know!
After compiling FAST using MATLAB we have a file by the name of *.mexw32 or *.mexw64; the question is; how should we use this file inside MATLAB or Simulink?


Dear Hamid,

The “Simulink Interface” chapter of the FAST User’s Guide explains how to run FAST compiled as a mex-function for use within MATLAB/Simulink. The process explained in the “Simulink Interface” chapter applies to both the *.mexw32 and *.mexw64.

Best regards,

Hi :slight_smile:
I have a question regarding the Cart Model which is analyzed in

In page 29, they are indicated the parameters A, B and Bd like a constants not like a matrix which normaly comes after the linearization. Somebody knows which procedure was used to get these paremeters like constants?

Thank you for your time,


Dear Augusto,

The example on page 29 of Alan’s controls report is a simple model with 1 state (rotor speed perturbation), 1 input (collective pitch angle perturbation), and 1 disturbance (wind speed perturbation). The FAST linearization process returns 2 states for every DOF enabled, so, with the generator-azimuth DOF enabled, the result is a 2-state model (rotor azimuth angle perturbation and rotor speed perturbation). But as Alan Wright explains in the last paragraph on section 4.1.2 , Alan removes the rotor azimuth angle perturbation as a state. This effectively eliminates the 1st column from A and the first equation, leaving only a single equation with scalar values of A, B, and Bd.

Best regards,


I am starting to work with FAST and specifically the Simulink model of Baseline Controller - I read the related manuals and instructions but still have problem with running the simulink file.
First of all, which FAST/Simulink version is now compatible with MATLAB2014 or 2013?
I mean I have the files from NREL’s website: (ftp folder )
"NRELOffshrBsline5MW/ "

1- Is there specific MATLAB version that should be used to work with this files?
2- Are the current FAST 8 and FAST 7 versions that are available at NREL’s download section compatible too run the 5MW turbine model?

I already downloaded the current FAST versions and I am using FAST 7 version files as samples for baseline controller/simulink files.
I am using MATLAB2014 and MATLAB 2013 -

In FAST Manual - page 35/36 there are instructions on how to run the Simulink sample - here it says ( first transfer files Simsetup.m and Openloop.mdl from simulinkSamples folder the directory containing the primary input file of a FAST model that you want to use).

3- Does this mean that I should copy these files (Simsetup.m and Openloop.mdl) to the same folder (CertTest)?
4- Should I also put the Read_FAST_Input. and FAST_SFunc.dll in the same folder (CertTest)?? if not where should these files be?
5- should all of these files be in the same root directory (or folder) as the software FAST is?

** my windows/MATLAB is 64-bits . SO I added the 64-bit version of the FAST_SFunc but I still get the Error and my MATLAB shuts down
** I tried to put the (0,[],[],9) in S_Func block settings but still the MATLAB shuts down.

Any comments?

Dear Elham,
These are my experiences using FAST and ADAMS interfacing with Simulink,
The FAST and ADAMS versions developed files in NREL is based on 32bit system, it means that you will need 32bit windows to install the 32bit version of Matlab to use them.
I have worked with Matlab 2010b it works well.
You should copy those files(Simsetup.m and Openloop.mdl) to your current working folder.

Best regards,


FAST v8 allows you to run the 5MW model without modifying source code, however, we have not yet released the FAST v8 S-Function for Simulink. (It should be ready for release in the very near future).

FAST v7 as distributed does not run the 5MW models. The primary reason is that the Bladed-style DLL controller requires a separate compilation. If you want to run the 5MW model in Simulink, you’ll have to recompile FAST_SFunc using the appropriate source files for the Bladed Interface.

If you set your Matlab path variable, you should not have to move any files. See, for instance, the Simulink_CertTest.m file in the CertTest directory of FAST v7. Your Matlab path needs to know the directory location of FAST_SFunc.mexw* and the directory location of the Simulink model you are trying to run.

Please note that FAST_SFunc.dll (on Windows) is FAST_SFunc.mexw32 for 32-bit versions of Matlab and FAST_SFunc.mexw64 for 64-bit version of Matlab. There are some slightly updated instructions for the Simulink interface in the Addendum to the FAST User’s Guide.

Dear Bonnie,

Thank you very much for your comments.

However, I am now a bit more confused!
1- So, how do I work with the files for 5MW WT at ( … Bsline5MW/) ? what FAST version is compatible ?
2- Should I use the current version of FAST 7 or 8?
3- should I download the FAST from (
4-how can I have access to the source files for making the S-function?

Please let me know your comments.

Dear Elham,

The FAST models of the NREL 5-MW turbine available from ( The Bladed-style DLL controller is compiled with FAST v8 by default.

The interface between FAST v8 and Simulink has not yet been publicly released yet, so if you wish to apply Simulink, you should currently use FAST v7. We will be releasing an updated version of FAST v8 with a Simulink interface soon.

The source files for compiling the Simulink S-Function with FAST v7 are available in the FAST v7 archive:

Best regards,

Dear Admin

   When I run OpenLoop.mdl, an error appears in both Command windows and Simulink, saying some files of *.dat  and  *.ipt are missing. These files are available in CetTest folder. When I add this folder path into MATLAB, the error insists. Please let me know how I can get rid of these error messages.


Which directory is your current MATLAB directory? And what is the name of the FAST input file you are telling Simulink to use?

The MATLAB path is useful for finding your model files and MATLAB scripts as well as any DLLs that are necessary (FAST_SFunc.mex* and, if you are using FAST v8, FAST_Library*.DLL and MAP_*.DLL). However, FAST does not use the MATLAB path, so you have to explicitly state where the FAST input file is located (use an absolute path or specify it relative to your current MATLAB directory). Once you do that, all of the files listed in the primary FAST input file should be specified relative to the location of the input file in which they are specified. (Which basically means if you leave all the input files from the CertTest case where they were originally in the FAST archive, you need only to properly specify the name of the primary FAST input file.)

Dear Bonnie

I followed what you said and it is now working well. Many many thanks for your reply.



Hi Bonnie:
Again a basic doubt … I basically need to test my controller for wind turbine. I have designed that in SIMULINK. In FAST 7 you have a simulink block in Green with openloop.mdl. So i used that for simulink and carefully followed the instruction in a pdf by yourself.It successfully ran. For FAST 8 I have there is no such block to interface as s_fuction in simulink. Then how can i run FAST 8.,does it works only with fortran compilers, is there a way to interface the 5MW baseline model in SIMULINK for testing my controller and how can i visualise my results. does the versions above FAST 8(ie 03,09 etc…) could be run only in fortran compilers and visual studios ?

Hi, Srinivasa.

The FAST v8 interface for Simulink was first released in version 8.10.00 (March 2015). It wasn’t available in earlier versions. You can download it here: The Simulink interface in FAST v8 has changed somewhat from FAST v7, so please read the Guide to Changes in FAST v8.