07-21-2017 08:11 PM
Hi,
In my VI, i have to 10 valves and each valve has a "open status", "closed status", a "command to open" and a "command to close". Normaly my valve takes 3 seconds to be open after a request, so if the delay between a "command to open=True'' and the "status open= True" and "status close=False" (Yes, i have two sensors) is greater than 3 seconds i have an alarm.
In this example i am using 10 valves but normaly i have much more, so i am trying to treat the alarms in a way that i can easily increase or decrease the quantity of valves. My first approach was to make a cluster array and treat each index in a FOR loop, but i got stucked because of the time i have to wait before the alarm. Any sugestion??
i am sending an example of the vi with my unsuccessfully first approach. (i know that is not working)
thank you!!!
Solved! Go to Solution.
07-21-2017 11:00 PM
Are all valves opened at once or is each on it's own schedule? What commands a valve to open or close? I guess it is not the operator, so the array of cluster should not be a control but an indicator.
All you need is a loop that checks all clusters and an array of tick counts to keep track of start time for each array element at regular intervals. Whenever the "cmd open" is true, time >3s and status open is false, throw an alarm. Do you also need an alarm if a valve takes too long to close?
07-22-2017 08:43 AM
Hi Altenbach,
-The valves has it's own schedule to open.
-The command to open or close can come from the operator, so the operator can decide which valve he wants to open/close, or could come from a semiautomatically function, where the operator request an operation and a combination of valves shall open to achieve it, fulfill a tank for example.
-In the example i just have included the "not open" alarm, but i also have a "not closed" alarm and an incosistency alarm, when the valve is neither open or close, or open and close for more than x seconds. All these alarms can be in a cluster array, each valve in a cluster.
I did not understand what you said about the tick count array. could you give me an example?? How do i start the count when a command to open/close is set???
tks
07-22-2017 03:07 PM
Here is a quick draft that can hopefully get you started.
We have a manual command switch for each valve which will start the corresponding timer and switches the valve with a small probability to the new command state with each iteration of the while loop. If it takes longer than 3 seconds, an error is displayed but the switch time recorded until it happens. At the end you see the actual time it took for each valve to react to the command.
The code is fully scalable and works with unlimited number of valves (within reason!). For even more valves, you might want to use a 2D array.
Please let me know if anything is not clear.
07-23-2017 07:23 AM
Thank you Altenbach.
i am adapting to my code but i believe it gonna work!!!
07-23-2017 02:00 PM
It might be a bit cleaner to keep extra metadata (last command state, ticker, etc.) in the same cluster (hide these elements on the front pane!). Here's a quick and dirty rewrite.
(Note that the next evolution would be to use objects for all this :D).