Class EquNet

    • Field Detail

      • transitions

        public HashMap<Integer,​EquTransition> transitions
        the list of the transitions which manage the time in the petri nets
      • places

        public HashMap<Integer,​EquPlace> places
        the list of the places which manage the location of a token in the petri nets
      • enabled

        public HashMap<Integer,​EquTransition> enabled
        the list of enabled transitions e.g. their clock is not 0 but there is tokens in their previous places
      • fireable

        public HashMap<Integer,​EquTransition> fireable
        the list of fireable transitions e.g. their clock is 0 and there is tokens in their previous places
      • blocked

        public HashMap<Integer,​EquTransition> blocked
        the list of the blocked transitions e.g. there is tokens at the end of the previous places but they are prevent from entering the next place due to minimum safety distance
      • garage

        public EquPlace garage
        a place which is a garage from where new tokens can be inserted by calling the insertToken method
      • initialState

        public HashMap<Integer,​Float> initialState
        the pair of place number and the time to browse set to its token at the initial state
    • Constructor Detail

      • EquNet

        public EquNet​(String fname)
        instanciate the EquNet and set the file name as specified in parameters
    • Method Detail

      • handleLine

        protected String handleLine​(String readLine,
                                    int lineNb)
        load a line of the input file
        Parameters:
        readLine - the line of the input file
        lineNb - the number of the line in the input file
        Returns:
        logs information as a String
      • addInFlow

        protected void addInFlow​(int tnum,
                                 int pnum)
        adds a place in the preset of a transition
        Parameters:
        tnum - the id number of the transition
        pnum - the id number of the place
      • addOutFlow

        protected void addOutFlow​(int tnum,
                                  int pnum)
        adds a place in the postset of a transition
        Parameters:
        tnum - the transition id number
        pnum - the place id number
      • maxAllowedTimedMove

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

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

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

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

        public void setBunchingState​(int nbTokens)
        set the net in a bunching state where tokens are grouped in successives places
      • 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
        Specified by:
        discreteMove in class PhysicalModel
      • 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
        Specified by:
        discreteMove in class PhysicalModel
      • drop

        public void drop()
        Description copied from class: PhysicalModel
        display informations of the network model
        Specified by:
        drop in class PhysicalModel
      • getStandardDeviation

        public float getStandardDeviation()
        return the standard deviation of the distances between the pairs of successive tokens
      • getStandardDeviation

        public float getStandardDeviation​(String pathLogs)
        return the standard deviation of the distances between the pairs of successive tokens
      • getAvgSpeed

        public float getAvgSpeed()
      • isGaussian

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

        public boolean isWeibull()
        Description copied from class: PhysicalModel
        return true if the prob. distribution is weibull. used for the sampling of the transitions
        Specified by:
        isWeibull in class PhysicalModel
      • 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
        Specified by:
        getWeibullCoef in class PhysicalModel
      • getTotalDistance

        public float getTotalDistance()
        get the total distance of the loop of the network
      • getAverage

        public float getAverage()
        average of the headway distance between the tokens, used in getStandardDeviation method
      • getTimeElapsed

        public float getTimeElapsed()
        get the time elapsed since the start of the simulation
        Overrides:
        getTimeElapsed in class PhysicalModel
      • getALPHA

        public float getALPHA()
        A constant for the whole simulation describing adherence to target speed This constant is used when computing an advice of time to browse a moving place for a train can be set in the input file as a line : ALPHA:value
      • setALPHA

        public void setALPHA​(float aLPHA)
        Set Alpha, A constant for the whole simulation describing adherence to target speed This constant is used when computing an advice of time to browse a moving place for a train can be set in the input file as a line : ALPHA:value
      • getRANGE_NOISE

        public static float getRANGE_NOISE()
        the range for the noise in the calculTime method. can be set in the input file as a line : RANGE_NOISE:value
      • setRANGE_NOISE

        public static void setRANGE_NOISE​(float rANGE_NOISE)
        set the range for the noise in the calculTime method. can be set in the input file as a line : RANGE_NOISE:value
      • getLastTokenSpeed

        public float getLastTokenSpeed()
        get the speed of a token which has been inserted into a new place while a discrete step was performed
      • getLastTokenTtb

        public float getLastTokenTtb()
        get the time to browse/clock of a token which has been inserted into a new place while a discrete step was performed
      • isDiscreteMove

        public boolean isDiscreteMove()
        return true if the last step is a discrete move
      • getCurrentAvgSpeed

        public float getCurrentAvgSpeed()
        get the current average speed of the moving tokens in the EquNet loop
      • getCurrentMinSpeed

        public float getCurrentMinSpeed()
        the min speed at the current state of the moving tokens
      • getCurrentMaxSpeed

        public float getCurrentMaxSpeed()
        the max speed at the current state
      • resetSpeedData

        public void resetSpeedData()
        used to reset the speed data information used to get average speed on a part of a simulation
      • getSpeed

        public float getSpeed​(Integer tokenNumber)
        get the current speed of the token number set in parameter
        Returns:
        the current speed
      • getTimeToBrowse

        public float getTimeToBrowse​(Integer tokenNumber)
        get the time to browse a place or the time to be elapsed to allow the token to be ready to get to a next place
        Parameters:
        tokenNumber - the id of the token from 0 to n-1, n is the number of tokens in the EquNet
        Returns:
        the time to browse a place
      • getDistanceInPlace

        public float getDistanceInPlace​(Integer tokenNumber)
        get the position of a token in a place
        Parameters:
        tokenNumber - the id of the token from 0 to n - 1, n is the number of tokens
      • getDistanceInNetwork

        public float getDistanceInNetwork​(Integer tokenNumber)
        get the position of a token in the EquNet
        Parameters:
        tokenNumber - the id of the token from 0 to n - 1, n is the number of tokens