35 if (trainType.compare(
"RB425") == 0) {
37 }
else if (trainType.compare(
"RB628") == 0) {
39 }
else if (trainType.compare(
"NGT400") == 0) {
41 }
else if (trainType.compare(
"NGT400_16") == 0) {
43 }
else if (trainType.compare(
"ICE1") == 0) {
45 }
else if (trainType.compare(
"REDosto7") == 0) {
47 }
else if (trainType.compare(
"Freight") == 0) {
49 }
else if (trainType.compare(
"ICE3") == 0) {
52 WRITE_ERROR(
"Unknown train type: " + trainType +
". Exiting!");
74 double ,
double ,
const MSVehicle*
const )
const {
80 double safetyGap = 5.0;
81 if (speed >= 30 / 3.6) {
90 return MIN2(vsafe, vmax);
94 return MAX2(
MIN2(vsafe, vmax), vmin);
121 double totalRes = res + gr;
126 if (speed < targetSpeed) {
130 if (totalRes > trac) {
147 double totalRes = res + gr;
152 return speed - a *
DELTA_T / 1000.;
165 std::map<double, double>::const_iterator low, prev;
166 low = lookUpMap->lower_bound(speed);
168 if (low == lookUpMap->end()) {
169 return (lookUpMap->rbegin())->second;
172 if (low == lookUpMap->begin()) {
179 double range = low->first - prev->first;
180 double dist = speed - prev->first;
184 double weight = dist / range;
186 double res = (1 - weight) * prev->second + weight * low->second;
209 WRITE_ERROR(
"function call not allowd for rail model. Exiting!");
224 const bool onInsertion)
const {
244 const double y =
MAX2(0.0, ((sqrt((b + 2.0 * v) * (b + 2.0 * v) + 8.0 * b * dist) - b) * 0.5 - v) / b);
245 const double yFull = floor(y);
246 const double exactGap = (yFull * yFull + yFull) * 0.5 * b + yFull * v + (y > yFull ? v : 0.0);
248 return DIST2SPEED(
MAX2(0.0, dist - exactGap) / (yFull + 1)) + fullSpeedGain + targetSpeed;
250 WRITE_ERROR(
"Anything else than semi implicit euler update is not yet implemented. Exiting!");
const int VTYPEPARS_MAXSPEED_SET
Representation of a vehicle in the micro simulation.
TrainParams initRB425Params() const
TrainParams initICE1Params() const
double stopSpeed(const MSVehicle *const veh, const double speed, double gap) const
Computes the vehicle's safe speed for approaching a non-moving obstacle (no dawdling) ...
MSCFModel_Rail(const MSVehicleType *vtype)
Constructor.
MSCFModel::VehicleVariables * createVehicleVariables() const
Returns model specific values which are stored inside a vehicle and must be used with casting...
The car-following model abstraction.
virtual MSCFModel * duplicate(const MSVehicleType *vtype) const
Duplicates the car-following model.
virtual double maxNextSpeed(double speed, const MSVehicle *const veh) const
Returns the maximum speed given the current speed.
std::map< double, double > LookUpMap
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...
TrainParams initICE3Params() const
TrainParams initNGT400_16Params() 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 getSpeedAfterMaxDecel(double v) const
Returns the velocity after maximum deceleration.
virtual double finalizeSpeed(MSVehicle *const veh, double vPos) const
Applies interaction with stops and lane changing model influences. Called at most once per simulation...
The car-following model and parameter.
bool wasSet(int what) const
Returns whether the given parameter was set.
TrainParams initREDosto7Params() const
TrainParams initNGT400Params() const
double freeSpeed(const MSVehicle *const veh, double speed, double seen, double maxSpeed, const bool onInsertion) const
Computes the vehicle's safe speed without a leader.
TrainParams initRB628Params() const
double getMaxSpeed() const
Get vehicle's maximum speed [m/s].
double maximumSafeStopSpeed(double gap, double currentSpeed, bool onInsertion=false, double headway=-1) const
Returns the maximum next velocity for stopping within gap.
const SUMOVTypeParameter & getParameter() const
double myDecel
The vehicle's maximum deceleration [m/s^2].
virtual ~MSCFModel_Rail()
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.
virtual void setMaxDecel(double decel)
Sets a new value for maximal comfortable deceleration [m/s^2].
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 myTrainParams
double getLength() const
Get vehicle's length [m].
static bool gSemiImplicitEulerUpdate
double getSlope() const
Returns the slope of the road at vehicle's position.
TrainParams initFreightParams() const
virtual void setEmergencyDecel(double decel)
Sets a new value for maximal physically possible deceleration [m/s^2].
double followSpeed(const MSVehicle *const veh, double speed, double gap2pred, double predSpeed, double predMaxDecel, const MSVehicle *const pred=0) const
Computes the vehicle's follow speed (no dawdling)
virtual int getModelID() const
Returns the model's ID; the XML-Tag number is used.
const int VTYPEPARS_LENGTH_SET
double getInterpolatedValueFromLookUpMap(double speed, const LookUpMap *lookUpMap) const