- java.lang.Object
-
- fr.inria.mochy.core.abstractClass.PhysicalModel
-
- fr.inria.mochy.core.equalization.EquNet
-
- Direct Known Subclasses:
EquNetNeural
,EquNetStopsLoic
,EquNetV1Fix
,EquNetV1Mov
,EquNetV2Fix
,EquNetV2Mov
,EquNetV3Fix
,EquNetV3Mov
public abstract class EquNet extends PhysicalModel
An EquNet is a Petri-Net which have tokens on a loop with successives transitions and places. The goal of its regulation is to seek to stick to an equal distance between each pair of successive tokens
-
-
Field Summary
Fields Modifier and Type Field Description HashMap<Integer,EquTransition>
blocked
the list of the blocked transitions e.g.HashMap<Integer,EquTransition>
enabled
the list of enabled transitions e.g.HashMap<Integer,EquTransition>
fireable
the list of fireable transitions e.g.EquPlace
garage
a place which is a garage from where new tokens can be inserted by calling the insertToken methodHashMap<Integer,Float>
initialState
the pair of place number and the time to browse set to its token at the initial stateHashMap<Integer,EquPlace>
places
the list of the places which manage the location of a token in the petri netsHashMap<Integer,EquTransition>
transitions
the list of the transitions which manage the time in the petri nets-
Fields inherited from class fr.inria.mochy.core.abstractClass.PhysicalModel
discreteStep, fname, nbDiscreteSteps, nbTokens, startLogs, stepsNb, timeElapsed, tokens
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
addInFlow(int tnum, int pnum)
adds a place in the preset of a transitionprotected void
addOutFlow(int tnum, int pnum)
adds a place in the postset of a transitionBoolean
addToken(int p)
add a token in the place specified in parameter by its numbervoid
discreteMove()
perform a discrete move e.g.boolean
discreteMove(String pathLogs, long elapsedTime, boolean enableLogs)
perform a discrete move e.g.void
drop()
display informations of the network modelString
dropConfig()
display informations of the configuration of the network modelPlaceAbstract
findPlace(int pname)
return the place as specified by its number in parameterTransitionAbstract
findTransition(Integer tname)
return the transition as specified by its number in parameterTransitionAbstract
findTransition(String string)
return the transition as specified by its name in parameterArrayList<TransitionAbstract>
fireableTransition()
return the list of fireable transitionsfloat
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:valuefloat
getAverage()
average of the headway distance between the tokens, used in getStandardDeviation methodfloat
getAvgSpeed()
float
getClock(Integer transitionNumber)
get the clock of a transitionPlaceAbstract
getControlPlace(int aplace)
return a control place as specified by its number in parameterHashMap<Integer,? extends PlaceAbstract>
getControlPlaces()
return the list of the control places which can be recovered by their id numberfloat
getCurrentAvgSpeed()
get the current average speed of the moving tokens in the EquNet loopfloat
getCurrentMaxSpeed()
the max speed at the current statefloat
getCurrentMinSpeed()
the min speed at the current state of the moving tokensfloat
getDistanceInNetwork(Integer tokenNumber)
get the position of a token in the EquNetfloat
getDistanceInPlace(Integer tokenNumber)
get the position of a token in a placeHashMap<Integer,? extends TransitionAbstract>
getEnabled()
get the list of the enabled transitions which can be retrieved by their id numberHashMap<Integer,? extends TransitionAbstract>
getFirable()
get the list of the fireable transitions which can be retrieved by their id numberfloat
getLastTokenSpeed()
get the speed of a token which has been inserted into a new place while a discrete step was performedfloat
getLastTokenTtb()
get the time to browse/clock of a token which has been inserted into a new place while a discrete step was performedint
getNbDiscreteSteps()
get the number of discrete steps performedHashMap<Integer,EquPlace>
getPlaces()
list the places which can be recovered with their numberstatic float
getRANGE_NOISE()
the range for the noise in the calculTime method.float
getSpeed(Integer tokenNumber)
get the current speed of the token number set in parameterfloat
getStandardDeviation()
return the standard deviation of the distances between the pairs of successive tokensfloat
getStandardDeviation(String pathLogs)
return the standard deviation of the distances between the pairs of successive tokensfloat
getTimeElapsed()
get the time elapsed since the start of the simulationfloat
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 placeLinkedHashMap<Integer,Token>
getTokens()
float
getTotalDistance()
get the total distance of the loop of the networkfloat
getTransitionClock(String name)
get the clock of a transitionHashMap<Integer,? extends TransitionAbstract>
getTransitions()
list the transitions which can be recovered with their numberint
getWeibullCoef()
get the coefficient used for the weibull prob.protected String
handleLine(String readLine, int lineNb)
load a line of the input filevoid
insertToken()
insert a new token in the net at the garage placeboolean
isBlocked(int tnum)
return true if the transition specified in parameter by its number is blockedboolean
isDiscreteMove()
return true if the last step is a discrete moveboolean
isGaussian()
return true if the prob.boolean
isWeibull()
return true if the prob.String
loadFile()
called to load the input model filefloat
maxAllowedTimedMove()
return the allowed timed move to be elapsed to perform a stepvoid
multipleSteps(int steps)
perform the number of steps specified in parameter (timed move, discrete move, ...)int
numberBlocked()
return the number of blocked transitionsint
numberFireable()
return the number of fireable transitionsvoid
reset(boolean init)
reset the network model to its initial statusvoid
resetSpeedData()
used to reset the speed data information used to get average speed on a part of a simulationvoid
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:valuevoid
setBunchingState(int nbTokens)
set the net in a bunching state where tokens are grouped in successives placesstatic void
setRANGE_NOISE(float rANGE_NOISE)
set the range for the noise in the calculTime method.-
Methods inherited from class fr.inria.mochy.core.abstractClass.PhysicalModel
discreteMove, getStepsNb, isDiscreteStep, minimumClock, progressTime
-
-
-
-
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
-
-
Constructor Detail
-
EquNet
public EquNet(String fname)
instanciate the EquNet and set the file name as specified in parameters
-
-
Method Detail
-
loadFile
public String loadFile()
Description copied from class:PhysicalModel
called to load the input model file- Specified by:
loadFile
in classPhysicalModel
-
handleLine
protected String handleLine(String readLine, int lineNb)
load a line of the input file- Parameters:
readLine
- the line of the input filelineNb
- 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 transitionpnum
- 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 numberpnum
- the place id number
-
getTransitions
public HashMap<Integer,? extends TransitionAbstract> getTransitions()
Description copied from class:PhysicalModel
list the transitions which can be recovered with their number- Specified by:
getTransitions
in classPhysicalModel
-
getPlaces
public HashMap<Integer,EquPlace> getPlaces()
Description copied from class:PhysicalModel
list the places which can be recovered with their number- Specified by:
getPlaces
in classPhysicalModel
-
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 classPhysicalModel
-
numberFireable
public int numberFireable()
Description copied from class:PhysicalModel
return the number of fireable transitions- Specified by:
numberFireable
in classPhysicalModel
-
numberBlocked
public int numberBlocked()
Description copied from class:PhysicalModel
return the number of blocked transitions- Specified by:
numberBlocked
in classPhysicalModel
-
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 classPhysicalModel
-
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 classPhysicalModel
-
reset
public void reset(boolean init)
Description copied from class:PhysicalModel
reset the network model to its initial status- Overrides:
reset
in classPhysicalModel
-
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 classPhysicalModel
-
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 classPhysicalModel
-
drop
public void drop()
Description copied from class:PhysicalModel
display informations of the network model- Specified by:
drop
in classPhysicalModel
-
dropConfig
public String dropConfig()
Description copied from class:PhysicalModel
display informations of the configuration of the network model- Specified by:
dropConfig
in classPhysicalModel
-
findTransition
public TransitionAbstract findTransition(Integer tname)
Description copied from class:PhysicalModel
return the transition as specified by its number in parameter- Specified by:
findTransition
in classPhysicalModel
-
findTransition
public TransitionAbstract findTransition(String string)
Description copied from class:PhysicalModel
return the transition as specified by its name in parameter- Specified by:
findTransition
in classPhysicalModel
-
findPlace
public PlaceAbstract findPlace(int pname)
Description copied from class:PhysicalModel
return the place as specified by its number in parameter- Specified by:
findPlace
in classPhysicalModel
-
addToken
public Boolean addToken(int p)
Description copied from class:PhysicalModel
add a token in the place specified in parameter by its number- Specified by:
addToken
in classPhysicalModel
-
getControlPlace
public PlaceAbstract getControlPlace(int aplace)
Description copied from class:PhysicalModel
return a control place as specified by its number in parameter- Specified by:
getControlPlace
in classPhysicalModel
-
getControlPlaces
public HashMap<Integer,? extends PlaceAbstract> getControlPlaces()
Description copied from class:PhysicalModel
return the list of the control places which can be recovered by their id number- Specified by:
getControlPlaces
in classPhysicalModel
-
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
-
fireableTransition
public ArrayList<TransitionAbstract> fireableTransition()
Description copied from class:PhysicalModel
return the list of fireable transitions- Specified by:
fireableTransition
in classPhysicalModel
-
getAvgSpeed
public float getAvgSpeed()
-
getEnabled
public HashMap<Integer,? extends TransitionAbstract> getEnabled()
Description copied from class:PhysicalModel
get the list of the enabled transitions which can be retrieved by their id number- Specified by:
getEnabled
in classPhysicalModel
-
getFirable
public HashMap<Integer,? extends TransitionAbstract> getFirable()
Description copied from class:PhysicalModel
get the list of the fireable transitions which can be retrieved by their id number- Specified by:
getFirable
in classPhysicalModel
-
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 classPhysicalModel
-
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 classPhysicalModel
-
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 classPhysicalModel
-
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 classPhysicalModel
-
getNbDiscreteSteps
public int getNbDiscreteSteps()
Description copied from class:PhysicalModel
get the number of discrete steps performed- Overrides:
getNbDiscreteSteps
in classPhysicalModel
-
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
-
insertToken
public void insertToken() throws NullGarageException
insert a new token in the net at the garage place- Throws:
NullGarageException
-
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
-
getClock
public float getClock(Integer transitionNumber) throws TransitionNotFoundException
get the clock of a transition- Parameters:
transitionNumber
- the id of the transition as described in the .net inpute file i.e. transition:3:ta2:[0.5,1] -> id = 3- Throws:
TransitionNotFoundException
-
getTransitionClock
public float getTransitionClock(String name) throws Exception
get the clock of a transition- Parameters:
name
- the name of the transition- Throws:
InvocationTargetException
Exception
-
getTokens
public LinkedHashMap<Integer,Token> getTokens()
- Specified by:
getTokens
in classPhysicalModel
-
-