FAST8 Build Model problems

Provide feedback, request enhancements, and get help with wind-turbine computer-aided engineering tools.

Moderators: Bonnie.Jonkman, Jason.Jonkman

Cheng.Zhang
Posts: 59
Joined: Tue Nov 14, 2017 6:50 am
Organization: ECN
Location: france

FAST8 Build Model problems

Postby Cheng.Zhang » Wed Nov 20, 2019 5:49 am

Dear all,

I want to make a connection between the SIMULINK FAST nonlinear model and DSpace.
I need to Build Model in the SIMULINK, but when I went to this step, the following errors appear.

Code: Select all

COMPILING  "..\FAST_SFunc.c" 
In file included from C:/PROGRA~1/Matlab/R2012b/extern/include/mex.h:58,
                 from ../FAST_SFunc.c:28:
C:/PROGRA~1/Matlab/R2012b/extern/include/matrix.h:299: error: conflicting types for `mxArray'
C:/PROGRA~1/Matlab/R2012b/rtw/c/src/rt_matrx.h:48: error: previous declaration of `mxArray'
C:/PROGRA~1/Matlab/R2012b/extern/include/matrix.h:319: error: conflicting types for `mxChar'
C:/PROGRA~1/Matlab/R2012b/rtw/c/src/rt_matrx.h:51: error: previous declaration of `mxChar'
C:/PROGRA~1/Matlab/R2012b/extern/include/matrix.h:326: error: conflicting types for `mxUNKNOWN_CLASS'
C:/PROGRA~1/Matlab/R2012b/rtw/c/src/rt_mxclassid.h:15: error: previous declaration of `mxUNKNOWN_CLASS'
C:/PROGRA~1/Matlab/R2012b/extern/include/matrix.h:327: error: conflicting taypes for `mxCELL_CLASS'
C:/PROGRA~1/Matlab/R2012b/rtw/c/src/rt_mxclassid.h:16: error: previous declaration of `mxCELL_CLASS'
C:/PROGRA~1/Matlab/R2012b/extern/include/matrix.h:328: error: conflicting types for `mxSTRUCT_CLASS'
C:/PROGRA~1/Matlab/R2012b/rtw/c/src/rt_mxclassid.h:17: error: previous declaration of `mxSTRUCT_CLASS'
C:/PROGRA~1/Matlab/R2012b/extern/include/matrix.h:329: error: conflicting types for `mxLOGICAL_CLASS'
C:/PROGRA~1/Matlab/R2012b/rtw/c/src/rt_mxclassid.h:18: error: previous declaration of `mxLOGICAL_CLASS'
C:/PROGRA~1/Matlab/R2012b/extern/include/matrix.h:330: error: conflicting types for `mxCHAR_CLASS'
C:/PROGRA~1/Matlab/R2012b/rtw/c/src/rt_mxclassid.h:19: error: previous declaration of `mxCHAR_CLASS'
C:/PROGRA~1/Matlab/R2012b/extern/include/matrix.h:332: error: conflicting types for `mxDOUBLE_CLASS'
C:/PROGRA~1/Matlab/R2012b/rtw/c/src/rt_mxclassid.h:21: error: previous declaration of `mxDOUBLE_CLASS'
C:/PROGRA~1/Matlab/R2012b/extern/include/matrix.h:333: error: conflicting types for `mxSINGLE_CLASS'
C:/PROGRA~1/Matlab/R2012b/rtw/c/src/rt_mxclassid.h:22: error: previous declaration of `mxSINGLE_CLASS'
C:/PROGRA~1/Matlab/R2012b/extern/include/matrix.h:334: error: conflicting types for `mxINT8_CLASS'
C:/PROGRA~1/Matlab/R2012b/rtw/c/src/rt_mxclassid.h:23: error: previous declaration of `mxINT8_CLASS'
C:/PROGRA~1/Matlab/R2012b/extern/include/matrix.h:335: error: conflicting types for `mxUINT8_CLASS'
C:/PROGRA~1/Matlab/R2012b/rtw/c/src/rt_mxclassid.h:24: error: previous declaration of `mxUINT8_CLASS'
C:/PROGRA~1/Matlab/R2012b/extern/include/matrix.h:336: error: conflicting types for `mxINT16_CLASS'
C:/PROGRA~1/Matlab/R2012b/rtw/c/src/rt_mxclassid.h:25: error: previous declaration of `mxINT16_CLASS'
C:/PROGRA~1/Matlab/R2012b/extern/include/matrix.h:337: error: conflicting types for `mxUINT16_CLASS'
C:/PROGRA~1/Matlab/R2012b/rtw/c/src/rt_mxclassid.h:26: error: previous declaration of `mxUINT16_CLASS'
C:/PROGRA~1/Matlab/R2012b/extern/include/matrix.h:338: error: conflicting types for `mxINT32_CLASS'
C:/PROGRA~1/Matlab/R2012b/rtw/c/src/rt_mxclassid.h:27: error: previous declaration of `mxINT32_CLASS'
C:/PROGRA~1/Matlab/R2012b/extern/include/matrix.h:339: error: conflicting types for `mxUINT32_CLASS'
C:/PROGRA~1/Matlab/R2012b/rtw/c/src/rt_mxclassid.h:28: error: previous declaration of `mxUINT32_CLASS'
C:/PROGRA~1/Matlab/R2012b/extern/include/matrix.h:340: error: conflicting types for `mxINT64_CLASS'
C:/PROGRA~1/Matlab/R2012b/rtw/c/src/rt_mxclassid.h:29: error: previous declaration of `mxINT64_CLASS'
C:/PROGRA~1/Matlab/R2012b/extern/include/matrix.h:341: error: conflicting types for `mxUINT64_CLASS'
C:/PROGRA~1/Matlab/R2012b/rtw/c/src/rt_mxclassid.h:30: error: previous declaration of `mxUINT64_CLASS'
C:/PROGRA~1/Matlab/R2012b/extern/include/matrix.h:344: error: conflicting types for `mxOBJECT_CLASS'
C:/PROGRA~1/Matlab/R2012b/rtw/c/src/rt_mxclassid.h:34: error: previous declaration of `mxOBJECT_CLASS'
C:/PROGRA~1/Matlab/R2012b/extern/include/matrix.h:353: error: redefinition of `mxClassID'
C:/PROGRA~1/Matlab/R2012b/rtw/c/src/rt_mxclassid.h:34: error: `mxClassID' previously declared here
C:/PROGRA~1/Matlab/R2012b/extern/include/matrix.h:360: error: conflicting types for `mxREAL'
C:/PROGRA~1/Matlab/R2012b/rtw/c/src/rt_matrx.h:59: error: previous declaration of `mxREAL'
C:/PROGRA~1/Matlab/R2012b/extern/include/matrix.h:362: error: conflicting types for `mxCOMPLEX'
C:/PROGRA~1/Matlab/R2012b/rtw/c/src/rt_matrx.h:61: error: previous declaration of `mxCOMPLEX'
C:/PROGRA~1/Matlab/R2012b/extern/include/matrix.h:363: error: redefinition of `mxComplexity'
C:/PROGRA~1/Matlab/R2012b/rtw/c/src/rt_matrx.h:61: error: `mxComplexity' previously declared here
In file included from C:/PROGRA~1/Matlab/R2012b/extern/include/mex.h:58,
                 from ../FAST_SFunc.c:28:
