Re: Design Problem



On Mon, 6 Feb 2006 12:34:41 +0100, "Ole Weigelt"
<o.weigelt@xxxxxxxxxxxxxx> wrote:

<snip>

My hunch is that there is a bunch of machines on the other end of the
COM Port, and that the 'instructions' contain a destination flag
- one machine is given a task
- while it is busy, he wants to send a task to another machine

If that is the case, then I think I can see a solution
- but ... more info would be helpful


We're coming closer.

What I have is a Building Management System (BMS) on the other side of the
COM-Port. The tasks are instructions to the BMS.

The tasks are i.e.: open a window, wait x seconds, close it again. So far
for the pause.

Now, while the window is open, i need to be able to switch some lights. That
is why the tasks need to be able to overlap.

During the whole thing, I need to listen for status messages and button
pushes that are reported through the same COM port.

Does that help?

It sure does

Do you know that you will want to run Task2 when you send the Task1
data ?

If so then you could 'merge' the tasks into one mega-task and just
send that

If not, then you have a situation where Task1 is running, probably
paused for hours, and you suddenly decide to run Task2

Does it matter if Task1 and Task2 get interleaved ?
eg:
Task1.Line1
Task1.Line2
Task2.Line1
Task1.Line3
Task2.Line2

If not you could set up a list of scheduled tasks with a time against
each line, simply add new tasks to the end of the list and have a
routine that picks the next Task Line regardless of which task it
belongs to.

eg: Task1.Line1 16:00
Task1.Line2 16:00
Task1.Line3 16:40 ' wait 40 mins
Task1.Line4 16:40 ' immediately after Line2
Task2.Line1 16:03 ' added at 16:03 so immediate
Task2.Line2 16:04 ' wait 1 min

Scanning the list, you could pick of the Task.Line with the next
'expired' wait time, send it and delete the line

It would give natural priority to earlier Tasks, but that should be no
problem.

Recording each line sent in a log file would also provide an
interesting audit of exactly what happened, and when.

This method would only work if the Task list did not wait for
feedback, eg: the Task is executed blindly

Do you have 'feedback' within the Task ?
eg: Send command Wait until some feedback then send another command

Or does the system just pump out commands on a timed basis ?



.