OC3 blade pitch control problem & its errors

Hi All,

I want to import wind and wave data into my adm file using VARSUB and VARIABLE statement. The rlating array that includes all the output data is AllOuts(:). So I must import AllOuts within VARSUB subroutine first, then by making dll i will be able to import those data to my adm file. Now the problem is that how I can invoke AllOuts within VARSUB?
Is there any body that could help me in this case?
I think a simple example will be so useful.


It seems no body have not faced with above problem.
Here is another question that may help to solve above problem.

Could anybody explain that what the following statements do in adm file? Is it contains all output data? Why used in adm file?Can we use it to extrat wanted output data?
! adams_view_name=‘CalcOuts_V’
, FUNCTION = USER(0, 97, 62.94, 12445, 1, 1, 1, 3, 17, 20, 63, 534.12)
Any answer will be so helpful,

Dear Mehdi,

These statements define VARIABLE/1 to the value returned from user-defined routine VARSUB() based on the set of parameters listed.

To access values from the AllOuts array, you should be able to define additional VARIABLE statements that call VARSUB to return the values you want.

Best regards,

Some questions regarding to following statements in adm file:
!---------------------------------- Generator ----------------------------------
! adams_view_name=‘Generator_SF’
, I = 3150
, J = 2050
, FUNCTION = USER( 11, 1047.2, 0, 9999.9, 2, 97, 3,
, 0.944, 1.25000E-02 )
!------------------------------------- Hub -------------------------------------
!------------------------------------ Blade 1 ----------------------------------
! adams_view_name=‘Pitch1Demand_V’
, FUNCTION = USER( 1, 0, 1.25000E-02, 97, 3,
, 9999.9, 9999.9, 0 )
! adams_view_name=‘Pitch1Error_V’
, FUNCTION = VARVAL(10000) - AZ(4011,10000)
! adams_view_name=‘Pitch1Actuator_SF’
, I = 10000
, J = 4011
, FUNCTION = -9.71350E+05VARVAL(10001) - 206WZ(10000,4011,4011)
What is the unit of accounted force in both above statements?( in N.m or KN.m)
What about unit of (FUNCTION = USER( 1, 0, 1.25000E-02, 97, 3, 9999.9, 9999.9, 0 ))?


Dear Mehdi,

The UNITS statement in the ADAMS dataset identifies the units. From this statement, you should be able to see that the SFORCE/3150 and SFORCE/10000 statements have the units of kN*m. VARSUB/10000 is the pitch-angle demand in radians.

Best regards,


I want to interface FAST with Simulink for NRELOffshrBsline5MW_OC3Hywind,(FAST_v70001a-bjj,matlab 2010b 64bit).
According to FAST user’s guide there must be a FAST_SFunc.dll in FAST archive, and there is not such file with dll extension there. Instead there is file named FAST_SFunc.mexw32.
It seems that the mexw32 might be as well as dll. But during running Open Loop simulink file according to FAST user’s guide(after set path, adding ,…), I encounter with following error:
Error in S-function ‘OpenLoop/FAST Nonlinear Wind Turbine/S-Function’: S-Function ‘FAST_SFunc’ does not exist.

I think FAST_SFunc.mexw32 dont work with my 64bit matlab and maybe the FAST_SFunc.mexw64 will be needed.
Is there any where to dowload provided FAST_SFunc.mexw64 file directly, that works with my matlab, because compiling is boring issue.
I also could’nt install matlab 32bit in my macine.
Any infos and help will be so helpfull.

My machine: Win 7 64bit
My Compiler:IVF 11 32bit

Dear Mehdi,

The S-Function has changed from “FAST_SFunc.dll” to “FAST_SFunc.mexw32” in MATLAB R2006a and newer.

Included with the FAST files of the NREL 5-MW OC3-Hywind model is a *.mexw32 version of the FAST-SFunction for 32-bit Windows versions of MATLAB. As has been described in many posts on this forum, you can install a 32-bit version of MATLAB on a 64-bit Windows machine and still use the *.mexw32 file.

If you’ve installed a 64-bit version of MATLAB, then you’ll have to recompile the S-Function in 64 bit to create a *.mexw64 file. Many people of tried this and ran into trouble running the *mexw64 file after compiling. One post recently discussed their success. While I haven’t tried it myself, you can see their comments here: http://forums.nrel.gov/t/compiling-fast-fast-s-function-on-linux-x86-64/462/1.

Best regards,

Dear All,

