- java.lang.Object
-
- fr.inria.mochy.core.abstractClass.PhysicalModel
-
- fr.inria.mochy.core.equalization.EquNet
-
- fr.inria.mochy.core.equalization.EquNetStopsLoic
-
public class EquNetStopsLoic extends EquNet
A Net model with transitions, places and their state. It is loaded from a net file.Net designed by Loic to test Headway regulation with stops
-
-
Field Summary
-
Fields inherited from class fr.inria.mochy.core.equalization.EquNet
blocked, enabled, fireable, garage, initialState, places, transitions
-
Fields inherited from class fr.inria.mochy.core.abstractClass.PhysicalModel
discreteStep, fname, nbDiscreteSteps, nbTokens, startLogs, stepsNb, timeElapsed, tokens
-
-
Constructor Summary
Constructors Constructor Description EquNetStopsLoic(String fname)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Boolean
addControlToken(int pnum)
Adds a token in a control placeprotected void
addInFlow1(int tnum, int pnum)
protected void
addOutFlow(int tnum, int pnum)
adds a place in the postset of a transitionBoolean
addToken(int pnum)
Add a token in a standard placevoid
blockTransition(EquTransitionStopsLoic t)
boolean
busyPostSet(Integer tnum)
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 implementationfloat
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.boolean
controlAllowsFiring(EquTransition t)
Checks if the control places used as input to the current transition allow firing of tvoid
discreteMove()
perform a discrete move e.g.String
discreteMove(TransitionAbstract onet, String logFile, float currentTime, boolean enableLogs)
perform a discrete move e.g.boolean
discreteMove(String pathLogs, long elapsedTime, boolean enableLogs)
perform a discrete move e.g.boolean
discreteMove(String pathLogs, long elapsedTime, boolean enableLogs, float AdhToTargetSpeed)
String
discreteMove2(TransitionAbstract trans, String pathLogs, float elapsedTime, boolean enableLogs)
String
discreteMoveHeadway(TransitionAbstract trans, String pathLogs, float elapsedTime, boolean enableLogs, float AdhToTargetSpeed)
boolean
discreteMoveWithControl(String pathLogs, long elapsedTime, boolean enableLogs)
float
DistanceFromPrevious(EquTransitionStopsLoic t1, EquTransitionStopsLoic tena)
float
DistanceToNext(EquTransitionStopsLoic tena, EquTransitionStopsLoic t2)
void
drop()
display informations of the network modelString
dropConfig()
A method to display the contents of places in a StringEquTransitionStopsLoic
findNextEnabledTransition(EquTransitionStopsLoic tarr)
EquTransitionStopsLoic
findNextTransition(EquTransition tarr)
EquPlace
findPlace(int pnum)
return the place as specified by its number in parameterEquTransitionStopsLoic
findPreviousTransition(EquTransitionStopsLoic tarr)
EquTransitionStopsLoic
findTransition(Integer tnum)
return the transition as specified by its number in parameterEquTransitionStopsLoic
findTransition(String name)
return the transition as specified by its name in parameterArrayList<TransitionAbstract>
fireableTransition()
return the list of fireable transitionsHashMap<Integer,EquTransition>
getBlocked()
EquPlace
getControlPlace(int pnum)
return a control place as specified by its number in parameterHashMap<Integer,EquPlace>
getControlPlaces()
return the list of the control places which can be recovered by their id numberMarking
getCurrentMarking()
HashMap<Integer,EquTransition>
getEnabled()
get the list of the enabled transitions which can be retrieved by their id numberHashMap<Integer,EquTransition>
getFirable()
get the list of the fireable transitions which can be retrieved by their id numberString
getFname()
EquPlace
getPlace(int pnum)
Find a place from its number This place can be a standard place or a control placeHashMap<Integer,EquPlace>
getPlaces()
list the places which can be recovered with their numberHashMap<Integer,EquTransition>
getTransitions()
list the transitions which can be recovered with their numberint
getWeibullCoef()
get the coefficient used for the weibull prob.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 successorfloat
giveStupidSpeedAdvice(float d1, float d2)
protected String
handleLineStopsLoic(String line, int lineNb)
void
initializeSpeeds()
boolean
isAControlPace(int pnum)
Returns true if pnum is the number of a control placeboolean
isAControlPlace(int pnum)
Checks is a place is a control placesboolean
isBlocked(int tnum)
return true if the transition specified in parameter by its number is blockedboolean
isEnabled(EquTransition t)
boolean
isFirable(EquTransition t)
boolean
isGaussian()
return true if the prob.boolean
isWeibull()
return true if the prob.void
listEnabled()
String
loadFile()
Loads a net from a filefloat
maxAllowedTimedMove()
return the allowed timed move to be elapsed to perform a stepfloat
minimumClock()
return the minimum time to advance in order to update the status of tokens or transitionsvoid
multipleSteps(int steps)
perform the number of steps specified in parameter (timed move, discrete move, ...)ArrayList<EquTransition>
newlyEnabled(Marking m1, Marking m2, EquTransition t)
int
numberBlocked()
return the number of blocked transitionsint
numberFireable()
return the number of fireable transitionsvoid
progressTime(Float delta)
advance the time of the delta parameter value and update the status of the transitions (blocked, fireable...)void
reset(boolean init)
reset the network model to its initial statusvoid
setBlocked(HashMap<Integer,EquTransition> list)
void
setConfig(HashMap<Integer,Float> config)
void
setCurrentMarking(Marking currentMarking)
void
setEnabled(HashMap<Integer,EquTransition> list)
void
setFirable(HashMap<Integer,EquTransition> firable)
void
setFireable(HashMap<Integer,EquTransition> list)
void
setMarking(ArrayList<EquPlace> l, ArrayList<Float> vallist)
int
size()
void
timedMove(Float f)
String
toString()
-
Methods inherited from class fr.inria.mochy.core.equalization.EquNet
addInFlow, getALPHA, getAverage, getAvgSpeed, getClock, getCurrentAvgSpeed, getCurrentMaxSpeed, getCurrentMinSpeed, getDistanceInNetwork, getDistanceInPlace, getLastTokenSpeed, getLastTokenTtb, getNbDiscreteSteps, getRANGE_NOISE, getSpeed, getStandardDeviation, getStandardDeviation, getTimeElapsed, getTimeToBrowse, getTokens, getTotalDistance, getTransitionClock, handleLine, insertToken, isDiscreteMove, resetSpeedData, setALPHA, setBunchingState, setRANGE_NOISE
-
Methods inherited from class fr.inria.mochy.core.abstractClass.PhysicalModel
getStepsNb, isDiscreteStep
-
-
-
-
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
-
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 classEquNet
- Parameters:
tnum
- the transition id numberpnum
- 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 classEquNet
-
addToken
public Boolean addToken(int pnum)
Add a token in a standard place
-
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
-
findTransition
public EquTransitionStopsLoic findTransition(Integer tnum)
Description copied from class:PhysicalModel
return the transition as specified by its number in parameter- Overrides:
findTransition
in classEquNet
-
findTransition
public EquTransitionStopsLoic findTransition(String name)
Description copied from class:PhysicalModel
return the transition as specified by its name in parameter- Overrides:
findTransition
in classEquNet
-
isFirable
public boolean isFirable(EquTransition t)
-
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:
-
isEnabled
public boolean isEnabled(EquTransition t)
-
findPlace
public EquPlace findPlace(int pnum)
Description copied from class:PhysicalModel
return the place as specified by its number in parameter
-
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)
-
newlyEnabled
public ArrayList<EquTransition> newlyEnabled(Marking m1, Marking m2, EquTransition t)
-
blockTransition
public void blockTransition(EquTransitionStopsLoic t)
-
maxAllowedTimedMove
public float maxAllowedTimedMove()
Description copied from class:PhysicalModel
return the allowed timed move to be elapsed to perform a step- Overrides:
maxAllowedTimedMove
in classEquNet
-
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 classPhysicalModel
-
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 classEquNet
-
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 classEquNet
-
discreteMove
public boolean discreteMove(String pathLogs, long elapsedTime, boolean enableLogs, float AdhToTargetSpeed)
-
discreteMoveWithControl
public boolean discreteMoveWithControl(String pathLogs, long elapsedTime, boolean enableLogs)
-
discreteMove2
public String discreteMove2(TransitionAbstract trans, String pathLogs, float 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 classEquNet
-
listEnabled
public void listEnabled()
-
drop
public void drop()
Description copied from class:PhysicalModel
display informations of the network model
-
getFirable
public HashMap<Integer,EquTransition> getFirable()
Description copied from class:PhysicalModel
get the list of the fireable transitions which can be retrieved by their id number- Overrides:
getFirable
in classEquNet
-
getEnabled
public HashMap<Integer,EquTransition> getEnabled()
Description copied from class:PhysicalModel
get the list of the enabled transitions which can be retrieved by their id number- Overrides:
getEnabled
in classEquNet
-
setFirable
public void setFirable(HashMap<Integer,EquTransition> firable)
-
size
public int size()
-
dropConfig
public String dropConfig()
A method to display the contents of places in a String- Overrides:
dropConfig
in classEquNet
- 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 classEquNet
-
isWeibull
public boolean isWeibull()
Description copied from class:PhysicalModel
return true if the prob. distribution is weibull. used for the sampling of the transitions
-
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 classEquNet
-
reset
public void reset(boolean init)
Description copied from class:PhysicalModel
reset the network model to its initial status
-
numberFireable
public int numberFireable()
Description copied from class:PhysicalModel
return the number of fireable transitions- Overrides:
numberFireable
in classEquNet
-
numberBlocked
public int numberBlocked()
Description copied from class:PhysicalModel
return the number of blocked transitions- Overrides:
numberBlocked
in classEquNet
-
isBlocked
public boolean isBlocked(int tnum)
Description copied from class:PhysicalModel
return true if the transition specified in parameter by its number is blocked
-
getFname
public String getFname()
-
getTransitions
public HashMap<Integer,EquTransition> getTransitions()
Description copied from class:PhysicalModel
list the transitions which can be recovered with their number- Overrides:
getTransitions
in classEquNet
-
getPlaces
public HashMap<Integer,EquPlace> getPlaces()
Description copied from class:PhysicalModel
list the places which can be recovered with their number
-
getBlocked
public HashMap<Integer,EquTransition> getBlocked()
-
getControlPlaces
public HashMap<Integer,EquPlace> getControlPlaces()
Description copied from class:PhysicalModel
return the list of the control places which can be recovered by their id number- Overrides:
getControlPlaces
in classEquNet
-
getCurrentMarking
public Marking getCurrentMarking()
-
setCurrentMarking
public void setCurrentMarking(Marking currentMarking)
-
setEnabled
public void setEnabled(HashMap<Integer,EquTransition> list)
-
setFireable
public void setFireable(HashMap<Integer,EquTransition> list)
-
setBlocked
public void setBlocked(HashMap<Integer,EquTransition> list)
-
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 classPhysicalModel
-
fireableTransition
public ArrayList<TransitionAbstract> fireableTransition()
Description copied from class:PhysicalModel
return the list of fireable transitions- Overrides:
fireableTransition
in classEquNet
-
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 traind2
- distance from current train to successorspd1
- speed of predecessor (in m/min)spd2
- speed of successor (in m/min)- Returns:
-
findNextTransition
public EquTransitionStopsLoic findNextTransition(EquTransition tarr)
-
findNextEnabledTransition
public EquTransitionStopsLoic findNextEnabledTransition(EquTransitionStopsLoic tarr)
-
findPreviousTransition
public EquTransitionStopsLoic findPreviousTransition(EquTransitionStopsLoic tarr)
-
discreteMove
public String discreteMove(TransitionAbstract onet, String logFile, float currentTime, 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
-
DistanceFromPrevious
public float DistanceFromPrevious(EquTransitionStopsLoic t1, EquTransitionStopsLoic tena)
-
DistanceToNext
public float DistanceToNext(EquTransitionStopsLoic tena, EquTransitionStopsLoic t2)
-
-