Lookout

cancel
Showing results for 
Search instead for 
Did you mean: 

Parsing the seconds from systime in Lookout

I guess there is a way to display the seconds. I got years, months, days, hours, minutes, but not the seconds.  I mean: there is no way I can display seconds counting 0 to 59 synchronized with the minutes.
 
How?
0 Kudos
Message 1 of 9
(4,426 Views)
As per the Help file, the $System.time "updates itself every minute, on the minute."  It will be nice, I agree, if this can be made to optionally update every second. 
 
The workaround is to use the NOW function.  Insert an Expression using the following statement and change the Numeric format to show seconds:
 
NOW(Pulse (true, 0:01, 0))
 
Regards,
 
-Khalid
Message 2 of 9
(4,417 Views)

That is simple and clean, Thanks. For display purposes works great, but I need more. 

How to take only the seconds from there and make it a numeric expression or pot? It looks like the numeric format option works only for the display of the object, hence I can not use text functions to "separate" the seconds. I need the seconds as a plain integer, shyncronized with the minutes.

Any other suggestions?

0 Kudos
Message 3 of 9
(4,408 Views)
If you'd like a pot that displays the seconds synchronized with the clock, just create a pot (0-59 range) with the following connections:
 
resetvalue=0
reset=TimeOfMinute(true, 0, 0)                
increment=Pulse (true, 0:01, 0)
 
This will create a counter that increments once per second and resets every minute.  *note* It will be invalid until the first minute transition occurs (maximum 59 seconds), after which it will stay synched to the clock. 
 
Hopefully this will meet your needs.
Cheers,

Matt Pollock
National Instruments
0 Kudos
Message 4 of 9
(4,394 Views)

That's a good idea Matt.  Here's another option:  use the following statement in an Expression:

right(text(now(Pulse (true, 0:01, 0)),"MM:SS"),2)

-Khalid

Message Edited by Khalid on 04-04-2006 02:00 PM

0 Kudos
Message 5 of 9
(4,389 Views)

Good tries folks!

For any average application, both suggestions are good. In my application a Spreadsheet object makes a 'csv' data collection running 20 samples per second. I can survive with +/- 1 or 2 data samplings (+/- 0.1 seconds max). Time synchronization is really important here.

Taking as a reference 'NOW(Pulse (true, 0:01, 0))', Matt's suggestion is almost one second ahead. The second '0'th is too short. Khalid's suggestion is almost one second behind. All the seconds have the same duration but there is a 0.7....0.8 sec delay. No one works well for me.

Is there any other "under the sleeve trick"?

0 Kudos
Message 6 of 9
(4,371 Views)

You can try increasing the pulse rate:

right(text(now(Pulse (true, 0:0.01, 0)),"MM:SS"),2)

See if that helps.  We will never be _exactly_ in sync with the system time because we are essentially polling the system time and then getting the seconds from it. 

-Khalid

0 Kudos
Message 7 of 9
(4,366 Views)
Thanks Khalid, none worked well for me.
 
Never mind, I'll modify a little the application, so I won't need too much time precision. If you want to keep this up, it will be followed.
 
Thanks again.
0 Kudos
Message 8 of 9
(4,353 Views)
Other possibility might be to have whatever PLC or device that is attached to Lookout produce time-tagged data, which would have the effect of tying the data exactly to the time that the event occured.

David
0 Kudos
Message 9 of 9
(4,342 Views)