question

anon-user avatar image
0 Likes"
anon-user asked Phil BoBo commented

Best way to work with multiple AStar Networks?

I want to use multiple AStars in a model (one for each floor of a building) and have the ability to switch operators between the AStars as they change floors. Once I started building out a demo model (In Flexsim 2019.0) I ran into some of the quirks of having multiple AStars in a model (some are the same as in 2018 and some are new). Below is a list of the questions I have/problems I ran into. Below that is a detailed description of the process I went through to come across those problems. Hopefully that detailed description makes it more clear what I was trying to do, so if what I'm doing is extremely wrong (likely :D) it's easier to see. I have also attached example models (each one is a step in the process I detail below).

1. Will AStars get their Quick Properties window back? In 2019 their quick properties are blank.

2. Is formal support for multiple AStars coming? Is multiple AStars something we shouldn't even be trying now? (It seems to work fine enough, the workflow is just a bit of a pain. See below).

3. Is there a better way to switch operators between AStars at runtime other than the function_s("addMember") command?

4. What is the best way to ID every barrier/path/etc. that belongs to an AStar network? The AStar's properties don't list its dividers/etc. and the divider's/etc. properties don't mention what AStar they belong to. It seems like the AStar's variable "barriers" (in the model tree) might be the best, but the references are messy. Maybe track them manually in Groups?

5. Is there any guideline on AStar performance? Are 5 smaller AStar networks faster than 1 large AStar network? In my head, smaller networks should be faster, but my head is usually wrong. I am curious about this because I considered doing 1 large AStar network and each divider/barrier would have a condition that it only applies to objects that are on its floor. But having multiple AStars lets me show/hide them separately, which is nice.

Below is the description of the process I went through to get multiple AStars in a model and then have operators be able to switch between them as needed.

I start with 1 AStar object with 1 divider (multiple legs) and one travel member (Operator1).

When I try to add another AStar object from the library nothing happens. When I try to copy and paste the existing AStar object it becomes apparent why (or seems to become apparent): Flexsim doesn't add the object number after the object's name (e.g. AStar41) like we see with other objects, so it fails because the name isn't unique. (exception: FlexScript exception: VIEW:/nodefunctions/setuniquename)

(AStar Test 2019 Step 1)

Okay, so I change the name of the existing AStar Object from "AStarNavigator" to "AStarFirstFloor", then add a new AStar object from the library. It works now and the new one comes in with the default "AStarNavigator" name. I add a divider (with multiple legs) and one travel member (Operator2) to "AStarNavigator" and change its color to pink (from its tree, since it no longer has quick properties).

(AStar Test 2019 Step 2)

Now, if I want to go back and add to AStarFirstFloor I run into a problem. The AStar object no longer has a "Barriers" tab, so I can only add to it by copy and pasting other dividers/barriers or by dragging them out from the library (without touching function_s methods. As far as I know). But when I drag out a divider from the library (or copy and paste an existing one) it is always added to the AStar with the name "AStarNavigator". If no AStar object has the name "AStarNavigator", when you add a new divider/barrier to the model it will create an AStar object named "AStarNavigator". So I rename "AStarNavigator" to "AStarSecondFloor", rename "AStarFirstFloor" to "AStarNavigator" and then make my changes to "AStarNavigator" (I add 3 dividers to it). The first two I add by dragging and dropping the divider object from the library and the last one I add by copy and pasting. Once I'm done with the changes I change the name back to "AStarFirstFloor".

There is a new problem though, the divider that I copy and pasted isn't "snapping to grid" like the others in "AStarFirstFloor" (which is what "AStarFirstFloor" is set to do). I think the model tree shows us why this is happening. Right now, the model tree looks like the attached image. AStarFirstFloor has subnodes for 4 dividers. AStarSecondFloor has no subnodes (despite having a divider). And there is a divider as a subnode of model (Divider10).

This seems to be because whenever you add a divider to the model from the library, that divider becomes a subnode of the first AStar Object in the model tree. Which happens to be AStarFirstFloor here. If you copy and paste a divider it becomes a subnode of the model node. It seems that some of a divider's properties are then inherited from the AStar Object it is a subnode of. Since Divider10 isn't a subnode of an AStar object, it doesn't know to "Snap to grid" and is moving freely.

