Unable to generate .dll file of simulink model to be used in amesim using the command sl2amecosim

9 views (last 30 days)
Hello,
I have a simulink black box model with S-function integrated, I want to use the simulink model in amesim as a submodel. I am using the command sl2amecosim to generate the library but unsuccessful. Please find the error below
***
sl2amecosim('Continental_CAirS_v2', 'CAIrs_SL2AME','auto')
Using version 2.0 of SL2AMECOSIM.
====> STARTING SL2AMECOSIM CODE GENERATION FOR MODEL CONTINENTAL_CAIRS_V2...
====> Step #1: Checking system and model...
====> Step #2: Generating code & building OBJ file
### Starting build procedure for model: Continental_CAirS_v2
### Generating code and artifacts to 'Model specific' folder structure
### Generating code into build folder: D:\temp\Provided_20220331\Continental_CAirS_v2_grt_rtw
Warning: Removed 'D:\temp\Provided_20220331\Continental_CAirS_v2_grt_rtw\html\css' from the MATLAB path for this MATLAB session.
See 'doc path' for more information.
Warning: Removed 'D:\temp\Provided_20220331\Continental_CAirS_v2_grt_rtw\html\js' from the MATLAB path for this MATLAB session.
See 'doc path' for more information.
Warning: Removed 'D:\temp\Provided_20220331\Continental_CAirS_v2_grt_rtw\html' from the MATLAB path for this MATLAB session.
See 'doc path' for more information.
### Invoking Target Language Compiler on Continental_CAirS_v2.rtw
### Using System Target File: C:\scApps\Matlab\R2018A_64\rtw\c\grt\grt.tlc
### Loading TLC function libraries
......
### Initial pass through model to cache user defined code
..
### Caching model source code
............................
### Generating TLC interface API.
..............
### Writing source file Continental_CAirS_v2_capi.c
...
### Writing header file Continental_CAirS_v2_capi.h
.....................................
### Writing header file Continental_CAirS_v2_types.h
### Writing header file Continental_CAirS_v2.h
### Writing header file rtwtypes.h
### Writing header file builtin_typeid_types.h
### Writing header file multiword_types.h
### Writing source file Continental_CAirS_v2.c
.
### Writing header file Continental_CAirS_v2_private.h
### Writing header file rtmodel.h
### Writing source file Continental_CAirS_v2_data.c
### Writing header file rt_nonfinite.h
### Writing source file rt_nonfinite.c
### Writing header file rt_sfcn_helper.h
.
### Writing source file rt_sfcn_helper.c
### TLC code generation complete.
.
### Processing Template Makefile: C:\scApps\AMESim\2019.2\Amesim\interfaces\sl2ame\ame_cosim_dll_grt_2012b_vc.tmf
### Continental_CAirS_v2.mk which is generated from C:\scApps\AMESim\2019.2\Amesim\interfaces\sl2ame\ame_cosim_dll_grt_2012b_vc.tmf is up to date
### Building Continental_CAirS_v2: .\Continental_CAirS_v2.bat
D:\temp\Provided_20220331\Continental_CAirS_v2_grt_rtw>call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\VCVARSALL.BAT" amd64
**********************************************************************
** Visual Studio 2017 Developer Command Prompt v15.9.49
** Copyright (c) 2017 Microsoft Corporation
**********************************************************************
[vcvarsall.bat] Environment initialized for: 'x64'
Microsoft (R) Program Maintenance Utility, Version 14.16.27048.0
Copyright (C) Microsoft Corporation. Alle Rechte vorbehalten.
### Compiling Continental_CAirS_v2.c
cl -c -DCRTAPI1=_cdecl -DCRTAPI2=_cdecl -nologo -GS -D_AMD64_=1 -DWIN64 -D_WIN64 -DWIN32 -D_WIN32 -W4 -D_WINNT -D_WIN32_WINNT=0x0502 -DNTDDI_VERSION=0x05020000 -D_WIN32_IE=0x0600 -DWINVER=0x0502 -D_MT -MT /wd4996 /fp:precise -DUSE_RTMODEL /Od /Oy- -DMODEL=Continental_CAirS_v2 -DRT -DNUMST=2 -DTID01EQ=1 -DNCSTATES=48 -DMT=0 -DHAVESTDIO -DMAT_FILE=1 -DONESTEPFCN=0 -DTERMFCN=1 -DMULTI_INSTANCE_CODE=0 -DCLASSIC_INTERFACE=0 Continental_CAirS_v2.c
Continental_CAirS_v2.c
Continental_CAirS_v2.c(26): fatal error C1083: Datei (Include) kann nicht geöffnet werden: "ASU_sf.h": No such file or directory
NMAKE : fatal error U1077: ""C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\bin\HostX64\x64\cl.EXE"": R³ckgabe-Code "0x2"
Stop.
The make command returned an error of 2
Der Befehl "An_error_occurred_during_the_call_to_make" ist entweder falsch geschrieben oder
konnte nicht gefunden werden.
### Creating HTML report file Continental_CAirS_v2_codegen_rpt.html
b:\matlab\rtw\internal\rtwtags\rtwtags: error opening 'D:\temp\Provided_20220331\Continental_CAirS_v2_grt_rtw\ASU_sf.c'
### Build procedure for model: 'Continental_CAirS_v2' aborted due to an error.
====> Step #3: Restoring initial model configuration
Error using RTW/genMakefileAndBuild>invokeTMF
Error(s) encountered while building "Continental_CAirS_v2"
Error in RTW/genMakefileAndBuild
Error in RTW/genMakefileAndBuildWrapper
Error in coder.internal.compileStage
Error in coder.internal.ModelBuilder/buildProcedure (line 1238)
compileResult = coder.internal.compileStage...
Error in coder.internal.ModelBuilder/make_rtw (line 197)
buildResult = buildProcedure...
Error in coder.internal.ModelCodegenMgr/make_rtw (line 8)
buildResult = obj.make_rtw(varargin);
Error in make_rtw (line 20)
buildResult = h.make_rtw(buildArgs, varargin{:});
Error in build_target
Error in build_target
Error in build_standalone_rtw_target
Error in slbuild_private
Error in slbuild_private
Error in sl (line 15)
[varargout{1:nargout}]=feval(varargin{:});
Error in slbuild (line 78)
sl('slbuild_private', mdl, target, varargin{2:end});
Error in rtwbuild (line 235)
slbuild(sys, 'StandaloneRTWTarget', ...
Error in new_sl2amecosim (line 339)
rtwbuild(model);
Error in sl2amecosim (line 71)
new_sl2amecosim(model,lib,icon,codegenoptions,debug,treeView);
Caused by:
SL2AMECOSIM cannot build model.
****
The function is unable to read the file ASU_sf.h even though it's provided in the folder
matlab version : 2018A, 2018B
amesim version : 2019.2
Any help would be appreciated
regards
Saad Ahmed

Answers (1)

Yash
Yash on 10 Jan 2024
Hello Ahmed,
The error message you are encountering indicates that the compiler cannot find the 'ASU_sf.h' header file, which is required for the compilation process. This file is likely associated with an S-function within your Simulink model. Ensure that the ASU_sf.h file exists in the expected directory. If the file is missing, you need to locate it and place it in the correct directory. If the file exists, ensure that the file path is correctly set so that the compiler can find it. The file path needs to be included in the compiler's include directories.
Here's a general code snippet to add a directory to the MATLAB path, which you can modify with the correct path where ASU_sf.h is located:
>> addpath('path_to_directory_containing_ASU_sf_header');
You need to replace 'path_to_directory_containing_ASU_sf_header' with the actual path to the directory containing the ASU_sf.h file. After updating the path, attempt to run 'sl2amecosim' again.
To know more about the 'addpath' function, refer its documentation here: https://in.mathworks.com/help/matlab/ref/addpath.html
Hope this helps

Categories

Find more on Simulink Coder in Help Center and File Exchange

Products


Release

R2018a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!