Beginner to Simulink and FAST V7

Hi all,

I am a beginner for FAST. Now I want to use FAST V7 on Simulink. I do the procedures just as follows:
1) Download the NREL 5MW model from wind.nrel.gov/public/jjonkman/NR … Bsline5MW/, Download NRELOffshrBsline5MW_Onshore.zip.

  2) Unzip NRELOffshrBsline5MW_Onshore.zip and move everything into the FAST folder\Simulink. After that, in folder \Simulink\Samples, move those two Simulink example files to \Simulink.

  3) Create a folder under \Simulink called WindData. Subsequently, Go to the FAST location\\CertTest\Wind\UAE_VI, copy the wind file, Shr11_30.wnd, to the WindData folder that I created. After that, under \Simulink, open NRELOffshrBsline5MW_AeroDyn.ipt, change line 10 to "WindData\Shr11_30.wnd".

  4) In folder \Simulink, NRELOffshrBsline5MW_Onshore.fst, I change (i) ADAMSPrep to 1, (ii) PCMode to 2, (iii) VSContrl to 3 and (iv) GenModel to 1. 

  5) Finally, Run Simsetup.m under \Simulink, then type "NRELOffshrBsline5MW_Onshore.fst".Now, open "OpenLoop.mdl" and run. 

Because my windows and Matlab are 64-bits. So I downloaded FAST_SFunc.mexw64 from the link wind.nrel.gov/public/jjonkman/FA … 2.00d-bjj/ and put it to the file \Simulink where FAST_SFunc.mexw32 was. And I put FAST_SFunc.mexw32 to other place. I also set the Matlab path to the file \Simulink.

When I run the 5th step above, I still have the problem below. It said that “Error while obtaining sizes from MEX S-function ‘FAST_SFunc’ in ‘OpenLoop/FAST Nonlinear Wind Turbine/S-Function’.” Then closing the program. Who can help me to fix this problem? Is FAST_SFunc.mexw64 above okay for the matlab of 64-bits? Thank you so much!
Untitled.jpg

Hi, Yanhua.

Is there any message in the Matlab Command Window? Simulink will put some generic messages in the pop-up window that appears when there is an error, but usually the most helpful information comes from the Matlab Command Window. FAST may be unable to read an input file or it may be trying to read a file that is in the wrong format.

P.S. In FAST v7.02, you shouldn’t have to be moving files all around. If you set relative path names inside your FAST input files and Matlab script, set your Matlab path so it can find the .mex (DLL) file and model files, and you should be good to go.

Dear Bonnie,

Sorry for answering you late. I fixed the above problem by using a 32-bit Matlab in my 64-bit windows system. When I do simulations with this FAST model, I have a confusion just as follows. When I change the wind input from 3m/s to 15m/s gradually, the OutData of GenPwr and GenTq (electrical generator power and torque respectively) should keep changing. However, the output always keeps 1, which I think is wrong. I can’t figure out what the possible problems are. Can you help me? Thank you so much!

All the best.

Yanhua



Dear Yanhua,

It looks like you are simply running the OpenLoop.mdl without active control of the generator and power. The “Torque Controller” block that is included in OpenLoop.mdl is just an example that supplies a constant torque of 1000 Nm and a constant power of 1000 W (as you are seeing in your output). If you wish to run FAST with control commands coming from Simulink, you must implement your own control logic within Simulink.

Best regards,

Dear Bonnie,

I am trying to design simple generator torque controller and pitch controller now. I encountered some confusions which need your help. I am using NRELOffshrBsline5MW_Onshore.fst, which I think is the NREL 5-MW baseline wind turbine. Am I right about this? Firstly, could you tell me the relationship between rotor speed and low-speed shaft speed for this type wind turbine? Does low-speed shaft speed multiplied by GBRatio (Gearbox ratio) equal to the high-speed shaft speed?

Secondly, what is the value of GBRatio of this type wind turbine? The definition of this value in Simsetup.m is 22.5 while the value of GBRatio in NRELOffshrBsline5MW_Onshore.fst is 97. Which one is correct? I see the description in " [url]http://www.nrel.gov/docs/fy09osti/38060.pdf[/url]" is like this “We specified the NREL 5-MW baseline wind turbine to have the same rated rotor speed (12.1 rpm), rated generator speed (1173.7 rpm), and gearbox ratio (97:1) as the REpower 5M machine. The gearbox was assumed be a typical multiple-stage gearbox but with no frictional losses—a requirement of the preprocessor functionality in FAST for creating ADAMS models [11].” Therefore I think the value of GBRatio is 22.5. Thus why is the value in Simsetup.m 22.5 ? Is it wrong? It confuses a lot. I hope you can help me. Thank you so so much.

All the best.

Yanhua

Dear Yanhua,

