LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

setting vi to change set on/off length at various times

This is a vi that controls a valve to have a certain on/off time (set by vlv1lowsec and vlv1onsec). I'd like to edit this vi so that I could have the valve on/off time change while the script is running- ie., have one on/off time (e.g. 800ms/1200 ms) for 60 s, then change to a new on/off time (e.g. 2000 ms / 4000 ms) at 100 s. Is this possible..?

 

valvetime.PNG

0 Kudos
Message 1 of 10
(1,540 Views)

@labviewnoob81 wrote:

This is a vi that


No, this is just a partial picture of a block diagram. Quite useless for anyone trying to help.

0 Kudos
Message 2 of 10
(1,487 Views)

You need to use the Elapsed time as an input to the formula node and in that check which output should be sent as OnTime

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 3 of 10
(1,473 Views)

@Yamaeda wrote:

You need to use the Elapsed time as an input to the formula node and in that check which output should be sent as OnTime


There is really no way to give advice if we can't even see where the wires go (so many wires hidden under structures and going in all directions!). Shouldn't the elapse time express VI at least be inside the loop? (Or is there an outer loop that is not shown?)

0 Kudos
Message 4 of 10
(1,464 Views)

I attached the rest of the block diagram below. The vi ws too large to screenshot in one screen, so I uploaded two images. The rest of the vi has to do with data collection and is mostly unrelated with the valve control part of the vi...

 

snippet1.PNG

snippet2.PNG

  

0 Kudos
Message 5 of 10
(1,455 Views)

Yes, I had Elapsed Time as an input to the formula node, and I've put it in the loop now. I don't really understand how Time Elapsed worked, I thought that it would start counting as soon as the vi was run? Or is there something else I can use to that effect?

 

 

 

0 Kudos
Message 6 of 10
(1,453 Views)

@labviewnoob81 wrote:

I attached the rest of the block diagram below.   


Again, you are attaching pictures instead of the actual VI. There are till plenty of hidden wires where there is no way to tell the dataflow.

0 Kudos
Message 7 of 10
(1,447 Views)

ah, didn't realize i could attach the actual, vi, here it is

0 Kudos
Message 8 of 10
(1,444 Views)

Hi noob,

 

on your VI:

By deleting that 2nd graph, which shows the very same data as the first one, your VI uses only half the memory and also its filesize cuts down to ~5MB!

You really should cleanup that VI and create subVIs for certain parts. I would put all the DAQmx task initialization into subVIs, and also that filepath creation (which can be simplified by using FormatIntoString). This way the block diagram size will be reduced drastically and you gain more overview (aka code readability)!

This formula node can be replaced by some simple math nodes. I would replace the ClusterToArray by simple UnbundleByName nodes…

 

And yes, using ElapsedTime (or simply subtracting two timestamps…) helps you to get the elapsed time to decide on the change of the valve timing: but again I recommend to first clean up this huge VI before starting to add even more functionality!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 9 of 10
(1,424 Views)

@GerdW wrote:

 (or simply subtracting two timestamps…) 


... or subtracting two high resolution relative seconds as shown here.

0 Kudos
Message 10 of 10
(1,392 Views)