How to use compiled mexw64 functions in User defined Simulink blocks

7 visualizaciones (últimos 30 días)
Lukas Abelt
Lukas Abelt el 2 de Jun. de 2017
Respondida: Don Zheng el 8 de Jun. de 2017
Hello everyone,
For my current project I am working on I need to transfer data between multiple Simulink instances running on individual PC's. The connection will be established using a TCP Connection. As the existing Receive/Transmit blocks only act as clients I need to implement Server functionality. Simulink itself (sadly) does not offer this capability. I am now trying to use this toolbox that (with some tweaks to make it compatible) seems to work fine for matlab. When I use it in the matlab command window it works just fine. Now I wanted to implement this into my Simulink model. I tried to call the pnet methods (for example
socket=pnet('tcpsocket',25000)
)the toolbox provides within a System Object but as the toolbox compiles to a mexw64 file I couldn't get it to work.
Now I wanted to ask if there would be any way to use this Toolbox in a system object or if I Need to use another approach (Matlab S-function?). Or, even better, if someone had a reliable, working, solution for TCP Server functionality in Simulink (I know about the workaround using echotcpip but I cannot use it for this case) Thanks in advance
Lukas

Respuestas (1)

Don Zheng
Don Zheng el 8 de Jun. de 2017
coder.extrinsic should work for simulation and also remember to initialize some outputs from the MEX function.

Categorías

Más información sobre Simulink Functions en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by