Skip to content

Commit

Permalink
fix #14869
Browse files Browse the repository at this point in the history
  • Loading branch information
namdre committed May 16, 2024
1 parent 77ff81e commit 714d336
Show file tree
Hide file tree
Showing 8 changed files with 33 additions and 3 deletions.
7 changes: 7 additions & 0 deletions src/microsim/MSVehicleType.h
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,13 @@ class MSVehicleType {
return isPerson ? myParameter.boardingDuration : myParameter.loadingDuration;
}

/** @brief Get this person type's factor for loading/boarding duration
* @return The multiplier for the time a container / person needs to get loaded
*/
SUMOTime getBoardingFactor() const {
return myParameter.boardingFactor;
}


/** @brief Get vehicle's maximum lateral speed [m/s].
* @return The maximum lateral speed (in m/s) of vehicles of this class
Expand Down
5 changes: 3 additions & 2 deletions src/microsim/devices/MSDevice_Transportable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -186,10 +186,11 @@ MSDevice_Transportable::notifyMove(SUMOTrafficObject& /*tObject*/, double /*oldP
// no boarding / unboarding time in meso
arrivalTime += 1;
} else {
const double bf = transportable->getVehicleType().getBoardingFactor();
if (timeForNext > currentTime - DELTA_T) {
timeForNext += boardingDuration;
timeForNext += boardingDuration * bf;
} else {
timeForNext = currentTime + boardingDuration;
timeForNext = currentTime + boardingDuration * bf;
}
}
//ensure that vehicle stops long enough for deboarding
Expand Down
2 changes: 1 addition & 1 deletion src/microsim/transportables/MSTransportableControl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ MSTransportableControl::loadAnyWaiting(const MSEdge* edge, SUMOVehicle* vehicle,
t->setAbortWaiting(-1);
}
if (timeToLoadNext >= 0) { // meso does not have loading times
const SUMOTime loadingDuration = vehicle->getVehicleType().getLoadingDuration(t->isPerson());
const SUMOTime loadingDuration = vehicle->getVehicleType().getLoadingDuration(t->isPerson()) * t->getVehicleType().getBoardingFactor();
//update the time point at which the next transportable can be loaded on the vehicle
if (timeToLoadNext > currentTime - DELTA_T) {
timeToLoadNext += loadingDuration;
Expand Down
4 changes: 4 additions & 0 deletions src/utils/vehicle/SUMOVTypeParameter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -342,6 +342,7 @@ SUMOVTypeParameter::SUMOVTypeParameter(const std::string& vtid, const SUMOVehicl
speedFactorPremature(-1),
frontSeatPos(1.7),
seatingWidth(-1),
boardingFactor(1),
parametersSet(0),
saved(false),
onlyReferenced(false) {
Expand Down Expand Up @@ -559,6 +560,9 @@ SUMOVTypeParameter::write(OutputDevice& dev) const {
if (wasSet(VTYPEPARS_SPEEDFACTOR_PREMATURE_SET)) {
dev.writeAttr(SUMO_ATTR_SPEEDFACTOR_PREMATURE, speedFactorPremature);
}
if (wasSet(VTYPEPARS_BOARDING_FACTOR_SET)) {
dev.writeAttr(SUMO_ATTR_BOARDING_FACTOR, boardingFactor);
}
if (wasSet(VTYPEPARS_LANE_CHANGE_MODEL_SET)) {
dev.writeAttr(SUMO_ATTR_LANE_CHANGE_MODEL, lcModel);
}
Expand Down
4 changes: 4 additions & 0 deletions src/utils/vehicle/SUMOVTypeParameter.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ const long long int VTYPEPARS_TTT_BIDI_SET = (long long int)1 << 34;
const long long int VTYPEPARS_SEATING_WIDTH_SET = (long long int)1 << 35;
const long long int VTYPEPARS_SPEEDFACTOR_PREMATURE_SET = (long long int)1 << 36;
const long long int VTYPEPARS_PARKING_BADGES_SET = (long long int)1 << 37;
const long long int VTYPEPARS_BOARDING_FACTOR_SET = (long long int)1 << 38;


const int VTYPEPARS_DEFAULT_EMERGENCYDECEL_DEFAULT = -1;
Expand Down Expand Up @@ -390,6 +391,9 @@ class SUMOVTypeParameter : public Parameterised {
/// @brief the parking access rights
std::vector<std::string> parkingBadges;

/// @brief factor for boardingDuration / loadingDuration
double boardingFactor;

/// @brief Information for the router which parameter were set
long long int parametersSet;

Expand Down
12 changes: 12 additions & 0 deletions src/utils/vehicle/SUMOVehicleParserHelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1083,6 +1083,18 @@ SUMOVehicleParserHelper::beginVTypeParsing(const SUMOSAXAttributes& attrs, const
vType->parametersSet |= VTYPEPARS_SPEEDFACTOR_PREMATURE_SET;
}
}
if (attrs.hasAttribute(SUMO_ATTR_BOARDING_FACTOR)) {
bool ok = true;
const double bf = attrs.get<double>(SUMO_ATTR_BOARDING_FACTOR, id.c_str(), ok);
if (!ok) {
return handleVehicleTypeError(hardFail, vType);
} else if (bf < 0) {
return handleVehicleTypeError(hardFail, vType, toString(SUMO_ATTR_BOARDING_FACTOR) + " must be equal or greater than 0");
} else {
vType->boardingFactor = bf;
vType->parametersSet |= VTYPEPARS_BOARDING_FACTOR_SET;
}
}
if (attrs.hasAttribute(SUMO_ATTR_MAXSPEED_LAT)) {
bool ok = true;
const double maxSpeedLat = attrs.get<double>(SUMO_ATTR_MAXSPEED_LAT, vType->id.c_str(), ok);
Expand Down
1 change: 1 addition & 0 deletions src/utils/xml/SUMOXMLDefinitions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -508,6 +508,7 @@ StringBijection<int>::Entry SUMOXMLDefinitions::attrs[] = {
{ "collisionMinGapFactor", SUMO_ATTR_COLLISION_MINGAP_FACTOR },
{ "boardingDuration", SUMO_ATTR_BOARDING_DURATION },
{ "loadingDuration", SUMO_ATTR_LOADING_DURATION },
{ "boardingFactor", SUMO_ATTR_BOARDING_FACTOR },
{ "scale", SUMO_ATTR_SCALE },
{ "insertionChecks", SUMO_ATTR_INSERTIONCHECKS },
{ "timeToTeleport", SUMO_ATTR_TIME_TO_TELEPORT },
Expand Down
1 change: 1 addition & 0 deletions src/utils/xml/SUMOXMLDefinitions.h
Original file line number Diff line number Diff line change
Expand Up @@ -710,6 +710,7 @@ enum SumoXMLAttr {
SUMO_ATTR_COLLISION_MINGAP_FACTOR,
SUMO_ATTR_BOARDING_DURATION,
SUMO_ATTR_LOADING_DURATION,
SUMO_ATTR_BOARDING_FACTOR,
SUMO_ATTR_SCALE,
SUMO_ATTR_INSERTIONCHECKS,
SUMO_ATTR_TIME_TO_TELEPORT,
Expand Down

0 comments on commit 714d336

Please sign in to comment.