Hardware in the loop

This forum if for discussing controls. Questions about how to implement controls in FAST are more appropriate to the CAE Tools forum.

Moderator: Bonnie.Jonkman

Sina.Ameli
Posts: 75
Joined: Mon Oct 15, 2018 11:23 am
Organization: FSU
Location: Florida

Hardware in the loop

Postby Sina.Ameli » Fri Jul 24, 2020 7:43 pm

Hi all,
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'
Stop.
The make command returned an error of 2

Error(s) encountered while building "FAST_model_only"
Component:Simulink | Category:Block diagram error

Thanks,
Best regards,
Sina

Jason.Jonkman
Posts: 5082
Joined: Thu Nov 03, 2005 4:38 pm
Location: Boulder, CO
Contact:

Re: Hardware in the loop

Postby Jason.Jonkman » Fri Jul 31, 2020 10:51 am

Dear Sina,

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:
viewtopic.php?f=4&t=2403&p=13761
viewtopic.php?f=4&t=1548&p=7073

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:
viewtopic.php?f=30&t=909&p=3712

Best regards,
Jason Jonkman, Ph.D.
Senior Engineer | National Wind Technology Center (NWTC)

National Renewable Energy Laboratory (NREL)
15013 Denver West Parkway | Golden, CO 80401
+1 (303) 384 – 7026 | Fax: +1 (303) 384 – 6901
nwtc.nrel.gov

Sina.Ameli
Posts: 75
Joined: Mon Oct 15, 2018 11:23 am
Organization: FSU
Location: Florida

Re: Hardware in the loop

Postby Sina.Ameli » Wed Aug 05, 2020 4:45 pm

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
Best regards,
Sina

Jason.Jonkman
Posts: 5082
Joined: Thu Nov 03, 2005 4:38 pm
Location: Boulder, CO
Contact:

Re: Hardware in the loop

Postby Jason.Jonkman » Wed Aug 05, 2020 5:10 pm

Dear Sina,

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.

Best regards,
Jason Jonkman, Ph.D.
Senior Engineer | National Wind Technology Center (NWTC)

National Renewable Energy Laboratory (NREL)
15013 Denver West Parkway | Golden, CO 80401
+1 (303) 384 – 7026 | Fax: +1 (303) 384 – 6901
nwtc.nrel.gov

Sina.Ameli
Posts: 75
Joined: Mon Oct 15, 2018 11:23 am
Organization: FSU
Location: Florida

Re: Hardware in the loop

Postby Sina.Ameli » Wed Aug 05, 2020 5:21 pm

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?
Thanks
Best regards,
Sina

Jason.Jonkman
Posts: 5082
Joined: Thu Nov 03, 2005 4:38 pm
Location: Boulder, CO
Contact:

Re: Hardware in the loop

Postby Jason.Jonkman » Wed Aug 05, 2020 6:00 pm

Dear Sina,

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.

Best regards,
Jason Jonkman, Ph.D.
Senior Engineer | National Wind Technology Center (NWTC)

National Renewable Energy Laboratory (NREL)
15013 Denver West Parkway | Golden, CO 80401
+1 (303) 384 – 7026 | Fax: +1 (303) 384 – 6901
nwtc.nrel.gov


Return to “Controls”

Who is online

Users browsing this forum: No registered users and 1 guest