question

Sofia G avatar image
0 Likes"
Sofia G asked Sofia G answered

How to change the preempt value of a task sequence depending on the item value?

Hello everyone,

I'm pretty new at this but I have started creating a model that has three types of items. The first queue send items 1 and 2 and the second one the item 3. Basically, the operator picks the items from the queues and put them in the processor. What I would like to do is to change the preempt value of task No.1 (move items from queue 1 to processor 1) based on the item value.

The operator is sent to the queues through the dispatcher using a pass to "first available unless preempting" and a "sort by task sequence priority" strategy. Additionally, the task sequence logic is in the queues.

I guess the logic would be something like:

int value = getitemtype(item);
switch(value)
{
case 1:  setpreempt(ts,100);
	 break;
case 2:  setpreempt(ts,100);
	 break;
default: return(0);
}

But, in case is correct, where does this logic goes? On the queue's Flow ? On a trigger? on the same code as the task sequence creation? or in the same dispatcher?

I would appreciate your help.

Thanks in advance.

capture1.png

FlexSim 16.2.2
task sequencetask sequence done by an operatorpreemptingtask sequence and processorsdisparcher
capture1.png (48.0 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.

Joerg Vogel avatar image
0 Likes"
Joerg Vogel answered

@Sofia G, You need a Tasksequence to use the command to change the preempt value. Preempting is a function which works on two tasksequences. A Taskexecuter (e.g. an operator) executes a tasksequence (a). This Taskexecuter gets something other to do by a second Tasksequence (b). The preempt Value of Tasksequence (b) defines in which order the execution of the tasksequences a or b goes on. If the value is greater than 0 then the Tasksequence (b) is instantly executed. The Tasksequence (a) is aborted and is sorted into the Tasksequencequeue. There are preempting Values which can destroy the Tasksequence (a) before the Tasksequence gets into the queue.

The preempting value has an effect if it can be evaluated by a taskexecuter. This happens if the taskexecuter receives the tasksequence. And this is done by dispatching a tasksequence.

If you want to change the preempt value the involved tasksequence must be in a tasksequencequeue or on a list and not an active tasksequence inside an executer. After changing the value a taskexecuter must know that there is something other to do. The tasksequence must be dispatched. This maybe a second time, if the sequence has been already dispatched to the executer.

The preempting value can you change as you mentioned in your question where ever you want but the tasksequence must be stored and not active. And then you have to make it active by dispatching it. Only if a taskexecuter can compare an incoming inactive tasksequence with an active tasksequence the preempting value has an effect.

Changing a preempting value has only a limited effect and you must act to get this effect as shown above.

Maybe you has something other in your mind when you wanted to change the preempting value of a tasksequence then ask another question what you want to achieve.

5 |100000

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

Sofia G avatar image
0 Likes"
Sofia G answered

Thanks @Jörg Vogel. I kind of understand what you are saying because I have been working with global tables as well and I think that might be a method change the preempt values, right?. I'm also following your advice and will post another question to specifically explain my problem.

On the other side: "If you want to change the preempt value the involved tasksequence must be in a tasksequencequeue or on a list and not an active tasksequence inside an executer. After changing the value a taskexecuter must know that there is something other to do. The tasksequence must be dispatched. This maybe a second time, if the sequence has been already dispatched to the executer."; If I'm using a dispatcher, how can I get the information about the tasks that are queued?, is it with the get gettasksequencequeue or gettasksequence? or what is the diffence between both commands?

Thanks a lot for your help.

5 |100000

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

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

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