Changing TaskSequence

Changing TaskSequence

pyunghee_o
Not applicable
952 Views
4 Replies
Message 1 of 5

Changing TaskSequence

pyunghee_o
Not applicable

[ FlexSim 20.0.2 ]

changing-tasksequence.fsm

I'm studying how to control the taskexecuter's tasksequence.

I made the code as below to change the tasksequence to avoid blocking when the destination processor is breakdown.

The problem that I can't solve now is, if the tasksequence has been changed at once, no more tasksequence is created after finishing the processing.

I don't want another solution, but I just want to know the reason why this problem is happen.

TaskSequence next_ts = gettasksequence(te, 1);

Object temp_task4_involve1 = gettaskinvolved(cur_ts,4,1);
Object temp_task5_involve1 = gettaskinvolved(next_ts,5,1);
Object temp_task5_involve2 = gettaskinvolved(cur_ts,5,2);

changetask(cur_ts, 4,TASKTYPE_TRAVEL,gettaskinvolved(next_ts,4,1));
changetask(cur_ts, 5,TASKTYPE_UNLOAD,gettaskinvolved(cur_ts,5,1),gettaskinvolved(next_ts,5,2));

changetask(next_ts, 4,TASKTYPE_TRAVEL,temp_task4_involve1);
changetask(next_ts, 5,TASKTYPE_UNLOAD,temp_task5_involve1,temp_task5_involve2);
next_ts.rank = 1;

cur_ts.dispatch();
Accepted solutions (1)
953 Views
4 Replies
Replies (4)
Message 2 of 5

Brandon_Peterson
Autodesk
Autodesk
Accepted solution

@Pyunghee O

In your model you are swapping the destination of one task sequence with a second one. While this seems like it should work on the surface, there are deeper reasons that will keep it from working. The underlying code for objects that handles the movement of flowitems between objects needs to keep track of a lot of information in order to ensure that capacities are not exceeded. Some of this information is not readily available and would be easy to get wrong or break if manipulated manually (as you have found out).

The reason that your model is stopping is because the flowitem is being unloaded at the wrong processor. In the picture below you can see that the flowitems have data stored on them for the Processor that they will be unloaded at. When they are unloaded at a different processor the code that is supposed to finish the transfer of the flowitem through the port connection does not execute correctly. The result in your model is that eventhough a flowitem has been transferred from Queue1 to each of the processors, neither of the processors recognizes that the flowitems have actually finished moving through the port connections. The result is that their input ports remain closed (second picture).

26730-2020-03-24-7-54-52.png

26731-2020-03-24-8-09-56.png

Going forward, the answer is yes, you could modify your code to take into account the information on the flowitems and swap that too. However, I am not sure that this would entirely solve the problem as there may be additional information stored somewhere else that I am unaware of. Also, when you get into a solution that manipulates the underlying default behavior of objects you run the risk of future problems if the default behavior is change in a future release.

I hope this answers your question,

Brandon

img src="https://damassets.autodesk.net/content/dam/autodesk/logos/autodesk-logo-primary-rgbblack-small_forum.png" >

Brandon Peterson
Principal Technology Consultant
>
Message 3 of 5

pyunghee_o
Not applicable
@Brandon Peterson

Thanks for your answer.

I had recognized the information on the flowitem was not correct and tried to access the values with getbundlevalue(), but I failed.

Could you let me know how I can swap the information on the flowitem?

0 Likes
Message 4 of 5

pyunghee_o
Not applicable

I've solved this problem through setting the nroftransportsin value as 0 like below code.

current.find(">variables/nroftransportsin").value = 0;

I don't know exactly what the meaning of this value is.

0 Likes
Message 5 of 5

Brandon_Peterson
Autodesk
Autodesk

@Pyunghee O

Yes, setting the value to zero solves the problem for now. However, I would not recommend it as a solution you should go with. Changing values that are used by the default logic of objects is not recommended. There is no way of knowing 100% that the changes you are making are not having an adverse affect somewhere else.

img src="https://damassets.autodesk.net/content/dam/autodesk/logos/autodesk-logo-primary-rgbblack-small_forum.png" >

Brandon Peterson
Principal Technology Consultant
>
0 Likes