04-26-2017 06:59 PM
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.
Solved! Go to Solution.
04-26-2017 08:08 PM
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
04-26-2017 08:46 PM
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.
04-26-2017 08:50 PM
@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
04-27-2017 02:58 PM
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.
04-27-2017 03:31 PM
Thanks - it worked.