question

jacopo-r avatar image
0 Likes"
jacopo-r asked jacopo-r commented

Get path reference in Conditional Rule

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

FlexSim 23.1.3
agvnetworkconditional rule
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

Jason Lightfoot avatar image
0 Likes"
Jason Lightfoot answered jacopo-r commented

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.

· 5
5 |100000

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

Felix Möhlmann avatar image Felix Möhlmann commented ·

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.

1 Like 1 ·
jacopo-r avatar image jacopo-r Felix Möhlmann commented ·

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 0 ·
1692963144647.png (9.5 KiB)
Felix Möhlmann avatar image Felix Möhlmann jacopo-r commented ·
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 0 ·
Show more comments
jacopo-r avatar image jacopo-r commented ·
Thank you for the answer
0 Likes 0 ·