org.jscience.architecture.lift
Class SimpleKinematicModel

java.lang.Object
  extended by org.jscience.architecture.lift.SimpleKinematicModel
All Implemented Interfaces:
KinematicModel

public class SimpleKinematicModel
extends java.lang.Object
implements KinematicModel

This file is licensed under the GNU Public Licens (GPL).
This is a sample (simple and effective) KinematicModel. It is simple: The time needed to reach Floor I from Floor J (K is the difference of I and J) is BaseTime+KFloorFligthTime.

See Also:
LoadSpeed

Constructor Summary
SimpleKinematicModel(int BaseTime, int FloorFligthTime, int DoorOpenTime, int DoorCloseTime)
          Constructor
 
Method Summary
 void dstFChanged(Car C)
          Notifies the Kinematic Model that the destination floor of the moving Car has changed.
 int getDoorCloseTime(int AbsFloor, Car C)
          Returns the time (in Ticks) needed to close the door of the Car C on the AbsFloorth Floor.
 int getDoorOpenTime(int AbsFloor, Car C)
          Returns the time (in Ticks) needed to open the door of the Car C on the AbsFloorth Floor.
 double getProgress(Car C)
          Gets the Progress of a Car in the [0, 1] interval.
 boolean mayStopAt(Car C, int AbsFloor)
          This method is used to determinate if the Car C may stop on floor AbsFloor before its next planned stop without reversing its direction.
 void tick(SimulatedCar C)
          Cars inherit void Tick() from the Tickable interface and call this function each time their Tick() method is called.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SimpleKinematicModel

public SimpleKinematicModel(int BaseTime,
                            int FloorFligthTime,
                            int DoorOpenTime,
                            int DoorCloseTime)
Constructor

Parameters:
BaseTime - See the class description
FloorFligthTime - See the class description
DoorOpenTime - Time needed to open the door
DoorCloseTime - Time needed to close the door
Method Detail

dstFChanged

public void dstFChanged(Car C)
Description copied from interface: KinematicModel
Notifies the Kinematic Model that the destination floor of the moving Car has changed. This usually happens when a Car catches a call that appears after it's start.

Specified by:
dstFChanged in interface KinematicModel
Parameters:
C - The Car which changed its destination floor

getDoorCloseTime

public int getDoorCloseTime(int AbsFloor,
                            Car C)
Description copied from interface: KinematicModel
Returns the time (in Ticks) needed to close the door of the Car C on the AbsFloorth Floor.

Specified by:
getDoorCloseTime in interface KinematicModel

getDoorOpenTime

public int getDoorOpenTime(int AbsFloor,
                           Car C)
Description copied from interface: KinematicModel
Returns the time (in Ticks) needed to open the door of the Car C on the AbsFloorth Floor.

Specified by:
getDoorOpenTime in interface KinematicModel

getProgress

public double getProgress(Car C)
Description copied from interface: KinematicModel
Gets the Progress of a Car in the [0, 1] interval. This is only applicable if the doors are closing or opening or if the Car is moving from one floor to another. This should be 0.25 if the door is only 25 percent open, 0.66 if the car already moved 66% of the distance between two adjacent floors, and so on.

Specified by:
getProgress in interface KinematicModel
Parameters:
C - The target Car
Returns:
The 0<=Progress<=1 value

mayStopAt

public boolean mayStopAt(Car C,
                         int AbsFloor)
Description copied from interface: KinematicModel
This method is used to determinate if the Car C may stop on floor AbsFloor before its next planned stop without reversing its direction. This occures when a moving Car needs to determine if it may accept a new call between its current floor and planned destination floor.

Specified by:
mayStopAt in interface KinematicModel

tick

public void tick(SimulatedCar C)
Description copied from interface: KinematicModel
Cars inherit void Tick() from the Tickable interface and call this function each time their Tick() method is called. Before calling, the Car increasess it's Progress by one. This happens in every Tick(), namely in every 0.1 second, so this method is called for each Car in every 0.1 second of simulation time.
It must call C.arrived() if the C Car arrives at it's planned destination Floor.
It must call C.CrtFReached() if the C Car is reached the next floor while moving

Specified by:
tick in interface KinematicModel
Parameters:
C - The Car which called this method.