question

Pyunghee O avatar image
1 Like"
Pyunghee O asked Brandon Peterson commented

Changing TaskSequence

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();
FlexSim 20.0.2
agvtasksequence
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

Brandon Peterson avatar image
2 Likes"
Brandon Peterson answered Brandon Peterson commented

@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).

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


· 3
5 |100000

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

Pyunghee O avatar image Pyunghee O commented ·
@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 0 ·
Pyunghee O avatar image Pyunghee O commented ·

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 0 ·
Brandon Peterson avatar image Brandon Peterson ♦ Pyunghee O commented ·

@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.

0 Likes 0 ·