question

lovestudy avatar image
0 Likes"
lovestudy asked Joerg Vogel edited

Crane collision

Hello friends, I am currently facing a problem that I cannot solve on my own and urgently need help. At the beginning, if machine 1 has no task, move to temporary storage area 2 to avoid collision with crane 2. When both cranes have tasks, determine whether one of the cranes is performing an unloading task and whether its destination is temporary storage area 4. If so, the corresponding crane needs to move to absorber 1. But the current problem is that collision avoidance can be achieved when the crane has no task, but if it is unloading a task and the destination is temporary storage area 4, the code will not execute. Please help me check where the mistake is. Thank you very much.picture.png代码.png

FlexSim 23.2.3
agent systemcollisionscancel
picture.png (201.8 KiB)
代码.png (146.0 KiB)
· 7
5 |100000

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

In the first picture it looks like the cranes are getting task sequences from fixed resources. Those always consist of the tasks (Travel, Load, Break, Travel, Unload) in that order. In the code you are checking whether the first task in the tasksequence is an unload task which it would never be. You should check the fifth instead.

At least that is what I assume is going wrong based on the screenshots.

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

Thank you very much for taking the time to answer. Activets=gettasksequence (this object, 0) refers to the task currently being executed in the sequence of tasks. Did I make a mistake here? If this is incorrect, how can I obtain the current task sequence that is being executed and which task is the first. Thank you very much.

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

Here, I used the task sequence, and the screenshots below are my task sequence and subtask sequence screenshots微信图片-20241218204433.png1.png

0 Likes 0 ·
1.png (45.9 KiB)
Felix Möhlmann avatar image Felix Möhlmann lovestudy commented ·

gettasksequence(obj, 0) gets the currently active task sequence, yes. One task sequence contains multiple tasks and in your case the unload task is the fourth one. In your code you have "gettasktype(activets, 1) == TASKTYPE_UNLOAD" which is always false, since the unload task is never at the start of the task sequence.

You are using deprecated commands in your code. You can check the online documentation for classes and their methods.

https://docs.flexsim.com/en/24.2/Reference/CodingInFlexSim/FlexScriptAPIReference/TaskExecuter/TaskExecuter.html

https://docs.flexsim.com/en/24.2/Reference/CodingInFlexSim/FlexScriptAPIReference/TaskExecuter/TaskSequence.html

0 Likes 0 ·
Show more comments
Joerg Vogel avatar image Joerg Vogel commented ·

@lovestudy,

@Felix Möhlmann,

attached an example that works in FlexSim 24.2 and records collisions of fixed resource queues in drawsurrogate objects of cranes. This allows to detect collisions alone based on bridge movements. The containers are currently Runner2 objects.

crane_collision_detectionFlexSim24.2

crane_collision_detection FlexSim23

0 Likes 0 ·

0 Answers