VeriStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Generating Data Pt by Pt in a Model

Hi, 

 

This is a bit of a twist relating to the post in the VS Playback of An Array. I would like tp generate a pt by pt signal from a LV model, as opposed to using a custom device or the real time stimulus tool. The reason for this is that we already have LV models that generate pt by pt signals, such as a sine, with or without noise ...

 

The model generates a sine wave based on a time (ti) variable read at each iteration. This time around we have a specific altered sine-like signal, more like a garbled sine that we want to generate in the HIL. I have a one cycle of this signal as a XY data set. In LV-RT this would be a no-brainer. How can I do this in VS though? Ideally I would pass the XY arrays for my data, and based on time t(i) I'd pick the proper Y value...

 

One idea that comes to mind is to have one model parameter being a XY cluster of 2 arrays (X and Y) ( or just 2 arrays) and dump into them the one-cycle data to be used in the model. At run time, based on ti+"modulo cycle time" I can pull the Y value out.

 

This approach has to be a "push", to pass the XY data once at the beginning, Any way to do a "pull" instead from the model side, from a file location on the RT side maybe ?

 

Thx.

Laurent

0 Kudos
Message 1 of 6
(6,060 Views)
sounds like you just need a look up table that is indexed by time that repeats forever. You can write the model as you mentioned (y array of data, x array of times) and have an input for system time. In NIVS, map the system time channel into the model. You can use the modulus divide to cause time to repeat over the range you need and use this time to grab the correct Y data. Interpolate if needed.

this would be easier if you created a simulation subsystem with LabVIEW control design and simulation. There is a look up table block you can just drop.... And the model has built in time, no need to map system time in.
Stephen B
0 Kudos
Message 2 of 6
(6,055 Views)
0 Kudos
Message 3 of 6
(6,054 Views)

HI Stephen,

Yes basically this is it, a lookup table. So I guess the only trick is to pass it at the right time, when this part of the model is activated...

 

Yes, Controls and Simulation Module...  good point, but we don't have the license for it. Maybe if I beg...

Thx

L.

0 Kudos
Message 4 of 6
(6,051 Views)

The question is how to pass the lookup table to the model. See this thread. Thx

L.

 

Smiley Frustrated

0 Kudos
Message 5 of 6
(6,030 Views)

Hi Laurent, 

 

Stephen can correct if I'm wrong, but I believe he meant for you to implement a lookup table within the model. Here's a little information on how you can create a look up table in LabVIEW: http://digital.ni.com/public.nsf/allkb/6E53D59537D50EAA8625735D0060BA2C

 

Also, the link in your previous post links back around to this thread. Did you mean to link a different thread?

 

Kind regards,

 

Alisha P

Applications Engineering

National Instruments 

0 Kudos
Message 6 of 6
(5,994 Views)