question

TTL avatar image
1 Like"
TTL asked Felix Möhlmann commented

Allocate all agv travel nodes at the same time

Hi there,


I am trying to create custom code that allocates all required nodes for a travel path after the OnAGVBuildTravelPath event which allocates all control points at the same time for an AGV's given travel path. This is in order to "pre-reserve" the control points as there are multiple AGV's in the space and would help with routing generation.

Right now, I am only able to get the default of allocating the next space and deallocating as it goes along.

Thanks

FlexSim 23.0.0
agvagvpathcontrolpoint
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

·
Felix Möhlmann avatar image
1 Like"
Felix Möhlmann answered Felix Möhlmann commented

The property that controls when a control point is allocated is the "stopDist", which is defined for each allocation point.

So you would read that value for the first point and then loop through all allocation points and set the property to the same value as the first.

Object current = ownerobject(c.up.value);
AGV agv = AGV(current);

if(agv.allocationPoints.length > 0)
{
    double firstStopDist = agv.allocationPoints[1].stopDist;
    for(int i = 2; i <= agv.allocationPoints.length; i++)
    {
        AGV.AllocationPoint allocPoint = agv.allocationPoints[i];
        allocPoint.stopDist = firstStopDist;
    }
}

allocateAllAtStart.fsm


· 4
5 |100000

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

TTL avatar image TTL commented ·
Thank you! That successfully allows me to allocate the forward control points in a path all at once. Am I able to keep those control points allocated until I have reached the last control point somehow with the traversal distance?
0 Likes 0 ·
Felix Möhlmann avatar image Felix Möhlmann TTL commented ·

Sure, set their "traversalDist" to be equal to the "arrivalDist" of the final point, so they stay allocated until the destination is reached. Just leave the final one as is, or it would not stay allcoated past the travel task.
(Can't test this right now, but the code should work)

Object current = ownerobject(c.up.value);
AGV agv = AGV(current);
if(agv.allocationPoints.length > 0)
{
    double firstStopDist = agv.allocationPoints[1].stopDist;
    double finalArrivalDist = agv.allocationsPoints[agv.allocationPoints.length].arrivalDist;
    for(int i = 2; i <= agv.allocationPoints.length; i++)
    {
        AGV.AllocationPoint allocPoint = agv.allocationPoints[i];
        allocPoint.stopDist = firstStopDist;
        if(i < agv.allocationPoints.length)
        {
            allocPoint.traversalDist = finalArrivalDist;
        }
    }
}
1 Like 1 ·
TTL avatar image TTL Felix Möhlmann commented ·

Thank you, the code you wrote is working for all but the first control point, it is still being deallocated once the agv has reached the 2nd control point.

0 Likes 0 ·
Show more comments

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.