C:/PROGRA~1/Matlab/R2012b/extern/include/matrix.h:391: error: parse error before "if"
C:/PROGRA~1/Matlab/R2012b/extern/include/matrix.h:403: error: `mxDOUBLE_CLASS' redeclared as different kind of symbol
C:/PROGRA~1/Matlab/R2012b/extern/include/matrix.h:332: error: previous declaration of `mxDOUBLE_CLASS'
C:/PROGRA~1/Matlab/R2012b/extern/include/matrix.h:409: error: parse error before "void"
C:/PROGRA~1/Matlab/R2012b/extern/include/matrix.h:427: error: parse error before numeric constant
C:/PROGRA~1/Matlab/R2012b/extern/include/matrix.h:439: error: parse error before numeric constant
C:/PROGRA~1/Matlab/R2012b/extern/include/matrix.h:451: error: parse error before numeric constant
C:/PROGRA~1/Matlab/R2012b/extern/include/matrix.h:496: error: parse error before numeric constant
C:/PROGRA~1/Matlab/R2012b/extern/include/matrix.h:502: error: parse error before numeric constant
C:/PROGRA~1/Matlab/R2012b/extern/include/matrix.h:509: error: parse error before numeric constant
C:/PROGRA~1/Matlab/R2012b/extern/include/matrix.h:516: error: parse error before numeric constant
C:/PROGRA~1/Matlab/R2012b/extern/include/matrix.h:523: error: parse error before numeric constant
C:/PROGRA~1/Matlab/R2012b/extern/include/matrix.h:530: error: parse error before numeric constant
C:/PROGRA~1/Matlab/R2012b/extern/include/matrix.h:537: error: parse error before numeric constant
C:/PROGRA~1/Matlab/R2012b/extern/include/matrix.h:544: error: parse error before numeric constant
C:/PROGRA~1/Matlab/R2012b/extern/include/matrix.h:551: error: parse error before numeric constant
C:/PROGRA~1/Matlab/R2012b/extern/include/matrix.h:558: error: parse error before numeric constant
C:/PROGRA~1/Matlab/R2012b/extern/include/matrix.h:578: error: parse error before numeric constant
C:/PROGRA~1/Matlab/R2012b/extern/include/matrix.h:584: error: conflicting types for `rt_mxGetDimensions'
C:/PROGRA~1/Matlab/R2012b/rtw/c/src/rt_matrx.h:263: error: previous declaration of `rt_mxGetDimensions'
C:/PROGRA~1/Matlab/R2012b/extern/include/matrix.h:590: error: parse error before '(' token
C:/PROGRA~1/Matlab/R2012b/extern/include/matrix.h:590: error: parse error before '*' token
C:/PROGRA~1/Matlab/R2012b/extern/include/matrix.h:590: error: parse error before "size_t"
C:/PROGRA~1/Matlab/R2012b/extern/include/matrix.h:598: error: parse error before '&' token
C:/PROGRA~1/Matlab/R2012b/extern/include/matrix.h:661: error: parse error before "const"
C:/PROGRA~1/Matlab/R2012b/extern/include/matrix.h:688: error: parse error before '(' token
C:/PROGRA~1/Matlab/R2012b/extern/include/matrix.h:688: error: parse error before ')' token
C:/PROGRA~1/Matlab/R2012b/extern/include/matrix.h:700: error: parse error before '(' token
C:/PROGRA~1/Matlab/R2012b/extern/include/matrix.h:700: error: parse error before ')' token
C:/PROGRA~1/Matlab/R2012b/extern/include/matrix.h:706: error: parse error before '(' token
C:/PROGRA~1/Matlab/R2012b/extern/include/matrix.h:706: error: parse error before '==' token
C:/PROGRA~1/Matlab/R2012b/extern/include/matrix.h:750: error: parse error before "sizeof"
C:/PROGRA~1/Matlab/R2012b/extern/include/matrix.h:842: error: parse error before string constant
C:/PROGRA~1/Matlab/R2012b/extern/include/matrix.h:882: error: parse error before "if"
C:/PROGRA~1/Matlab/R2012b/extern/include/matrix.h:888: error: conflicting types for `rt_mxCreateNumericArray'
C:/PROGRA~1/Matlab/R2012b/rtw/c/src/rt_matrx.h:239: error: previous declaration of `rt_mxCreateNumericArray'
In file included from C:/PROGRA~1/Matlab/R2012b/extern/include/mex.h:58,
                 from ../FAST_SFunc.c:28:
