OpenFAST / openfast

Main repository for the NREL-supported OpenFAST whole-turbine and FAST.Farm wind farm simulation codes.
http://openfast.readthedocs.io
Apache License 2.0
690 stars 457 forks source link

OpenFAST Simulink compilation in dev branch crashing. #692

Open aidowu opened 3 years ago

aidowu commented 3 years ago

I want to ask if you can give a timeline for when the Simulink OpenFAST version (at least up to the TCF MOD2 merge) in the development branch will be ready?

We tried compiling currently as is, to get started on our work, pending the time the updates gets completed. While the OpenFAST compiled for the command line works, the Simulink compilation keeps crashing MATLAB.

andrew-platt commented 3 years ago

How are you compiling it, which compiler, and which platform?

aidowu commented 3 years ago

I am compiling following the steps listed in the attached file which I found on this forum. I am compiling for windows x64. It does compile and I generate the S-Function from the compilation but when I try running it, it crashes MATLAB. I have followed the steps in the attached document to compile the main branch and that runs well.

So I want to verify if the Simulink compilation process has been validated or when it will be validated? OpenFAST_Simulink.pdf

andrew-platt commented 3 years ago

Are there any errors from the create_FAST_SFunc.m script?

aidowu commented 3 years ago

There are no errors. Here is a picture of the directory containing the compiled files. image

andrew-platt commented 3 years ago

What version of the Intel Fortran compiler are you using with Visual Studio? And which version of MATLAB?

Which Simulink example case are you running?

Also, I'm not entirely sure what you are asking about in terms of timeline. The TCF MODS2 branch was merged in January, but did not contain any updates for control channels. If you are asking about the cable control channels, there is a branch in development associated with this pull request: #664.

aidowu commented 3 years ago

I am using Intel Parallel Studio X17 and I didn't run any of the Simulink example cases but ran a project case that worked with the main dev Simulink compilation. I will go run an example case to see if I can narrow down where the issue might be.

Looking through the pull request you mentioned above, I'll modify my question by asking if the Simulink version in the development branch has been validated for the cable control updates? That way I can know if the error is from my path or if it might be a bug?

andrew-platt commented 3 years ago

Did you update the input file set for your project? Several input files have changed between the main branch and the development branch. There had been some error handling issues that were causing MATLAB to crash when there were input file errors -- I those had been corrected in the development branch.

The development branch does not currently contain any of the cable control functionality. We hope to merge that in by the end of the month (#664).

aidowu commented 3 years ago

Hi Andrew, thanks for the update on the status of the cable control capability. Yes, I did update the input file. I found that deleting the temp file created by Simulink helped the simulation advance but I am now getting an error of "size of NumOutputs is invalid". I have attached a screenshot of this error. Can you help provide some insight on why I might be getting this error? image

andrew-platt commented 3 years ago

Which branch are you using?

If you are using the branch in PR #664, there are some changes in the Simulink interface from the OpenFAST main and dev branches.

aidowu commented 3 years ago

Yes, I am using the branch PR #664. Does that mean that I need to change the open loop block I have to the open loop block in the Simulink example folder? What I have done initially was just compile the SFunc using the branch PR #664, modify the input files (ServoDyn) and run the simulation using a previous simulink model that worked with the OpenFAST main branch.

andrew-platt commented 3 years ago

Yes. You will need to change your Similink model to match the setup in the examples. There are an additional 43 channels in the new block configuration in 3 groups:

Screen Shot 2021-03-25 at 10 37 21 AM
aidowu commented 3 years ago

Thanks a lot Andrew. I'll make the modifications and see how it goes.

andrew-platt commented 3 years ago

Hi @aidowu,

There might be another issue going on here with the output handling within OpenFAST that is causing a mismatch between the list of output channels passed to Simulink and the size of the array holding the output channel data. The current suspicion is that one of the modules has a bug with this and is causing the FAST_Start:size of NumOutputs is invalid. error.

Can you post your outlist section for the HydroDyn input file?

aidowu commented 3 years ago

Hi @andrew-p, I attached the output section of my HydroDyn input file (It's only Wave1Elev).

I am yet to get the Simulink running. It's currently just hanging and no longer getting to the point of returning the "size of NumOutputs is invalid" error after updating the model and input files.

image latt ,

bjonkman commented 3 years ago

One other thought: How many output channels are in your model? You should be able to check how many there are in the OpenFAST summary file that is generated at initialization. That error might be triggered if you've exceeded the max number of outputs allowed in the Simulink interface (4000).

aidowu commented 3 years ago

Hi @bjonkman, my model has 465 outputs channels.

Andrew-P commented 3 years ago

Hi @Andrew-P, I attached the output section of my HydroDyn input file (It's only Wave1Elev).

I am not involved in this project. Please direct comments to @andrew-platt, not @Andrew-P.

andrew-platt commented 3 years ago

The issue has been found (see #702). This will be updated shortly in the dev branch and in my branch (for #664).

andrew-platt commented 3 years ago

Corrected in dev and in branch for #664.

andrew-platt commented 3 years ago

PR #702 only partially fixed things. Now it seems to hang. Looking into it.

Cookiewyf commented 3 years ago

‎您是否更新了项目设置的输入文件?主分支和开发分支之间发生了若干输入文件更改。当输入文件错误时,出现了一些错误处理问题,导致 MATLAB 崩溃 - I 这些问题已在开发分支中更正。‎

‎开发分支目前不包含任何电缆控制功能。我们希望在月底之前合并‎‎(#664‎).

hi I met the same question, I use matlab(2020b) and I also tried 2019. they all crashed, and I have the openfast-simulink_x64.dll,also created the mexw64.But when I want to run openloop.m, the matlab crashed.(I download the openfast2.6) image

bjonkman commented 3 years ago

@Cookiewyf, You can try using the files I've uploaded here: https://github.com/bjonkman/openfast/releases/tag/v2.6.0. The OpenLoop example runs with them on Matlab 2019.

jjonkman commented 3 years ago

@rafmudaf -- Can you take these precompiled versions of OpenFAST v2.6 for MATLAB / Simulink on Windows from Bonnie, along with the precompiled executable for Windows and put them on the main OpenFAST v2.6 release page? Thanks,

rafmudaf commented 3 years ago

Yes. I only see the Simulink files. Where is the precompiled executable?

jjonkman commented 3 years ago

Haven't you been generating those with each release (except v2.6)? Otherwise, Bonnie likely has one as well.

rafmudaf commented 3 years ago

I generate those manually but I'm working on moving the process to an automated system, so it is delayed. If @bjonkman has already compiled this, I'll add it to the release.

bjonkman commented 3 years ago

@rafmudaf , I just uploaded the additional file. Note that it does not require the Intel redistributables.

rafmudaf commented 3 years ago

Thanks! Its all now included in the OpenFAST v2.6.0 release.

jjonkman commented 3 years ago

Thanks!