06-08-2013 05:58 PM
which is the best option to monitor a process time each hour throughout the whole week?
I am making a vi that have to do the next:
* Monitor every hour the status of a device,
* When the time has arrived, write down to the data base the status of the device
Coul you tell me which is the best option to monitor this kind of time (hours)? And whic is the best option to implement it, I am using 2 while loops, one to monitor the status of the device and other to monitor the time. In this way, when the time has arrived then I write to the data base.
Thanks
06-08-2013 06:26 PM - edited 06-08-2013 06:50 PM
You don't need separate loops, put both equipment acquisition and time/compare into 1 loop....shift register stores current and previous 'hour' values, when the hour changes>>compare: if not equal then do your acquisition code.... also, please do not post multiples of the same question. eventually someone will answer soon...if not , just bump it
06-08-2013 09:10 PM - edited 06-08-2013 09:16 PM
Alternately you could use something like the attached vi which is even simpler and uses practically no resources from the computer! 🙂 It goes to "sleep" for an entire hour yet it will respond right away when you hit the stop button... Only thing is that if you have other controls also tied in the event structure then Apok's approach works more consistently even through it uses some resources.
-DP
BatchTest Corp.
NI Alliance Partner
06-08-2013 09:19 PM
Note that the tick counter - which is used by the event structure timeout - is driven by a different oscillator than the Time of Day clock. Before relying on that you may want to check to see how much error you have over a week. The Time of Day clocks are usually synchronized to a network time server so any errors in the on-board clock oscillator are corrected over whatever time server correction interval is used. The tick counter oscillator has no such correction.
Also be aware that any other event will reset the timer. The Stop event does not matter of course. If other events are to be used, careful planning and possibly a second event structure (which is normally NOT recommended) may be appropriate.
Lynn
06-08-2013 10:38 PM
Actually the Time of Day clocks are more inaccurate (several mSec inaccuracy) than event timeouts which I believe are based on a free running counter on hardware level. So if the user needs better accuracy, he/she would have to use RT or some sort of more accurate hardware-based counter/clock (maybe an add-on board). However, for practical purposes I don't know why a user would take data only every hour and worry about a few milliseconds of inaccuracy.
Regarding timeout prematurely occuring due to any other event, true, and that's what I mentioned in my previous note too - in which case other posted vi would be more appropriate.
-DP
BatchTest Corp.
NI Alliance Partner
06-13-2013 12:11 AM
Hi,
Thanks for your answers, please tell me If the code that I am attaching will work properly. I want to stop the monitoring when an event occurs. Regards
06-13-2013 12:58 AM
it is hard to understand the whole picture, with just a picture...post the vi please
06-13-2013 04:02 AM
If the job is to monitor something once an hour, do 5ms or even a second make a tangible difference?
/Y
06-13-2013 08:45 AM
Hi,
I am attaching the vi. Also, a few seconds make no a difference due the monitoring is each hour.
Thanks
06-13-2013 10:16 AM - edited 06-13-2013 10:23 AM
@IronFer wrote:
Hi,
Thanks for your answers, please tell me If the code that I am attaching will work properly. I want to stop the monitoring when an event occurs. Regards
what event are you waiting for? you need to put the event structure in a separate loop, otherwise your current loop hangs waiting for an user interface....then you can send a dynamic event to that separate event structured loop