I am trying to run a FAST v7 model on MATLAB\Simulink 2018.
But I am having following issue,
Error while obtaining sizes from MEX S-function ‘FAST_SFunc’ in ‘Model/FAST Nonlinear Wind Turbine/S-Function’.
Caused by:
Invalid MEX-file ‘C:\FAST_v7.02\Simulink\FAST_SFunc.mexw64’:
Missing symbol ‘MXGETSTRING’ in ‘C:\Program Files\MATLAB\R2018a/bin/win64\libmx.dll’ required by ‘C:\FAST_v7.02\Simulink\FAST_SFunc.mexw64’
Missing symbol ‘MXCOPYREAL8TOPTR’ in ‘C:\Program Files\MATLAB\R2018a/bin/win64\libmx.dll’ required by ‘C:\FAST_v7.02\Simulink\FAST_SFunc.mexw64’
Missing symbol ‘MXCREATEDOUBLEMATRIX’ in ‘C:\Program Files\MATLAB\R2018a/bin/win64\libmx.dll’ required by ‘C:\FAST_v7.02\Simulink\FAST_SFunc.mexw64’
Missing symbol ‘MXGETN’ in ‘C:\Program Files\MATLAB\R2018a/bin/win64\libmx.dll’ required by ‘C:\FAST_v7.02\Simulink\FAST_SFunc.mexw64’
Missing symbol ‘MXGETM’ in ‘C:\Program Files\MATLAB\R2018a/bin/win64\libmx.dll’ required by ‘C:\FAST_v7.02\Simulink\FAST_SFunc.mexw64’
Missing symbol ‘MXCOPYPTRTOREAL8’ in ‘C:\Program Files\MATLAB\R2018a/bin/win64\libmx.dll’ required by ‘C:\FAST_v7.02\Simulink\FAST_SFunc.mexw64’.
Yes, I am using the FAST_SFunc.mexw64 file for FAST v7.02 available from the link you mentioned.
Yes, I tried running the FAST S-Function for FAST v8.16. It runs fine.
But the issue is that, for the reasons discussed in the post, “NREL Forum - The National Renewable Energy Laboratory (NREL)”, I need to run this simulation in FAST v7.02.
If you can suggest the solution to this problem, that would be helpful.
Perhaps there is some sort of incompatibility between the old FAST_SFunc.mexw64 file provided for FAST v7 and MATLAB/Simulink 2018? I’m not an expert on the Simulink interface. Perhaps someone else on this forum can comment on that.
From the forum topic you referenced, it sounds like you want to use FAST v7 due to its linearization capability. But it was not possible in FAST v7 to perform a linearization analysis when using the Simulink-FAST v7 interface anyway. Perhaps you could change your process so that you use the FAST v7 executable (without the MATLAB/Simulink interface) to generate the linear state-space models and use the Simulink-FAST v8 interface to run nonlinear time-domain simulations?
As you proposed, I have done linearization in the FAST v7 with platform DOFs. Now my plan is to design an LQR for FAST v8 using the state-space system of equations I have obtained from linearization in the FAST v7.
In FAST v8 if I want to calculate hydrodynamic loads on wind turbine for a fixed-bottom monopile (with a rigid foundation), I enable all platform DOFs (PtfmSgDOF = PtfmSwDOF = PtfmHvDOF = PtfmRDOF = PtfmPDOF = PtfmYDOF = True) while turning on the CompHydro = CompSub = 1 in main FAST input file?
As you proposed, I have done linearization in the FAST v7 with following linearization input properties and DOFs (please see txt file attachment).
Then I used following commands to extract the data from linearization file and to apply MBC3:
GetMats
file_name
mbc3
MBC_AvgB = mean(MBC_B, 3);
MBC_AvgC = mean(MBC_C, 3);
MBC_AvgD = mean(MBC_D, 3);
MBC_AvgBd = mean(MBC_Bd, 3);
MBC_AvgDd = mean(MBC_Dd, 3);
MBC_AvgB_complete=horzcat(MBC_AvgBd,MBC_AvgB);
MBC_AvgD_complete=horzcat(MBC_AvgDd,MBC_AvgD);
Afterwards, to test the system in simulink, I apply unit step at the wind input for linear system and obtained the following output pattern. Rest of the control inputs are zero.
Scale for output_1 for y axis is from 0-300.
Some thing went wrong with the linearization process. Please advice how to solve the issue.
After applying MBC3 and azimuth-averaging, have you eliminated the generator-azimuth state from the linear model? This is discussed e.g. in the following forum topic: FAST linearization V7.
Yes, even after eliminating the term associated with “Variable speed generator DOF” in A and C matrices, i.e., replaced that column vactor with zero, I get similar response (as i mentioned above in my previous post).
When you eliminate the generator-azimuth state from the linear state-space model, you should eliminate the corresponding columns from the A and C matrices and you should eliminate the rows of the A and B matrices associated with the first derivative of the generator-azimuth state (i.e. the generator speed). Did you do that?
As you proposed, after eliminating the generator DOF before linearizing the FAST model i.e. when setting GenDOF = False, I still get the same response.
After applying unit step at the wind input for linear system, I obtained the following output pattern. (I am only attaching rotor response)
When you say, “rotor response”, do you mean rotor speed? I would double check your model settings because if you disable the generator DOF, the generator will spin at a constant speed regardless of loads applied (the rotor speed may vary slightly as a result of the drivetrain-torsion DOF).
Dear all,
recompiling the FAST7 sFunction in Matlab R2018 solves the issue mentioned in the first post (unfortunately full quote not possible). Matlabs Fortran API changed slightly and the missing symbols above are called with some version numbers. The correct way to implement the changes would be to include the fintrf.h in FASTGateway.f90. As I was unable to get this to work, I adjusted FASTGateway.f90 to call the functions directly:
!----------------------------------------------------------------------------------------------
! define the EXTERNAL MATLAB procedures
!----------------------------------------------------------------------------------------------
INTEGER(mwPointer), EXTERNAL :: mexGetVariablePtr ! MATLAB routine
EXTERNAL :: mxCopyPtrToReal8700 ! MATLAB mex function to create REAL(8) array from pointer to an array
EXTERNAL :: mxCopyReal8ToPtr700 ! MATLAB mex function to create pointer to copy of a REAL(8) array
INTEGER(mwPointer), EXTERNAL :: mxCreateDoubleMatrix700 ! pointer [Replace integer by integer*8 on the DE! Alpha and the SGI 64-bit platforms] ===changes by TH===
INTEGER(mwSize), EXTERNAL :: mxGetM700 ! MATALB mex function get number of rows in array
INTEGER(mwSize), EXTERNAL :: mxGetN700 ! MATALB mex function to get number of columns in array
INTEGER(mwPointer), EXTERNAL :: mxGetPr ! MATLAB mex function to get the address of the first real number [Replace integer by integer*8 on the DE! Alpha and the SGI 64-bit platforms] ===changes by TH===
REAL(mxDB), EXTERNAL :: mxGetScalar ! MATLAB mex function to return a scalar ( like mxCopyPtrToReal8700() for 1 element )
INTEGER(mwPointer), EXTERNAL :: mxGetString700 ! MATLAB mex function to get string from its pointer
My standard FAST8 sFunction works in R2018a so no changes have to be made there.