LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Fire Single Event After Midnight

Solved!
Go to solution

I have a VI I have written to check the status within a database. I have it so that it sends out an email if the status is true. I want to check the status just after midnight and fire off the email. I only want it to fire off the single event, and then reset so that it does the same thing every night just after midnight. I can not figure out how I can check the time and if it is true fire off the event. I have searched the forums and the internet to see if someone has done this, but I have found nothing. Is there a way to do this? Any help is greatly appreciated.

 

Dave

0 Kudos
Message 1 of 7
(4,508 Views)

Hi Dave,

 

I can think of a few ways this could be done. The most accurate might be to use the Get Date/Time In Seconds function and use LabVIEW's version of the modulus function to determine when midnight occurs. Alternatively, you could use a timer that measures 24 hour periods and executes every time the timer goes off. You'll still need to use the Get Date/Time In Seconds with a shift register though. Check out some FGV Timer examples if you are unfamiliar with the architecture. Also, you would probably have to start this timer manually at the time you want it to go off.

 

There are numerous other ways to do this, but the first option I have listed is how I would do it off the top of my head.

 

Best,

 

Duncan W.

0 Kudos
Message 2 of 7
(4,501 Views)
Solution
Accepted by DMerchen

The easiest solution I've ever found to this was to look at the day, and in a shift register or feedback node, compare it to the previous value for day, and if it is not equal, then do your event.  If it is equal (then midnight hasn't passed) and you should not trigger the event.  If you move time zones this will effect it, but if daylight savings occurs it will still happen since that is at 2AM.

 

Example_VI_BD.png

Message 3 of 7
(4,418 Views)

Thank you for your replies and for the example. It seems pretty straight forward and simple. I knew there must be a simple solution, I was just over thinking the whole thing!!

Thanks,

Dave

0 Kudos
Message 4 of 7
(4,402 Views)

@Hooovahh wrote:

  If you move time zones this will effect it,

 

 


Interesting thing I found out with LabVIEW is that if you change time zones on your PC, LabVIEW does not detect it while its running.  Only after you exit and restart LabVIEW will it detect the new time zone.

Message 5 of 7
(4,387 Views)

@RavensFan wrote:


Interesting thing I found out with LabVIEW is that if you change time zones on your PC, LabVIEW does not detect it while its running.  Only after you exit and restart LabVIEW will it detect the new time zone.


Oh interesting point, so I guess in this situation it should be fine.  I was more or less thinking of the situation where you ship a piece of equipment into a new timezone, and things are shifted, but then again if you ship the thing there's a pretty good chance it won't be setup at midnight the next day anyway.  This is a bigger issue when logging data in one timezone, and sending the files to another (assuming no standard like UTC is used)

0 Kudos
Message 6 of 7
(4,381 Views)

@Hooovahh wrote:

@RavensFan wrote:


Interesting thing I found out with LabVIEW is that if you change time zones on your PC, LabVIEW does not detect it while its running.  Only after you exit and restart LabVIEW will it detect the new time zone.


Oh interesting point, so I guess in this situation it should be fine.  I was more or less thinking of the situation where you ship a piece of equipment into a new timezone, and things are shifted, but then again if you ship the thing there's a pretty good chance it won't be setup at midnight the next day anyway.  This is a bigger issue when logging data in one timezone, and sending the files to another (assuming no standard like UTC is used)


Just saw this thread.  "%^<%I:%M:%S %p>T"  See that carret?  That is really nice to have in the display format for timestamp controls and constants you ship to other areas.

Somtimes Ill even do this

Capture.PNG


"Should be" isn't "Is" -Jay
0 Kudos
Message 7 of 7
(4,210 Views)