Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Guidance for using OpenFAST with Matlab / Simulink #434

Closed
khalilmishal opened this issue Apr 7, 2020 · 21 comments
Closed

Guidance for using OpenFAST with Matlab / Simulink #434

khalilmishal opened this issue Apr 7, 2020 · 21 comments

Comments

@khalilmishal
Copy link

I'm a very beginner into OpenFAST; I want to use it to verify my model. I need help to install it, it seems too complicated for me from the instruction. Can someone help??

@andrew-platt
Copy link
Collaborator

I suggest you take a few hours to read through and attempt installation following the directions here: https://openfast.readthedocs.io/en/dev/source/install/index.html

Then search through the issues for similar questions that might give you insight into your installation:

@khalilmishal
Copy link
Author

Well, thanks for your answer. I tried to follow those materials, step by step and now I'm here: opened the file fast.snl in visual studio but not sure what to do. I want to use it with [Matlab.
Skjermbilde 2020-04-07 kl  19 51 06

@khalilmishal
Copy link
Author

my programming skills are at the low level

@jjonkman
Copy link
Collaborator

jjonkman commented Apr 8, 2020

There is guidance on how to compile the OpenFAST interface to MATLAB/Simulink on Windows using Visual Studio in the following OpenFAST issue: #387 (see the back and forth between me and Kumara from about 3 weeks ago).

@SatishJ013
Copy link

There is guidance on how to compile the OpenFAST interface to MATLAB/Simulink on Windows using Visual Studio in the following OpenFAST issue: #387 (see the back and forth between me and Kumara from about 3 weeks ago).

I followed the document which kumara provided. So could i know how to proceed after creating mexw64 file and how to use.
Thanks.

@rafmudaf rafmudaf self-assigned this Apr 20, 2020
@rafmudaf rafmudaf changed the title Help for installing of openFast Guidance for using OpenFAST with Matlab / Simulink May 14, 2020
@saeidfn
Copy link

saeidfn commented Aug 6, 2020

Hi,
I'm very beginner to OpenFAST. I tried to go step by step from link https://openfast.readthedocs.io/en/dev/source/install/index.html
Firstly, I downloaded Binaries files and I tried to run "openfast_x64.exe" but nothing happened.
Then I went through the next step, Compile From Source, at the first step I couldn't install "CMake" and how to run it.
Generally speaking, I'll be highly grateful if someone gives me a helping hand that how to finish these procedures and get to the end of the installation.

@jjonkman
Copy link
Collaborator

jjonkman commented Aug 6, 2020

Hi @saeidfn,

If you are running on Windows and don't require changing the source code, you shouldn't need to recompile the OpenFAST executable. When you say that you tried to run "OpenFAST_x64.exe", but nothing happens, what do you mean? Are you running OpenFAST from a command prompt or by double clicking on it? See, e.g., #463.

Best regards,

@saeidfn
Copy link

saeidfn commented Aug 7, 2020

Dear Jason,
What do you mean by don't require changing the source code?
By nothing happens, I mean when I try to install the executable, the command window briefly opens and then disappear. I'm just double-clicking on the "openfast_x64.exe".

@jjonkman
Copy link
Collaborator

jjonkman commented Aug 7, 2020

Dear @saeidfn,

To run OpenFAST, the source code is first compiled into an executable. Windows versions of this executable are already provided for you, so, Windows users should not need to recompile unless what want to change how OpenFAST works. For general use, OpenFAST is run by setting parameters in an input file and calling invoking the executable.

As mentioned in #463, you can't run OpenFAST by double clicking on the executable. Instead, the FAST.exe must be run from a command prompt. The syntax is:

To start, it is probably easiest to open up your command window in the directory in which your primary OpenFAST input file (*.fst) is stored. For example, if you have an input file named "Input.fst", which is stored at "C:\FileLocation", you should type:

C:>cd FileLocation
C:\FileLocation> OpenFAST_x64.exe Input.fst

OpenFAST should then run fine. The documentation explains a lot more.

I hope that helps.

Best regards,

@Domotopeng
Copy link

I have successfully compiled the Mex file, but when I run 'Run_Test01_SIG.m', matlab crashes. Are there any steps I haven't done, or is this a problem with matlab, I use matlab 2018a.

@jjonkman
Copy link
Collaborator

Dear @Domotopeng,

What do you mean by "MATLAB crashes"; it closes itself down? Are there any error messages reported?

Best regards,

@Domotopeng
Copy link

Dear @jjonkman ,
First,Thank you for your reply. Matlab turned it off by itself, and its crash log is shown in the attachment. It should be a problem with the mex-file, but I cannot find the reason. I modified the path of 'inputfilename', is it impossible to modify it here?

Best wishes!

matlab_crash_dump.txt

@jjonkman
Copy link
Collaborator

Dear @Domotopeng,

I'm not sure. How did you compile the mexw64 file? Could you run earlier versions of the FAST S-Function, e.g., the mexw64 file provided with FAST v8.16?

Best regards,

@Domotopeng
Copy link

Dear @jjonkman ,
I compiled the FAST.sln in the VS-build folder through VS2019, the solution configuration is Debug, and the solution platform is x64. After the compilation is complete, I use the OpenFAST-Simulink_x64.lib file in the bulid\bin folder and MinGW-w64 compiler to run the create_FAST_SFunc.m file in glue-codes\simulink\src, and finally gets the FAST_SFunc.mexw64 file. I can run earlier versions of the FAST S-Function, e.g., the mexw64 file provided with FAST v7. At present, I have not found the relevant documents of Fast v8.

Best wishes!

@jjonkman
Copy link
Collaborator

Dear @Domotopeng,

If you have Visual Studio and presumably the Intel Fortran compiler, I'm not sure why you would use the MinGW compiler. There is guidance on how to compile the OpenFAST interface to MATLAB/Simulink on Windows using Visual Studio and Intel Fortran in the following OpenFAST issue: #387 (see the back and forth between me and kumaraeedara ; kumaraeedara even posted step-by-step instructions in the post dated Mar 21, 2020). I would also recommend compiling in Release mode rather than Debug.

The NWTC Information Portal--where older versions of FAST were archived--crashed before the new website is available. In the interim, I've shared the archive of FAST v8.16 on my Google Drive: https://drive.google.com/drive/folders/10Pw8zzOr_YqIgtLmq10XhYpdAveKAWAJ?usp=sharing.

Best regards,

@Domotopeng
Copy link

dear @jjonkman ,
Thank you very much, I have successfully run "Run_Test01_SIG.m" according to your suggestions. At the beginning, I couldn't find the VS2019 compiler in Matlab 2018a, so I followed the prompts to download the MinGW compiler, which may cause problems.
Finally, thank you again for your patience!

Best wishes!

@Domotopeng
Copy link

Dear @jjonkman ,
I am very sorry that I encountered a new problem while running “Run_OpenLoop.m”, as shown in the picture, I am a novice, so I can't figure out the problem.
image

Best wishes!

@jjonkman
Copy link
Collaborator

Dear @Domotopeng,

I'm glad you are now able to compile and run the OpenFAST S-Function properly.

The error you are receiving implies that your input files are formatted improperly. I would guess that your OpenFAST binary is for a version newer than your input files. You can see how the input files have changed between the various releases of OpenFAST in the documentation--see: https://openfast.readthedocs.io/en/master/source/user/api_change.html. You can also enable the Echo option in the various OpenFAST input files to debug problems in the input file processing.

Best regards,

@Domotopeng
Copy link

Dear @jjonkman ,
I have solved the problem, thank you again for your patience!

Best regards!

@Chidex221
Copy link

Hello, I am a beginner in OpenFast too. I have managed to run(using precompiled binaries) test a sample input file as provided in the r-test documentation, but I am also confused as to how to begin simulations or how the interface is supposed to look like. Do I have to used Visual Studio at any point?. Sorry this might sound trivial but I am still lost.
Capture

@jjonkman
Copy link
Collaborator

Dear @Chidex221,

You don't need to compile or use Visual Studio if you are using the precompiled Windows executable and don't need to change the source code.

It looks like you running OpenFAST properly through a Windows command prompt.

Best regards,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

8 participants