Class VehicleSpeedChange
java.lang.Object
org.eclipse.mosaic.rti.api.Interaction
org.eclipse.mosaic.interactions.vehicle.VehicleSpeedChange
- All Implemented Interfaces:
Serializable
,Cloneable
,Comparable<Interaction>
This represents a 'change of speed' instruction to the used traffic simulator. The instruction
basically only needs the target speed as well as the timeframe to reach that speed.
Seeing as some traffic simulators can't seem to detect if this represents a speed up
or a slow down compared to the current speed a
VehicleSpeedChange.VehicleSpeedChangeType
needs to be given to
determine that data.
As a special bonus VehicleSpeedChange.VehicleSpeedChangeType.RESET
tells the traffic simulator to control the
speed on its own again. In that case speed as well as interval should be disregarded by
the respective traffic simulator ambassadors.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enum
These are all available types of speed changes currently supported. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final String
String identifying the type of this interaction.Fields inherited from class org.eclipse.mosaic.rti.api.Interaction
time
-
Constructor Summary
ConstructorsConstructorDescriptionVehicleSpeedChange
(long time, String vehicleId, VehicleSpeedChange.VehicleSpeedChangeType type, double newSpeed, long duration, double acceleration) Creates a newVehicleSpeedChange
interaction. -
Method Summary
Methods inherited from class org.eclipse.mosaic.rti.api.Interaction
compareTo, createTypeIdentifier, getId, getSenderId, getTime, getTypeId, setSenderId
-
Field Details
-
TYPE_ID
String identifying the type of this interaction.
-
-
Constructor Details
-
VehicleSpeedChange
public VehicleSpeedChange(long time, String vehicleId, VehicleSpeedChange.VehicleSpeedChangeType type, double newSpeed, long duration, double acceleration) Creates a newVehicleSpeedChange
interaction.- Parameters:
time
- Timestamp of this interaction, unit: [ns]vehicleId
- vehicle identifiertype
- change speed typenewSpeed
- New desired speed, unit [m/s]duration
- Duration in which the desired speed shall be reached, unit [ns]acceleration
- desired acceleration
-
-
Method Details
-
getVehicleId
-
getType
-
getSpeed
public double getSpeed() -
getDuration
public long getDuration() -
getAcceleration
public double getAcceleration() -
hashCode
public int hashCode()- Overrides:
hashCode
in classInteraction
-
equals
- Overrides:
equals
in classInteraction
-
toString
- Overrides:
toString
in classInteraction
-