LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

"relative" real time

Hello,

 

I need to be able to know what the present time is in my VI, but relative to when I hit the "start" button - not absolute time.  I have a process that takes about 0.3 seconds to complete.  I want the counter to run from 0 to the end of the process (.3) and tell me how many seconds have past in real time.  I.e. It will count 0.01 , 0.02 , 0.03 ......0.1 ....0.2..0.3.

 

Thanks

0 Kudos
Message 1 of 32
(3,040 Views)

You can use the tick count function to achieve that. Read the tick count value when your VI starts, then whenever you want to update the elapsed time subtract the start time from the current tick count value (will return the time in ms).

0 Kudos
Message 2 of 32
(3,034 Views)

That's what i thought but i can't get it to work.  i tried also using elapsed time but its not working either.  perhaps my case structures are confusing me.

 

attached is the VI.  can you show me?

0 Kudos
Message 3 of 32
(3,023 Views)

Could you attach your read vi?

 

Tim
GHSP
0 Kudos
Message 4 of 32
(3,014 Views)

here's the attached DAQ read

0 Kudos
Message 5 of 32
(3,009 Views)

You are not using Tick Count.  You are using Get Date/Time in Seconds, so you will not get fractions of a second.

You should also avoid using the Stacked Sequence Structure.  This leads to bad programming style (a long discussion that I don't want to get into).

 

I don't understand what you are trying to do.

 

You get data from the DAQ, and then offet each measurement by the timestamp?  Maybe I misread your code, but it does not seem to make sense.

 

 

0 Kudos
Message 6 of 32
(2,994 Views)

I was thinking the same thing as Ray R. I added a state machine to your code and cleaned it up a bit. I figure that we can get the process data step working better once we understand what you are doing.

Tim
GHSP
0 Kudos
Message 7 of 32
(2,989 Views)

Here is my setup:

 

I have a verticl axis wind turbine spinning in a wind tunnel at about 500 RPM (8 Hz).  A visual analog sensor is attached to the shaft at the bottom that detects 1 revolution of the shaft.  The analog sensor gives out a 5 volt signal.  I need to determine the RPM of the turbine.  I also need to determine the position of the shaft in real time relative to the starting position.

 

Later (i haven't built this part yet) the program will trigger on and off another VI when the shaft has turned certain degrees.

 

I hope this explains it.

 

Thanks again

0 Kudos
Message 8 of 32
(2,984 Views)

You want to add the time factor to the measured signal and create a waveform.  Ah ok..  that makes more sense.  But that is not what you code will do.

 

Unfortunately, I do not have time to create an example.  But the first thing would be to start from scratch on your main code.  Use the Tick Count.  Build an array of Tick Count values.  AT the end, simply subtract the entire array by the value of the first element[0]. 

 

Look into the waveform palette or better look under help menu and select find examples and type "waveform" in the search field.  There should be an example on how to build a waveform using data & timestamps. 

 

That would be a start...  I have not looked at the code changes by aeastet but it could also be a starting point.

 

 

0 Kudos
Message 9 of 32
(2,976 Views)

Hi Ray,

 

I'm new to labview so i'm trying to understand all of this.  Ray, the file you sent me runs one iteration and then stops.  i'm not familiar with the "message dispatcher" syntax you are using.

 

Also, I'm using labview 8.6

0 Kudos
Message 10 of 32
(2,964 Views)