C:/PROGRA~1/Matlab/R2012b/extern/include/matrix.h:896:68: macro "mxCreateNumericArray" requires 4 arguments, but only 3 given
C:/PROGRA~1/Matlab/R2012b/extern/include/matrix.h:902: error: conflicting types for `rt_mxCreateDoubleMatrix'
C:/PROGRA~1/Matlab/R2012b/rtw/c/src/rt_matrx.h:226: error: previous declaration of `rt_mxCreateDoubleMatrix'
C:/PROGRA~1/Matlab/R2012b/extern/include/matrix.h:1010: error: conflicting types for `rt_mxGetString'
C:/PROGRA~1/Matlab/R2012b/rtw/c/src/rt_matrx.h:287: error: previous declaration of `rt_mxGetString'
C:/PROGRA~1/Matlab/R2012b/extern/include/matrix.h:1039: error: conflicting types for `rt_mxCreateString'
C:/PROGRA~1/Matlab/R2012b/rtw/c/src/rt_matrx.h:214: error: previous declaration of `rt_mxCreateString'
C:/PROGRA~1/Matlab/R2012b/extern/include/matrix.h:1047: error: conflicting types for `rt_mxCreateCharMatrixFromStrings'
C:/PROGRA~1/Matlab/R2012b/rtw/c/src/rt_matrx.h:202: error: previous declaration of `rt_mxCreateCharMatrixFromStrings'
C:/PROGRA~1/Matlab/R2012b/extern/include/matrix.h:1090: error: conflicting types for `rt_mxDuplicateArray'
C:/PROGRA~1/Matlab/R2012b/rtw/c/src/rt_matrx.h:251: error: previous declaration of `rt_mxDuplicateArray'
C:/PROGRA~1/Matlab/R2012b/extern/include/matrix.h:1118:30: macro "mxGetEps" passed 1 arguments, but takes just 0
C:/PROGRA~1/Matlab/R2012b/extern/include/matrix.h:1124:30: macro "mxGetInf" passed 1 arguments, but takes just 0
C:/PROGRA~1/Matlab/R2012b/extern/include/matrix.h:1130:30: macro "mxGetNaN" passed 1 arguments, but takes just 0
C:/PROGRA~1/Matlab/R2012b/extern/include/matrix.h:1147: error: parse error before "double"
C:/PROGRA~1/Matlab/R2012b/extern/include/matrix.h:1155: error: parse error before "double"
In file included from ../FAST_SFunc.c:28:
C:/PROGRA~1/Matlab/R2012b/extern/include/mex.h:330:27: macro "mexLock" passed 1 arguments, but takes just 0
C:/PROGRA~1/Matlab/R2012b/extern/include/mex.h:336:29: macro "mexUnlock" passed 1 arguments, but takes just 0
C:/PROGRA~1/Matlab/R2012b/extern/include/mex.h:342:31: macro "mexIsLocked" passed 1 arguments, but takes just 0
C:/PROGRA~1/Matlab/R2012b/extern/include/mex.h:348:42: macro "mexFunctionName" passed 1 arguments, but takes just 0
In file included from ../OpenFOAM_Types.h:18,
                 from ../FAST_Library.h:2,
                 from ../FAST_SFunc.c:30:
