Skip to content
< All Topics

Route class

Routes are used in Experior to move loads following a track (linear, curve) without usage of the physics engine. Therefore routes are mainly used in discrete event mode. Routes are implemented in Experior using the abstract base class Experior.Core.Routes.Route. A straight route is implemented by the Experior.Core.Routes.Linear class, while a curved route is implemented by the Experior.Core.Routes.Curve class.

Routes may contain Action Points which typically represent destination points or decision points. By connecting routes Experior calculates the routing graph based on the nodes (action points) in the network. This routing graph can be used to calculate the shortest path to a new destination (Action Point).

To incorporate routes in the working area and other components they are usually encapsulated in a TransportSection assembly. The TransportSection assemblies themselves are used as building blocks in the different Track assemblies.

A Route keeps track of the loads that are moving on it and of the Action Points it contains.

Note: In discrete event mode loads are always on a Route or on an Action Point. (Loads that are Deletable will be automatically deleted by Experior when they are not on a Route or Action Point).

Main properties:

List ActionPoints: Getter property that returns all action points on this route.

LinkedList Loads: Getter property that returns all loads on this route.

Load First: Getter property returning the first load on this route.

Load Last: Getter property returning the last load on this route.

bool Bidirectional: Property that indicates whether Experior should consider this route as bidirectional or not when constructing the routing graph. Suppose the route between action points AP1 and AP2 is bidirectional than this means that the routing graph will have two edges between the vertices AP1 and AP2. In case the bidirectional property is false only 1 directed edge from AP1 to AP2 is available. Setting the bidirectional property has no impact on the actual movement of the loads: the developer still has to ensure that a load can move in opposite direction.

Motor Motor: Property that gets/sets the Motor used to control the movements of the loads on this Route. Changing the speed of the motor will change the speed by which loads move on its route and changing the speed sign will make the loads move in opposite direction.

Vector3 Start: Property that gets/sets the global position of the startpoint of the route.

Vector3 End: Property that gets/sets the global position of the endpoint of the route.

float Yaw: Getter property that returns the global Yaw of this route.

float Length: Property that gets/sets the total length of this route

bool Vertical: Property that gets or sets whether the route is vertical or not. This has an impact on how loads are positioned on the route.

bool Visible: Gets or sets a value indicating whether this Experior.Core.Routes.Route is visible.

float Yaw: Getter property that returns the global Yaw of this route

Main events:

event Route.ArrivedEvent Arrived: This event is raised when a load arrives. This is not synchronized with the discrete event execution.

event Route.LoadAddedEvent LoadAdded: This event is raised when a load is added to the route.

event Route.LoadRemovedEvent LoadRemoved: This event is raised when a load is removed from the route.

static event Route.UpdatedEvent Updated: This event is raised when the routing graph is updated.

Main methods:

void Add(Load load): This method will add the given load to the start of this Route.

void Add(Load load, float distance): This method will add the given load to this Route at the given distance from the start.

void Remove(Load load): This method will remove the given load from this Route.

ActionPoint InsertActionPoint(float distance): This method will create and return an actionpoint and position it at the given distance from the start of this route.

void RemoveActionPoint(ActionPoint ap): This method will remove the given actionpoint ap from this route.

void ClearLoads(): This method will remove all loads from this route.

Main static methods:

static ActionPoint FindNextActionPoint(ActionPoint ap): Given an actionpoint ap this method will return the next axtionpoint on the route (returns null if no actionpoint is found).

static ActionPoint FindNextActionPoint(Route route): Given a Route route this static method will return the first actionpoint on that route.

static ActionPoint FindNextActionPoint(ActionPoint ap, out float distance): Given an actionpoint ap this static method will return the next actionpoint on the route (if any) and put the distance between the two actionpoints in the distance out parameter.
static ActionPoint FindPreviousActionPoint(ActionPoint ap, out float distance): Given an actionpoint ap this static method will return the previous actionpoint on the route of ap and put the distance between the two actionpoints in the distance out parameterIf the route of ap does not have a previous actionpoint then the previous route is looked at to find the previous actionpoint.

static float ShortestDistanceToActionPoint(Load load, string destination): Given a load and the name of an actionpoint this static method will return shortest distance from the current position of the load to the actionpoint by following the shortest path on the linked routes. If no path can be found float.PositiveInfinity is returned and a warning is logged.

static float ShortestDistanceToActionPoint(string sourceAP, string destinationAP): Given the name of a source actionpoint  and the name of a destination actionpoint this static method will return shortest distance between the two actionpoints by following the shortest path on the linked routes. If no path can be found float.PositiveInfinity is returned and a warning is logged.

static void Update(): This static method will result in the updating of the routing graph. (This is also called when a user deletes or adds an actionpoint)

Example:

float distance = Route.ShortestDistanceToActionPoint(load, "AP3");
if (float.IsInfinity(distance))
{
    Experior.Core.Environment.Log.Write("No path found from load " + load.Identification + " to actionpoint AP3");
}
else
{
    Experior.Core.Environment.Log.Write("Distance from load " + load.Identification + "to actionpoint AP3=" + distance);
}
distance = Route.ShortestDistanceToActionPoint("AP2", "AP3");
if (float.IsInfinity(distance))
{
    Experior.Core.Environment.Log.Write("No path found between AP2 and AP3");
}
else
{
    Experior.Core.Environment.Log.Write("Distance from AP2 to AP3=" + distance);
}
Was this article helpful?
How can we improve this article?
Please submit the reason for your vote so that we can improve the article.