nl.tudelft.simulation.traffic.vehicle
Class VehiclePhysical

java.lang.Object
  extended bynl.tudelft.simulation.event.EventProducer
      extended bynl.tudelft.simulation.traffic.vehicle.VehiclePhysical
All Implemented Interfaces:
java.util.EventListener, nl.tudelft.simulation.event.EventListenerInterface, nl.tudelft.simulation.event.EventProducerInterface, nl.tudelft.simulation.dsol.animation.LocatableInterface, java.io.Serializable, VehiclePhysicalInterface

public class VehiclePhysical
extends nl.tudelft.simulation.event.EventProducer
implements VehiclePhysicalInterface


(c) copyright 2003-2004 Delft University of Technology , the Netherlands.
See for project information www.simulation.tudelft.nl
License of use: General Public License (GPL) , no warranty

Version:
Jul 4, 2004
Author:
Alexander Verbraeck
See Also:
Serialized Form

Field Summary
 nl.tudelft.simulation.event.EventType DISTANCE_SPEED_1SECOND_EVENT
          the x-v event type to use for the xyChart
 nl.tudelft.simulation.event.EventType TIME_SPEED_1SECOND_EVENT
          the t-v event type to use for the xyChart
 
Fields inherited from class nl.tudelft.simulation.event.EventProducer
listeners
 
Fields inherited from interface nl.tudelft.simulation.traffic.vehicle.VehiclePhysicalInterface
REMOVE_EVENT
 
Fields inherited from interface nl.tudelft.simulation.event.EventProducerInterface
FIRST_POSITION, LAST_POSITION
 
Constructor Summary
VehiclePhysical(VehicleType vehicleType, VehicleControlInterface vehicleControl, TrackInterface track, double progression, double maxSpeedStart, nl.tudelft.simulation.dsol.simulators.DEVDESSSimulatorInterface simulator)
          Create a physical vehicle
 
Method Summary
protected  void driveOverControlPoints(double from, double to)
           
 javax.vecmath.Point3d getBackwardLocation(double distance)
          get a location along the track to the back
 javax.media.j3d.Bounds getBounds()
           
 double getCurrentAcceleration(double speed, double progression)
          Returns the vehicle's current acceleration
 double getCurrentSpeed()
          Returns the vehicle's current speed
 TrackInterface getCurrentTrack()
          Returns the vehicle's current track
protected  double getCurrentTracksLength()
           
 double getDistanceTraveled()
          this method is used for verification etc.
 nl.tudelft.simulation.event.EventType[] getEventTypes()
           
 nl.tudelft.simulation.language.d3.DirectedPoint getLocation()
           
 double getProgression()
          Returns the vehicle's current progression on the track where it is located.
 VehicleControlInterface getVehicleControl()
          Returns the control associated to this physical vehicle.
 VehicleType getVehicleType()
          Returns the vehicleType.
protected  void moveToFirstTrack(TrackInterface track, double progression)
           
protected  void moveToNextTrack()
          The front of the vehicle passes the track limit.
 void notify(nl.tudelft.simulation.event.EventInterface event)
           
 void removeVehicle()
          remove the vehicle from the track
 void setMaximumSpeed(double maxSpeed)
          Sets the vehicle's maximum speed
 double[] setSpeedAndProgression(double speed, double progression)
           
 void setVehicleControl(VehicleControlInterface vehicleControl)
           
 void startDriving()
          indicate that the vehicle can start driving.
 java.lang.String toString()
           
 
Methods inherited from class nl.tudelft.simulation.event.EventProducer
addListener, addListener, addListener, addListener, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, removeAllListeners, removeAllListeners, removeListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface nl.tudelft.simulation.event.EventProducerInterface
addListener, addListener, addListener, addListener, removeListener
 

Field Detail

TIME_SPEED_1SECOND_EVENT

public nl.tudelft.simulation.event.EventType TIME_SPEED_1SECOND_EVENT
the t-v event type to use for the xyChart


DISTANCE_SPEED_1SECOND_EVENT

public nl.tudelft.simulation.event.EventType DISTANCE_SPEED_1SECOND_EVENT
the x-v event type to use for the xyChart

Constructor Detail

VehiclePhysical

public VehiclePhysical(VehicleType vehicleType,
                       VehicleControlInterface vehicleControl,
                       TrackInterface track,
                       double progression,
                       double maxSpeedStart,
                       nl.tudelft.simulation.dsol.simulators.DEVDESSSimulatorInterface simulator)
Create a physical vehicle

Parameters:
vehicleType -
vehicleControl -
track -
progression -
maxSpeedStart -
simulator -
Method Detail

getEventTypes

public nl.tudelft.simulation.event.EventType[] getEventTypes()
Specified by:
getEventTypes in interface nl.tudelft.simulation.event.EventProducerInterface
See Also:
EventProducerInterface.getEventTypes()

startDriving

public void startDriving()
indicate that the vehicle can start driving. As long as this variable is false, the acceleration remains zero.

Specified by:
startDriving in interface VehiclePhysicalInterface
See Also:
VehiclePhysicalInterface.startDriving()

getCurrentAcceleration

public double getCurrentAcceleration(double speed,
                                     double progression)
Description copied from interface: VehiclePhysicalInterface
Returns the vehicle's current acceleration

