org.opensourcephysics.sip.ch14.traffic
Class Freeway

java.lang.Object
  extended by org.opensourcephysics.sip.ch14.traffic.Freeway
All Implemented Interfaces:
Drawable

public class Freeway
extends java.lang.Object
implements Drawable

Freeway uses the Nagel-Schreckenberg model of single lane traffic


Field Summary
 double[] distribution
           
 double flow
           
 int maximumVelocity
           
 int numberOfCars
           
 double p
           
 int roadLength
           
 int scrollTime
           
 LatticeFrame spaceTime
           
 int steps
           
 int t
           
 int[] v
           
 int[] x
           
 int[] xtemp
           
 
Constructor Summary
Freeway()
           
 
Method Summary
 void computeSpaceTimeDiagram()
           
 void draw(DrawingPanel panel, java.awt.Graphics g)
          Draws freeway.
 void initialize(LatticeFrame spaceTime)
          Initializes arrays and starting configuration of cars.
 void step()
          Does one time step
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

v

public int[] v

x

public int[] x

xtemp

public int[] xtemp

spaceTime

public LatticeFrame spaceTime

distribution

public double[] distribution

roadLength

public int roadLength

numberOfCars

public int numberOfCars

maximumVelocity

public int maximumVelocity

p

public double p

flow

public double flow

steps

public int steps

t

public int t

scrollTime

public int scrollTime
Constructor Detail

Freeway

public Freeway()
Method Detail

initialize

public void initialize(LatticeFrame spaceTime)
Initializes arrays and starting configuration of cars.


step

public void step()
Does one time step


computeSpaceTimeDiagram

public void computeSpaceTimeDiagram()

draw

public void draw(DrawingPanel panel,
                 java.awt.Graphics g)
Draws freeway.

Specified by:
draw in interface Drawable