TIME Command
TurnipTruck
Posts: 1,485
Does anyone use the TIME command?
I am using it to send the current time to AXB-TMCs once a day in DEFINE_PROGRAM with a flag so my event only occurs once each time 06:00:00 comes around.
Is this a typical usage for the TIME command?
Does anyone find it otherwise useful?
Thanks!
I am using it to send the current time to AXB-TMCs once a day in DEFINE_PROGRAM with a flag so my event only occurs once each time 06:00:00 comes around.
Is this a typical usage for the TIME command?
Does anyone find it otherwise useful?
Thanks!
0
Comments
IF(TIME='23:00:00')
{
// SHUT SYSTEM DOWN
}
Joe
Or if you want to use the wildcard(??), valdating the expression for the entire minute:
IF (COMPARE_STRING(TIME,''12:00:??'))
{
// SHUT SYSTEM DOWN
}
i do things with TIME, like downloading tv guides early in the morning for the next day; reseting log files just after midnight; for very remote systems, i ensure they do a reboot at 4am every day (i don't want an inaccessible device that's 300 kilometres away to hang); if the time is equal to sunset, turn on some lights, or open/close blinds
i tend to place repeating, relative time events into a timeline. this is better for example when checking weather or news, every 60 minutes or so.
just my 2 cents worth.
Also keep in mind that the "If(Time='23:00:00')" will be true for a full second, and will execute multiple times. Make sure if you're doing something that should only be done once that you set a flag or somthing to make sure that it doesn't happen multiple times. I usually use a "Wait 11" for that purpose.
--D
The '??' wildcard will not work in NetLinx!!!
Some kind of funtion I'd do:
Please read Tech Note Number 555
However... nice to have functions to get the time elements numeric
Every 15 minutes
I use the seconds to allow for a short wait to keep the event from repeating during the duration of the minute. So I wait for 1.5 seconds whichs is 1/2 second longer than the duration of the second of which the event would evaluate as true and keep repeating through every pass if not for the wait and the local variable nSBRunOnce.
I use the time string for HVAC setbacks - we have a customer who sometimes turns zones off, but forgets to turn them back on. With Michigan weather - this can become an issue quickly from rapids temperature changes.
As a result in my timeline for feedback I use this:
IF(TIME='02:00:00')
{
//TO SAVE SPACE I WONT WRITE OUT THE LOOP,
//BUT IT IS A FOR LOOP THAT TURNS THE ZONES ON.
}
Works well.
vining,
You are absolutely right, which is why this time line is at 1000ms. It is a seperate timeline for the HVAC feedback. You do point out something that is a good detail that less experienced programmers might miss. Also you made me realize that I did not put enough detail in my hastily crafted post. Sorry to all for any confusion.
Dave