question

Gabriel Morgante avatar image
1 Like"
Gabriel Morgante asked Gabriel Morgante commented

Crane collision logic with Agent System

Hello guys.

I've been trying to get the new agent system to work with cranes for a while but no success so far. I hope someone can help me solve this issue.

What I need is basically what used to work before the update, which is: If one crane with higher priority comes to certain distance the crane with less priority goes away. Including if it is performing a travel task. Using a priority label I could change the priority value on load/unload tasks and it worked great.

But now they removed the collision menu and the new Agent System doesn't seem to have been made with cranes in mind. At first sight it looks simples to just use social behavior and create a repel rule but it doesn't work on cranes, it makes the whole structure of the crane move away, not the moving part.

So I've been trying to make it work with Proximity Detection, sending a message to the crane that needs to move and with that message make it go away by process flow. It seems promising but I'm struggling with the preemption of the travel task.

i've attached a model with one of my tryouts. I would really appreciate any help on the matter.

Thanks!

Crane col agent system.fsm

FlexSim 21.0.2
flexsim 21.0.2agent modulecranescollision avoidancecollision problem
5 |100000

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

Afonso Teberga avatar image
4 Likes"
Afonso Teberga answered Gabriel Morgante commented

Hi @Gabriel Morgante, as Jörg suggested, you can get and adjust the crane collision logic available in previous versions of FlexSim. I believe the easiest and fastest solution at the moment would be to use this logic directly as a trigger in the agent proximity system. So you don't need to define a preemption logic using processflow.

The following model uses this strategy. If it is applicable to your case, you can copy the proximity trigger.

crane collision with agent system.fsm

You may change the following parameters, which are mostly the same as those from the previous version.

The only additional parameter is collisionradius. While the agent system proximity radius defines a detection sphere (or cylinder), the collision radius defines the minimum desired distance between cranes within the proximity radius and along the chosen axis. For your case, with that logic, I think the proximity radius should be approx. half the distance between both crane rails (~15m) and the collision radius = 5m (considering the value you've already chosen). The crane will move apart if the distance along the chosen axis is less than the collision radius. Clearly, it is not a completely efficient solution in terms of logic processing, but it should work. Perhaps other colleagues can suggest alternatives.

It is important to follow the instructions provided at how to avoid colision in cranes.

I also changed your model according to this suggestion:

crane-col-agent-system.fsm

Sucesso em seu modelo!


· 8
5 |100000

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

Gabriel Morgante avatar image Gabriel Morgante commented ·

@Afonso Teberga

Brilliant! This is exactly the solution I wanted!

Also thank you for making the extra effort to make it understandable for me with all the explanations inside the code!

I could not have asked for more. Case closed!

Muito obrigado amigo, facilitou a minha vida demais! Abraço!

0 Likes 0 ·
Patrick Cloutier avatar image Patrick Cloutier commented ·
Hello Afonso, I've been working for a week on a crane collision avoidance logic but it doesn't work so I decided to use yours. But it doesn't work all the time either. Sometimes the avoidance works and sometimes they go right through each other.

I can't send you the model here because it is confidential. I'd have to create a new private question.

But 2 things:

- My model is in millimeters instead of meters so I changed the parameters accordingly.

- All the tasks that the cranes do are controlled by a Process Flow (acquire, load, unload, release).

Could any of these explain my problem?

Or let me know if you have time to look at it and I will create a new private question to send you the model.

Thanks,

0 Likes 0 ·
Patrick Cloutier avatar image Patrick Cloutier Patrick Cloutier commented ·
I think the problem is that the crane Load Time can't be preempted. Is that possible?

I have a 15 seconds Load Time and Unload Time.

0 Likes 0 ·
Joerg Vogel avatar image Joerg Vogel Patrick Cloutier commented ·
Please consider, that you can implement load and unload times by a different construct in a model. You can replace those executed functions by utilize task sequences or just delay tasks. Then you would be able to preempt them. In real world you are not allowed to preempt those times because it is an enclosed process, that has got its own error handling routine.
0 Likes 0 ·
Show more comments
Gabriel Morgante avatar image Gabriel Morgante Patrick Cloutier commented ·
Patrick,


Have you checked if the collision radius that you have set is enough to prevent them from crossing each other being side by side?
What I mean is: if the width of the crane is 10meter and your collision radius is 3m, they could be crossing without collision if they are in opposite sides of the crane. It has happened to me.

0 Likes 0 ·
Patrick Cloutier avatar image Patrick Cloutier Gabriel Morgante commented ·
At first I had this problem but I changed the radius and that is no longer the problem.
0 Likes 0 ·
Show more comments
Joerg Vogel avatar image
0 Likes"
Joerg Vogel answered Gabriel Morgante commented

Probably you can start with this thread robot collision. A crane is special construct, because the Taskexecuter is just the hook. But a collision occurs between bridges first. Maybe you are able to place the involved objects to be a part of the drawsurrogate node, which represent the bridge node. Those components are objects nodes in a tree structure of the drawsurrogate node.

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

Gabriel Morgante avatar image Gabriel Morgante commented ·

Thanks for the answer.
I've seen the post about robot collision but it doesn't quite fit my situation.

It can detect correctly the collision on the hook, if you open my model you'll see the collision circle works great.
The problem is how to make the preemption work.

I was hopping for a simpler solution than to have to remodel all of the crane's behavior.

It seems the devs don't care too much about cranes and heavy indrustry since most of the new updates focus mainly on Health Care. The sad part isn't that I'm not getting any new features, I just wanted the old ones to still exist...

0 Likes 0 ·
Joerg Vogel avatar image Joerg Vogel Gabriel Morgante commented ·

If you have still access to an older version, you can copy the source code of the crane collision logic and adjust them to the agent triggers responses. The main idea of the older logic was to send the crane with a lower priority away from the collision area. The mechanism was a preempted Tasksequence to let travel the low priority crane some meters in opposite direction by a travel to location task wether in absolute coordinates or relatively. To prevent an immediate collision the higher priority crane gets a preempted Tasksequence, too. This Tasksequence let the crane wait some time to deactivate the collision state. The mechanism works without superior control unit, because each involved object knows his priority in relation to any other object. The object, that has to leave the collision area, sets his preempted Tasksequence a bit higher in priority in relation to the other crane, but the adjustment is not to the same level of the other crane. It is just as high as it is necessary if a collision in the future occurs, to let finish the transport job.

1 Like 1 ·
Gabriel Morgante avatar image Gabriel Morgante Joerg Vogel commented ·

Thank you for the help Vogel!

Ok I understand how it should work. But can you help me to model this whole preemption logic by process flow?

I don't know if you have seem the model I've attached. But what you said is exactly what I'm trying but no success with this preemption logic so far.

0 Likes 0 ·

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.