12-12-2018 02:01 PM
Hi There,
Following on from another question which was solved, I am trying to run a loop multiple times with just one output from a queue.
I am outputting a boolean array which represents heater state into a queue which is then read by a consumer loop.
I would like the consumer loop to continuously run once this array is recieved rather than running once and waiting another value from the queue, this is as once the heaters are selected on/off the PID will take over on the on states.
Is this completly the wrong way to use an event structure queue?
Any help is appreciated.
Solved! Go to Solution.
12-12-2018 02:25 PM
I can't open your VI, but when I've needed to do this in the past I use a shift register wired to the "timeout" input of "dequeue element."
I initialize it to -1, and when it gets a message that needs to keep looping, it sets the value to 0. When a new command comes in it'll process it. If it gets the Stop message, I set the value back to -1.
You can also re-enqueue a message into the queue from the state that needs to keep looping, but you can end up with some weird conditions if you're not careful.
12-13-2018 02:53 AM
Hi Alex!
Using File » Save for Previous Version you save your VIs compatible to older versions of LabVIEW. Not everybody has access to LabVIEW 2018, especially on the Forum it makes sense to save a VI in e.g. LabVIEW 2014 format.
Apart from what Bert said, I'd underline as well that this is mainly a question about the architecture of your application. I assume this is what you want to achieve:
- Call your ovens' PIDs regularly, e.g. once a second.
- In case an oven is enabled, send the related PID's value to it, otherwise send a 0.
- Be able to change the enabled/disabled state per oven any time.
There are several possible solutions to this. All have specific dis-/advantages; which one you want to pick depends on your requirements. Just two ideas:
Apart from that two small comments on your code:
12-13-2018 04:50 AM
Hi Bert & ikaiser,
Thank you both for your replies. Yes that is essentially what I am trying to do.
Berts way seems simple even though I havent managed to make it work yet, I will have to wire a compound arithmetic OR to the Boolean array so that it loops whenever any block is enabled.
I Do like the FGV option as it seems like the more programatic way of doings things possibly? however I have never used them and don't quite understand the exmple yet. Would using FGV mean that I dont need the Queue for the Boolean Array?
Thank you for your comments regarding the notifier, I was just trying to use a standard way of stopping all loops as in the end the program will have the following loops not driven by the event structure,
Data Producer Loop - (Main)
Data Manipulation Loop - Queue from (Main)
Write to Front Screen Loop - Queue from (Data Manipulation Loop)
Save Data Loop - Queue from (Data Manipulation Loop)
PID Loop - Driven by Event Structure to initiate then Queue from (Data Manipulation Loop)
Thanks
P.s files re-uploaded to v2014