|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjava.util.Observable
org.jscience.architecture.traffic.Model
org.jscience.architecture.traffic.simulation.SimModel
public class SimModel
The heart of the simulation.
| Nested Class Summary | |
|---|---|
class |
SimModel.SimModelThread
The second thread that runs the simulation. |
| Field Summary | |
|---|---|
protected SimController |
controller
The SimController |
static boolean |
CrossNodes
Indicates if roadusers cross nodes or jump over them. |
protected int |
curCycle
The current cycle we're in |
protected int |
curSeries
DOCUMENT ME! |
protected static DrivingPolicy |
dp
The Driving Policy in this Simulation |
protected java.util.Random |
generator
The pseudo-random-number-generator we need in this simulation |
protected boolean |
hasRun
A boolean to keep track if this simulation has already run (ivm initialization) |
protected static int |
LOCK_THRESHOLD
DOCUMENT ME! |
protected boolean |
locked
DOCUMENT ME! |
protected static int |
numSeries
DOCUMENT ME! |
protected static int |
numSeriesSteps
The number of steps each of the simulations in a series should make |
protected boolean |
runSeries
Indicates whether we are running a series of simulations |
protected SignController |
sgnctrl
The Thing that makes all Trafficlights shudder |
protected java.lang.String |
simName
Name of the simulation |
protected SimModel.SimModelThread |
thread
The second thread that runs the actual simulation |
protected TLController |
tlc
The TrafficLightControlling Algorithm |
| Fields inherited from class org.jscience.architecture.traffic.Model |
|---|
infra, parentName, SAVE_STATS |
| Constructor Summary | |
|---|---|
SimModel()
Creates second thread |
|
| Method Summary | |
|---|---|
protected PosMov[] |
calcPosMovs(Node node,
Sign sign,
Drivelane lane,
Roaduser ru,
java.util.ListIterator li)
DOCUMENT ME! |
protected void |
cityDoStep()
DOCUMENT ME! |
void |
doStep()
Does 1 step in the simulation. |
int |
getCurCycle()
Returns the current cycle |
int |
getCurSeries()
DOCUMENT ME! |
static DrivingPolicy |
getDrivingPolicy()
Returns the current Driving Policy |
int |
getNumSeries()
DOCUMENT ME! |
java.util.Random |
getRandom()
Returns the random number generator |
SpecialNode |
getRandomDestination(SpecialNode moi)
Get a completely random destination, don't choose moi |
java.util.Random |
getRNGen()
Returns the pseudo-random-number generator of this Model |
java.lang.String |
getSimName()
Returns the name of the simulation |
int |
getSpeed()
Gets the speed of the simulation |
TLController |
getTLController()
Returns the current TLController |
void |
initialize()
DOCUMENT ME! |
boolean |
isRunning()
DOCUMENT ME! |
boolean |
isRunSeries()
DOCUMENT ME! |
void |
load(XMLElement myElement,
XMLLoader loader)
DOCUMENT ME! |
void |
lockedSeries()
DOCUMENT ME! |
void |
moveAllRoadusers()
moving all Roadusers to their new places |
protected void |
moveLane(Drivelane lane)
moving all roadusers from one lane to their new places |
protected int |
moveRoaduserOnLane(java.util.ListIterator li,
Roaduser ru,
int speed_left,
Drivelane lane)
|
void |
nextCurSeries()
DOCUMENT ME! |
void |
nextSeries()
DOCUMENT ME! |
void |
pause()
Pauses the simulation |
void |
reset()
Resets data |
void |
runSeries()
DOCUMENT ME! |
void |
saveChilds(XMLSaver saver)
DOCUMENT ME! |
XMLElement |
saveSelf()
DOCUMENT ME! |
void |
setCurCycle(int c)
Sets the current cycle |
void |
setDrivingPolicy(DrivingPolicy _dp)
Sets the current DrivTLController |
void |
setInfrastructure(Infrastructure i)
DOCUMENT ME! |
void |
setRandom(java.util.Random r)
Sets the random number generator |
void |
setSimController(SimController sc)
DOCUMENT ME! |
void |
setSimName(java.lang.String s)
Sets the name of the simulation |
void |
setSpawnFrequency(EdgeNode en,
int rutype,
float newspawn)
Sets spawn frequency for given node and ru type. |
void |
setSpeed(int s)
Sets the speed of the simulation |
void |
setTLController(TLController _tlc)
Sets the current TLController |
void |
spawnNewRoadusers()
New road users are placed on the roads when necessary. |
protected void |
specialNodesDoStep()
DOCUMENT ME! |
void |
stop()
Stops the simulation. |
void |
stopSeries()
DOCUMENT ME! |
void |
unpause()
Unpauses the simulation |
| Methods inherited from class org.jscience.architecture.traffic.Model |
|---|
getInfrastructure, getXMLName, setParentName |
| Methods inherited from class java.util.Observable |
|---|
addObserver, clearChanged, countObservers, deleteObserver, deleteObservers, hasChanged, notifyObservers, notifyObservers, setChanged |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface org.jscience.architecture.traffic.xml.XMLSerializable |
|---|
getXMLName, setParentName |
| Field Detail |
|---|
protected static DrivingPolicy dp
public static boolean CrossNodes
protected static int numSeriesSteps
protected static int LOCK_THRESHOLD
protected static int numSeries
protected java.util.Random generator
protected SimModel.SimModelThread thread
protected SimController controller
protected int curCycle
protected TLController tlc
protected SignController sgnctrl
protected java.lang.String simName
protected boolean hasRun
protected boolean runSeries
protected boolean locked
protected int curSeries
| Constructor Detail |
|---|
public SimModel()
| Method Detail |
|---|
public void setSimController(SimController sc)
sc - DOCUMENT ME!public void setInfrastructure(Infrastructure i)
setInfrastructure in class Modeli - DOCUMENT ME!public int getCurCycle()
public void setCurCycle(int c)
c - DOCUMENT ME!public static DrivingPolicy getDrivingPolicy()
public void setDrivingPolicy(DrivingPolicy _dp)
_dp - DOCUMENT ME!public TLController getTLController()
public void setTLController(TLController _tlc)
_tlc - DOCUMENT ME!public java.util.Random getRandom()
public void setRandom(java.util.Random r)
r - DOCUMENT ME!public java.lang.String getSimName()
public void setSimName(java.lang.String s)
s - DOCUMENT ME!public java.util.Random getRNGen()
public void setSpawnFrequency(EdgeNode en,
int rutype,
float newspawn)
en - DOCUMENT ME!rutype - DOCUMENT ME!newspawn - DOCUMENT ME!public void stop()
public void pause()
public void unpause()
public boolean isRunning()
public void runSeries()
public void nextSeries()
public void lockedSeries()
public void stopSeries()
public void nextCurSeries()
public int getCurSeries()
public boolean isRunSeries()
public int getNumSeries()
public void reset()
throws SimulationRunningException
SimulationRunningException - DOCUMENT ME!public void doStep()
public void initialize()
public int getSpeed()
public void setSpeed(int s)
s - DOCUMENT ME!protected void cityDoStep()
protected void specialNodesDoStep()
throws java.lang.Exception
java.lang.Exception - DOCUMENT ME!
public void moveAllRoadusers()
throws InfraException
InfraException - DOCUMENT ME!
protected void moveLane(Drivelane lane)
throws InfraException
lane - The lane whose roadusers should be moved
InfraException - DOCUMENT ME!
protected int moveRoaduserOnLane(java.util.ListIterator li,
Roaduser ru,
int speed_left,
Drivelane lane)
protected PosMov[] calcPosMovs(Node node,
Sign sign,
Drivelane lane,
Roaduser ru,
java.util.ListIterator li)
node - DOCUMENT ME!sign - DOCUMENT ME!lane - DOCUMENT ME!ru - DOCUMENT ME!li - DOCUMENT ME!
public void spawnNewRoadusers()
throws InfraException,
java.lang.ClassNotFoundException
InfraException - DOCUMENT ME!
java.lang.ClassNotFoundException - DOCUMENT ME!
public SpecialNode getRandomDestination(SpecialNode moi)
throws InfraException
moi - DOCUMENT ME!
InfraException - DOCUMENT ME!
public void load(XMLElement myElement,
XMLLoader loader)
throws XMLTreeException,
java.io.IOException,
XMLInvalidInputException
load in interface XMLSerializableload in class ModelmyElement - DOCUMENT ME!loader - DOCUMENT ME!
XMLTreeException - DOCUMENT ME!
java.io.IOException - DOCUMENT ME!
XMLInvalidInputException - DOCUMENT ME!public XMLElement saveSelf()
saveSelf in interface XMLSerializablesaveSelf in class Model
public void saveChilds(XMLSaver saver)
throws java.io.IOException,
XMLTreeException,
XMLCannotSaveException
saveChilds in interface XMLSerializablesaveChilds in class Modelsaver - DOCUMENT ME!
java.io.IOException - DOCUMENT ME!
XMLTreeException - DOCUMENT ME!
XMLCannotSaveException - DOCUMENT ME!
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||