< All Topics

ActionPoint class

Action Points are points on a Route where a load can stop and stay. They are used internally by Experior as vertices or nodes in the routing graph (where parts of the route between the action points are the edges).

They are implemented in Experior using the Experior.Core.Routes.ActionPoint class.

Main properties:

  • string Name: Getter property for the name of this actionpoint.
  • string APName: Gets or sets the name of this actionpoint.
  • Route Parent: This getter property returns the route to which this actionpoint is added.
  • Assembly:  This getter property returns the Assembly object to which this actionpoint belongs.
  • Vector3 Position: This getter property returns the global position of this actionpoint.
  • bool Routing: Gets or sets a value indicating whether this actionpoint should be included as node in the routing graph.
  • bool Selectable: Gets or sets a value indicating whether this actionpoint is pickable by the user.
  • bool Selected: Gets or sets a value indicating whether this actionpoint is selected.
  • Experior.Core.Reports.Statistics.Statistic.Counter Statistic: This getter property returns the counter statistic linked to this actionpoint.
  • ActionPoint.StoppingMode StopMode: This property gets or sets the stopping mode of this actionpoint. Possible values are: StoppingMode.NoneStoppingMode.StopStoppingMode.CapacityStoppingMode.StopMotor and only available in discrete event mode StoppingMode.Interval.
  • ActionPoint.Edges Collision: This property gets/sets when an actionpoint triggers its Enter event.
  • float Distance: This property gets/sets the distance of this actionpoint on its route measured from the start of the route.
  • bool Active: This getter property returns whether this actionpoint is active (has load) or not.
  • Load ActiveLoad: This getter property returns whether the current load on this actionpoint (or null in case the actionpoint is not active).
  • string VirtualNode: This property gets/sets whether this actionpoint is a virtual node or not (default). This VirtualNode is used to join a group of nodes into one edge in the route graph. All actionpoints with the same VirtualNode value will behave as 1 node in the routing graph.
  • static ReadOnlyDictionary<string, ActionPoint> Items: Static getter property that returns a read-only dictionary with all existing user actionpoints. Key in the dictionary is the name of the actionpoint while the value is the actual ActionPoint instance. Note: this dictionary only contains actionpoints that were added by the user, it does not contain the actionpoints that were created by code internally in assemblies. The developer should keep track of those.

Main events:

  • event ActionPoint.EnterEvent Enter: This event is raised when a load enters this actionpoint.
  • event ActionPoint.ReleasedEvent Released: This event is raised when a load leaves this actionpoint. It can be because the load was never stopped, or because the load is deleted or released or  switched to another ActionPoint or Route.
  • event ActionPoint.MoveToEvent MoveTo: This event is raised when the MoveTo method is called on the load.
  • event ActionPoint.RemovedEvent Removed: This event is raised when an actionpoint is deleted.

Example:

public ActionPoint CreateActionPoint (int index)
{
    ActionPoint ap = new ActionPoint();
    ap.Edge = ActionPoint.Edges.Leading;
    ap.StopMode = ActionPoint.StoppingMode.Stop;
    ap.Name = index.ToString();
    ap.Enter += new ActionPoint.EnterEvent(ap_Enter);
    ap.Released += new ActionPoint.ReleasedEvent(ap_Released);
    return ap;
}

void ap_Enter(ActionPoint ap, Load load)
{
    // Example of gathering and logging some routing info
    // we will lo the previuous and next actionpoint and the distance to them
    float nextdistance;
    float prevdistance;
    ActionPoint next = Route.FindNextActionPoint(ap, out nextdistance);
    ActionPoint prev = Route.FindPreviousActionPoint(ap, out prevdistance);
    if (next != null) Experior.Core.Environment.Log.Write("Next ActionPoint of " + ap.Name + " is " + next.Name + " at distance " + nextdistance);
    else Experior.Core.Environment.Log.Write("No next ActionPoint found for " + ap.Name );
    if (prev != null) Experior.Core.Environment.Log.Write("Previous ActionPoint of " + ap.Name + " is " + prev.Name + " at distance " + prevdistance);
    else Experior.Core.Environment.Log.Write("No previous ActionPoint found for " + ap.Name);

    // example of some diverting decision based on load info
    if (load.Identification == ap.Name)
    {
        //divert load to route
        Int16 idx=0;
        if (Int16.TryParse(ap.Name, out idx))
        {
            load.Switch(divertroutes[idx].Route);
            load.Release();
        }
    }
    else load.Release();
}

void ap_Released(ActionPoint ap, Load load)
{
    Experior.Core.Environment.Log.Write("ActionPoint " + ap.APName + " is released by load " + load.Identification);
}

Main static methods

  • static string GetValidName(string prefix): Actionpoints require a unique name. This method will create a unique name with the given prefix.
  • static ActionPoint Get(string name): A factory method to create and return an actionpoint with the given name.If there was already an actionpoint with the given name then this existing one is returned.
  • static ActionPoint Release(string name): This static method will release the actionpoint with the given name.
Was this article helpful?
How can we improve this article?
Please submit the reason for your vote so that we can improve the article.
Next Build a Controller