For the NREL 5-MW turbine, the gearbox ratio (GBRatio, i.e. the ratio between the high- and low-speed shaft speeds) is 97, whereas for the AWT-27CR2 turbine GBRatio is 22.5.

Test01_SIG.mdl is a test of the Simulink interface that mimics the simple induction generator (SIG) model built into FAST for test #1 in the FAST certification suite, which is a model of the AWT-27CR2 turbine. The SimSetup.m file of FAST7 sets the parameters needed for Test01_SIG.mdl to function properly, and so, the parameters are specific to the AWT-27CR2 turbine. These are provided only as an example.

I hope that helps.

Best regards,

Dear Jason,

Thanks for your help.I am using NRELOffshrBsline5MW_Onshore.fst, which I think is the NREL 5-MW baseline wind turbine. I am trying to design the generator torque controller for this wind turbine as P31 of the document [url]http://www.nrel.gov/docs/fy09osti/38060.pdf[/url] .I encountered some problem as follows:

(1) It said the rated generator speed is 1173.7 rpm which I found that the generator speed could be 4503 rpm when the wind speed is 18 m/s. And the rated rotor speed is 12.1 rpm and the low-speed shaft speed (which I saw it same with the rotor speed) could be 46 rpm when the wind speed is 18 m/s. It conflicts. What’s the problem?

(2) I can’t figure out the calculation equation of the generator torque when it’s in region 1 1/2 and region 2 1/2. Can you help me with this?

Thank you so much. It puzzles me a lot.

All the best.

Yanhua

Dear Yanhua,

I’m sorry, but I don’t understand your first question.

Regarding your second question, the torque-speed curve is linear in regions 1.5 and 2.5. The exact equations used to form the complete torque-speed curve are given in the source code for the DLL controller, as available in Annex C of the report you reference: nrel.gov/docs/fy09osti/38060.pdf.

Best regards,

Dear Jason,

Thanks for your help. Sorry for not explaining the first problem so clearly. I mean when I am doing the simulation on the Matlab with NREL 5MW Baseline Wind turbine model, I encountered the problem as following:

As the document [url]http://www.nrel.gov/docs/fy09osti/38060.pdf[/url] said, the rated wind speed of this wind turbine is 11.4 m/s. So I set the wind speed input as 18 m/s which it should be in the rated operation regime. I found that the simulated generator speed is 4503 rpm which is different from the rated generator speed (1173.7 rpm). I don’t understand why it is much larger than the number given by the above document. I think the simulated generator speed output should be 1173.7 rpm regardless of the generator torque controller.

I hope you can understand it this time. Thanks so much for your patience. Thanks a lot.

All the best.

Yanhua

Dear Yanhua,

My guess is that you model doesn’t include blade-pitch control? The generator speed is regulated by the blade-pitch controller above rated wind speed. The generator speed would get very high above rated wind speed if you model does not include blade-pitch control.

Best regards,

Dear all,

corresponding to a recommendation of Mr.La Cava and Mr. Park I decided to use FAST-SC´s interface with Simulink for the simulation of semiactive TMD´s. Unfortunately there is a problem with the Read_Fast_Input_TMD file. I put every necessary file in the correct folder as described in the FAST-V7 manual! When I call Simsetup.m (I changed simsetup.m to Read-Fast_Input_TMD) in the MATLAB Command Window and enter the name of the Input file NRELOffshrBsline5MW_TMD_v710.fst Matlab doesnt import all the input parameters. Some of them are imported correctly but for others the software reads in a whole line (including all the text) instead of just the parameter value. I didnt change anything within the files… Have you had such a problem before? I really hope you can help me out!

Thanks in advance!

David

Hi, David.

Since NREL didn’t create the Read_Fast_Input_TMD file, I’m not sure any of us can help with the error you are getting. Perhaps Bill La Cava or Semyung Park can help. I’d probably take a look at Read_Fast_Input_TMD and see which line is causing it to stop reading your input file correctly.

Dear all,

I am an MSc student and I am a beginner to Simulink and FAST V7.
I post a reply beacause I have the same problem as the beginning of this conversation.
I have an issue when I run a simulation with FAST V7. Everything works when I use FAST v8 but since I need the linearization model from FAST v7, I changed the version.

I have windows and Matlab 64-bits so I have downloaded FAST_SFunc.mexw64 from the link wind.nrel.gov/public/jjonkman/FA … 2.00d-bjj/ and put it to the file \Simulink where FAST_SFunc.mexw32 was. But for each run, Matlab is closed without any message in the Matlab Command Window.
I have tried to do like Yanhua: to use a 32-bit Matlab in my 64-bit windows system and use the FAST_SFunc.mexw32 but the problem persists.
It is an important problem for me because I cannot run any simulation or linearization calculs.
Have you an idea to solve this problem?

Thank you in advance.

Best regards,
Audrey

Hello Bonnie,

I found the mistake in the Read_FAST_Input_TMD and now I can import all the parameters I need! Thank you very much for your help! Nevertheless the simulink model provided by Dr. Lackner still doesnt run because of an error. In the process of eliminating the errors in the model I noticed the following: In the FAST-SC Overview.pdf it is mentioned that the “NREL5MW_Baseline_06b_TMD.mdl” is based on a model, which Dr. Namik from the University of Auckland has developed earlier! I already tried to contact him, but so far he has not replied to my message! I am wondering if you maybe know how I can get access to this simulink model from Dr. Namik? It would help me a lot to understand the changes Prof. Lackner undertook developing his TMD model!

If you dont have access to Dr. Namiks model you can maybe help me with the occuring error. I think the error the error is not directly associated with the TMD module: As soon as I run the model (after reading in the parameters) I get the following status line:
[b]
Warning: Invalid arguments passed to ‘dpoly’ drawing command in block ‘NREL5MW_Baseline_06b_TMD/speedfilter’. Polynomial arguments cannot be empty

Error evaluating ‘InitFcn’ callback of block_diagram ‘NREL5MW_Baseline_06b_TMD’. Caused by: Undefined function or variable ‘Model_Inputs’.[/b]

Unfortunately the board attachment quota has been reached, so that I cannot upload any screenshots! But if you have a look into the modell you`ll see that it tries to extract the HSS speed from the green wind turbine block with “u(strmatch(‘GenSpeed’,OutList))” - I added “GenSpeed” to the Outlist before running the model. Next in line is a transfer fcn with numerator w_cut, denominator [1 w_cut] and initial conditions 1173.7*1/w_cut. At the location of this transfer fcn I get the question marks and thats where the warning message points to! Do you have an idea what I may need to change in the primary Input file?

Thanks a lot,

David

Hi, Audrey.

Depending on the version of Matlab you are using, you may need to recompile the FAST_SFunc mex function. I think the mex file was created with Matlab R2012a so it may not be compatible with your version of Matlab.

Hi, David.

I do not have the files from Dr. Namik. The first error indicates that one or more arguments to dpoly are empty. It looks like the w_cut variable is undefined. The other error refers something called Model_Inputs that is undefined. So, I would guess that you are missing a MATLAB script that defines some variables (including w_cut and Model_Inputs) that are needed for the Simulink model you are running.

Hi Bonnie.

“It looks like the w_cut variable is undefined. The other error refers something called Model_Inputs that is undefined. So, I would guess that you are missing a MATLAB script that defines some variables (including w_cut and Model_Inputs) that are needed for the Simulink model you are running.”

That was my assumption as well! I also thought that the “Model_Inputs error” only occurs because the w_cut variable is missing, but I dont know that for sure. Or could it also be that there is some kind of error in the extraction of “Genspeed” fromthe Output list? When you say “missing a MATLAB script that defines some variables that are needed for the Simulink model”, what exactly do you mean? I am confused because I couldnt find the variable w_cut in any of the UserGuides! Guessing only by the name of the variable, it sounds like it is some kind of cut-off/filter variable! But where exactly do I define those variables (w_cut and Model_Inputs)? Do I need an additional Matlab script for it or would I make additions to one of the existing ones (like source codes, Simsetup, Read_FAST_input)?

Just to see if there are any additional errors in the model I deleted the “speed filter” block from the simulink model and the “Model_Inputs” variable from InitFcn (in the Model Properties window). Then I get the following error:

Input array cannot hold the number of inputs.
Aborting program.
Error while obtaining sizes from MEX S-function ‘FAST_SFunc’ in ‘NREL5MW_Baseline_06b_TMD/FAST Nonlinear Wind Turbine/S-Function’.
Caused by:
Closing program.

I compiled the Fast_Sfunc exactly how it is described in the the make_FAST_Sfunc, that´s why I dont understand why Simulink has a porblem obtaining the sizes! Where exactly do I define the number of inputs/the input array? And how do I know the number of Inputs I need to define?

Thank you very much in advance,

David

Hi Bonnie,

Thank you for your answer. I am trying to compile FAST_Sfun using Make_FAST_SFun.m file and matlab 32 bits.
I followed the instructions in the matlab script. But I have the following error:

make_FAST_SFunc
→ Options file specified on command line


→ Options file = intelf12msvs2010shellopts.bat
MATLAB = C:\Program Files (x86)\MATLAB\R2014a32
→ COMPILER = ifort
→ Compiler flags:
COMPFLAGS = /assume:byterecl /traceback /real_size:64 /Qzero /Qsave
OPTIMFLAGS = /O2 /DNDEBUG
DEBUGFLAGS = /Z7
arguments =
Name switch = /Fo
→ Pre-linking commands =
→ LINKER = link
→ Link directives:
LINKFLAGS = /dll /export:MEXFUNCTION /LIBPATH:“C:\Program Files (x86)\MATLAB\R2014a32\extern\lib\win32\microsoft” libmx.lib libmex.lib libmat.lib /implib:“C:\Users\AUDREY~1\AppData\Local\Temp\mex_Ha1Z6v\templib.x” /MAP:“FAST_SFunc.mexw32.map” /NOLOGO /manifest /INCREMENTAL:NO
LINKDEBUGFLAGS = /debug /PDB:“FAST_SFunc.mexw32.pdb”
LINKFLAGSPOST =
Name directive = /out:“FAST_SFunc.mexw32”
File link directive =
Lib. link directive =
Rsp file indicator = @
→ Resource Compiler = rc /fo “mexversion.res”
→ Resource Linker =

→ ifort /assume:byterecl /traceback /real_size:64 /Qzero /Qsave /FoC:\Users\AUDREY~1\AppData\Local\Temp\mex_Ha1Z6v\DoubPrec.obj /O2 /DNDEBUG -DMX_COMPAT_32 “C:\Users\Audrey Viala\Desktop\Fast v7\Source\NWTC_LIB\Source\DoubPrec.f90”

Intel(R) Visual Fortran Compiler for applications running on IA-32, Version 16.0 Build 20160415
Copyright (C) 1985-2016 Intel Corporation. All rights reserved.

ifort: error #10037: could not find ‘link’

C:\PROGRA~2\MATLAB\R2014A32\BIN\MEX.PL: Error: Compile of ‘C:\Users\Audrey Viala\Desktop\Fast v7\Source\NWTC_LIB\Source\DoubPrec.f90’ failed.

Unable to complete successfully…

I suppose there is a problem with my paths but I am lost between compiler paths, FAST paths and matlab paths…
I have intel fortran compiler with visual studio 2015.I am using MATLAB R2014a 32 bits.
I am not sure about “LINKER=link”
Could you clarify this point for me please?

Thank you very much in advance.

Best regards,
Audrey

Hi, Audrey.

If the script can’t find the link command, that means the path/include/lib variables in your options .bat file are not set properly. I have found the easiest way to fix this is to copy the variables that the Intel Command Prompt window sets for you.

Open the Intel command prompt (see FAST v7 compiling instructions for descriptions of where you can find this on your computer). In that command window that opens, change to a directory where you have write permissions, then type this:

echo SET TmpPath=%PATH%; >> opts.out echo SET TmpIncl=%INCLUDE%; >> opts.out echo SET TmpLib=%LIB%; >> opts.out This will append three lines to a file called opts.out (you can name it whatever you want, just make sure you don’t overwrite anything important).
Open the opts.out file, copy those three lines, and then paste them into your FortranOptionsFile (the batch script specified in make_FAST_SFunc.m) before the three lines that start with SET PATH= SET INCLUDE= SET LIB=

Now, take a close look at the PATH, INCLUDE, and LIB variables specified in the FortranOptionsFile. Each entry in those lines is separated by a semicolon; Remove each entry in those three lines that doesn’t contain the word “MATLAB”. In my case, that leaves me with:SET PATH=%MATLAB_BIN%; SET INCLUDE= SET LIB=%MATLAB%\extern\lib\win32;

Then, I add the paths that the Intel Command Window gave me, so my final section of code will look something like this:

[code]
SET TmpPath=C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\CommonExtensions\Microsoft\TestWindow;C:\Progra…
SET TmpIncl=C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\INCLUDE;C:\Program Files (x86)\Microsoft Visual Studio 1…
SET TmpLib=C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\LIB;C:\Program Files (x86)\Microsoft Visual Studio 12.0\V…

SET PATH=%MATLAB_BIN%;%TmpPath%;
SET INCLUDE=%TmpIncl%;
SET LIB=%MATLAB%\extern\lib\win32;%TmpLib%;
[/code]Note that I didn’t copy the full TmpPath, TmpIncl, and TmpLib variables here because they are very long. You should obviously copy the full set of paths.

David,

You are using a model that was not developed at NREL, and our User’s Guides will not cover details that are specific to other people’s models. I have never seen the TMD model or the FAST-SC documentation, so I can only guess.

I have seen some models where the Simsetup.m file calls other Matlab scripts to set variables specific to the Simulink model being run. You probably could add these parameters to Simsetup.m, but it’s also possible the missing Matlab script does other things, too.

The “Input array cannot hold the number of inputs” is generated in FASTGateway.f90 (FAST v7). The (NREL) FAST_SFunc assumes there are 2 Generator + 2 Yaw + NumBl blade pitch + 2*NDOF (q, qdot) inputs. If the number of inputs to the FAST_SFunc block in Simulink does not match those values, it aborts. Perhaps the version you are using is different, but that is what is in the code NREL distributes.