Class EquNetStopsLoic


  • public class EquNetStopsLoic
    extends EquNet
    A Net model with transitions, places and their state. It is loaded from a net file.

    Net class diagram Net designed by Loic to test Headway regulation with stops

    • Constructor Detail

      • EquNetStopsLoic

        public EquNetStopsLoic​(String fname)
    • Method Detail

      • ComputeTotalLength

        public float ComputeTotalLength()
        Computes the total length of a circular network CAUTION: may cause an error if the network is not circular or transitions have more than one successor. Use with care.
        Returns:
      • initializeSpeeds

        public void initializeSpeeds()
      • loadFile

        public String loadFile()
        Loads a net from a file
        Overrides:
        loadFile in class EquNet
        Returns:
        The method returns a strings to display success/failure in the log area of the interface.
      • handleLineStopsLoic

        protected String handleLineStopsLoic​(String line,
                                             int lineNb)
      • addInFlow1

        protected void addInFlow1​(int tnum,
                                  int pnum)
      • addOutFlow

        protected void addOutFlow​(int tnum,
                                  int pnum)
        Description copied from class: EquNet
        adds a place in the postset of a transition
        Overrides:
        addOutFlow in class EquNet
        Parameters:
        tnum - the transition id number
        pnum - the place id number
      • getPlace

        public EquPlace getPlace​(int pnum)
        Find a place from its number This place can be a standard place or a control place
        Parameters:
        pnum -
        Returns:
        the place found
      • getControlPlace

        public EquPlace getControlPlace​(int pnum)
        Description copied from class: PhysicalModel
        return a control place as specified by its number in parameter
        Overrides:
        getControlPlace in class EquNet
      • addToken

        public Boolean addToken​(int pnum)
        Add a token in a standard place
        Overrides:
        addToken in class EquNet
        Parameters:
        pnum -
        Returns:
      • addControlToken

        public Boolean addControlToken​(int pnum)
        Adds a token in a control place
        Parameters:
        pnum -
        Returns:
      • isAControlPlace

        public boolean isAControlPlace​(int pnum)
        Checks is a place is a control places
        Parameters:
        pnum - : the place number
        Returns:
        true if pnum is a control place, false otherwise
      • controlAllowsFiring

        public boolean controlAllowsFiring​(EquTransition t)
        Checks if the control places used as input to the current transition allow firing of t
        Parameters:
        t -
        Returns:
      • findPlace

        public EquPlace findPlace​(int pnum)
        Description copied from class: PhysicalModel
        return the place as specified by its number in parameter
        Overrides:
        findPlace in class EquNet
      • isAControlPace

        public boolean isAControlPace​(int pnum)
        Returns true if pnum is the number of a control place
        Parameters:
        pnum -
        Returns:
      • busyPostSet

        public boolean busyPostSet​(Integer tnum)
      • maxAllowedTimedMove

        public float maxAllowedTimedMove()
        Description copied from class: PhysicalModel
        return the allowed timed move to be elapsed to perform a step
        Overrides:
        maxAllowedTimedMove in class EquNet
      • timedMove

        public void timedMove​(Float f)
      • progressTime

        public void progressTime​(Float delta)
        Description copied from class: PhysicalModel
        advance the time of the delta parameter value and update the status of the transitions (blocked, fireable...)
        Specified by:
        progressTime in class PhysicalModel
      • discreteMove

        public void discreteMove()
        Description copied from class: PhysicalModel
        perform a discrete move e.g. a transition will be fired and a token will change of place
        Overrides:
        discreteMove in class EquNet
      • discreteMove

        public boolean discreteMove​(String pathLogs,
                                    long elapsedTime,
                                    boolean enableLogs)
        Description copied from class: PhysicalModel
        perform a discrete move e.g. a transition will be fired and a token will change of place
        Overrides:
        discreteMove in class EquNet
      • discreteMove

        public boolean discreteMove​(String pathLogs,
                                    long elapsedTime,
                                    boolean enableLogs,
                                    float AdhToTargetSpeed)
      • discreteMoveWithControl

        public boolean discreteMoveWithControl​(String pathLogs,
                                               long elapsedTime,
                                               boolean enableLogs)
      • discreteMoveHeadway

        public String discreteMoveHeadway​(TransitionAbstract trans,
                                          String pathLogs,
                                          float elapsedTime,
                                          boolean enableLogs,
                                          float AdhToTargetSpeed)
      • multipleSteps

        public void multipleSteps​(int steps)
        Description copied from class: PhysicalModel
        perform the number of steps specified in parameter (timed move, discrete move, ...)
        Overrides:
        multipleSteps in class EquNet
      • listEnabled

        public void listEnabled()
      • drop

        public void drop()
        Description copied from class: PhysicalModel
        display informations of the network model
        Overrides:
        drop in class EquNet
      • size

        public int size()
      • dropConfig

        public String dropConfig()
        A method to display the contents of places in a String
        Overrides:
        dropConfig in class EquNet
        Returns:
        a string with the contents of all places
      • isGaussian

        public boolean isGaussian()
        Description copied from class: PhysicalModel
        return true if the prob. distribution is gaussian. used for the sampling of the transitions
        Overrides:
        isGaussian in class EquNet
      • isWeibull

        public boolean isWeibull()
        Description copied from class: PhysicalModel
        return true if the prob. distribution is weibull. used for the sampling of the transitions
        Overrides:
        isWeibull in class EquNet
      • getWeibullCoef

        public int getWeibullCoef()
        Description copied from class: PhysicalModel
        get the coefficient used for the weibull prob. distribution. used for the sampling of the transitions
        Overrides:
        getWeibullCoef in class EquNet
      • reset

        public void reset​(boolean init)
        Description copied from class: PhysicalModel
        reset the network model to its initial status
        Overrides:
        reset in class EquNet
      • numberFireable

        public int numberFireable()
        Description copied from class: PhysicalModel
        return the number of fireable transitions
        Overrides:
        numberFireable in class EquNet
      • numberBlocked

        public int numberBlocked()
        Description copied from class: PhysicalModel
        return the number of blocked transitions
        Overrides:
        numberBlocked in class EquNet
      • isBlocked

        public boolean isBlocked​(int tnum)
        Description copied from class: PhysicalModel
        return true if the transition specified in parameter by its number is blocked
        Overrides:
        isBlocked in class EquNet
      • getFname

        public String getFname()
      • getCurrentMarking

        public Marking getCurrentMarking()
      • setCurrentMarking

        public void setCurrentMarking​(Marking currentMarking)
      • minimumClock

        public float minimumClock()
        Description copied from class: PhysicalModel
        return the minimum time to advance in order to update the status of tokens or transitions
        Specified by:
        minimumClock in class PhysicalModel
      • calculTime

        public float calculTime​(Token tok,
                                EquTransition t)
        This method is a stub to define an abstract method of the physical model It is not used in this implementation
      • giveStupidSpeedAdvice

        public float giveStupidSpeedAdvice​(float d1,
                                           float d2)
      • giveSpeedAdvice

        public float giveSpeedAdvice​(float d1,
                                     float d2,
                                     float spd1,
                                     float spd2,
                                     float AdhToTargetSpeed)
        Computes a speed advice for a train, considering the distance to its predecessor, to its successor, the speed of predecessor, the speed of successor
        Parameters:
        d1 - distance from predecessor to current train
        d2 - distance from current train to successor
        spd1 - speed of predecessor (in m/min)
        spd2 - speed of successor (in m/min)
        Returns: