help for remexing FAST S-function

Dear Bonnie,

Let me illustrate my problem briefly. Since I plan to introduce extra control variables into FAST, I need to remex FAST S-function to test the controller and run the simulation. Unfortunately, I got a huge trouble on that, which puzzled me for more than two weeks. I have searched and read your instructions carefully (Beginner to Simulink and FAST V7 - #19 by Bonnie.Jonkman), but still have no idea on how to solve my problem.

software: MATLAB 7.10.0(R2010a, 32bit), Visual Studio 2010, Visual FORTRAN compiler XE12.0, FAST_v7.02.00d-bjj

I changed the source files path in the file make_FAST_Sfunc.m and modified the intelf12msvs2010shellopts.bat as the following:



Running Matlab, I got many *.mod files in the folder and messages like

Finally, I got the error message like this:

The error message from matlab:

FYI, I have successfully compiled and got FAST.exe on my computer, which works quite well.

Could you help me point out any errors on my work? Any suggestion is greatly appreciated. Thank you so much.

Zhongyou.Wu

Zhongyou,

It looks like the code has compiled successfully, but it fails on the linking stage. Unfortunately, I can’t tell what exactly the problem is. I’d first check double check your path, include, and lib variables. If they look okay, verify that LINKFLAGS doesn’t have anything missing (or anything strange added). You might want to create a very simple example file in Fortran and just see if you can get it to compile and link with the options file you’re creating for FAST. There are probably some examples in the Matlab help.

Hi Bonnie,

Thanks to your suggestion, I finally mexed the FAST S-function after another day’s try. For other guys information, I share the solution to my problem.

As you pointed out, the mexing failed on the link stage. The reason for this failure is the error with the path, include, and lib variables. I believe that I did exactly as (AeroDyn Feedback) . The weired thing was that the path of link.exe was not included in the TmpPath. I do not know why it is.

This time, I did the following things, as the instruction in make_FAST_SFunc.m

  1. Install Matlab 2014a;
  2. Copy intelf12msvs2010opts.bat from matlab/R2014a/bin/win32/mexopts to the folder where “make_FAST_SFunc.m” is stored;
  3. get the path, include, and lib variables as what was suggested in (AeroDyn Feedback) ;
  4. change COMPFLAGS in intelf12msvs2010opts.bat as step 3 in make_FAST_SFunc.m.

Another important thing is that attention should be paid to any error message in Intel command prompt. For me, there was an error message “Cannot determine the location of the VS Common Tools folder” . It can be solved by simply adding a semicolon at the end of windows OS environment variables.

Hope everyone can enjoy the mex process.