Can I tune the UDP Send & UDP Receive block IP address and port parameters with Simulink Real-Time (SLRT) and Speedgoat?
3 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
MathWorks Support Team
el 9 de Dic. de 2020
Editada: MathWorks Support Team
el 3 de Abr. de 2025
I am using UDP Receive and UDP Send blocks in my Simulink Real-Time model to exchange data between my Speedgoat and an external device.
Is it possible to change the "To IP address" and "To port" parameters for the UDP Send block, or the "From IP address" parameter for the UDP Receive block, during the real-time simulation or between simulations without requiring a rebuild?
Respuesta aceptada
MathWorks Support Team
el 3 de Abr. de 2025
Editada: MathWorks Support Team
el 3 de Abr. de 2025
Starting from R2021a, it is possible to tune the IP & port parameters for Simulink Real-Time UDP blocks during runtime.
Using our Target To Host UDP example, you can change the parameters in the UDP block masks if you started the model with the "Run on Target" button (external mode). The MATLAB code syntax for "setparam" is the following:
tg.setparam('slrt_ex_target_to_host_UDP/UDP Send','toAddress',uint8([255 255 255 255]));
tg.setparam('slrt_ex_target_to_host_UDP/UDP Send','toPort',uint16(8004));
tg.setparam('slrt_ex_target_to_host_UDP/UDP Receive','fmAddress',uint8([10 10 10 100]));
Note that there is also a UDP Multicast Receive block available, as well as multicast and broadcast support for the UDP Send block.
In R2020b and earlier, this feature is not available. IP Addresses are not tunable.
You can consider one of the following workarounds:
1. If supported in your release of Simulink Real-Time, use UDP multicasting or broadcasting as a workaround. Consult the documentation.
2. Place multiple UDP Send/Receive blocks. Place each in an enabled subsystem, triggered subsystem, or switch case action subsystem. If you know all possible ports that you may need to use, you can add a dedicated block for each port. Please see the attached R2013b example "multiUDPsend.slx" where 6 instances of UDP Send blocks are used in order to enable 6 different Local IP ports.
0 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Block Libraries 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!