LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Generate User Events

Here is something that I use a lot. You can set the wait to next year and still have the ability to stop at any time.

 

Open and run test timer. Note that there is no Wait (mS) function in the loop. You will want to add one so it isn't greedy.

=====================
LabVIEW 2012


0 Kudos
Message 11 of 14
(762 Views)

@Steve Chandler wrote:

 


@Mark Yedinak wrote:


 The only comment I have is that if the user is only looking for an event every Friday set your timeout accordingly. A timeout every 50 ms is WAY TOO many timeouts when looking for an event that occurs once a week.



Yes indeed, unless you want to know it's Friday right away which I usually do Smiley Very Happy

 

Better to come up with some algorithm that adjusts the timeout as Friday aproaches until it is eventually set to 0. But even firing an event every 50mS all week long will not hurt anything. Overkill yes but the CPU load will not be noticable and memory leaks will not happen. It should be fine (I think)


If you are using a reasonabley fast timeout for polling purposes I see no need to adjust the timeout period as you get close to Friday. I doubt the timing has to be that precise if you are dealing with a weekely event. I am sure your tolerance is probably several hundred milliseconds if not several seconds.

 

But yes, a self adjusting algorith is a very elegant solution and it is one that I do use.

 

I also agree that using the 50 ms timeout probably won't hurt but part of the design process is to minimize unnecessary processing. If your tolerance is several seconds then a timeout of 1 second will reduce the number of events to 1/20. It is always a prudent design decision to use practical and reasonable values for such events.



Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
0 Kudos
Message 12 of 14
(757 Views)

@Mark Yedinak wrote:

@Steve Chandler wrote:

 


@Mark Yedinak wrote:


 The only comment I have is that if the user is only looking for an event every Friday set your timeout accordingly. A timeout every 50 ms is WAY TOO many timeouts when looking for an event that occurs once a week.



Yes indeed, unless you want to know it's Friday right away which I usually do Smiley Very Happy

 

Better to come up with some algorithm that adjusts the timeout as Friday aproaches until it is eventually set to 0. But even firing an event every 50mS all week long will not hurt anything. Overkill yes but the CPU load will not be noticable and memory leaks will not happen. It should be fine (I think)


If you are using a reasonabley fast timeout for polling purposes I see no need to adjust the timeout period as you get close to Friday. I doubt the timing has to be that precise if you are dealing with a weekely event. I am sure your tolerance is probably several hundred milliseconds if not several seconds.

 

But yes, a self adjusting algorith is a very elegant solution and it is one that I do use.

 

I also agree that using the 50 ms timeout probably won't hurt but part of the design process is to minimize unnecessary processing. If your tolerance is several seconds then a timeout of 1 second will reduce the number of events to 1/20. It is always a prudent design decision to use practical and reasonable values for such events.


And, There is an elegnt example of a long-term suitable wait over here.  I would suggest modifying it slightly to listen for a "stop early" command. Or your weekend might never come.Smiley Wink


"Should be" isn't "Is" -Jay
0 Kudos
Message 13 of 14
(753 Views)

Thanks guys for your replies. I will check it out right now and come back with a good solution as your comments.

---
Silver_Shaper | CLD
0 Kudos
Message 14 of 14
(733 Views)