I can easily run the open loop (FAST v8) in Matlab/Simulink but when I run it in the real-time environment in Matlab it gives me these two errors including “LINK : fatal error LNK1104: cannot open file ‘FAST_SFunc.obj’”, and “NMAKE : fatal error U1077”. Has anyone encountered such errors? The details of the errors are as follows:
LINK : fatal error LNK1104: cannot open file ‘FAST_SFunc.obj’
NMAKE : fatal error U1077: ‘“C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.25.28610\bin\HostX86\x86\link.EXE”’ : return code ‘0x450’
The make command returned an error of 2
Error(s) encountered while building “FAST_model_only”
Component:Simulink | Category:Block diagram error
My understanding is that there are options in MATLAB/Simulink for running real-time simulations, but I’m not very familiar with these. If your existing FAST / OpenFAST model within MATLAB/Simulink already runs faster than real time (or can be simplified a bit to do so), I would guess it would possible to use it for real-time applications, but you’d have to check MATLAB/Simulink documentation for information on how to do that.
A similar question was discussed in the following forum topics, but I’m not sure where the work ended up:
The FAST v7 interface to LabView was used for real-time implementation, but this functionality has not yet been ported to FAST v8 or OpenFAST. It was up to the user to set up the FAST v7 model so that it would run faster than real time without the interface to LabView enabled. LabView would then wait before calling FAST v7 again so that the simulation was real time. NREL used the LabView interface to link FAST v7 with the actual controller implemented on the physical CART wind turbine tested at NREL (in a hardware in the loop mode), so that the controller could be tested before using it on the real CART. This capability is discussed a bit in the following forum topic:
Dear Dr. Jonkman,
Thank you very much for your respond and very helpful links. I read them and found the source of the problem. To illustrate, to make a real-time there is a header file (simstruc.h) in Matlab that should be used for C S-function level 2. This header file itself, includes other header files depending on compiling a MEX file or Simulink Coder product for a real-time application. There is header file termed “matrix.h” which is included for MEX file compilation; on the other hand, there is another one for real-time called “rt_matrx.h”. The problem is that some variables are defined in them differently (same name but with different definition). So, it seems it is not possible to compile a MEX file while in the real-time application because of the conflict between these two header files. When I run FAST in real-time environment it gives me a lot of errors that one of which for example is as follows:
“C:\Program Files\MATLAB\R2019b\extern\include\matrix.h(143): error C2371: ‘mxArray’: redefinition; different basic types
C:\Program Files\MATLAB\R2019b\rtw\c\src\rt_matrx.h(41): note: see declaration of ‘mxArray’”
To solve this problem, I think I shouldn’t compile the MEX file to avoid this conflict. Is there any way to run FAST in Simulink without using the MEX? Or is there exist any other solution for it?
Thanks for the summary, which contains details I’m not familiar with. Sorry, but I’m not aware of other ways to interface FAST with Simulink.
Dear Dr. Jonkman,
Thanks again for your response. Yes, it is not directly related to the control section in FAST. Maybe, I should ask this any other forum sections. What about " Computer-Aided Engineering Software Tools" section? Do you know is there anybody to reply in it?
I would guess most users of this forum check all of the forum categories, so, I don’t think there would be much benefit to posting the same question twice.