Get path reference in Conditional Rule

Get path reference in Conditional Rule

jacopo_r
Not applicable
26 Views
6 Replies
Message 1 of 7

Get path reference in Conditional Rule

jacopo_r
Not applicable

[ FlexSim 23.1.3 ]

Hi all,

I am trying to set a conditional rule for a straight path. I need to get the path reference in the code, so I can access a label I assigned to the path and then check if this label matches with a label on the AGV. Can someone help me out on how to do this, please?
Thanks

0 Likes
Accepted solutions (1)
27 Views
6 Replies
Replies (6)
Message 2 of 7

jason_lightfootVL7B4
Autodesk
Autodesk
Accepted solution

Just like AStar barrier rules the Conditional Rules are not object based so you can't get a reference to a path to find its attributes afaik. You can try to use the route cost which is a path based - but there you have no agv reference.

Alternatively look at the AGV Customization Delegate which may provide the required hooks for you to achieve your goal.

0 Likes
Message 3 of 7

jacopo_r
Not applicable
Thank you for the answer
0 Likes
Message 4 of 7

moehlmann_fe
Observer
Observer

You could also define a rule for each possible label value and then use code to switch which rule applies to the path depending on the path label.

Object path = Model.find("AGVNetwork/Path1");
treenode condition = getvarnode(path, "condition");
treenode pathConditions = Model.find("AGVNetwork>variables/pathConditions");
condition.value = pathConditions.subnodes[path.Type];

Or, as Jason mentioned, use the getPathTravelWeight hook of the customization delegate.

Message 5 of 7

jacopo_r
Not applicable

Thanks for the additional solution @Felix Möhlmann


I am not sure I understood it correctly, specifically where to place the suggested code.
To make it clearer, here's what I need to do.

I am simulating a container terminal and there are different storage sections. I want my trucks (AGVs) to drive on a storage connected path (see picture) only if they have to load or unload a container to or from that section, otherwise I would like them to use the lower path. My idea is to set a label on the path related to the storage with the reference of the storage section, while on the AGV I set a label with the reference of the section it has to drive to. Therefore if the label does not match, then an AGV should not be able to drive another path that is connected to another section.

Any suggestion for implementing this? thanks1692963144647.png

0 Likes
Message 6 of 7

moehlmann_fe
Observer
Observer
My idea mostly aimed at providing a way to change the rule a path is using on the fly. I don't think this would be necessary here.

Just create a rule for each such path, storing the required TE label value to travel on the path as a label on the respective storage object. After you know where the TE is going, change its label to the value stored on the storage object.

0 Likes
Message 7 of 7

jacopo_r
Not applicable
Your idea helped. Thanks
0 Likes