question

cyc avatar image
0 Likes"
cyc asked cyc published

How to release operator when a processor is waiting for operator?

Hello, experts.

Thank you in advance for your help. I want to implement a function using a script in Flexsim.

Here's my question model: problem-model.fsm

The situation is illustrated in the attached image:1722916951480.png

At time = 1 second, Operator1 is traveling to Processor1. I want to use a script to free Operator1, meaning that Operator1 will not continue traveling to Processor1, and Processor1 should remain idle. Is it possible to do that? In my case, I use moveobject to send an item to another Processor for processing, and I use freeoperators() to release the Operator. However, in situations like this, freeoperators() doesn't seem to work.

Could anyone help me understand how to achieve this? I'm very grateful for any assistance.

FlexSim 24.1.0
freeoperatorwaiting for operatorchange status
1722916951480.png (412.7 KiB)
problem-model.fsm (33.9 KiB)
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

1 Answer

Felix Möhlmann avatar image
0 Likes"
Felix Möhlmann answered cyc published

"freeoperators()" is used to release operators that are currently doing the utilize task on the passed in item.

When this task has not been started, you can dispatch a preempting task sequence to the operator to interrupt the current one.

There are multiple possibilities of what to do with the original task sequence. You can delete it when preempting (PREEMPT_ABORT_ACTIVE), but then you'd need to create it again later. You could lower its priority so other tasks in the operator's task queue are done first. Or, as I do in the attached model, you move it to another object (dispatcher) to "hold onto it" for the time being and re-dispatch it to the operator or another task executer later.

problem-model1.fsm


problem-model1.fsm (36.3 KiB)
· 5
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

cyc avatar image cyc commented ·

Dear @Felix Möhlmann ,

I apologize for the missing comment; I don't know why it didn't go through. Your help means a lot to me.

Is it possible to reset the processor from 'waiting for operator' to 'idle'? The reason is that I don't want the processor to be needed move task sequence, and send it back. I was hoping for a simple solution, similar to destroyeventsofobject(), to reset the processor, but it seems that destroyeventsofobject() doesn't work in this situation.

1722933058755.pngproblem-model2.fsm


0 Likes 0 ·
1722933058755.png (292.9 KiB)
problem-model2.fsm (35.8 KiB)
cyc avatar image cyc cyc commented ·

It seems like the processor calls requestoperators() to call an operator for processing. Is there any way to reset or cancel this function or variable?

0 Likes 0 ·
Felix Möhlmann avatar image Felix Möhlmann cyc commented ·

If you want to free up the processor you do have to call destroyeventsofobject() on it, have the operator do the StopRequestFinish task and reset the variable that tells the processor to call an operator for the next item.

The original task sequence does not need to be preserved in this case and can be aborted upon preemption.

problem-model3.fsm

0 Likes 0 ·
problem-model3.fsm (35.9 KiB)
cyc avatar image cyc commented ·

Dear @Felix Möhlmann,

Thank you for your help; it means a lot to me.

I'm trying to simplify the process. Is it possible to change Processor1's state from 'waiting for operator' to 'idle' in task2.involved1? In other words, let Operator1 go to Processor2 to process.

problem-model2.fsm




0 Likes 0 ·
Felix Möhlmann avatar image Felix Möhlmann cyc commented ·

Yes, but you shouldn't do that. Processor2 will likely create its own task sequence and you wouldn't want to create a duplicate. If processor2 is also set to use the same operator then the operator will have the respective task sequence in its queue. If you increase its priority to be higher than that of the first task sequence, the operator will first work on processor2 after the preempting task sequence ends.

For example:

Object op1 = Model.find("Operator1");
TaskSequence curTS = op1.as(TaskExecuter).activeTaskSequence; curTS.priority = -1; TaskSequence newTS = TaskSequence.create(op1, 0, PREEMPT_ONLY); newTS.addTask(TASKTYPE_DELAY, NULL, NULL, 1, STATE_IDLE); newTS.dispatch();
0 Likes 0 ·