Effacer les filtres
Effacer les filtres

How to use compiled mexw64 functions in User defined Simulink blocks

10 vues (au cours des 30 derniers jours)
Lukas Abelt
Lukas Abelt le 2 Juin 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
  1 commentaire
Navan Ruthramoorthy
Navan Ruthramoorthy le 5 Juin 2017
If you need only simulation take a look at coder.extrinsic function.

Connectez-vous pour commenter.

Réponses (1)

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

Catégories

En savoir plus sur Simulink Functions dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by