tags:

views:

68

answers:

1

Hi,

I am working on a project to automate the calibration tests for some usints at a small local company.

Part of the test requires me to issue 3 commands on 0, 5, 10, 15, 20 and 30 minutes to check stablility.

However, I am also required to do these commands for 10 seconds every minute too. These 10 seconds can be anywhere within each minute (1st 10 seconds, last 10 seconds, middle 10 secodns etc), so they need not clash with any of the 5, 10 ,15 minute checks.

Can I simply set up some timers to do these or is there a better way ? Should I use just one timer for the 5, 10, 20 minute test and another for the 10 second test or should I use a seperate timer for each ?

Also, is ther a delay command to stop processing for 5 seconds ? Instead of creating a loop to wait for a particular message to process ?

I know how I would have done this in Cobol, but being new to C# I am happy got take any advice given.

Any suggestions are most welcome.

A: 

I'd use two System.Timers.Timer objects. Their event is raised in a separate thread so you wouldn't have to worry about these separate checks clashing.

The other way is to have only one timer with small interval and within the event check what you have to do on this (if time since last minute check > 1 minute, then go into the 10 seconds command set. If 5 minutes have passed since the last stability check, then go do that). This will ensure only one set of checks/commands is executed at any one time, and if the two were to clash, one of the two would just be delayed until the next time the event was raised.

Rekreativc
Yes, I like your 2nd idea. That makes it much more manageable as far as I am concerned. I will give that a bash.Thanks everyone for all the ideas.
George