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) {
132 WRITE_WARNING(
TLF(
"Ignoring tractionTable because maxPower and maxTraction are set for vType '%'.", vtype->
getID()));
140 if (hasSomeResCoef && !hasAllResCoef) {
141 throw ProcessError(
TLF(
"Some undefined resistance coefficients for vType '%' (requires resCoef_constant, resCoef_linear and resCoef_quadratic)", vtype->
getID()));
144 WRITE_WARNING(
TLF(
"Ignoring resistanceTable because resistance coefficients are set for vType '%'.", vtype->
getID()));
148 throw ProcessError(
TLF(
"Either tractionTable or maxPower must be defined for vType '%' with Rail model type '%'.", vtype->
getID(), trainType));
151 throw ProcessError(
TLF(
"Either resistanceTable or resCoef_constant must be defined for vType '%' with Rail model type '%'.", vtype->
getID(), trainType));
167 if (speed >= 30 / 3.6) {
177 return MIN2(vsafe, vmax);
181 return MAX2(
MIN2(vsafe, vmax), vmin);
212 if (r == std::numeric_limits<double>::max()) {
219 WRITE_WARNINGF(
"Cannot compute curve resistance for vehicle '%' with radius % at time %",
242 double totalRes = res + gr + cr;
246 if (speed < targetSpeed) {
250 if (totalRes > trac) {
264 const double slope = veh->
getSlope();
268 const double totalRes = res + gr + cr;
272 return MAX2(vMin, 0.);
303 WRITE_ERROR(
"function call not allowed for rail model. Exiting!");
314 const bool onInsertion,
const CalcReason )
const {
334 const double y =
MAX2(0.0, ((sqrt((b + 2.0 * v) * (b + 2.0 * v) + 8.0 * b * dist) - b) * 0.5 - v) / b);
335 const double yFull = floor(y);
336 const double exactGap = (yFull * yFull + yFull) * 0.5 * b + yFull * v + (y > yFull ? v : 0.0);
338 return DIST2SPEED(
MAX2(0.0, dist - exactGap) / (yFull + 1)) + fullSpeedGain + targetSpeed;
340 WRITE_ERROR(
TL(
"Anything else than semi implicit euler update is not yet implemented. Exiting!"));
#define WRITE_WARNINGF(...)
#define WRITE_ERRORF(...)
#define WRITE_WARNING(msg)
std::string time2string(SUMOTime t, bool humanReadable)
convert SUMOTime to string (independently of global format setting)
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_ROECKL_OFFSET_SHARP
@ SUMO_ATTR_RESISTANCE_TABLE
@ SUMO_ATTR_ROECKL_NUMERATOR_SHARP
@ SUMO_ATTR_CURVE_RESISTANCE
@ SUMO_ATTR_ROECKL_SHARP_RADIUS
@ SUMO_ATTR_ROECKL_NUMERATOR
@ SUMO_ATTR_RESISTANCE_COEFFICIENT_QUADRATIC
@ SUMO_ATTR_EMERGENCYDECEL
@ SUMO_ATTR_ROECKL_OFFSET
@ 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
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.
double getCurveResistance(const MSVehicle *veh) const
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 getCurveRadius() const
Returns the vehicle's current curve radius in m.
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
const std::string & getID() const
Returns the id.
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
double roeckl_offset_sharp
LinearApproxHelpers::LinearApproxMap resistance
double roeckl_numerator_sharp
double getTraction(double speed) const
double roeckl_sharp_radius
double getResistance(double speed) const