Extend library of functions from another library SLRT, SLDRT

16 visualizaciones (últimos 30 días)
Hi,
as I am trying to establish a TCP/IP communication in the Desktop Real-Time External Mode [SLDRT], I am struggling with the Packet Input and Packet Output blocks that were originally designed for TCP/IP communication in that mode. Since I had some TCP/IP connection working in Desktop Real-Time Normal mode when using TCP blocks (TCP Client, TCP Send and TCP Receive - the blocks are originally from the the Real-Time library [SLRT]) I wanted to implement these blocks in Desktop Real-Time External.
Since both, Desktop Real-Time External and Real-Time are generating C code I thought that I could also use the TCP blocks in Desktop-Real-Time External. But when I trieed to build a simple Simulink model (see image below) I receive the following error message:
"The pre-compiled libraries libslrealtime_libsrc_ip.a_sldrt.lib are missing from the TargetPreCompLibLocation C:\Program Files\MATLAB\R2021a\toolbox\sldrt\lib\win64."
When trying to use the "fix" button, matlab starts building and some other operations and then simply terminates with closing Simulink and the error is still not fixed when restarting Semulink and trying to build it again.
The TCP blocks are part of the official Real-Time [SLRT] library as can be seen here: https://de.mathworks.com/help/slrealtime/referencelist.html?type=block but are further defined as part of the Simulink Real-Time / IP library as can be seen here: https://de.mathworks.com/help/slrealtime/io_ref/tcpclient.html.
It looks like that the library for Desktop Real-Time External [SLDRT] is missing the libslrealtime_libsrc_ip containing information about the TCP blocks, which should be found inside of the Real-Time [SLRT] library if I am right here?
Problems:
  1. In the directory of the error message, I can not find a_sldrt.lib All I have there is: ex_sldrt.lib, mc_sldrt.lib ne_sldrt.lib, pm_math_sldrt.lib, pm_sldrt.lib, sldrtlib.lib, sm_sldrt.lib, sm_ssci_sldrt.lib, ssc_core_sldrt.lib and ssc_sli_sldrt.lib
  2. In the directory of the Real-Time toolbox (C:\Program Files\MATLAB\R2021a\toolbox\slrealtime\simulink\blocks\dist\lib) I found libslrealtime_libsrc_ip_slrt_x64.a
Question:
How can I extend the SLDRT library by the libslrealtime_libsrc_ip of the SLRT library and will this even fix my problem?
Thank you in advance.
Simple Simulink model to be built for Real-Time External

Respuesta aceptada

Jan Houska
Jan Houska el 25 de Jun. de 2021
Hi Maxmilian,
unfortunately, what you are trying to do cannot be done. In External mode, the code runs on the target - inside the real-time kernel for Simulink Desktop Real-Time, on a target machine in Simulink Real-Time. These are two completely different environments with completely different system-level support for network communication, and the blocks use this system-level support. So even if you manage to compile the SLRT blocks somehow, they will still not work in SLDRT environment (and vice versa).
Your only choice for TCP/IP in SLDRT External mode is to use the Packet Input/Output or Stream Input/Output blocks since these are the only blocks that interface the SLDRT network communication support. If you have troubles using the blocks, these can be probably solved. But trying to use different blocks instead is definitely not going to work.
Jan
  3 comentarios
Jan Houska
Jan Houska el 25 de Jun. de 2021
Hi Maxmilian,
the important thing not to miss is that Simulink is not present in the environment where the code compiled for external mode runs. This code runs on the target operating system, which is an environment completely different from Windows, MATLAB, or Simulink. This is perhaps more visible for SLRT when the code runs on the target computer (a separate piece of hardware), but the situation is the same for SLDRT even though SLDRT uses the same CPU (but not same OS).
There is no such thing as an universal C code that establishes TCP connection that would work regardless of the target environment it is compiled for. To use TCP/IP, you must always call the underlying target OS, and support for TCP/IP varies with different operating systems, there are different libraries to use, etc.
Trying to solve any issues with the Packet I/O blocks is definitely by far the easiest way to do what you want (and very likely the only way), even if other ways may seem easier at the beginning.
Jan
Maximilian Becker
Maximilian Becker el 25 de Jun. de 2021
Thank you again for that explanation, that surely helped a lot. I would really like to get your opinion on my problem, but I first need to check if my problem is caused by the hardware or not.

Iniciar sesión para comentar.

Más respuestas (0)

Community Treasure Hunt

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

Start Hunting!

Translated by