Simulink Desktop Real-time external mode doesn't support real-time UDP communication block

11 次查看(过去 30 天)
Hi,
I try to use real-time UDP communicaition block in Simulink Desktop Real-time. My program runs well in Normal mode. But when I try to run it in External mode, it reports that
C:/MATALB~1/toolbox/sldrt/clang/win64/clang -emit-llvm -c -m64 -O4 -DINT64_T="long long" -DUINT64_T="unsigned long long" -fno-ms-compatibility -U_MSC_VER -U__STDC_HOSTED__ -Wno-switch-enum -Wno-empty-body -IC:/MATALB~1/toolbox/sldrt/lib/include -I. -I.. -IC:/MATALB~1/simulink/include -IC:/MATALB~1/extern/include -IC:/MATALB~1/rtw/c/src -IC:/MATALB~1/rtw/c/src/ext_mode/common -IC:/MATALB~1/toolbox/shared/can/src/scanutil -IC:/MATALB~1/toolbox/sldrt/src -IC:/Users/qzlab -IC:/Users/qzlab/Deskrealtime_sldrt_win64 -IC:/MATALB~1/extern/include -IC:/MATALB~1/simulink/include -IC:/MATALB~1/rtw/c/src -IC:/MATALB~1/rtw/c/src/ext_mode/common -IC:/MATALB~1/toolbox/coder/rtiostream/src -DTGTCONN -DEXT_MODE -DON_TARGET_WAIT_FOR_START=1 -DEXT_MODE -DUSE_RTMODEL -DMODEL=Deskrealtime -DRT -DNUMST=1 -DTID01EQ=0 -DNCSTATES=0 -DMT=0 -o "slrtIPConfig.obj" "C:/MATALB~1/toolbox/slrt/blocks/UDP/slrtIPConfig.c" C:/MATALB~1/toolbox/slrt/blocks/UDP/slrtIPConfig.c:13:10: fatal error: 'socketfuncs.h' file not found #include "socketfuncs.h" ^ 1 error generated. gmake: *** [slrtIPConfig.obj] Error 1
Can anyone give me some suggestions?
Thanks,
zezhou

回答(1 个)

Sai Sri Pathuri
Sai Sri Pathuri 2019-10-31
  2 个评论
