Class Net


  • public class Net
    extends PhysicalModel
    A classic Net model with transitions, places and their state. It is loaded from a net file. A net contains transitions (actions) places (place holders for objects that are moved, consumed or produced) control places : they are used to allow or conversely disable transitions. the semantics is the following : as soon as a transition has all its places in its presset filled, a value is sampled. This is the time to fire (TTF, clock) of the transition. The time to fire decreases over time When the TTF reaches 0, the transition is firable. However, it can fire only if its control place is filled, and if the postset places of the net are free

    Net class diagram

    • Field Detail

      • places

        public HashMap<Integer,​Place> places
        the list of the places which have a content "marked" if there is one token or none then its content is "null"
      • transitions

        public HashMap<Integer,​Transition> transitions
        the list of the transitions which manage the time a token will stay at a place
      • enabled

        public HashMap<Integer,​Transition> enabled
        list of enabled transitions : previous places marked and clock != 0
      • blocked

        public HashMap<Integer,​Transition> blocked
        list of blocked transitions : previous places marked, and at least one next place is marked and clock = 0
      • firable

        public HashMap<Integer,​Transition> firable
        list of firable transitions : previous places marked, free next places, clock=0
    • Constructor Detail

      • Net

        public Net​(String fname)
        take the path of the input file as parameter
    • Method Detail

      • loadFile

        public String loadFile()
        Loads a net from a file
        Specified by:
        loadFile in class PhysicalModel
        Returns:
        The method returns a strings to diplay success/failure in the log area of the interface.
      • handleLine

        protected String handleLine​(String line,
                                    int lineNb)
        load a line of the input file
        Parameters:
        line - the line to read
        lineNb - the number of the line in the input file
        Returns:
        the errors which occur as a String
      • addInFlow1

        protected void addInFlow1​(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
      • getPlace

        public Place 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 Place getControlPlace​(int pnum)
        Description copied from class: PhysicalModel
        return a control place as specified by its number in parameter
        Specified by:
        getControlPlace in class PhysicalModel
        Parameters:
        the - control place id number
        Returns:
        the control place with this id number
      • addToken

        public Boolean addToken​(int pnum)
        Add a token in a standard place
        Specified by:
        addToken in class PhysicalModel
        Parameters:
        pnum - the place number
        Returns:
        true if the place exist
      • 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
      • isFirable

        public boolean isFirable​(Transition t)
      • controlAllowsFiring

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

        public boolean isEnabled​(Transition t)
      • findPlace

        public Place findPlace​(int pnum)
        Description copied from class: PhysicalModel
        return the place as specified by its number in parameter
        Specified by:
        findPlace in class PhysicalModel
      • 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)
      • blockTransition

        public void blockTransition​(Transition t)
      • 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
      • 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
        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
      • discreteMoveWithControl

        public boolean discreteMoveWithControl​(String pathLogs,
                                               long elapsedTime,
                                               boolean enableLogs)
      • 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
      • listEnabled

        public void listEnabled()
      • size

        public int size()
      • dropConfig

        public String dropConfig()
        A method to display the contents of places in a String
        Specified by:
        dropConfig in class PhysicalModel
        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
        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
      • reset

        public void reset​(boolean init)
        Description copied from class: PhysicalModel
        reset the network model to its initial status
        Overrides:
        reset 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
      • 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
      • drop

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