Beginner Guide for MATLAB Simulink and FAST

Dear Jason.Jonkman,

Yes, I want to learn how Openfast builds matlab interface. The main purpose is to know how to establish matlab interface for fast.farm. But I still don’t understand how Openfast for simulink works.

I follow the prompts in ‘Creat.m’ in matlab. First, I need to compile 0penFAST for Simulink to create a Dll. I found the Openfast-Simulink folder in the OpenFAST source folder, but there is only a file named “FAST_Library.f90” in it. Does this file need to be compiled?

Best regards,

Dear @Liye.Zhao,

Yes, you must first compile the OpenFAST library for Simulink before running the create_FAST_SFunc.m script. How do you normally compile OpenFAST? On Windows, I find compiling with Visual Studio is easiest (Installing Visual Studio is the hardest step). Once Visual Studio is installed, to compile the OpenFAST library for Simulink, open up the FAST.sln (in the vs-build/FAST directory), select the “Release_Matlab” configuration, and press “Build Solution”.

Best regards,

Dear Jason.Jonkman,

Thank you very much for your reply. I have compiled fast according to your prompt, but I have encountered the following problems:

5>------ All restarts have been started: Project: OpenFAST-Simulink, configuration: Release_Matlab x64 ------
5>Deleting intermediate files and output files for project ‘OpenFAST-Simulink’, configuration ‘Release_Matlab|x64’.
5>Compiling with Intel Fortran Compiler Classic 2021.1.1 [Intel(R) 64]…
5>FAST_Library.f90
5>E:\openfast-main\openfast-main\modules\openfast-library\src\FAST_Library.f90(40): warning #7025: This directive is not standard F2003.
5>E:\openfast-main\openfast-main\modules\openfast-library\src\FAST_Library.f90(72): warning #7025: This directive is not standard F2003.
5>E:\openfast-main\openfast-main\modules\openfast-library\src\FAST_Library.f90(89): warning #7025: This directive is not standard F2003.
5>E:\openfast-main\openfast-main\modules\openfast-library\src\FAST_Library.f90(185): warning #7025: This directive is not standard F2003.
5>E:\openfast-main\openfast-main\modules\openfast-library\src\FAST_Library.f90(249): warning #7025: This directive is not standard F2003.
5>E:\openfast-main\openfast-main\modules\openfast-library\src\FAST_Library.f90(331): warning #7025: This directive is not standard F2003.
5>E:\openfast-main\openfast-main\modules\openfast-library\src\FAST_Library.f90(404): warning #7025: This directive is not standard F2003.
5>E:\openfast-main\openfast-main\modules\openfast-library\src\FAST_Library.f90(417): warning #7025: This directive is not standard F2003.
5>E:\openfast-main\openfast-main\modules\openfast-library\src\FAST_Library.f90(459): warning #7025: This directive is not standard F2003.
5>E:\openfast-main\openfast-main\modules\openfast-library\src\FAST_Library.f90(513): warning #7025: This directive is not standard F2003.
5>E:\openfast-main\openfast-main\modules\openfast-library\src\FAST_Library.f90(645): warning #7025: This directive is not standard F2003.
5>E:\openfast-main\openfast-main\modules\openfast-library\src\FAST_Library.f90(670): warning #7025: This directive is not standard F2003.
5>E:\openfast-main\openfast-main\modules\openfast-library\src\FAST_Library.f90(783): warning #7025: This directive is not standard F2003.
5>E:\openfast-main\openfast-main\modules\openfast-library\src\FAST_Library.f90(86): warning #8809: An OPTIONAL or EXTERNAL dummy argument to a BIND(C) procedure is not interoperable. [TMAX]
5>E:\openfast-main\openfast-main\modules\openfast-library\src\FAST_Library.f90(86): warning #8809: An OPTIONAL or EXTERNAL dummy argument to a BIND(C) procedure is not interoperable. [INITINPARY]
5>Linking…
5>LINK: fatal error LNK1181: Failed to open the input file C:\Program Files\MATLAB\R2019b\extern\lib\win64\microsoft\libmex.lib
5 >
5>Build log written to “file://E:\openfast-main\openfast-main\vs-build\OpenFAST-Simulink\x64\Release_Matlab\BuildLog.htm”
5>OpenFAST-Simulink - 1 error(s), 15 warning(s)
= = = = = = = = = = all regenerated: three success, failure 1, skip 1

