FAST simulink interface with mexw64

Dear Bonnie,
I am trying to run FAST with Simulink/Matlab 2010b 64bit
For creating FAST_SFunc.mexw64 using vs2005 and IVF 11.0.066 I modified make_FAST_SFunc as below:

FortranOptionsFile = ‘intelf11msvs2005opts.bat’;
OutputRootName = ‘FAST_SFunc’; % name of the mex file
FortranOptionsFile = ‘intelf11msvs2005opts.bat’;
OutputRootName = ‘FAST_SFunc’;
NWTC_LIB = ‘C:\Design Codes\NWTC_Lib_v1.03.01\Source’;
WIND_LOC = ‘C:\Design Codes\AeroDyn\Source\InflowWind\Source’;
AD_LOC = ‘C:\Design Codes\AeroDyn\Source’;
FAST_LOC = ‘C:\Design Codes\FAST\Source’;
Sim_LOC = ‘C:\Design Codes\FAST\Simulink\Source’;
mex(‘-v’ , … %verbose
‘-f’, FortranOptionsFile , … %file containing fortran options
‘-output’, OutputRootName , … %name of the resulting mex function
fullfile(NWTC_LIB, ‘DoubPrec.f90’ ), …
fullfile(NWTC_LIB, ‘SysMatlab.f90’ ), …
fullfile(NWTC_LIB, ‘NWTC_IO.f90’ ), …
fullfile(NWTC_LIB, ‘NWTC_Num.f90’ ), …
fullfile(NWTC_LIB, ‘NWTC_Aero.f90’ ), …
fullfile(NWTC_LIB, ‘NWTC_Library.f90’ ), …
fullfile(WIND_LOC, ‘SharedInflowDefs.f90’), …
fullfile(WIND_LOC, ‘HHWind.f90’ ), …
fullfile(WIND_LOC, ‘FFWind.f90’ ), …
fullfile(WIND_LOC, ‘FDWind.f90’ ), …
fullfile(WIND_LOC, ‘CTWind.f90’ ), …
fullfile(WIND_LOC, ‘UserWind.f90’ ), …
fullfile(WIND_LOC, ‘InflowWindMod.f90’ ), …
fullfile(AD_LOC, ‘SharedTypes.f90’ ), …
fullfile(AD_LOC, ‘AeroMods.f90’ ), …
fullfile(AD_LOC, ‘GenSubs.f90’ ), …
fullfile(AD_LOC, ‘AeroSubs.f90’ ), …
fullfile(AD_LOC, ‘AeroDyn.f90’ ), …
fullfile(FAST_LOC, ‘FAST_Mods.f90’ ), …
fullfile(FAST_LOC, ‘Noise.f90’ ), …
fullfile(FAST_LOC, ‘fftpack.f’ ), …
fullfile(FAST_LOC, ‘FFTMod.f90’ ), …
fullfile(FAST_LOC, ‘HydroCalc.f90’ ), …
fullfile(FAST_LOC, ‘AeroCalc.f90’ ), …
fullfile(FAST_LOC, ‘FAST_IO.f90’ ), …
fullfile(FAST_LOC, ‘FAST.f90’ ), …
fullfile(FAST_LOC, ‘PitchCntrl_ACH.f90’ ), …
fullfile(FAST_LOC, ‘SetVersion.f90’ ), …
fullfile(FAST_LOC, ‘UserSubs.f90’ ), …
fullfile(FAST_LOC, ‘UserVSCont_KP.f90’ ), …
fullfile(Sim_LOC , ‘FASTSimulink.f90’ ), …
fullfile(Sim_LOC, ‘FASTGateway.f90’ ) );
delete (‘*.mod’)
disp([‘mex completed: ’ OutputRootName ‘.’ mexext ’ has been created.’])

Also modified intelf11msvs2005opts as below:

