How to use A * when I create task executer using process flow?

How to use A * when I create task executer using process flow?

craig_dickson
Not applicable
124 Views
5 Replies
Message 1 of 6

How to use A * when I create task executer using process flow?

craig_dickson
Not applicable

[ FlexSim 20.1.0 ]

I defined a class of task executers using the flow item bin, and set it to use A*. But when I use process flow to create those task executers, the resulting TEs aren't in the A*. Is there a simple way to make sure they use A*? (If not, is there a complicated way? LOL)

Also I am using 20.1.1 but that's not in the pulldown below yet.

0 Likes
Accepted solutions (1)
125 Views
5 Replies
Replies (5)
Message 2 of 6

Matthew_Gillespie
Autodesk
Autodesk
Accepted solution

Here are the ways to do it currently:

1. In a custom code block after you create the person, use this code to attach the person to the A* Navigator

contextdragconnection(Model.find("AStarNavigator"), token.Person, 'A');

2. In the Create Object activity choose Create In and create the person in the A* Navigator, this will attach the person to the navigator. You might then need to move the person to where you actually want them.

3. Use the Create Person activity instead of Create Object. The Create Person activity automatically does this if there's an A* Navigator in the object. Note, however, that by adding this People activity it will also add a bunch of People groups, lists, and down behaviors to the model as well.



Matthew Gillespie
FlexSim Software Developer

Message 3 of 6

craig_dickson
Not applicable

@Matthew Gillespie First, to be clear I am not creating people; I am creating AMRs (Automated Mobile Mobots, the generic name for what Kiva does -- basically a smarter AGV). Can I use "create person" for this? (The main reason I am using process flow to create them is because there are a couple hundred of them in the facility; I was trying to save the tedium of creating them individually in 3d, and also to allow fewer in a particular run without worrying about parking out of the way.)

When I create the AMR in the A*, the model stops with the token at that activity, and when I reset it it seems like the Create activity at the top is disabled, and I need to either replace it with a new Create activity, or restart the model.

If I use the custom code block, it almost works, except that 1.) the graphics of my AMR are gone -- all that moves is the blue collision circle and 2.) when I reset the model the created AMR is still shown in the A* list, so after a few runs I end with qith quite a number of extra non-existent AMRs. So I suppose I need a trigger to clear all traveler members from A* on reset? What would that code look like?

0 Likes
Message 4 of 6

Matthew_Gillespie
Autodesk
Autodesk

OK, I see. It looks like the Add a New Task Executer Flowitem option in the FlowItem Bin doesn't quite set up the new TE flowitem correctly. We'll get that fixed. If you want to fix it in your model you can run this script:

treenode bin = Model.find("Tools/FlowItemBin");
for (int i = 1; i <= bin.subnodes.length; i++) {
    treenode obj = bin.subnodes.first;
    if (isclasstype(obj, "TaskExecuter")) {
        assertattribute(obj, "itemtype", 0);
        rebindobjectattributes(obj);

        treenode resetPosition = getvarnode(obj, "resetposition");
        clearcontents(resetPosition);
        set(resetPosition, 0);
    }
}

After doing that methods 1 and 2 should work fine.



Matthew Gillespie
FlexSim Software Developer

0 Likes
Message 5 of 6

craig_dickson
Not applicable

@Matthew Gillespie So do I run this in a custom code activity each time I run the model? Or just once in the Script console?

And whichever I do, does that mean that the new AMR task executers do go away when I reset, so I can create the correct number of them each time the model runs, which is what I was hoping to do?

Thanks!

Craig


0 Likes
Message 6 of 6

Matthew_Gillespie
Autodesk
Autodesk

@Craig DIckson You just have to run it once in the script console. We released 20.1.2 this weekend which fixes that issue, so you could just install 20.1.2 and then create a TE flowitem.

Yes, things created from the flowitem bin are supposed to be deleted when you reset the model. This fixes the TE flowitem to behave the same way.



Matthew Gillespie
FlexSim Software Developer

0 Likes