LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Waveform Chart - Plot every n Samples

Solved!
Go to solution

Hello, all, I have a question that has been bugging me for days. I'm running a main VI that records an "hour:" ever twelve iterations of the while loop. This probably isn't the most efficient way to do this, but that's not what I'm trying to change. I'm tracking another variable (energy) that I want to plot against "hours". My question is, how can I use the waveform chart to plot the value of "energy" every "hour", i.e. every twelve iterations?

 

I'm not using a real-time-stamp, though. This is pure simulation, it doesn't necessarily have to model actual time.

0 Kudos
Message 1 of 6
(2,940 Views)

I think it needs more context but it depends on how you want to do it. If all you care about is just plotting once every hour you can just put it in a while loop with 1 hour wait time. Otherwise you can set it to log once every hour which would be better but depends on what you wanna do... maybe like this? i dunno

 

FDSAFEAW.PNG

0 Kudos
Message 2 of 6
(2,911 Views)
Solution
Accepted by topic author engrstudent1

12 iterations per hour?!  That is one SLOW loop.  Typically, you want your loop rates to be more of the 100 to 500ms per iteration.

 

Anyways, use a shift register to hold a counter that you increment each iteration.  When you have reached your "hour", write to the chart and reset your counter.  Use a case structure.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 3 of 6
(2,900 Views)

@crossrulz wrote:

12 iterations per hour?!  That is one SLOW loop.  Typically, you want your loop rates to be more of the 100 to 500ms per iteration.

 

Anyways, use a shift register to hold a counter that you increment each iteration.  When you have reached your "hour", write to the chart and reset your counter.  Use a case structure.


This is probably better than my suggestion Smiley Very HappySmiley Very Happy

0 Kudos
Message 4 of 6
(2,898 Views)

It isn't an actual hour, it's just a figurative hour for simulation purposes. I currently have each iteration taking about 25 ms but I'll increase it once I have the entire thing working.

 

Thanks for the reply, I will try this.

0 Kudos
Message 5 of 6
(2,855 Views)

Thanks - it worked.

0 Kudos
Message 6 of 6
(2,851 Views)