Specified by:
getCurrentAcceleration in interface VehiclePhysicalInterface
Parameters:
speed -
progression -
Returns:
double
See Also:
VehiclePhysicalInterface.getCurrentAcceleration(double, double)

setSpeedAndProgression

public double[] setSpeedAndProgression(double speed,
                                       double progression)
Specified by:
setSpeedAndProgression in interface VehiclePhysicalInterface
Parameters:
speed -
progression -
Returns:
the new speed and progresssion if they have been changed
See Also:
VehiclePhysicalInterface.setSpeedAndProgression(double, double)

moveToNextTrack

protected void moveToNextTrack()
The front of the vehicle passes the track limit. Add a new track to the current track list. The progression on the new track will be 0. The 'update' method is responsible for deleting trailing tracks that are no longer needed. Note: the vehicle is only registered on the track of the front of the vehicle.


moveToFirstTrack

protected void moveToFirstTrack(TrackInterface track,
                                double progression)
Parameters:
track -
progression -

driveOverControlPoints

protected void driveOverControlPoints(double from,
                                      double to)
Parameters:
from -
to -

getCurrentSpeed

public double getCurrentSpeed()
Description copied from interface: VehiclePhysicalInterface
Returns the vehicle's current speed

Specified by:
getCurrentSpeed in interface VehiclePhysicalInterface
Returns:
double
See Also:
VehiclePhysicalInterface.getCurrentSpeed()

setMaximumSpeed

public void setMaximumSpeed(double maxSpeed)
Description copied from interface: VehiclePhysicalInterface
Sets the vehicle's maximum speed

Specified by:
setMaximumSpeed in interface VehiclePhysicalInterface
Parameters:
maxSpeed -
See Also:
VehiclePhysicalInterface.setMaximumSpeed(double)

getProgression

public double getProgression()
Description copied from interface: VehiclePhysicalInterface
Returns the vehicle's current progression on the track where it is located.

Specified by:
getProgression in interface VehiclePhysicalInterface
Returns:
progression
See Also:
VehiclePhysicalInterface.getProgression()

getCurrentTrack

public TrackInterface getCurrentTrack()
Description copied from interface: VehiclePhysicalInterface
Returns the vehicle's current track

Specified by:
getCurrentTrack in interface VehiclePhysicalInterface
Returns:
Track
See Also:
VehiclePhysicalInterface.getCurrentTrack()

getVehicleType

public VehicleType getVehicleType()
Description copied from interface: VehiclePhysicalInterface
Returns the vehicleType.

Specified by:
getVehicleType in interface VehiclePhysicalInterface
Returns:
vehicleType.
See Also:
VehiclePhysicalInterface.getVehicleType()

getVehicleControl

public VehicleControlInterface getVehicleControl()
Description copied from interface: VehiclePhysicalInterface
Returns the control associated to this physical vehicle.

Specified by:
getVehicleControl in interface VehiclePhysicalInterface
Returns:
vehicleControl
See Also:
VehiclePhysicalInterface.getVehicleControl()

setVehicleControl

public void setVehicleControl(VehicleControlInterface vehicleControl)
Specified by:
setVehicleControl in interface VehiclePhysicalInterface
Parameters:
vehicleControl - The vehicleControl to set.
See Also:
VehiclePhysicalInterface.setVehicleControl(nl.tudelft.simulation.traffic.vehicle.VehicleControlInterface)

getDistanceTraveled

public double getDistanceTraveled()
Description copied from interface: VehiclePhysicalInterface
this method is used for verification etc.

Specified by:
getDistanceTraveled in interface VehiclePhysicalInterface
Returns:
total distance the vehicle has traveled
See Also:
VehiclePhysicalInterface.getDistanceTraveled()

removeVehicle

public void removeVehicle()
                   throws java.rmi.RemoteException
Description copied from interface: VehiclePhysicalInterface
remove the vehicle from the track

Specified by:
removeVehicle in interface VehiclePhysicalInterface
Throws:
java.rmi.RemoteException
See Also:
VehiclePhysicalInterface.removeVehicle()

notify

public void notify(nl.tudelft.simulation.event.EventInterface event)
            throws java.rmi.RemoteException
Specified by:
notify in interface nl.tudelft.simulation.event.EventListenerInterface
Throws:
java.rmi.RemoteException
See Also:
EventListenerInterface.notify(nl.tudelft.simulation.event.EventInterface)

getCurrentTracksLength

protected double getCurrentTracksLength()
Returns:
the total length of the current track list

getLocation

public nl.tudelft.simulation.language.d3.DirectedPoint getLocation()
Specified by:
getLocation in interface nl.tudelft.simulation.dsol.animation.LocatableInterface
See Also:
LocatableInterface.getLocation()

getBackwardLocation

public javax.vecmath.Point3d getBackwardLocation(double distance)
get a location along the track to the back

Specified by:
getBackwardLocation in interface VehiclePhysicalInterface
Parameters:
distance -
Returns:
the location

getBounds

public javax.media.j3d.Bounds getBounds()
Specified by:
getBounds in interface nl.tudelft.simulation.dsol.animation.LocatableInterface
See Also:
LocatableInterface.getBounds()

toString

public java.lang.String toString()
See Also:
Object.toString()


Copyright © 2003-2004 Delft University of Technology, the Netherlands. All Rights Reserved.