49 return MIN2(maxPower / speed, maxTraction);
63 if (trainType.compare(
"RB425") == 0) {
65 }
else if (trainType.compare(
"RB628") == 0) {
67 }
else if (trainType.compare(
"NGT400") == 0) {
69 }
else if (trainType.compare(
"NGT400_16") == 0) {
71 }
else if (trainType.compare(
"ICE1") == 0) {
73 }
else if (trainType.compare(
"REDosto7") == 0) {
75 }
else if (trainType.compare(
"Freight") == 0) {
77 }
else if (trainType.compare(
"ICE3") == 0) {
79 }
else if (trainType.compare(
"MireoPlusB") == 0) {
81 }
else if (trainType.compare(
"MireoPlusH") == 0) {
83 }
else if (trainType.compare(
"custom") == 0) {
125 WRITE_WARNING(
TLF(
"Ignoring tractionTable because maxPower and maxTraction are set for vType '%'.", vtype->
getID()));
133 if (hasSomeResCoef && !hasAllResCoef) {
134 throw ProcessError(
TLF(
"Some undefined resistance coefficients for vType '%' (requires resCoef_constant, resCoef_linear and resCoef_quadratic)", vtype->
getID()));
137 WRITE_WARNING(
TLF(
"Ignoring resistanceTable because resistance coefficients are set for vType '%'.", vtype->
getID()));
141 throw ProcessError(
TLF(
"Either tractionTable or maxPower must be defined for vType '%' with Rail model type '%'.", vtype->
getID(), trainType));
144 throw ProcessError(
TLF(
"Either resistanceTable or resCoef_constant must be defined for vType '%' with Rail model type '%'.", vtype->
getID(), trainType));
160 if (speed >= 30 / 3.6) {
170 return MIN2(vsafe, vmax);
174 return MAX2(
MIN2(vsafe, vmax), vmin);
214 double totalRes = res + gr;
218 if (speed < targetSpeed) {
222 if (totalRes > trac) {
236 const double slope = veh->
getSlope();
239 const double totalRes = res + gr;
243 return MAX2(vMin, 0.);
274 WRITE_ERROR(
"function call not allowed for rail model. Exiting!");
291 const bool onInsertion,
const CalcReason )
const {
311 const double y =
MAX2(0.0, ((sqrt((b + 2.0 * v) * (b + 2.0 * v) + 8.0 * b * dist) - b) * 0.5 - v) / b);
312 const double yFull = floor(y);
313 const double exactGap = (yFull * yFull + yFull) * 0.5 * b + yFull * v + (y > yFull ? v : 0.0);
315 return DIST2SPEED(
MAX2(0.0, dist - exactGap) / (yFull + 1)) + fullSpeedGain + targetSpeed;
317 WRITE_ERROR(
TL(
"Anything else than semi implicit euler update is not yet implemented. Exiting!"));
#define WRITE_ERRORF(...)
#define WRITE_WARNING(msg)
const long long int VTYPEPARS_MAXSPEED_SET
const long long int VTYPEPARS_MASS_SET
const long long int VTYPEPARS_LENGTH_SET
@ SUMO_ATTR_RESISTANCE_COEFFICIENT_CONSTANT
@ SUMO_ATTR_RESISTANCE_TABLE
@ SUMO_ATTR_RESISTANCE_COEFFICIENT_QUADRATIC
@ SUMO_ATTR_EMERGENCYDECEL
@ SUMO_ATTR_RESISTANCE_COEFFICIENT_LINEAR
@ SUMO_ATTR_TRACTION_TABLE
const double INVALID_DOUBLE
invalid double
static double getInterpolatedValue(const LinearApproxMap &map, double axisValue)
Get interpolated value.
const MSVehicleType & getVehicleType() const
Returns the vehicle's type definition.
TrainParams initICE3Params() const
TrainParams initNGT400_16Params() const
virtual ~MSCFModel_Rail()
TrainParams initREDosto7Params() const
MSCFModel::VehicleVariables * createVehicleVariables() const
Returns model specific values which are stored inside a vehicle and must be used with casting.
virtual double minNextSpeedEmergency(double speed, const MSVehicle *const veh=0) const
Returns the minimum speed after emergency braking, given the current speed (depends on the numerical ...
TrainParams initCustomParams() const
TrainParams initICE1Params() const
MSCFModel_Rail(const MSVehicleType *vtype)
Constructor.
TrainParams initMireoPlusB2TParams() const
double freeSpeed(const MSVehicle *const veh, double speed, double seen, double maxSpeed, const bool onInsertion, const CalcReason usage=CalcReason::CURRENT) const
Computes the vehicle's safe speed without a leader.
TrainParams initRB628Params() const
virtual MSCFModel * duplicate(const MSVehicleType *vtype) const
Duplicates the car-following model.
virtual int getModelID() const
Returns the model's ID; the XML-Tag number is used.
double getSpeedAfterMaxDecel(double v) const
Returns the velocity after maximum deceleration.
TrainParams myTrainParams
virtual double minNextSpeed(double speed, const MSVehicle *const veh) const
Returns the minimum speed given the current speed (depends on the numerical update scheme and its ste...
double getWeight(const MSVehicle *const veh) const
double followSpeed(const MSVehicle *const veh, double speed, double gap2pred, double predSpeed, double predMaxDecel, const MSVehicle *const pred=0, const CalcReason usage=CalcReason::CURRENT) const
Computes the vehicle's follow speed (no dawdling)
double getRotWeight(const MSVehicle *const veh) const
TrainParams initRB425Params() const
TrainParams initFreightParams() const
virtual double maxNextSpeed(double speed, const MSVehicle *const veh) const
Returns the maximum speed given the current speed.
TrainParams initNGT400Params() const
TrainParams initMireoPlusH2TParams() const
double finalizeSpeed(MSVehicle *const veh, double vPos) const
Applies interaction with stops and lane changing model influences. Called at most once per simulation...
double stopSpeed(const MSVehicle *const veh, const double speed, double gap, double decel, const CalcReason usage=CalcReason::CURRENT) const
Computes the vehicle's safe speed for approaching a non-moving obstacle (no dawdling)
The car-following model abstraction.
virtual void setEmergencyDecel(double decel)
Sets a new value for maximal physically possible deceleration [m/s^2].
virtual double finalizeSpeed(MSVehicle *const veh, double vPos) const
Applies interaction with stops and lane changing model influences. Called at most once per simulation...
virtual void setMaxDecel(double decel)
Sets a new value for maximal comfortable deceleration [m/s^2].
CalcReason
What the return value of stop/follow/free-Speed is used for.
double myDecel
The vehicle's maximum deceleration [m/s^2].
double maximumSafeStopSpeed(double gap, double decel, double currentSpeed, bool onInsertion=false, double headway=-1, bool relaxEmergency=true) const
Returns the maximum next velocity for stopping within gap.
static bool gSemiImplicitEulerUpdate
Representation of a vehicle in the micro simulation.
double getSlope() const
Returns the slope of the road at vehicle's position in degrees.
The car-following model and parameter.
double getMaxSpeed() const
Get vehicle's (technical) maximum speed [m/s].
const std::string & getID() const
Returns the name of the vehicle type.
double getMinGap() const
Get the free space in front of vehicles of this class.
bool wasSet(long long int what) const
Returns whether the given parameter was set.
double getLength() const
Get vehicle's length [m].
double getMass() const
Get this vehicle type's mass.
const SUMOVTypeParameter & getParameter() const
LinearApproxHelpers::LinearApproxMap getCFProfile(const SumoXMLAttr attr, const LinearApproxHelpers::LinearApproxMap &defaultProfile) const
Returns the named value from the map, or the default if it is not contained there.
double getCFParam(const SumoXMLAttr attr, const double defaultValue) const
Returns the named value from the map, or the default if it is not contained there.
std::string getCFParamString(const SumoXMLAttr attr, const std::string defaultValue) const
Returns the named value from the map, or the default if it is not contained there.
LinearApproxHelpers::LinearApproxMap traction
LinearApproxHelpers::LinearApproxMap resistance
double getTraction(double speed) const
double getResistance(double speed) const