I couldn’t install matlab 32bit on my machine, so started to compile mexw64 myself.
I have installed IVF 11(32bit) and visual studio 2005 on my win 7 (64bit) machine.
I changed “make_FAST_SFunc.m” file as below:
FortranOptionsFile = ‘intelf11msvs2005opts.bat’;
OutputRootName = ‘FAST_SFunc’;
NWTC_LIB = ‘C:\Design Codes\NWTC_Lib_v1.03.01\Source’;
WIND_LOC = ‘C:\Design Codes\AeroDyn\Source\InflowWind\Source’;
AD_LOC = ‘C:\Design Codes\AeroDyn\Source’;
FAST_LOC = ‘C:\Design Codes\FAST\Source’;
Sim_LOC = ‘C:\Design Codes\FAST\Simulink\Source’;
mex(’-v’ , … %verbose
‘-f’, FortranOptionsFile , … %file containing fortran options
‘-output’, OutputRootName , … %name of the resulting mex function
fullfile(NWTC_LIB, ‘DoubPrec.f90’ ), …
fullfile(NWTC_LIB, ‘SysMatlab.f90’ ), …
fullfile(NWTC_LIB, ‘NWTC_IO.f90’ ), …
fullfile(NWTC_LIB, ‘NWTC_Num.f90’ ), …
fullfile(NWTC_LIB, ‘NWTC_Aero.f90’ ), …
fullfile(NWTC_LIB, ‘NWTC_Library.f90’ ), …
fullfile(WIND_LOC, ‘SharedInflowDefs.f90’), …
fullfile(WIND_LOC, ‘HHWind.f90’ ), …
fullfile(WIND_LOC, ‘FFWind.f90’ ), …
fullfile(WIND_LOC, ‘FDWind.f90’ ), …
fullfile(WIND_LOC, ‘CTWind.f90’ ), …
fullfile(WIND_LOC, ‘UserWind.f90’ ), …
fullfile(WIND_LOC, ‘InflowWindMod.f90’ ), …
fullfile(AD_LOC, ‘SharedTypes.f90’ ), …
fullfile(AD_LOC, ‘AeroMods.f90’ ), …
fullfile(AD_LOC, ‘GenSubs.f90’ ), …
fullfile(AD_LOC, ‘AeroSubs.f90’ ), …
fullfile(AD_LOC, ‘AeroDyn.f90’ ), …
fullfile(FAST_LOC, ‘FAST_Mods.f90’ ), …
fullfile(FAST_LOC, ‘Noise.f90’ ), …
fullfile(FAST_LOC, ‘fftpack.f’ ), …
fullfile(FAST_LOC, ‘FFTMod.f90’ ), …
fullfile(FAST_LOC, ‘HydroCalc.f90’ ), …
fullfile(FAST_LOC, ‘AeroCalc.f90’ ), …
fullfile(FAST_LOC, ‘FAST_IO.f90’ ), …
fullfile(FAST_LOC, ‘FAST.f90’ ), …
fullfile(FAST_LOC, ‘PitchCntrl_ACH.f90’ ), …
fullfile(FAST_LOC, ‘SetVersion.f90’ ), …
fullfile(FAST_LOC, ‘UserSubs.f90’ ), …
fullfile(FAST_LOC, ‘UserVSCont_KP.f90’ ), …
fullfile(Sim_LOC , ‘FASTSimulink.f90’ ), …
fullfile(Sim_LOC, ‘FASTGateway.f90’ ) );
delete (’*.mod’)
disp([‘mex completed: ’ OutputRootName ‘.’ mexext ’ has been created.’])

Also create the intelf11msvs2005opts batch file include:
set MATLAB=C:\Program Files\MATLAB\R2010b
SET IFORT_COMPILER11=C:\Program Files (x86)\Intel\Compiler\11.0\066\fortran
set VS80COMNTOOLS=C:\Program Files (x86)\Microsoft Visual Studio 8\Common7\Tools
set PATH=%IFORT_COMPILER11%\Bin\ia32;%LINKERDIR%\VC\BIN;%LINKERDIR%\Common7\Tools;%LINKERDIR%\Common7\Tools\bin;%LINKERDIR%\Common7\IDE;%LINKERDIR%\SDK\v2.0\bin;%PATH%
set MW_TARGET_ARCH=win64
set COMPILER=ifort
set COMPFLAGS= /Qprec “/I%MATLAB%/extern/include” -c -nologo -DMATLAB_MEX_FILE /MD /fp:source /assume:bscc /assume:byterecl /traceback /real_size:64 /Qzero /Qsave
set LIBLOC=%MATLAB%\extern\lib\win64\microsoft
set LINKER=link
set RC_COMPILER=rc /fo “%OUTDIR%mexversion.res”
set POSTLINK_CMDS1=del “%LIB_NAME%.x” “%LIB_NAME%.exp”
set POSTLINK_CMDS2=mt -outputresource:"%OUTDIR%%MEX_NAME%%MEX_EXT%";2 -manifest “%OUTDIR%%MEX_NAME%%MEX_EXT%.manifest”

