Help for beginner running OpenFAST with Simulink

Hi All,

I have run OpenFAST successfully for steady cases using a set of tools that I have written to manipulate the input files using Python.

Now, however, I need to move on to dynamic modelling as I want to investigate the behaviour of a spring-based passive blade-pitch mechanism.

My understanding is that Simulink would be the best tool for setting up and running a time-step dynamic model. Please could someone point me towards some really simple instructions as to how to get started with running OpenFAST with Simulink.?

Here is what I have tried so far:

1) I first tried to open “Run_OpenLoop.m” in matlab and “OpenLoop.mdl” in Simulink

2.) I ran “Run_OpenLoop.m” but got the following error:

"Error while obtaining sizes from MEX S-function ‘FAST_SFunc’ in ‘OpenLoop/FAST Nonlinear Wind Turbine/S-Function’.
Caused by:
Invalid MEX-file ‘C:\Users.…\OpenFAST\glue-codes\simulink\examples\FAST_SFunc.mexw64’: The specified module could not be found."

3) I then tried to run “mex -setup” and “Create_FAST_SFunc.m” to see if this would solve the problem, but it does not. When I run “Create_FAST_SFunc.m” I get the following error:

"Error using mex
MEX cannot find library ‘openfastlib’, specified with the -l option.

  • MEX searched for a file with one of the following names:*
  • libopenfastlib.a*
    openfastlib.lib
    libopenfastlib.lib
  • Verify the library name is correct. If the library is not*
  • on the existing path, specify the path with the -L option.*

Error in create_FAST_SFunc (line 63)
mex(‘-largeArrayDims’, …"

I suspect the problem may be to do with compiling OpenFAST for Simulink to create a DLL. I have so far used the compiled OpenFAST executable (openfast_x64.exe) and I have no experience of using cmake or Visual Studio.

So, as I said, I’m looking for some really simple instructions as to how to get started with running OpenFAST with Simulink, and I specifically need to know how to overcome the errors mentioned above.

I would be very grateful for any advice anyone is able to offer.

Kind regards,
Tom

Dear @Tom.Summers,

Presumably you are running OpenFAST and MATLAB/Simulink on Windows? If so, you should be able to use the precompiled OpenFAST library for Simulink (OpenFAST-Simulink_x64.dll) and precompiled mex function for Simulink (FAST_SFunc.mexw64) for Windows provided by NREL. You can find these for the newest version of OpenFAST–currently OpenFAST v3.5–here: Releases · OpenFAST/openfast · GitHub. This means that you should not need to compile anything with CMake or Visual Studio, unless you need to change the source code for some reason.

Best regards,

Dear @Jason.Jonkman,

Thank you very much. You were correct. I am running Windows and adding the precompiled OpenFAST library for Simulink ( OpenFAST-Simulink_x64.dll) seems to have got the model running.

I now get the following error which I need to look into:

Error using Run_OpenLoop
Error reported by S-function ‘FAST_SFunc’ in ‘OpenLoop/FAST Nonlinear Wind Turbine/S-Function’:
FAST_InitializeAll:FAST_Init:FAST_ReadPrimaryFile:OpenFInpFile:The input file, "

I guess this is an issue with the FAST_InputFileName = ‘…/…/…/reg_tests/r-test/glue-codes/openfast/AOC_WSt/AOC_WSt.fst’.

I’d really appreciate your advice if you can obviously see what the issue is here? If not, I’ll spend a but of time looking at it.

Thanks again!

Best regards,
Tom

Dear @Tom.Summers,

The error is indicating that the input file cannot be found. I would check that the file name and/or path is correctly specified.

Best regards,

1 Like

Dear @Jared.Sanchez,

My response is the same as it was to the others:

The error is indicating that the input file cannot be found. I would check that the file name and/or path is correctly specified.

I also see that you’ve asked the same question on OpenFAST issues, which Derek Slaughter responded to: OPENFAST error with Simulink · Issue #2367 · OpenFAST/openfast · GitHub.

Best regards,