There is a second quirk here as well. "AStarSecondFloor" has no dividers as subnodes, but "Divider2" clearly belongs to it(and is affecting the runtime model as such). In "AStarSecondFloor"’s tree, under the "barriers" variable there is a subnode for "AStarFirstFloor/Divider2>stats/navigator/1". So “AStarSecondFloor" seems to know that "Divider2" belongs to it, even though "Divider2" is a subnode of "AStarFirstFloor". So it looks like there is a disconnect between what AStar a divider belongs to and what AStar a divider is a subnode of in the model tree (and maybe inherit some of its properties from).

Let's test this real quick by turning off "Snap Dividers to Grid" in "AStarSecondFloor". When I do this and move "Divider2", it still snaps to grid (because "Divider2" is a subnode of "AStarFirstFloor"). If I turn off "Snap Dividers to Grid" in "AStarFirstFloor", then "Divider2" will move freely.

This isn't entirely correct though, because when I uncheck "Show Barriers" in an AStar objects "Visual" properties, it still hides all the barriers that belong to the AStar object (the ones we want to hide), regardless of what AStar the divider/barrier is a subnode of in the model tree. If I uncheck "Show barriers" for "AStarSecondFloor" it still hides "Divider2". Even though the "Snap Dividers to Grid" option doesn't impact "Divider2". So the "Snap Dividers to Grid" behavior may be an outlier. Or it may be related to what’s going on when Copy and Pasting. Either way, it seems there is a disconnect in some cases between what AStar a divider (or barrier/preferred path/etc.) belongs to and what AStar it is a subnode of in the model tree.

(AStar Test 2019 Step 3)

Lastly, I want an operator to be able to switch between AStars. To get this to work at runtime I call the function_s(AStarObject, "addMember", memberToAdd) command. It works in switching the AStar the operator is on, but it also teleports the operator. To prevent the teleport I save the operator's location to some variables, switch the AStar the operator is on, and then immediately teleport the operator back to their saved location. This seems to work well, but if there's a better way please let me know.

(AStar Test 2019 Step 4)

So my workflow for mutliple AStars largely depends on changing the AStar I want to tweak's name to "AStarNavigator" and then changing it back once I'm done editing it. It's not terrible, but not great, and I'm worried there may be some trouble going on behind on the scenes in Flexsim that will cause problems later.

Any help/input is appreciated, thanks!

bugastarastar navigatormultifloor
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

·
Phil BoBo avatar image
4 Likes"
Phil BoBo answered Phil BoBo commented

1. The quick properties for adjusting the object's shape and location were purposefully removed in FlexSim 2019 because the way the A* Navigator draws its shape was changed so that the object itself is always at position [0,0,0] and size [1,1,1] and the 3D shape that is drawn is a surrogate object of the main object. I'll add a note to the dev list to consider adding widgets that let you adjust the surrogate object's positioning in quick properties.

2. FlexSim 2019 Update 1 includes support for multiple grids on the A* Navigator. Using this functionality, you can have multiple grids at the same Z level or different Z levels. You can use the Bridge object to connect them together.

You should only use one A* Navigator in your model. None of the UI for modifying the A* Navigator is designed for use with multiple navigators in one model. All of the UI for controlling the A* Navigator assumes you only have 1 in your model.

Just use one Navigator and use Bridge elements to connect your floors together. Prior to 19.1, all of your floors need to be at Z position 0, but in 19.1, you'll be able to have multiple grids at different Z locations if you want to model different floors above each other instead of side-by-side.

3-5. Don't use multiple A* Navigator objects.

· 2
5 |100000

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

anon-user avatar image anon-user commented ·

Thanks for the quick response @phil.bobo! Any word on when 19.1 is dropping?

0 Likes 0 ·
Phil BoBo avatar image Phil BoBo ♦♦ anon-user commented ·

19.1 Beta should be available sometime in March, and the final release of 19.1 should be sometime in April.

1 Like 1 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

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