Zezhou Zhang
Zezhou Zhang 2019-10-31
Thank you for suggestions, but it doesn't solve the problem.
I use Simulink Destop Real-time. So, in code generation, I choose sldrt.tlc (SIMULINK DESKTOP REAL-TIME).
When I try to use UDP block in Embedded Coder Toolbo or DSP Toolbox, the errors are the same:
C:\Users\qzlab\Deskrealtime1_sldrt_win64>set MATLAB=C:\Matalb2019B C:\Users\qzlab\Deskrealtime1_sldrt_win64>"C:\Matalb2019B\bin\win64\gmake" -f Deskrealtime1.mk EXTMODE_STATIC_ALLOC=0 EXTMODE_STATIC_ALLOC_SIZE=1000000 TMW_EXTMODE_TESTING=0 COMBINE_OUTPUT_UPDATE_FCNS=0 INCLUDE_MDL_TERMINATE_FCN=1 MULTI_INSTANCE_CODE=0 ISPROTECTINGMODEL=NOTPROTECTING OPTS="-DTGTCONN -DEXT_MODE -DON_TARGET_WAIT_FOR_START=0" ### Compiling Deskrealtime1.c C:/MATALB~1/toolbox/sldrt/clang/win64/clang -emit-llvm -c -m64 -O4 -DINT64_T="long long" -DUINT64_T="unsigned long long" -fno-ms-compatibility -U_MSC_VER -U__STDC_HOSTED__ -Wno-switch-enum -Wno-empty-body -IC:/MATALB~1/toolbox/sldrt/lib/include -I. -I.. -IC:/MATALB~1/simulink/include -IC:/MATALB~1/extern/include -IC:/MATALB~1/rtw/c/src -IC:/MATALB~1/rtw/c/src/ext_mode/common -IC:/MATALB~1/toolbox/shared/can/src/scanutil -IC:/MATALB~1/toolbox/sldrt/src -IC:/Users/qzlab -IC:/MATALB~1/toolbox/shared/spc/src_ml/extern/include -IC:/Users/qzlab/Deskrealtime1_sldrt_win64 -IC:/MATALB~1/extern/include -IC:/MATALB~1/simulink/include -IC:/MATALB~1/rtw/c/src -IC:/MATALB~1/rtw/c/src/ext_mode/common -IC:/MATALB~1/toolbox/coder/rtiostream/src -DTGTCONN -DEXT_MODE -DON_TARGET_WAIT_FOR_START=0 -DEXT_MODE -DUSE_RTMODEL -DMODEL=Deskrealtime1 -DRT -DNUMST=2 -DTID01EQ=0 -DNCSTATES=0 -DMT=0 -o "Deskrealtime1.obj" "Deskrealtime1.c" In file included from Deskrealtime1.c:21: In file included from ./Deskrealtime1.h:32: In file included from C:/MATALB~1/toolbox/shared/spc/src_ml/extern/include\DAHostLib_Network.h:44: In file included from C:/MATALB~1/toolbox/shared/spc/src_ml/extern/include/DAHostLib_rtw.h:12: C:/MATALB~1/toolbox/sldrt/lib/include\windows.h:16:2: error: Attempt to include "windows.h" #error Attempt to include "windows.h" ^ C:/MATALB~1/toolbox/sldrt/lib/include\windows.h:17:2: error: The model being compiled contains a block that can run on host only and cannot be compiled for External Mode. Please either switch to Normal Mode or remove the block. #error The model being compiled contains a block that can run on host only and cannot be compiled for External Mode. Please either switch to Normal Mode or remove the block. ^ In file included from Deskrealtime1.c:21: In file included from ./Deskrealtime1.h:32: In file included from C:/MATALB~1/toolbox/shared/spc/src_ml/extern/include\DAHostLib_Network.h:44: C:/MATALB~1/toolbox/shared/spc/src_ml/extern/include/DAHostLib_rtw.h:47:5: error: unknown type name 'HMODULE' HMODULE library; ^ C:/MATALB~1/toolbox/shared/spc/src_ml/extern/include/DAHostLib_rtw.h:53:5: error: unknown type name 'FARPROC' FCNPTR libCreate; ^ C:/MATALB~1/toolbox/shared/spc/src_ml/extern/include/DAHostLib_rtw.h:13:18: note: expanded from macro 'FCNPTR' # define FCNPTR FARPROC ^ C:/MATALB~1/toolbox/shared/spc/src_ml/extern/include/DAHostLib_rtw.h:54:5: error: unknown type name 'FARPROC' FCNPTR libStart; ^ C:/MATALB~1/toolbox/shared/spc/src_ml/extern/include/DAHostLib_rtw.h:13:18: note: expanded from macro 'FCNPTR' # define FCNPTR FARPROC ^ C:/MATALB~1/toolbox/shared/spc/src_ml/extern/include/DAHostLib_rtw.h:55:5: error: unknown type name 'FARPROC' FCNPTR libReset; ^ C:/MATALB~1/toolbox/shared/spc/src_ml/extern/include/DAHostLib_rtw.h:13:18: note: expanded from macro 'FCNPTR' # define FCNPTR FARPROC ^ C:/MATALB~1/toolbox/shared/spc/src_ml/extern/include/DAHostLib_rtw.h:56:5: error: unknown type name 'FARPROC' FCNPTR libUpdate; ^ C:/MATALB~1/toolbox/shared/spc/src_ml/extern/include/DAHostLib_rtw.h:13:18: note: expanded from macro 'FCNPTR' # define FCNPTR FARPROC ^ C:/MATALB~1/toolbox/shared/spc/src_ml/extern/include/DAHostLib_rtw.h:57:5: error: unknown type name 'FARPROC' FCNPTR libOutputs; ^ C:/MATALB~1/toolbox/shared/spc/src_ml/extern/include/DAHostLib_rtw.h:13:18: note: expanded from macro 'FCNPTR' # define FCNPTR FARPROC ^ C:/MATALB~1/toolbox/shared/spc/src_ml/extern/include/DAHostLib_rtw.h:58:5: error: unknown type name 'FARPROC' FCNPTR libTerminate; ^ C:/MATALB~1/toolbox/shared/spc/src_ml/extern/include/DAHostLib_rtw.h:13:18: note: expanded from macro 'FCNPTR' # define FCNPTR FARPROC ^ C:/MATALB~1/toolbox/shared/spc/src_ml/extern/include/DAHostLib_rtw.h:59:5: error: unknown type name 'FARPROC' FCNPTR libDestroy; ^ C:/MATALB~1/toolbox/shared/spc/src_ml/extern/include/DAHostLib_rtw.h:13:18: note: expanded from macro 'FCNPTR' # define FCNPTR FARPROC ^ 10 errors generated. gmake: *** [Deskrealtime1.obj] Error 1 Error(s) encountered while building "Deskrealtime1"
It seems that in SIMULINK DESKTOP REAL-TIME external mode, some libs are lost.
Thanks,
Zezhou
Stefanie Schwarz
Stefanie Schwarz 2021-9-15
编辑:Stefanie Schwarz 2021-9-15
You cannot use driver blocks from libraries such as Embedded Coder or DSP Toolbox with Simulink Desktop Real-Time (SLDRT). These driver blocks are simply not compatible with SLDRT. You need to use dedicated blocks from the SLDRT library:
>> sldrtlib
If your UDP packets contain ASCII encoded data, you can use the Stream Input/Output blocks. Here is practical example on how to use the Stream Input/Output blocks:

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Development Computer Setup 的更多信息

产品


版本

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by