../stdbool.h:13:7: warning: no newline at end of file
../FAST_SFunc.c: In function `mdlInitializeSizes':
../FAST_SFunc.c:156: error: invalid use of undefined type `struct mxArray_tag'
../FAST_SFunc.c:156: error: dereferencing pointer to incomplete type
../FAST_SFunc.c:159: error: invalid use of undefined type `struct mxArray_tag'
../FAST_SFunc.c:159: error: dereferencing pointer to incomplete type
../FAST_SFunc.c:172: error: invalid use of undefined type `struct mxArray_tag'
../FAST_SFunc.c:172: error: dereferencing pointer to incomplete type
../FAST_SFunc.c:172: error: invalid use of undefined type `struct mxArray_tag'
../FAST_SFunc.c:172: error: dereferencing pointer to incomplete type
../FAST_SFunc.c:173: warning: implicit declaration of function `min'
../FAST_SFunc.c:175: error: invalid use of undefined type `struct mxArray_tag'
../FAST_SFunc.c:175: error: dereferencing pointer to incomplete type
 
COMPILING FAILED (1)
 
MAKE PROCESS ABORTED
 
----------------------------------------------------------------------
*** Errors occurred during make process.
*** Inspect MATLAB Command Window for details.
*** Aborting RTI build procedure for model OpenLoop.
----------------------------------------------------------------------
*** Stopped RTI build procedure for model: OpenLoop.
----------------------------------------------------------------------
>>


I can't find a solution. Is there anyone who can solve such problems?
Thank you!

Best regards,
Cheng

Bonnie.Jonkman
Posts: 561
Joined: Thu Nov 10, 2005 10:51 am
Organization: Envision Energy USA
Location: Colorado
Location: Boulder, CO
Contact:

Re: FAST8 Build Model problems

Postby Bonnie.Jonkman » Wed Nov 20, 2019 1:15 pm

It looks like you've got multiple definitions of the header files that are needed for the build process. I am not sure why it would be looking for files in both the extern/include and rtw/c/src directories. Did you modify anything in the build process? Or any of the include paths?

When you build using the mex command, it sets certain preprocessor directives to include the files it needs; but if you, for example, build it from the Simulink Coder product for real-time applications, it includes different files. Perhaps one of the preprocessor directives is incorrect?

I don't have the 2012b documentation, but here's the latest on building the s-function c templates: https://www.mathworks.com/help/simulink ... tions.html. Maybe that will help you debug the issue.
Bonnie Jonkman

Envision Energy USA, 2016-
National Renewable Energy Laboratory, 2003-2016

Cheng.Zhang
Posts: 59
Joined: Tue Nov 14, 2017 6:50 am
Organization: ECN
Location: france

Re: FAST8 Build Model problems

Postby Cheng.Zhang » Thu Nov 21, 2019 6:44 am

Dear Bonnie,

Thank you for your reply.
I didn't make any change the include path of creat_FAST_SFunc.c. I know that I can use creat_FAST_SFunc.c to generate the .mexw64 file.

I don't know if I well understand what you said, my understanding is:
If I want to use the creat_FAST_SFunc.c to built model for real-time simulation. I need to modify the header file the this C code(as the link you send me). Is it correct?

Best regards,
Cheng

Bonnie.Jonkman
Posts: 561
Joined: Thu Nov 10, 2005 10:51 am
Organization: Envision Energy USA
Location: Colorado
Location: Boulder, CO
Contact:

Re: FAST8 Build Model problems

Postby Bonnie.Jonkman » Tue Dec 03, 2019 9:27 am

I don't have any experience building Simulink models for real-time simulation. I have read some comments about it in the MATLAB/Simulink documentation that I sent you. I do not think you have to modify the header file; I think you need to make sure MATLAB is setting the appropriate preprocessor flags so it uses the correct header files.

My concern is that your error message seems to indicate that Matlab is finding duplicate header files, some of which are in the real-time-workshop toolbox. The paths to the included headers are set by MATLAB.

I would recommend that you read the MATLAB documentation on the C template for level-2 S-functions and see if perhaps the API for MATLAB 2012 is different than what is implemented in FAST. Or, perhaps there is something else that needs to be set when you run it for DSpace.
Bonnie Jonkman

Envision Energy USA, 2016-
National Renewable Energy Laboratory, 2003-2016


Return to “Computer-Aided Engineering Software Tools”

Who is online

Users browsing this forum: No registered users and 1 guest