LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to make a chart in LabVIEW that will plot something in an intermitant way?

I'm trying to make a chart in LabVIEW that will only plot voltage data when a switch relay is on. For instance, I'm draining out current from battery intermittantly (i.e. 2 seconds on... 2 mins off). I want to plot data only during "on" part of the test. I have tried use a while loop to control this, but I keep getting an error. Does anyone have experience with this kind of thing? Thanks.
0 Kudos
Message 1 of 6
(3,211 Views)
Two possibilites:

(1) You want a gap whenever the relay is off.
Use a "case" or "select" structure in front of the chart using the "relay on" boolean. In the true case, wire you voltage out. In the false case, use a "NaN" constant. (simply create a numberic diagram constant and type nan in it). Wire the output of this structure to the chart terminal.

(2) You don't want to update the chart when the relay is off.
Same as above, but place the chart inside the true case and leave the false case empty.
0 Kudos
Message 2 of 6
(3,211 Views)
Thank you, but my issue is little bit more complicated. Because my test is repetitive (on/off on/off...) at set time increment, I couldn't figure out a way to implement it using the case structure because I can't figure out a way to make the on and off cases alternate after certain period of time, so I used while loops, and it worked. Unfortunately, however, it won't let me graph the thing the way I want it to.
0 Kudos
Message 3 of 6
(3,211 Views)
> Thank you, but my issue is little bit more complicated. Because my
> test is repetitive (on/off on/off...) at set time increment, I
> couldn't figure out a way to implement it using the case structure
> because I can't figure out a way to make the on and off cases
> alternate after certain period of time, so I used while loops, and it
> worked. Unfortunately, however, it won't let me graph the thing the
> way I want it to.

If you timestamp the data using waveform datatypes, you can send it to a
chart, and when there is a sizeable delay between timestamps, it will
leave a gap in the chart.

Greg McKaskle
0 Kudos
Message 4 of 6
(3,211 Views)
Thank you, but I'm quite new at LabVIEW, and frankly, I don't have any clue what you mean by timestamping the data. Is there a way to do that with a while loop? Thank you.
0 Kudos
Message 5 of 6
(3,211 Views)
> Thank you, but I'm quite new at LabVIEW, and frankly, I don't have any
> clue what you mean by timestamping the data. Is there a way to do
> that with a while loop? Thank you.

I'm referring to the waveform datatype. When you acquire your voltage
readings, they may already have a valid timestamp associated with them,
or you might need to use the computer time if not.

A waveform is a timestamp, a samplind period, and an array of values.
It works fine with one value, but the sampling period is pretty much
ignored. You can build a waveform from these pieced using the Build
Waveform node from the Waveform palette.

If you are using express blocks, they dynamic datatype is also pretty
much a waveform, and can easi
ly be converted to a waveform if necessary.

I hope this gets you started. Post more specific questions if you get
stuck.

Greg McKaskle
0 Kudos
Message 6 of 6
(3,211 Views)