How to use compiled mexw64 functions in User defined Simulink blocks

10 次查看(过去 30 天)
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

回答(1 个)

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

类别

Help CenterFile Exchange 中查找有关 Simulink Functions 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by