LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Simulation Interface Toolkit Custom IO Timing Problems

Solved!
Go to solution

I am implementing a Simulink .dll model (executing with an integration step of 50ms) with SIT in Real-Time and need to talk via UDP sockets to another device bi-directionally such that all packets are sent from one to the other in-sync and within the timing constraints of my base rate loop.

 

To reiterate: In the designated structure for Reading within the base rate loop vi that is generated with Connection Manager I have UDP blocks that listen on various ports for packets from my other device (non-NI) and feed data into the .dll, and similarly in the structure designated for Writing I will be sending packets out to this device. Think control loop.

 

I have not yet begun to implement this because I am realizing that when these two asynchronous devices are sending/listening for packets will not be at the same time unless I have a synching mechanism. I don't believe they have to be kept in sync each 50ms interval, but problems with drift I will have to address later on.

 

For a first cut at this, where can I implement a block that will sit and wait indefinitely until my other non-NI device sends a Sync packet of some kind to then "kick-off" the 50ms iterations of the model with some initial known relative timing.

 

Or is there a better way to handle this? I would think this would be a common problem for simulations involving control loops. How is it usually implemented in NI Real-Time with SIT?

0 Kudos
Message 1 of 3
(2,818 Views)
Solution
Accepted by topic author gdubb85

Hi gdubb85,

 

You should be able to do this by adding a while loop outside of your driver VI with a Wait Until Next ms Multiple set to 50 ms. In this loop, you can listen for packets with a UDP Read, and send the data that you receive using a functional global to your model.

 


Regards,

Stephen S.

National Instruments
Applications Engineering
0 Kudos
Message 2 of 3
(2,795 Views)
Thanks, this looks like a good solution and seems to working so far.
0 Kudos
Message 3 of 3
(2,747 Views)