Depending on how detailed you describe them, there are a huge number of ways of how transports can be implemented in FlexSim. On a broad level there are two options:
- Utilize port-connections and the "Use Transport" option to dispatch transport task sequences to Task Executers. This is mostly useful when the transport is a simple A to B and all transported items have the same origin and destination. Getting this to work well when different priorities, mixed destinations or other more complex logic comes into play is often not worth the effort. The second option is better suited for those cases.
- Implement custom task sequences. The AGV Process Flow template is essentially just one specific implementation of doing this. If the general behaviour (patrolling along a fixed route, picking up and dropping of items opportunistically) is what you want then it's a good option to use. If the goal is different (for example waiting at a park point until a given number of items is ready for transport or doing one run per hour), then a custom build Process Flow might at first seem daunting, but will ultimately be much easier to build than chaning the AGV template to fit your needs.
The information about the destination could be given in a variety of ways. It might be stored in a global table or as labels on the origin object or as fixed references in code fields. The AGV Process Flow template uses a label "destination" on the item, for example (which gets added as part of the "Push to List" option in the "Use Transport" field when you use port-connections for the routing. This means you could also add this label through other means and then push the item to the AGV work list, if you don't want to use port-connections.
In regards to using modelling a tugger train:
The code you put into the OnReceiveTaskSequence trigger only adds a move object task to task sequences containing five tasks (the default transport task sequence: travel - load - break - travel - unload). The AGV Process Flow template gives individual tasks to the vehicles, so this code doesn't do anything.
You could move the items to a 'trailer' in the OnLoad trigger or do so in a Custom Code activity in Process Flow after the load task. You should be aware though that the statistics of the AGV will be wrong when doing this. The items in the totes will not count as 'content' of the AGV. This also means that the AGV's travel state will always be "Travel Loaded" (when the totes were attached as trailers through the automatic option that does so for loaded items) or "Travel Empty" (when they are attached through a Custom Code activity). It's possible to work around this but that will add more complexity to the model. So if the statistics are important, think about whether the added visual fidelity of having trailers attached to the AGV is worth it.
I have attached an example model where I showcase some useful techniques. Mostly the usage of lists. If you haven't already, I would recommend you check out the Task Logic tutorial. It can help to understand the different options of how (transport) tasks can be implemented in FlexSim.