LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

simulation interface toolkit question

I am using the SIT to interface to an aerodynamic simulink simulation that I have. Everything worked fine until yesterday when I went to add some writes into Labview. I have 9 or 10 variables in Simulink hooked up to NISinks. For each time step i want a set of those variable written to a file. I was having trouble getting this done so i decided to go into the Read Loop and Case Statement and write one variable at a time. It seems what is happening is that I am getting 30 samples of 1 variable in a row followed by 30 samples of another and so on until it finishes all variables. It then goes back to the beginning and gets the next 30 samples of the first variable and repeats. Eventually, Im going to want to send out 1 set of data to some motion control hardware and take in the response to generate the following set of data. This obviously cant be done if im getting 30 samples at a time. Does anyone know how to fix this so im getting 1 set of data from all 10 variables before moving on?
0 Kudos
Message 1 of 2
(2,545 Views)
norocky,

I see that you're using version 2 of the the Simulation Interface Toolkit, so that's what I'll discuss. When you're running a model in Simulink, the model may take several time steps before your host VI receives new data. Each time the SIT Read Loop in the host VI calls the Dequeue Element function, it will get a cluster which includes a number of data points for a single NI Sink. That's why you're seeing 30 samples for the first variable, followed by 30 samples for the next one, and so on.

You say that your ultimate plan is to take one time step worth of data and send it to a motion controller. If you want to get deterministic behavior in that system, you'll need to run your simulation on real-time hardware, by building a DLL out of your Simulink model. If you don't need deterministic behavior, then you have a couple of choices. If you're still interested in writing all the data to a file, then you could change the SIT Read Loop so that you call the Dequeue Element function once for each variable you have. Then, you can write a loop that interleaves the values from the queue, so that you get all the samples for one time step written out together. Or, you could use a To File block in your Simulink model, which would write data to a file. Or, you could upgrade to SIT 3.0, which has data logging support built in; it works in the way you're trying to achieve.

Here's what the configuration for SIT 3.0's data logging looks like, to give you an idea of what's possible:



Hope this helps,
Andrew

Message Edited by AndrewE on 04-11-2006 11:27 AM

0 Kudos
Message 2 of 2
(2,530 Views)