Search code examples
simulationanylogic

Is there a function to get the current node that an AGV is in?


I'm modeling DES using material handling library that has multiple AGVs on guided path. There are a few rectangular nodes that covers some part of the path that AGV travel pass through. I have an event in the AGV that will trigger randomly. Once the event trigger, the action depends on which rectangular node the AGV is currently.

Question: Is there a Java function to get the name of the node that the AGV is currently in?

I have similar action to check the path that was set at 'On enter path' in transporterFleet box

if(path == path1) {
  action 1}
if(path == path2) {
  action 2}
if(path == path3) {
  action 3}
else {
  action 4}

but this time I need to get node name in 'action' within an event. Not sure what function there is.


Solution

  • You can do it the other way around:whenever an AGV enters a node, the node tells the AGV "store me":

    1. add a variable of type Node named myNode into your AGV agent type
    2. ensure your node has "access restrictions" enabled, butfeel free to set the capacity to infinity
    3. in the on-enter code of the node, write agent.myNode = self;

    Now, your AGVs will always "know" about their current node. On exit, you could reset it to null to avoid confusions