I'm wondering if anyone can help me understand how the model time and system time are controlled. I'm using Simulink models in Veristand and I am recording data from accelerometers that are connected to a PXI DAQ. One of my models uses the input that is being recorded from the accelerometers and then outputs the data to a Veristand graph. I'm monitoring the model and system times of the model and I notice that they seem to start at a random time each time I start the workspace. Also the two times are not perfectly synchronized. There is always a few thenths of a second difference between the two times. I'm hoping someone can explain how the times work and why they're not perfectly synchronized and why they may be starting at a random time as opposed to zero. Any help is appreciated.
It is important to note that, unless you are running on windows, the RT target running your configuration is always running until you tell it to stop. So the model and the system continue to execute regardless of if you are connected and watching from the workspace... or if your host computer is even on.
So if you launch the workspace and look at the time, I would never expect the time to be zero. Even if you just deployed... by the time you get the workspace open the target has been running for at least a little bit.
As far as the difference in time between them... this can be caused by running a model at a rate it was not compiled at. For example, if you compiled your model with a 1ms time step and your system is set to 2ms step size (500 Hz).. then you will see that the times grow differently. That brings up the question, are your times growing apart or are they growing at the same rate but have an offset? If it is just an offset, how large is it? You can look at the times in the channel data viewer tool and select 'hold' to freeze them.
Is this offset a problem?
There is also a known issue with the Workspace in NI VeriStand 2009 that controls on the Workspace window don't always update at the same time. So you can see some phase difference as each updates independently of the others. This is a cosmetic issue, albeit an annoying one.
You can try using the Channel Data Viewer tool to verify the model time channels, because it scans all its values together. These values should appear in sync.
Stephen and Jarrod,
So if I execute on a PC target the model and system time start once I hit 'Run Workspace', while models executed on an RT target start their time as soon as I turn on my RT controller and just keeps going until I either turn the controller off or redeploy the file? From what you said and what I've observed that is what it appears to be doing.
As for the offset between the model time and system time, they both are going at the same rate because I made sure to set my model to run at the same rate as the control loop. There is an offset though, and when I hold the numbers in the channel data viewer there appears to be an offset of 1 or sometimes 2 hundredths of a second. I'm not sure if this will be a problem but I am curious to know if there is supposed to be this offset and what is causing it.
Ah, OK. I think the second issue (time difference between model time and system time) is that the VeriStand Engine technically starts at time delta t, not zero, whereas models start at time 0. It was a quirk we didn't notice until recently, because as Stephen noted, you don't generally ever get the Workspace up and running until the target has been running for a while.