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

Number of inputs of Simulink SFunction #1205

Closed
eletroinf opened this issue Jul 30, 2022 · 7 comments
Closed

Number of inputs of Simulink SFunction #1205

eletroinf opened this issue Jul 30, 2022 · 7 comments

Comments

@eletroinf
Copy link

eletroinf commented Jul 30, 2022

Hello guys,
I was using OpenFAST 3.0.0 and now I downloaded the sources and compiled the v. 3.2.0 with Intel compiler.
I updated the FAST files (I am currently working with the WP_VSP_WTurb model).
When I start the matlab run (that was working perfectly with v. 3.0.0) I got the following error:


OpenFAST

Copyright (C) 2022 National Renewable Energy Laboratory
Copyright (C) 2022 Envision Energy USA LTD

This program is licensed under Apache License Version 2.0 and comes with ABSOLUTELY NO WARRANTY.
See the "LICENSE" file distributed with this software for details.


OpenFAST-Unversioned from 08fffef
Compile Info:

  • Compiler: Intel(R) Fortran Compiler 1910
  • Architecture: 64 bit
  • Precision: single
  • OpenMP: No
  • Date: Jul 29 2022
  • Time: 20:06:02
    Execution Info:
  • Date: 07/30/2022
  • Time: 07:55:33-0300

OpenFAST input file heading:
FAST Certification Test #13: WindPACT 1.5 MW Baseline with many DOFs with VS and VP and FF
turbulence.

Running ElastoDyn.
Nodal outputs section of ElastoDyn input file not found or improperly formatted.
Running AeroDyn.
AD15 Nodal Outputs: Nodal output section of AeroDyn input file not found or improperly formatted.
Skipping nodal outputs.
Warning: Turning off Unsteady Aerodynamics because UA parameters are not included in airfoil
(airfoil has likely has constant polars). (node 1, blade 1)
Warning: Turning off Unsteady Aerodynamics because UA parameters are not included in airfoil
(airfoil has likely has constant polars). (node 2, blade 1)
Warning: Turning off Unsteady Aerodynamics because UA parameters are not included in airfoil
(airfoil has likely has constant polars). (node 1, blade 2)
Warning: Turning off Unsteady Aerodynamics because UA parameters are not included in airfoil
(airfoil has likely has constant polars). (node 2, blade 2)
Warning: Turning off Unsteady Aerodynamics because UA parameters are not included in airfoil
(airfoil has likely has constant polars). (node 1, blade 3)
Warning: Turning off Unsteady Aerodynamics because UA parameters are not included in airfoil
(airfoil has likely has constant polars). (node 2, blade 3)
Running InflowWind.

Reading a 13x13 grid (80 m wide, 44.288 m to 124.29 m above ground) with a characteristic wind
speed of 14 m/s.

Processed 13115 time steps of 20-Hz full-field data (655.7 seconds).

Running ServoDyn.

FAST_InitializeAll:SrvD_Init:ValidatePrimaryData:Pitch angles are not commanded from Simulink
model.
ValidatePrimaryData:Airfoil control is not commanded from Simulink model.
ValidatePrimaryData:Cable control is not commanded from Simulink model.

OpenFAST completed.

Error using test13_fast_v10_paper_ipc (line 52)
Error due to multiple causes.
Caused by:
Error using test13_fast_v10_paper_ipc (line 52)
Error in port widths or dimensions. Output port 1 of
'test13_fast_v10_rmrac_ipc/FAST Nonlinear Wind Turbine/Mux1' is a one
dimensional vector with 8 elements.
Error using test13_fast_v10_paper_ipc (line 52)
Error in port widths or dimensions. Input port 1 of
'test13_fast_v10_rmrac_ipc/FAST Nonlinear Wind Turbine/S-Function' is a one
dimensional vector with 51 elements.

It happens that the SFunction is expecting a 51 elements vector but I use only eight, which is according to the documentation at:
https://raf-openfast.readthedocs.io/en/docs-fast8readme/source/user/openfast/simulink.html

What did I forget?
Thanks
Ricardo

@eletroinf
Copy link
Author

eletroinf commented Jul 30, 2022

If I add a zeros(43, 1) to the FAST_Sfunction, the simulation starts and soon I got the following:
openfast_322_error

@jjonkman
Copy link
Collaborator

jjonkman commented Aug 1, 2022

Dear @eletroinf,

Regarding the switch from 8 to 51 channels in the OpenFAST v3.1 S-Function for Simulink, see: #1163 and #1176.

Regarding the forrtl error, I'm not sure. Are you implying that you get that 4 s into a 650-s simulation?

Best regards.

@eletroinf
Copy link
Author

Hello @jjonkman, thank you for helping me.

I'll see your links. Regarding to the error, my simulation runs until the 4s and then it shows the error of the picture I uploaded.
Closing the picture closes Matlab+Simulink (crash).

@bjonkman
Copy link
Contributor

bjonkman commented Aug 1, 2022

The error message indicates that it is trying to access a file called fort.86 that doesn't exist. Did you happen to add a print statement to the code before building it (like write(86,*) someVar)? It could also be an error in OpenFAST with file I/O. What files are getting written at that time? Are there any files that are being opened to read?

Also, please note that v3.2.0 modified the S-Function interface with the OpenFAST dll, but the source code has a problem so it doesn't build. To fix it, you should apply these changes: https://github.com/OpenFAST/openfast/pull/1180/files. I think there is going to be a v3.2.1 soon with this bug fix, but I don't see it there, yet.

@eletroinf
Copy link
Author

Did you happen to add a print statement to the code before building it (like write(86,*) someVar)?

No, I just downloaded the openfast code as a zip file (as I did before in many other versions), unzip it, open the FAST.sln in Visual Studio, set the correct matlab path (because I use the 2018b version) and compiled it. No errors and all the output files were generated. After, I run the Matlab script to generate the S-Function, that worked perfectly.

@bjonkman
Copy link
Contributor

bjonkman commented Aug 1, 2022

Okay, so after looking at your screen output closer, it looks like you are running commit 08fffef (the latest commit on main), which is a few commits past the v3.2.0 tag. This has the commit I was mentioning earlier, so that should be okay.

It looks like unit 86 is hard-coded for the pitch.ipt file used in Craig Hansen's user-defined pitch-controller. Are you using PCMode=3: user-defined from routine PitchCntrl?

@eletroinf
Copy link
Author

Thank you @bjonkman and all people that keep this great work.
The problem was that I updated my files with the new ones and I missed PCmode = 3 while my pitch control is made from Simulink. So now, correcting this, the simulation is working.
I can't open the examples in the Simulink folder because they were edited with a newer Matlab version - and I'm using 2018b.
I put a zeros(43, 1) vector in addition to my 8 inputs, I hope that it's the correct way to do this.
Thank you for the help.
simulink_openfast

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

No branches or pull requests

4 participants