LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Time measurement

Solved!
Go to solution

Hello everyone.

I have a solenoid valve which increases the pressure in a line automatically until it reaches a precise level I want to measure the time it takes to increase the pressure to this level. Someone can help me please

0 Kudos
Message 1 of 9
(1,321 Views)
Solution
Accepted by topic author Malaak1

@Malaak1 wrote:

Hello everyone.

I have a solenoid valve which increases the pressure in a line automatically until it reaches a precise level I want to measure the time it takes to increase the pressure to this level. Someone can help me please


  1. Use the "Elapsed Time" Express vi
  2. Hold the "Reset" input high (Reset)
  3. Start increasing the pressure
  4. Start the timer (Set Reset input low)
  5. Check the pressure
  6. IF pressure = the "precise" level
    1. Read the Elapsed time
    2. Else goto 5

Or

  1. Use "Get Date/Time In Seconds"
  2. Start increasing the pressure
  3. Get the current time and save it (TimeStart)
  4. Check the pressure
  5. IF pressure = the "precise" level
    1. Get the current time and save it (TimeEnd)
    2. Elapsed Time = TimeEnd - TimeStart
    3. Else goto 4
========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 2 of 9
(1,294 Views)

I create a timer but the problem is it goes back to 0 when the pressure reaches the pricese level, here is my programme to see what i did if you can help me please 

Download All
0 Kudos
Message 3 of 9
(1,234 Views)

Hi Malaak,

 

several problems in your VI(s):

  • Don't use local variables (like you do), e.g. "Test" in the "untitled" VI. Replace all those locals by wires!
  • You should not compare float values for equality! Otherwise you shoul dexpect unexpected results! 😄
  • Don't delete the labels of frontpanel elements! You may hide them in the frontpanel, but still show them in the block diagram!
  • Avoid duplicate code, like that case structure used to write the digital output! All that is different in the cases is this boolean constant, which already is defined by the case condition (aka "Test")…
  • the subVI may look like this:
  • are you sure you need all that code just to create a string showing the current time?

Please cleanup your VI for all these items and reattach it…

Best regards,
GerdW


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

Thanks for your answer, I am new with labview this is my first program. I will take all of this advice into consideration. but you still haven't answered my main question I want to measure the time it takes for the pressure to move from one level to another

0 Kudos
Message 5 of 9
(1,223 Views)

Hi Malaak,

 

this has been already explained in message #2…

Best regards,
GerdW


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

I want to opt for the 2nd solution, How can I save the current time when the pressure start increasing and the same when it reaches the precise level so I can do the subtraction

0 Kudos
Message 7 of 9
(1,206 Views)

@Malaak1 wrote:

I want to opt for the 2nd solution, How can I save the current time when the pressure start increasing and the same when it reaches the precise level so I can do the subtraction


I suggest using a Shift Register to store the start time

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 8 of 9
(1,193 Views)

Thank you

0 Kudos
Message 9 of 9
(1,178 Views)