Class VehicleSpeedChange
- java.lang.Object
-
- org.eclipse.mosaic.rti.api.Interaction
-
- org.eclipse.mosaic.interactions.vehicle.VehicleSpeedChange
-
- All Implemented Interfaces:
Serializable
,Cloneable
,Comparable<Interaction>
public final class VehicleSpeedChange extends 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 aVehicleSpeedChange.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:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
VehicleSpeedChange.VehicleSpeedChangeType
These are all available types of speed changes currently supported.
-
Field Summary
Fields Modifier and Type Field Description static String
TYPE_ID
String identifying the type of this interaction.-
Fields inherited from class org.eclipse.mosaic.rti.api.Interaction
time
-
-
Constructor Summary
Constructors Constructor Description VehicleSpeedChange(long time, String vehicleId, VehicleSpeedChange.VehicleSpeedChangeType type, double newSpeed, long duration, double acceleration)
Creates a newVehicleSpeedChange
interaction.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(Object obj)
double
getAcceleration()
long
getDuration()
double
getSpeed()
VehicleSpeedChange.VehicleSpeedChangeType
getType()
String
getVehicleId()
int
hashCode()
String
toString()
-
Methods inherited from class org.eclipse.mosaic.rti.api.Interaction
compareTo, createTypeIdentifier, getId, getSenderId, getTime, getTypeId, setSenderId
-
-
-
-
Field Detail
-
TYPE_ID
public static final String TYPE_ID
String identifying the type of this interaction.
-
-
Constructor Detail
-
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 Detail
-
getVehicleId
public String getVehicleId()
-
getType
public VehicleSpeedChange.VehicleSpeedChangeType getType()
-
getSpeed
public double getSpeed()
-
getDuration
public long getDuration()
-
getAcceleration
public double getAcceleration()
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classInteraction
-
equals
public boolean equals(Object obj)
- Overrides:
equals
in classInteraction
-
toString
public String toString()
- Overrides:
toString
in classInteraction
-
-