set MATLAB=C:\Program Files\MATLAB\R2010b
SET IFORT_COMPILER11=C:\Program Files (x86)\Intel\Compiler\11.0\066\fortran
set VS80COMNTOOLS=C:\Program Files (x86)\Microsoft Visual Studio 8\Common7\Tools
set LINKERDIR=%VS80COMNTOOLS%....
set PATH=%IFORT_COMPILER11%\Bin\intel64;%LINKERDIR%\VC\BIN;%LINKERDIR%\Common7\Tools;%LINKERDIR%\Common7\Tools\bin;%LINKERDIR%\Common7\IDE;%LINKERDIR%\SDK\v2.0\bin;%PATH%
set INCLUDE=%IFORT_COMPILER11%\Include;%IFORT_COMPILER11%\Include\intel64;%LINKERDIR%\VC\ATLMFC\INCLUDE;%LINKERDIR%\VC\INCLUDE;%LINKERDIR%\VC\PlatformSDK\include;%LINKERDIR%\SDK\v2.0\include;%INCLUDE%
set LIB=%IFORT_COMPILER11%\Lib\intel64;%LINKERDIR%\VC\ATLMFC\LIB\AMD64;%LINKERDIR%\VC\LIB\AMD64;%LINKERDIR%\VC\PlatformSDK\lib\AMD64;%LINKERDIR%\SDK\v2.0\lib\AMD64;%MATLAB%\extern\lib\win64;%LIB%
set MW_TARGET_ARCH=win64
set COMPILER=ifort
set COMPFLAGS= /Qprec “/I%MATLAB%/extern/include” -c -nologo -DMATLAB_MEX_FILE /MD /fp:source /assume:byterecl /traceback /real_size:64 /Qzero /Qsave
set OPTIMFLAGS=-Ox -DNDEBUG
set DEBUGFLAGS=/Z7
set NAME_OBJECT=/Fo
set LIBLOC=%MATLAB%\extern\lib\win64\microsoft
set LINKER=link
set LINKFLAGS=/DLL /EXPORT:MEXFUNCTION /LIBPATH:“%LIBLOC%” libmx.lib libmex.lib libmat.lib /implib:“%LIB_NAME%.x” /MAP:“%OUTDIR%%MEX_NAME%%MEX_EXT%.map” /NOLOGO /INCREMENTAL:NO
set LINKOPTIMFLAGS=
set LINKDEBUGFLAGS=/debug /PDB:“%OUTDIR%%MEX_NAME%%MEX_EXT%.pdb”
set LINK_FILE=
set LINK_LIB=
set NAME_OUTPUT=/out:“%OUTDIR%%MEX_NAME%%MEX_EXT%”
set RSP_FILE_INDICATOR=@
set RC_COMPILER=rc /fo “%OUTDIR%mexversion.res”
set RC_LINKER=
set POSTLINK_CMDS=del “%OUTDIR%%MEX_NAME%%MEX_EXT%.map”
set POSTLINK_CMDS1=del “%LIB_NAME%.x” “%LIB_NAME%.exp”
set POSTLINK_CMDS2=mt -outputresource:“%OUTDIR%%MEX_NAME%%MEX_EXT%”;2 -manifest “%OUTDIR%%MEX_NAME%%MEX_EXT%.manifest”
set POSTLINK_CMDS3=del “%OUTDIR%%MEX_NAME%%MEX_EXT%.manifest”

Then ran make_FAST_SFunc m-file in Matlab command line, after appearing following commands in command line window the FAST_SFunc.mexw64 was created with size 2,118kB without any error.
command lines.txt
I followed Simulink Interface part of FAST users guide to run the OpenLoop.mdl but encountered with following error:
command line Error.txt
Error while obtaining sizes from MEX S-function ‘FAST_SFunc’ in ‘OpenLoop/FAST Nonlinear Wind Turbine/S-Function’. MATLAB error message:
FatalException

Do the procedures I have passed are true? Does the created FAST_SFunc.mexw64 is correct?
How to fix the problem?

Thanks,

I couldn’t upload the files so emailed them to you.

Dear Mehdi,

As we’ve mentioned before, we do not currently support the FAST_SFunc in 64-bit Matlab. We have not had time to look into the issue, and because the 32-bit version of Matlab (which can be installed on 64-bit systems) works, this has been a low priority.

You might try this user’s solution: