-
Notifications
You must be signed in to change notification settings - Fork 458
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
Issue when I run simulink model which depends on openfast S-Function mex #548
Comments
I'm a little confused by the traceback stack. It looks like the problem happens in routine
|
I would work on getting the example OpenLoop model to work with one of the OpenFAST r-test cases before trying to debug what is going on with your particular Simulink model. That way you can share all the details of what you are doing. Make sure you built the FAST_SFunc with the same compiler that you used when building |
Hello @bjonkman,
2 - Yes, I execute create_FAST_SFunc.m and I obtain FAST_SFunc.mex64 in build/bin. To show you all the steps I did, I'm going to attach some screenshots: First, I execute mex -setup to confirm that I use the same compiler---Visual Studio 2015. This is correct. Next step is running Run_OpenLoop.m: Best regards, Joaquín |
I think this probably points to an issue in the |
No, the code didn't show anything else apart of that. 1- I execute fast solution (release_x64 double); after I use python for running test and the test I'm keen on, pass ok. 2- Next step, to do the integration Openfast Simulink, I open Visual Studio 2015 and I execute the fortran File called OpenFAST-Simulink and in properties-input, I change to aim correctly to libmex.lib (default path is not the correct one) ¿Do you need screenshots of all the steps? |
Could you open the |
@hbasbas: You need to generate a OpenFAST-Simulink-x64.dll from the Visual Studio project, so you really only need to build the version in your step 3 (except you do also need to run the The reason your Release_Matlab | x64 configuration (which is the one you need to use) is not building appears to be that you have a different version of Matlab than the project was configured for. You'll need to open the configuration properties for the OpenFAST-Simulink project file (right click on the project, then select |
@JoaquinPerCarr , to get the master branch with git, you can checkout the master branch and then pull the new code. It's possible that you have another copy of the DLL on your Matlab path that is causing confusion, too. Try |
Hi @bjonkman: I did that you said to me. First I downloaded all master openfast files, then I change the old fortran OpenFAST-Simulink and I copied the new one. I built FAST with Release_Matlab_x64 and OpenFAST-Simulink_Release_Matlab_x64 to obtain the new .dll. I repeated all the process such as that I explained you at first moment in this discussion and I had the same results, Matlab crashes when I execute simulink. i attach a screenshot when I use which OpenFAST-Simulink: |
Hello, @bjonkman : thank you for you reply. Thanks to your recommendations, the compilation works. I would like to precise (to possible others users) that it is important to insert the quotation between the path. Due to the space of "Program File", VS tries to find an object file. Is it possible that the versions of Matlab, of Visual Studio and Intel Parallel Studio XE are responsible of the Matlab crash ? @JoaquinPerCarr : In the "which" command, it seems that you specified the wrong file : you write "-x64" instead of "_x64" |
Ohterwise, is it possible to share the compiled file .mex64 of the openfast-master version. I only need to change the input file (.dat) but the source code must be the same for me. Moreover, I will identify the problem : |
Okay, I think I see what the problem is. If you open
Then re-run the I will get a pull request with this fix into OpenFAST. |
Thank you very much. It works ! |
Hi @bjonkman, If I do this, I obtain this: I can see that simulink doesn't open and It doesn't do anything else. |
If you read the error message below the part you circled, you will see that OpenFAST can't find the input file you asked it to run. Run_OpenLoop.m was set up for the old FAST (v8) CertTest cases so you'd have to change the names of the input files. I ran the following code to test the OpenLoop model:
|
I'm trying the next code because I'm keen on test 25: FAST_InputFileName = Test25; sim('openloop.mdl',[0,TMax]); I notice that the simulink model doesn't open automatically and I don't know why, but at first it seems to be that it works well To sum up, do you think the only problem about my first issue was the code line #define CHANNEL_LENGTH 20 in .h file? Thank you very much @bjonkman |
I don't think Simulink needs to open the model when you run it with the The incorrect definition of As for that being the only problem, let's hope so. :) |
I'm doing different things and I think the master openfast-Simulink is necessary |
I'm going to try run my first simulink model and I will say you if it works nicely |
Hi @bjonkman , I would like to ask you how can I see which OpenFAST version I have(dev/master). If there are any form to return to master version, I wish do it. If it isn't possible, How can I remove/fix the errors(flags) that I show you in next screenshots? CalcSteady, Twr_Kdmp, and Bld_Kdmp are the main problem. I'm seeing the OpenFAST documentation too. The errors I think that it could be for using dev version of OpenFAST. I don't know what to do. Best regards, Joaquín. |
Dear @JoaquinPerCarr, I'm not sure I really understand your question, but you appear to be using an older dev version of OpenFAST (somewhere between v2.3 and v2.4) and input file compatible with v2.3. As with any error in the input file processing, you can enable the Echo option to debug problems in the input file formatting. Regardless, unless you have a specific reason to use this dev version of OpenFAST, I would recommend upgrading to the master branch of OpenFAST, v2.4. Example OpenFAST input files compatible with v2.4 are provided in the master branch of the r-test. Best regards, |
You can typically see the version of OpenFAST printed to the screen when you run OpenFAST. From your screen shot, I see that it is To switch to a different version, you can just use some git commands to checkout whatever branch and commit you want. You could do
which would checkout openfast version 2.4.0, but put you in a detached head state in git, or
which should give you the latest version of the master branch (assuming your master branch is pointing to the openfast repository). Keep in mind that the current state of your git repo may mean that you need to stash some changes before switching branches, etc. Otherwise, just make sure that you are using example files from the r-test commit associated with the version of OpenFAST you are using. |
Hello everyone, I could compile the S-Fuction and run the examples of OpenLoop and Test01_SIG. Now I am trying to extend the inputs of the S-Fuction to enable additionally inputs in addition to the original 8. But in the OpenFAST S-Function I don't have the option to change the NumAdditionalInputs as in FASTv8. Thank you in advance. |
Are you using the correct combination of FAST_SFunc.mexw64 and OpenFAST-Simulink_x64? Sometimes there are multiple copies of each on the Matlab path. You can check by doing |
Which model are you running? |
I use openfast-2.6, and I run 5MW_Land_DLL_WTurb and AWT_YFix_WSt(Is this you want to know?and sorry about the jet lag) |
Hi, @bjonkman I tried openfast-2.3 and 2.2, the matlab both crashed. I also tried to compile with VS2017, but it didn't work.I am very distressed about this problem,nad I don't know which part what went wrong.
Hi, @bjonkman I tried openfast-2.3 and 2.2, the matlab both crashed. I also tried to compile with VS2017, but it didn't work.I am very distressed about this problem,nad I don't know which part what went wrong. |
1 similar comment
Hi, @bjonkman I tried openfast-2.3 and 2.2, the matlab both crashed. I also tried to compile with VS2017, but it didn't work.I am very distressed about this problem,nad I don't know which part what went wrong.
Hi, @bjonkman I tried openfast-2.3 and 2.2, the matlab both crashed. I also tried to compile with VS2017, but it didn't work.I am very distressed about this problem,nad I don't know which part what went wrong. |
I deleted all the old versions as you said, and build openfast-2.6 with VS2019. Matlab would still crash. In addition, I would like to ask how to know whether the C compiler version of VS2019 is the same as the C compiler version of matlab?I use "Microsoft Visual C++ 2019 (C)" to generate mexw64. |
I Screenshots the steps that how I build and use the matlab,and put it in a doc,and the crash.txt is report from matlab crash.mp4 |
Please choose |
It works! Sorry for my stupid mistake,and thank you very very very much! I wiil do more tests tomorrow .Thank you very much for solving the problem that has troubled me for a long time. |
Hello @bjonkman, Is there any function that can be used in conjunction with Best regards. |
@LaurenceWETI , there isn't currently a function to write matrices to the Matlab command window. You could modify a function like
|
Hello everyone, I don't know if I am posting in the right place. I am using version 2.4 of OpenFAST, Matlab 2021a and VS 2019. Best Regards, Flavie |
Hello Flavie, I was stuck on this problem. No success with v2.4 and I don't remember if I discovered what was the problem. Regards, |
Thank you for you reply Ricardo, I try with OpenFAST 3.0 but unfortunately it didn't work either. Best regards, |
Hi, @FlavieDidier Could you send the screenshot of the error message from Matlab please ? Hedi |
Hi @hbasbas, Matlab crash immediately without any error message. Regards, |
@FlavieDidier Do the sample models provided with OpenFAST run? |
@bjonkman If we are talking about Run_OpenLoop or Test01_SIG, then neither of them works with the FAST_InputFileName already specified. |
I'm not exactly sure what you mean by that statement. Can you get the OpenLoop simulink model to run with one of the OpenFAST r-test cases? For example:
You will have to change the paths to match your setup. Also notice that I added the It's really hard to know how to help without more detailed information about what you are running, how you are trying to run the model, and how the simulation is failing. |
Hello @bjonkman, Thank you for your explaination.
When I check the content of the diary file, nothing is written in it. Best Regards, |
|
Dear @bjonkman, I have the same crashing problem. Although the r-tests work fine, the crash occurs when I try to use a different controller other than the *.dll provided. I compiled the S-function myself as well as tried using the precompiled binaries, yet the crash persists. I attached both the crash report and the diary file. Could you please share your email so that I can send you the files to check if you don't mind? Best regards, |
Hi @arhegazy, In the diary file you sent, I don't see that you are calling an external DLL controller. I would expect to see something like Both of the crashes appear to happen at 51 seconds into the simulation. Is there anything in particular that is happening at that time? |
Hi @bjonkman, Thanks for your response. I am telling the code to use control signals from Simulink instead of Discon.dll provided. |
Hi everyone,
I'm trying to run a Simulink model after run other .m which has specific variables for the Simulink model. After few attempts I can't find the way to run that without crashing.
My machine's characteristics are in file 'Issue 1' that I attach, and the crashes are in issue 1 and 2. All OpenFAST files are in C:/, including the files referred to .m and simulink models, that I need to run the simulations properly. Moreover, for give you more extra information, all the OpenFAST files are in Matlab path.
Issue1.txt
Issue2.txt
For confidential issues I can't attach the simulink model but I hope you could help me because I can't follow doing my final project at university.
Best regards,
Joaquín
The text was updated successfully, but these errors were encountered: