Table of Contents

Table of Contents

FlexScript Class - AGV

AGV

Description

Provides access to data and methods related to AGVs.

Properties

accumAheadAGV Gets the next AGV on an accumulating path.
ampHours Gets the number of amp hours remaining in the AGV's battery.
batteryLevel Gets or sets the ratio of (amp hours remaining)/(total amp hours) as a percentage.
currentCP Gets or sets the current control point for this AGV.
destination Gets the current destination of the AGV.
destinationCP Gets the current desination control point of the AGV.
finalDestinationCP Gets the final destination control point of the AGV.
object Provides access to Object methods and properties for this AGV.
originCP Gets the origin control point of the AGV.
overflowCP Gets/sets the control point to "overflow" to when the AGV is pushing trailers.
proximityState Gets the current proximity state of the AGV.
speed Gets the current speed of the AGV.
te Provides access to TaskExecuter methods and properties for this AGV.
trailers An array of AGV.Trailers comprising the set of trailers attached to this AGV.

Methods

attachTrailer Attaches the given object as a trailer on the AGV.
coupleTrain Attaches a train of trailers to this AGV, automatically calculating gaps, etc. based on network geometry.
detachTrailer Detaches the given trailer from the AGV.
getTrailer Gets a specific trailer based on an ahead/behind parameter, and a rank for the AGV driver.
redirect Redirects the AGV to a new destination, based on the given mode.
startRecharge Begins recharging the AGV's battery.
uncoupleTrain Detaches a train of trailers from this AGV, creating a separate AGV train.

Static Methods

AGV Creates an AGV object based on the given TaskExecuter.

Details

Do no remove, this fixes the anchor on doc.flexsim.com

AGV.accumAheadAGV

readonly AGV accumAheadAGV

Description

Gets the next AGV on an accumulating path.

If there is no AGV ahead of the current one, or if the path type is not accumulating, this property returns a null value.
AGV agv2; 
if (agv1.accumAheadAGV) 
	agv2 = agv1.accumAheadAGV;
Do no remove, this fixes the anchor on doc.flexsim.com

AGV.ampHours

readonly double ampHours

Description

Gets the number of amp hours remaining in the AGV's battery.

double ampHoursLeft = agv.ampHours;
Do no remove, this fixes the anchor on doc.flexsim.com

AGV.batteryLevel

double batteryLevel

Description

Gets or sets the ratio of (amp hours remaining)/(total amp hours) as a percentage.

double batteryLevel = agv.batterLevel;
Do no remove, this fixes the anchor on doc.flexsim.com

AGV.currentCP

treenode currentCP

Description

Gets or sets the current control point for this AGV.

treenode cp = agv.currentCP;
agv.currentCP = Model.find("MyCP");
Do no remove, this fixes the anchor on doc.flexsim.com

AGV.destination

readonly treenode destination

Description

Gets the current destination of the AGV.

If the destination is a FixedResource connected to a ControlPoint, this property will return the FixedResource treenode destination = agv.destination;
Do no remove, this fixes the anchor on doc.flexsim.com

AGV.destinationCP

readonly treenode destinationCP

Description

Gets the current desination control point of the AGV.

treenode destinationCP = agv.destinationCP;
Do no remove, this fixes the anchor on doc.flexsim.com

AGV.finalDestinationCP

readonly treenode finalDestinationCP

Description

Gets the final destination control point of the AGV.

The final destination control point can be changed when redirect() is called with REDIRECT_AS_FINAL. treenode finalDest = agv.finalDestinationCP;
Do no remove, this fixes the anchor on doc.flexsim.com

AGV.object

readonly Object object

Description

Provides access to Object methods and properties for this AGV.

Object object = agv.object;
Do no remove, this fixes the anchor on doc.flexsim.com

AGV.originCP

readonly treenode originCP

Description

Gets the origin control point of the AGV.

treenode originCP = agv.originCP;
Do no remove, this fixes the anchor on doc.flexsim.com

AGV.overflowCP

treenode overflowCP

Description

Gets/sets the control point to "overflow" to when the AGV is pushing trailers.

This is generally only needed if the AGV is pushing trailers. When pushing trailers, overflowCP defines a point on the AGV path network to which the AGV's trailers should "overflow", since those trailers will be pushed past the AGV's target destination.

overflowCP is controlled solely by the user. It is only automatically reset when the model is reset. Thus, if you set this property, you should reset it to 0 after finishing the operation where the it is applicable. If you do not reset it after its applicable travel operation, weird AGV path travel behavior may occur.

agv.overflowCP = Model.find("ControlPoint5");
Do no remove, this fixes the anchor on doc.flexsim.com

AGV.proximityState

readonly int proximityState

Description

Gets the current proximity state of the AGV.

A 0 indicates unrestricted. A 1 indicates that the AGV is stopped because of the AGV ahead of it.
if (agv.proximityState) {
// handle a stopped agv
...
}
Do no remove, this fixes the anchor on doc.flexsim.com

AGV.speed

readonly double speed

Description

Gets the current speed of the AGV.

double agvSpeed = agv.speed;
Do no remove, this fixes the anchor on doc.flexsim.com

AGV.te

readonly TaskExecuter te

Description

Provides access to TaskExecuter methods and properties for this AGV.

TaskExecuter te = agv.te;
Do no remove, this fixes the anchor on doc.flexsim.com

AGV.trailers

readonly trailers

Description

An array of AGV.Trailers comprising the set of trailers attached to this AGV.

The trailers are ordered from front to back. In other words the ahead-most trailer will be

agv.trailers[1]
, and the behind-most trailer will be
agv.trailers[agv.trailers.length]
.

Do no remove, this fixes the anchor on doc.flexsim.com

AGV.attachTrailer()

attachTrailer( treenode trailer , double gap , int behind , int detachRule )

Parameters

trailer The object that will trail the AGV
gap The trailer's distance from the next trailer or AGV
behind Sets the position of the trailer. Can be 0 or 1: 0 is ahead, 1 is behind
detachRule Sets the detach mode of the AGV. Can be 0 or 1: 0 is manual, 1 is automatic

Description

Attaches the given object as a trailer on the AGV.

If you attach the trailer using the manual detach mode, you must call detachTrailer() to detach the trailer.

agv.attachTrailer(trailerObj, 0.1, 1, 0);
Do no remove, this fixes the anchor on doc.flexsim.com

AGV.coupleTrain()

coupleTrain( treenode trailer )

Parameters

trailer The object that will be coupled to the AGV. If the trailer is itself an AGV, or is a trailer of an AGV, then the entire AGV train will be attached.

Description

Attaches a train of trailers to this AGV, automatically calculating gaps, etc. based on network geometry.

coupleTrain() is similar to attachTrailer(), with the following primary differences:

  • Whereas attachTrailer() attaches a single trailer to the AGV, coupleTrain() will attach all trailers that are part of another AGV train, if such a train exists.
  • While attachTrailer() requires you to define parameters like whether the trailer should be attached ahead or behind, gap distance, etc., coupleTrain(), on the other hand, automatically resolves these parameters based on the location of the trailer/train on the AGV path network.

There are two possible scenarios when coupling the trailer onto the AGV's train. Each scenario effects a different logic for coupling the train, as follows:

  1. The trailer is an independent object - When the trailer is not associated with another AGV train, the AGV will determine where to couple the trailer by analyzing simple spatial proximity. It retrieves the location of the trailer, and determines whether that location is ahead of the AGV or behind. Then, based on that determination, it resolves the gap between the trailer and the AGV's associated ahead/behind-most trailer by again analyzing spatial proximity. Further, since there is no AGV train associated with the trailer, it will couple only that trailer to the AGV, and no other objects.
  2. The trailer is itself another AGV, or is a trailer of another AGV - When the trailer is part of another AGV, the AGV will determine couple parameters by analyzing its own location on the AGV path network relative to the location of that other AGV on the path network. Ahead/behind attributes, gap, etc. are determined by doing a path network distance analysis between each end of each AGV, and coupling the train via the shortest resulting path between the train ends. This algorithm assumes that the AGV ends can reach each other via one or more paths that do not require a train direction switch. In other words, the trains' proximity to each on the network should be "close and intuitive", like how you would want to couple trains in a real life situation. Coupling across weird path geometries will result in undetermined behavior.

Use this method in conjunction with uncoupleTrain() to simulate coupling and uncoupling of cars in a train yard.

Do no remove, this fixes the anchor on doc.flexsim.com

AGV.detachTrailer()

detachTrailer( treenode trailer )

Parameters

trailer The trailer to detach from the AGV

Description

Detaches the given trailer from the AGV.

agv.detachTrailer(trailerObj);
Do no remove, this fixes the anchor on doc.flexsim.com

AGV.getTrailer()

AGV.Trailer getTrailer( int isBehind , int rankFromDriver )

Parameters

isBehind 1 if you want to access a trailer behind the AGV, and 0 if you want to access a trailer ahead of the AGV.
rankFromDriver The 1-based rank of the trailer from the AGV driver.

Description

Gets a specific trailer based on an ahead/behind parameter, and a rank for the AGV driver.

Object trailer = agv.getTrailer(1, 2).object;
Do no remove, this fixes the anchor on doc.flexsim.com

AGV.redirect()

redirect( Object newDest , int mode )

Parameters

newDest The new desination for the AGV to travel to
mode Determines what happens on redirect. Can have one of 4 values:

REDIRECT_AND_WAIT - if not redirected before arrival, the agv will wait at the destination until redirected
REDIRECT_AS_FINAL - the destination becomes the new final destination for the agv
REDIRECT_AND_CONTINUE_ON_ARRIVAL - the agv will continue to the final destination after arriving at the intermediate destination
REDIRECT_AND_CONTINUE_ON_PRE_ARRIVAL - the agv will continue to the final destination after pre-arriving at the intermediate destination (it will not decelerate to a stop)

Description

Redirects the AGV to a new destination, based on the given mode.

agv.redirect(newDest, REDIRECT_AS_FINAL);
Do no remove, this fixes the anchor on doc.flexsim.com

AGV.startRecharge()

double startRecharge( )

Returns

double The amount of time a full recharge will take

Description

Begins recharging the AGV's battery.

The battery recharges at the rate defined by the AGV type. Once the battery is fully recharged, recharging stops.
Do no remove, this fixes the anchor on doc.flexsim.com

AGV.uncoupleTrain()

uncoupleTrain( treenode trailer , treenode newDriver = 0 )

Parameters

trailer The trailer at which to uncouple from the train.
newDriver The object who will become the new "driver" AGV. If this object does not already have an AGV instance associated with it, then an AGV will be created. If newDriver is not passed as a parameter, or is 0, then the first trailer parameter will become the new driver.

If the new driver is not a TaskExecuter, then it will only contain AGV data for storing where the AGV train is on the path network. You will not be able to give the object travel tasks like you would a TaskExecuter.

Description

Detaches a train of trailers from this AGV, creating a separate AGV train.

AGV(current).uncoupleTrain(AGV(current).trailers[1].object);

Use this method in conjunction with coupleTrain() to simulate coupling and uncoupling of cars in a train yard.

Do no remove, this fixes the anchor on doc.flexsim.com

AGV.AGV()

static AGV AGV( treenode te )

Parameters

te A TaskExecuter that is connected to the AGV network as an AGV Traveler.

Returns

AGV An AGV object

Description

Creates an AGV object based on the given TaskExecuter.

An AGV object can only be accessed by calling this method. Casting from a treenode is not correct.
AGV agv = AGV(te); // correct
AGV agv = te; // incorrect