LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Queued Message Handler Timing

Solved!
Go to solution
Highlighted

I am writing a program to control our tempering oven. Currently, the program is working great. I am able to run profiles and update setpoints, read process values, update deadbands, update heating and cooling modes, etc. I am now finalizing the program but have run into an issue. Currently the program is taking a datapoint of the process value every second. Going forward, we only will need a data point every minute. I changed my timing to accommodate this and noticed that it caused my message handler loop to respond slowly as it has to wait 1 minute before the default case executes. Is there a simple way to get data points each minute without heavy modification of this program and without slowing down the message handler loop? Also, any other feedback on this program would be greatly appreciated. Thank you in advance.

0 Kudos
Message 1 of 7
(305 Views)
Highlighted

If your loop runs once per second (good for getting data that you'll use to keep the loop fairly "current"), there's nothing that says you have to save all of that data.  Count the points, and save every 60th (or once/minute).  

 

Bob Schor

Message 2 of 7
(293 Views)
Highlighted

Yes, that was my initial thought. I just wasn't sure how to implement that with my current setup.

0 Kudos
Message 3 of 7
(239 Views)
Highlighted
Solution
Accepted by Cannon_Controls

@Cannon_Controls wrote:

Yes, that was my initial thought. I just wasn't sure how to implement that with my current setup.


I think @Bob_Schor described how to implement it.

 

@Bob_Schor wrote:

Count the points, and save every 60th (or once/minute).


Something like this:

Output_every_60th_value_JoB.png

Notes on the case structures.

  • "Update UI", Default is the only case in the outer case of the snippet. (You would wire the "index" shift register through each case. Retain the value, only increment when you get a new data point.)
  • The False case in the inner case structure is completely empty.

Output_every_60th_value_JoB_Empty_False.png

(I took the liberty of only using a 10 ms wait to make this example easier to see when running.)

 

 

Does this make sense?

 

-joeorbob

 

0 Kudos
Message 4 of 7
(222 Views)
Highlighted

That makes perfect sense. Thank you so much for your help and the great solution.

0 Kudos
Message 5 of 7
(197 Views)
Highlighted

@Cannon_Controls wrote:

That makes perfect sense. Thank you so much for your help and the great solution.


I just looked at what I posted...If you only need to use it in the "Update UI" case, you can replace the shift register with one of these:

Spoiler
Output_every_60th_value_JoB_alternate.png
Output_every_60th_value_JoB_alternate2.png

Either one would simplify the diagram by pulling the Shift Register out so that the other cases didn't need it.

 

A better solution might be to use Time to track how often you need to save off data - it would be less dependent on magic numbers (like 60 and a Wait (ms) of 1000) and could save off the data every minute, independent of any loop timing changes.

 

-joeorbob

 

0 Kudos
Message 6 of 7
(144 Views)
Highlighted

That is a much cleaner way to do that. Thank you for the insight. I ran a temperature profile with it last night and it worked great. Appreciate the help.

0 Kudos
Message 7 of 7
(123 Views)