my MATLAB version is 2022b, how can I do?

Best regards,
Liye

Dear @Liye.Zhao,

It looks like a similar question regarding this LNK1181 error was asked and answered on our OpenFAST issues page–see: Build error · Issue #638 · OpenFAST/openfast · GitHub.

Best regards,

Dear Jason.Jonkman,
Thank you very much for your reply, it is very useful.

Best regards,
Liye

Hello, sorry if this is off topic or a very basic question, but is anyone using MATLAB/simulink as a grid/microgrid design tool? or interfacing with SCADA servers for operational deployment of simulink data to field devices? we have a campus of 275 facilities and are very interested in this product!

Hello,
Hope you are doing well.
I am a research student in vibration control of offshore structures, and I, too, am very new to the research topic and the OpenFAST software.
I have read the documents provided by the esteemed NREL core team, and I really appreciate their efforts in building this software. I would, however, like to request that you list out the steps to incorporate the structural control module in running the software.
The problem I am facing is that while I am able to run the FAST software using the basic test example structures as provided in the software, I am unable to understand the steps to incorporate structural control.
Could you please provide the steps using which I can do that or some kind of documentation that helps me to do that…?
I am really sorry for the inconvenience.

Thankyou in advance,
With best regards,
Shreyasee

Dear @Shreyasee.Sanjay,

You should identify the number of structural controllers (StCs) that you want and which components (blades, nacelle, tower, substructure) that you want to place these StCs. You should identify these in the STRUCTURAL CONTROL section of the ServoDyn input file. Each StC should get its own StC input file. The StC input file is documented here, along with the rest of the StC documentation: 4.2.12. Structural Control (SrvD) — OpenFAST v3.5.3 documentation.

Best regards,

Respected Dr. Jonkman,
Thank you so much for your prompt reply. I have changed the StC file in the ServoDyn folder and there are some errors I am encountering. I have the following queries regarding that,

  1. the 5MW_OC3_Spar folder I have does not have a ServoDyn folder but has the .StC file which I have tried to edit. I have attached the contents of the folder below (Fig 1). Could you please check if the contents are right…?
  2. I used the default values for structural control in .StC file and I obtained the data after running the software. then I tried to opt out of structural control by inputting “false” in the structural control file, but I saw that the program was getting aborted (Fig 2). Could you please tell me the things I can correct if I want to get the data without using structural control. I want to compare the displacement with and without structural control.

fig 1

fig 2

Thankyou so much for your time and patience in advance,
With best regards,
Shreyasee Sanjay

Dear @Shreyasee.Sanjay,

I’m not sure I understand your first question.

Regarding your second question, are you referring to StC_X_DOF, StC_Y_DOF, and StC_Z_DOF? These are only used when StC_DOF_MODE = 1, but you have selected StC_DOF_MODE = 2.

Best regards,

Respected Dr. Jonkman,

I am sorry for the confusion.

From the first question, I meant if I had missed downloading any file folders inside the case example “5MW_OC3_SPAR_LINEAR”

For the second question, I checked and cleared my mistake, and I am attaching a fresh copy of the code so far.

My issue still remains that I am getting the same results with and without structural control and I request you to guide me regarding that.

thanking you,
with best regards,
Shreyasee

Dear @Shreyasee.Sanjay,

If OpenFAST is not complaining about a missing file, you should have the files you need.

I’m not sure I really understand what you are comparing to answer your question. What inputs are you changing between the two simulations that you expect to produce different results?

Best regards,

Respected Dr. Jonkman,

I tried simulating the case examples using the default values as provided in the software. I got the results as well.

Though when I tried to change the code by disabling the structural controls. I am getting the same results as before.

I am considering the surge sway heave roll yaw and pitch movements of the platforms of the case examples to understand how the software works.

Thankyou and best regards,
Shreyasee Sanjay.

Dear @Shreyasee.Sanjay,

I’m sorry, but I still don’t understand what two simulations you are comparing that you expect to yield different results. Are you running a specific OpenFAST r-test example; if so, which one? And what are you changing in this model when you run it again and expect to get a different answer?

Best regards,