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!