Then run the “make_FAST_SFunc.m” file in matlab command window and tons of lines of commands passed as below:
Annexed File
command line .txt (79 KB)
And at the end, the following error appeared in matlab command line:
??? Error using ==> mex at 208
Unable to complete successfully.
Error in ==> make_FAST_SFunc at 65
mex(’-v’ , … %verbose

I myself think I set compiler parameters wrongly, or the IVF 32bit dont work with matlab2010b 64bit.
Any way:
Any help to fix this problem to create mexw64 will be appreciable.


I would recommend you remove the /assume:bscc switch from COMPFLAGS (we do not treat the backslash character as a C-style control character). That should allow the FAST source to compile. However, you still have a linking error: MSVCRT.lib(chkstk.obj) : fatal error LNK1112: module machine type ‘x64’ conflicts with target machine type ‘X86’

Because the 64-bit Matlab wants to create a 64-bit dll (mex64), I think you will need to compile with a 64-bit compiler. But as Jason has already said, you should read the other posts on this forum about making a .mex64 file.

Hey Fellows,

I switched to a 32 bit system to run FAST with simulink. I do everything according to FAST user’s guide. Here is my command line:


Enter the name of the FAST input file to read

< OC3Hywind.fst
NREL 5.0 MW Baseline Wind Turbine for Use in Offshore Analysis.
Warning: The model name ‘OpenLoop’ is shadowing another name in the MATLAB workspace or path. Type “which -all OpenLoop” at the command line to find the other uses of this name. You should change the name of the model to avoid problems. To turn this warning off, type “warning(‘off’,‘Simulink:ShadowedModelName’)” at the command line.

Running FAST (v7.00.01a-bjj, 5-Nov-2010)-Compiled as S-Function for Simulink.
Linked with NWTC Subroutine Library (v1.02.00, 16-Mar-2010).

Heading of the FAST input file: NREL 5.0 MW Baseline Wind Turbine for Use in Offshore Analysis.

Aerodynamic loads calculated using AeroDyn (v13.00.00a-bjj, 31-Mar-2010).
Heading of the AeroDyn input file: NREL 5.0 MW offshore baseline aerodynamic input properties;
Compatible with AeroDyn v12.58.

No file extension found. Assuming WindData\90m_12mps is a binary FF wind file with a “.wnd”

Reading a 31x31 grid (145 m wide, 17.5 m to 162.5 m above ground) with a characterstic wind
speed of 18 m/s.
Processed 12762 time steps of 20-Hz full-field data (638.05 seconds).
Generating incident wave kinematics and current time history.
Reading in WAMIT output with root name “HydroData\Spar”.
Computing radiation impulse response functions and wave diffraction forces.

FAST_SFunc initialized with 55 inputs and 139 outputs.
WARNING: Small angle assumption violated in SUBROUTINE SmllRotTrans() due to a large blade
deflection. The solution may be inaccurate. Simulation continuing, but future warnings will be
WARNING: High VNB velocity encountered during induction factor calculation.
Blade number 1, Element number 1
VNW = 15.198, VNB = 2222.4
WARNING: High VNB velocity encountered during induction factor calculation.
Blade number 1, Element number 2
VNW = 14.463, VNB = 54154
WARNING: High VNB velocity encountered during induction factor calculation.
Blade number 1, Element number 3
VNW = 14.339, VNB = 2.61006E+05
Error: FF wind array boundaries violated. Grid too small in Z direction (Z=189.07 m is above the
Error getting velocity in AeroDyn/AD_WindVelocityWithDisturbance().

Aborting FAST.

??? Closing program.

FAST_SFunc completed.

Total Real Time: 195.22 seconds
Total CPU Time: 32.375 seconds
Simulated Time: 2.50000E-02 seconds
Time Ratio (Sim/CPU): 7.72201E-04

Also annexed my FAST input file.
OC3Hywind.txt (22.3 KB)
If I run FAST lonely(without simulink), everything is Ok. So I am sure my wind files are OK as well.
I have not changed OpenLoop.mdl specification(default).
Is there anybody knows exactly why I encountered with this problem, and how to fix it.

Any help will be so appreciable.

The previous error was solved by setting GBRatio to 97.
I have other questions as below:

  1. What are the legal limitations of generator Torque and blade pitch angle. That is the ranges of these parameters that can vary? (more infos in this case will be so helpful).
  2. How FAST produce graphic output data, and how we can see those graphic files(is it visible through ADAMS/View)?

Best Regards,

Dear Mehdi,

I’m glad you solved the problem with the simulation.

See the NREL 5-MW specifications report for its control parameters and limits: nrel.gov/docs/fy09osti/38060.pdf.

FAST currently has no graphical animation capability. The animations NREL has presented for simulations of the NREL 5-MW turbine on a floating platform were generated from MSC.ADAMS via equivalent ADAMS simulations.

Best regards,

Dear Jason,
According to your PHD dissertation(page 70), you linearized model in ADAMS by invoking a “LINEAR/EIGENSOL” command.
Could you please give more information how you did this?

Best Regards,


Dear Mehdi,

I used the linearization feature of MSC.ADAMS that is enabled directly through the FAST-to-ADAMS preprocessor. See the “ADAMS Preprocessor” chapter of the FAST User’s Guide or ADAMS documentation for more information.

Best regards,

I ran the NREL OC3Hywind with included baseline control, through FAST and ADAMS (after the adm and acf file was created by FAST+dll file), And every thing was OK.The results were Ok, as well.
Then I manipulated the generator torque through inside of adm file, as below:
!---------------------------------- Generator ----------------------------------
! adams_view_name=‘Generator_SF’
, I = 3150
, J = 2050
, FUNCTION = 3.0

That is, I deleted the “USER( 11, 1047.2, 0, 9999.9, 2, 97, 3, 0.944, 1.25000E-02 )” and replace it by 3.0. Then ran the simulation.Simulation down well.
I opened the output file(MyModel.plt) to check the results, But I encoutered with unexpected result for GenTq. The plot shows that the GenTq is 0.0 at all simulation time(GenTq=0.0 for 0<t<630s). Whereas i expected GenTq be 3.0.

Is there anybody knows whats the wrong in my work, and how to fix it?


Dear Mehdi,

When you make your change to SFORCE/3150, your model will include a 3 kNm reaction torque between MARKER/3150 and MARKER/2050 as you desire. However, the value of ouput parameter GenTq is computed within A2AD as the value of the torque computed within the SFOSUB called by the USER call of SFORCE/3150. Because you have removed this call to SFOSUB, output GenTq is not computed properly.

Best regards,


I set the parameter settings as below to use Bladed-style Master contoller in my model.I did everything according to FAST user’s guide.

mean wind speed=18m/s(wind files)

I got the following curves for GenTq , GenSpeed and GenPower.

Why the GenTq is constant (=~43.5KN) and GenPwr is fluctuating throughout the simulation?
whereas I expected conversaly according to Fig 7-2 of technical report Definition of 5-MV Reference Wind Turbine for Offshore System Development NREL in region 3.


Dear Mehdi,

Which NREL 5-MW turbine are you simulating? The land-based baseline version comes with the controller described in Chapter 7 of the report you referred to. But if you are modeling the OC3-Hywind version, the controller was modified a bit relative to the baseline. For example, the torque controller in Region 3 was changed from a constant power controller to a constant torque controller. This looks like the controller response you are seeing. See the OC3-Hywind specifications report for more information: nrel.gov/docs/fy10osti/47535.pdf.

Best regards,


In FAST interfacing with Simulink, It seems that changing the GenPwr do not affect the system’s output. For example I ran my model twice, one with GenPwr=1000W and once with GenPwr=1200W, and the only thing that changed in output file was GenPwr, according to input value(1000,1200),
So, if the GenPwr do not affect the FAST Nonlinear Wind Turbine responses(FAST_SFunc.mexw32), why it has been set as input to the model?
Or otherwise how it affects wind turbine?
I dont know how the gen power can be as an input.
More information will be welcome.


Dear Mehdi,

I’ve answered a similar question in my June 30, 2011 post in the forum topic found here: http://forums.nrel.gov/t/fast-sfunc/377/1.

Best regards,