61 OptionsCont::getOptions().getFloat(
"mapmatch.distance"),
63 myActiveRouteRepeat(0),
64 myActiveRoutePeriod(0),
65 myActiveRoutePermanent(false),
68 myActiveTransportablePlan(nullptr),
69 myAddVehiclesDirectly(addVehiclesDirectly),
70 myCurrentVTypeDistribution(nullptr),
71 myCurrentRouteDistribution(nullptr),
72 myAmLoadingState(false),
73 myScaleSuffix(
OptionsCont::getOptions().getString(
"scale-suffix")),
74 myReplayRerouting(
OptionsCont::getOptions().getBool(
"replay-rerouting")),
75 myStartTriggeredInFlow(false) {
106 const std::string element =
toString(tag);
119 if (type !=
nullptr) {
127 const std::string tazType = useJunction ?
"junction" :
"taz";
130 if (fromTaz ==
nullptr) {
131 throw ProcessError(
"Source " + tazType +
" '" + tazID +
"' not known " + rid +
"!"
133 }
else if (fromTaz->getNumSuccessors() == 0 && tag !=
SUMO_TAG_PERSON) {
134 throw ProcessError(
"Source " + tazType +
" '" + tazID +
"' has no outgoing edges " + rid +
"!");
170 if (viaSink ==
nullptr) {
173 viaEdges.push_back(viaSink);
180 if (!viaEdges.empty()) {
183 for (
const MSEdge* e : viaEdges) {
192 const std::string tazType = useJunction ?
"junction" :
"taz";
195 if (toTaz ==
nullptr) {
196 throw ProcessError(
"Sink " + tazType +
" '" + tazID +
"' not known " + rid +
"!"
198 }
else if (toTaz->getNumPredecessors() == 0 && tag !=
SUMO_TAG_PERSON) {
199 throw ProcessError(
"Sink " + tazType +
" '" + tazID +
"' has no incoming edges " + rid +
"!");
291 std::vector<double> probs;
301 while (st.hasNext()) {
302 const std::string& vtypeID = st.next();
304 if (dist !=
nullptr) {
305 const double distProb = ((int)probs.size() > probIndex ? probs[probIndex] : 1.) / dist->
getOverallProb();
306 std::vector<double>::const_iterator probIt = dist->
getProbs().begin();
313 if (type ==
nullptr) {
316 const double prob = ((int)probs.size() > probIndex ? probs[probIndex] : type->
getDefaultProbability());
321 if (probs.size() > 0 && probIndex != (int)probs.size()) {
396 WRITE_WARNING(
TL(
"Attribute 'period' is deprecated for route. Use 'cycleTime' instead."));
425 std::string type =
"vehicle";
426 if (mayBeDisconnected) {
447 if (route !=
nullptr) {
470 std::string errSuffix =
".";
474 if (vtype !=
nullptr) {
480 if (tmpStops.size() == 0 || tmpStops.back().jump < 0) {
481 throw ProcessError(
TLF(
"Disconnected route '%' when repeating. Last edge '%' is not connected to first edge '%'%",
489 if (stop.until > 0) {
494 throw ProcessError(
TLF(
"Cannot repeat stops with 'until' in route % because no cycleTime is defined.", description));
498 if (stop.arrival > 0) {
503 throw ProcessError(
TLF(
"Cannot repeat stops with 'arrival' in route % because no cycleTime is defined.", description));
570 std::vector<double> probs;
583 std::string routeID = st.
next();
585 if (route ==
nullptr) {
588 const double prob = ((int)probs.size() > probIndex ? probs[probIndex] : 1.0);
592 if (probs.size() > 0 && probIndex != (int)probs.size()) {
630 if (rDist !=
nullptr && rDist->
getVals().size() > 0) {
631 route = rDist->
getVals().front();
634 if (route ==
nullptr) {
642 if (route !=
nullptr && route->getID() == embeddedRouteID) {
643 route->checkRemoval();
655 if (vtype ==
nullptr) {
672 if (route ==
nullptr) {
686 if (route->mustReroute()) {
709 if (route->getEdges().size() == 1
746 if (rDist !=
nullptr) {
747 for (
int i = 0; i < (int)rDist->
getVals().size() - 1; i++) {
760 for (
int i = 1; i < quota; i++) {
793 std::string scaleWarning =
"";
795 scaleWarning =
"\n (Possibly duplicate id due to using option --scale. Set option --scale-suffix to prevent this)";
797 throw ProcessError(
"Another vehicle with the id '" + veh_id +
"' exists." + scaleWarning);
805 if (vehicle !=
nullptr) {
819 assert(route->getStops().size() > 0);
823 if (stop.index == 0) {
824 if (edges.front() != stopEdge ||
825 route->getStops().front().endPos < stop.endPos) {
826 edges.insert(edges.begin(), stopEdge);
829 if (edges.back() != stopEdge ||
830 route->getStops().back().endPos > stop.endPos) {
831 edges.push_back(stopEdge);
838 isPermanent,
new RGBColor(route->getColor()), route->getStops());
969 for (
int j = 0; j < quota; j++) {
970 if (i > 0 || j > 0) {
978 copyPlan->push_back(s->clone());
993 + (j > 0 ?
"." +
toString(j) :
""));
1002 if (!tc.
add(transportable)) {
1004 delete transportable;
1027 const std::string
id = vehType->
getID();
1030 throw ProcessError(
TLF(
"Another vehicle type (or distribution) with the id '%' exists.",
id));
1037 if (dist !=
nullptr) {
1039 std::vector<double>::const_iterator probIt = dist->
getProbs().begin();
1084 if (route ==
nullptr) {
1087 if (route->mustReroute()) {
1152 const std::string mode = modeTag ==
SUMO_TAG_RIDE ?
"ride" :
"transport";
1153 std::string agent =
"person";
1154 std::string stop =
"bus stop";
1156 agent =
"container";
1157 stop =
"container stop";
1162 throw ProcessError(
"Found " + mode +
" inside " + agent +
" element");
1166 const MSEdge* from =
nullptr;
1178 const MSEdge* startVehFrom =
nullptr;
1180 if (st.size() != 1) {
1181 throw ProcessError(
"Triggered departure for " + agent +
" '" + aid +
"' requires a unique lines value.");
1185 const std::string vehID = st.front();
1187 if (sVeh ==
nullptr) {
1190 if (startVeh !=
nullptr) {
1192 startVehFrom = route->getEdges().front();
1204 if (startVeh ==
nullptr) {
1206 WRITE_WARNINGF(
TL(
"Skipping % '%' with triggered departure because vehicle '%' was removed by scaling."), agent, aid, vehID);
1208 throw ProcessError(
"Unknown vehicle '" + vehID +
"' in triggered departure for " + agent +
" '" + aid +
"'.");
1213 throw ProcessError(
"Cannot use triggered vehicle '" + vehID +
"' in triggered departure for " + agent +
" '" + aid +
"'.");
1218 const std::string fromID = attrs.
get<std::string>(
SUMO_ATTR_FROM, aid.c_str(), ok);
1220 if (from ==
nullptr) {
1221 throw ProcessError(
"The from edge '" + fromID +
"' within a " + mode +
" of " + agent +
" '" + aid +
"' is not known.");
1226 const bool transferAtJunction = (from->getFromJunction() ==
myActiveTransportablePlan->back()->getDestination()->getFromJunction()
1228 if (!(stopWithAccess || transferAtJunction)) {
1229 throw ProcessError(
"Disconnected plan for " + agent +
" '" + aid +
1233 if (startVeh !=
nullptr && startVehFrom != from) {
1234 throw ProcessError(
"Disconnected plan for triggered " + agent +
" '" + aid +
1235 "' (edge '" + fromID +
"' != edge '" + startVehFrom->
getID() +
"').");
1237 }
else if (startVeh !=
nullptr) {
1238 from = startVehFrom;
1241 if (from ==
nullptr) {
1242 throw ProcessError(
"The start edge for " + agent +
" '" + aid +
"' is not known.");
1250 const std::string toID = attrs.
get<std::string>(
SUMO_ATTR_TO, aid.c_str(), ok);
1252 if (to ==
nullptr) {
1253 throw ProcessError(
"The to edge '" + toID +
"' within a " + mode +
" of " + agent +
" '" + aid +
"' is not known.");
1282 if (toStop ==
nullptr) {
1297 std::string errorSuffix;
1315 const MSEdge* edge =
nullptr;
1320 if (pa !=
nullptr) {
1327 if (toStop !=
nullptr) {
1342 if (ok && stop.
edge !=
"") {
1345 throw ProcessError(
TLF(
"The edge '%' for a stop is not known%.", stop.
edge, errorSuffix));
1347 }
else if (ok && stop.
lane !=
"") {
1349 if (stopLane ==
nullptr) {
1352 if (stopLane !=
nullptr) {
1359 throw ProcessError(
TLF(
"The lane '%' for a stop is not known%.", stop.
lane, errorSuffix));
1372 positions.push_back(pos);
1378 if (type !=
nullptr) {
1384 edge = geoEdges.front();
1389 stop.
endPos = edge->
getLanes()[0]->getShape().nearest_offset_to_point2D(pos,
false);
1391 throw ProcessError(
TLF(
"Could not map stop position '%' to the network%.", pos, errorSuffix));
1396 if (toStop !=
nullptr) {
1409 const std::string msg =
TLF(
"A stop must be placed on a busStop, a chargingStation, an overheadWireSegment, a containerStop, a parkingArea, an edge or a lane%.", errorSuffix);
1420 WRITE_WARNINGF(
TL(
"Deprecated attribute 'pos' in description of stop%."), errorSuffix);
1431 throw ProcessError(
TLF(
"Invalid start or end position for stop on %'%.",
1432 stop.
lane !=
"" ? (
"lane '" + stop.
lane) : (
"edge '" + stop.
edge), errorSuffix));
1458 if (start > prevAr + NUMERICAL_EPS || end < prevAr - NUMERICAL_EPS) {
1459 WRITE_WARNINGF(
TL(
"Disconnected plan for % '%' (stop range %-% does not cover previous arrival position %)."),
1511 const MSStage*
const lastStage,
bool& ok) {
1513 const std::string description =
"person '" + personID +
"' walking from edge '" + fromEdge->
getID() +
"'";
1516 WRITE_WARNING(
TL(
"The attribute departPos is no longer supported for walks, please use the person attribute, the arrivalPos of the previous step or explicit stops."));
1519 if (lastStage !=
nullptr) {
1530 if (bs !=
nullptr) {
1533 if (arrivalPos < 0) {
1534 const std::string message =
TLF(
"Bus stop '%' is not connected to arrival edge '%' for %.",
1535 bs->
getID(), arrivalEdge->
getID(), description);
1549 arrivalPos = arrPos;
1556 if (toEdge ==
nullptr) {
1576 throw ProcessError(
TL(
"Cannot define person stage without person."));
1582 const MSEdge* from =
nullptr;
1583 const MSEdge* to =
nullptr;
1589 if (hasExplicitFrom) {
1598 if (previousDestination !=
nullptr && previousDestination != from) {
1599 WRITE_WARNINGF(
TL(
"Person '%' jumps from edge '%' to personTrip origin edge '%'."),
1600 id, previousDestination->
getID(), from->
getID());
1613 double departPos = 0;
1614 double arrivalPos = 0;
1624 std::string errorMsg;
1636 const std::string vtypeid = st.next();
1637 const MSVehicleType*
const vType = vehControl.getVType(vtypeid);
1638 if (vType ==
nullptr) {
1660 stoppingPlace, duration, modeSet, types, speed, walkFactor, group,
1678 throw ProcessError(
TL(
"Cannot define person stage without person."));
1696 double departPos = 0;
1697 double arrivalPos = 0;
1702 if (route ==
nullptr) {
1737 std::vector<SUMOTime>* exitTimes =
new std::vector<SUMOTime>();
1769 if (lane ==
nullptr) {
1772 const double usableWidth = lane->
getWidth() - 0.5;
1775 pos = -usableWidth / 2;
1778 pos = usableWidth / 2;
1818 const MSEdge* from =
nullptr;
1819 const MSEdge* to =
nullptr;
1827 throw ProcessError(
TLF(
"Could not read tranship speed for container '%'.", cid));
1835 throw ProcessError(
TLF(
"Non-positive tranship speed for container '%'.", cid));
1838 const MSEdge* preEdge =
nullptr;
1852 const std::string fromID = attrs.
get<std::string>(
SUMO_ATTR_FROM, cid.c_str(), ok);
1854 if (from ==
nullptr) {
1855 throw ProcessError(
"The from edge '" + fromID +
"' within a tranship of container '" + cid +
"' is not known.");
1857 if (preEdge !=
nullptr && preEdge != from) {
1858 throw ProcessError(
"Disconnected plan for container '" + cid +
"' (" + from->getID() +
"!=" + preEdge->
getID() +
").");
1860 }
else if (preEdge ==
nullptr) {
1861 throw ProcessError(
TLF(
"The start edge for container '%' is not known.", cid));
1867 const std::string toID = attrs.
get<std::string>(
SUMO_ATTR_TO, cid.c_str(), ok);
1869 if (to ==
nullptr) {
1870 throw ProcessError(
"The to edge '" + toID +
"' within a tranship of container '" + cid +
"' is not known.");
1873 const std::string description =
"container '" + cid +
"' transhipping from edge '" + from->
getID() +
"'";
1875 if (cs !=
nullptr) {
1878 throw ProcessError(
TLF(
"Inconsistent tranship for container '%', needs either: 'edges', 'to', 'containerStop' (or any other stopping place)", cid));
1887 if (preEdge ==
nullptr) {
1907 for (
MSLane* lane : edge->getLanes()) {
1909 const float cmin[2] = {(float) b.
xmin(), (float) b.
ymin()};
1910 const float cmax[2] = {(float) b.
xmax(), (float) b.
ymax()};
1911 tree->
Insert(cmin, cmax, lane);
std::vector< const MSEdge * > ConstMSEdgeVector
#define JUNCTION_TAZ_MISSING_HELP
#define WRITE_WARNINGF(...)
#define WRITE_WARNING(msg)
std::shared_ptr< const MSRoute > ConstMSRoutePtr
SUMOTime string2time(const std::string &r)
convert string to SUMOTime
constexpr SUMOTime TIME2STEPS(double x)
const long long int VTYPEPARS_MAXSPEED_SET
const long long int VTYPEPARS_VEHICLECLASS_SET
const std::string & getVehicleClassNames(SVCPermissions permissions, bool expand)
Returns the ids of the given classes, divided using a ' '.
long long int SVCPermissions
bitset where each bit declares whether a certain SVC may use this edge/lane
const double DEFAULT_VEH_PROB
const std::string DEFAULT_VTYPE_ID
SUMOVehicleClass
Definition of vehicle classes to differ between different lane usage and authority types.
@ SVC_IGNORING
vehicles ignoring classes
@ SVC_PASSENGER
vehicle is a passenger car (a "normal" car)
@ SVC_BICYCLE
vehicle is a bicycle
@ SVC_PEDESTRIAN
pedestrian
const double DEFAULT_CONTAINER_TRANSHIP_SPEED
@ GIVEN
The edge index is given.
@ DEFAULT
No information given; use default.
const long long int VEHPARS_FORCE_REROUTE
DepartPosLatDefinition
Possible ways to choose the lateral departure position.
@ RANDOM
The lateral position is chosen randomly.
@ RIGHT
At the rightmost side of the lane.
@ GIVEN
The position is given.
@ LEFT
At the leftmost side of the lane.
@ FREE
A free lateral position is chosen.
@ CENTER
At the center of the lane.
@ RANDOM_FREE
If a fixed number of random choices fails, a free lateral position is chosen.
@ RANDOM
A random position is chosen.
@ GIVEN
The position is given.
const long long int VEHPARS_ROUTE_SET
const std::string LINE_ANY
const long long int VEHPARS_TO_TAZ_SET
const long long int VEHPARS_DEPARTPOS_SET
const long long int VEHPARS_ARRIVALPOS_SET
const int STOP_INDEX_REPEAT
const long long int VEHPARS_FROM_TAZ_SET
@ GIVEN
The arrival position is given.
const double MIN_STOP_LENGTH
@ BEGIN
The departure is at simulation start.
@ GIVEN
The time is given.
@ TRIGGERED
The departure is person triggered.
SumoXMLTag
Numbers representing SUMO-XML - element names.
@ SUMO_TAG_CHARGING_STATION
A Charging Station.
@ SUMO_TAG_NOTHING
invalid tag, must be the last one
@ SUMO_TAG_FLOW
a flow definition using from and to edges or a route
@ SUMO_TAG_PARAM
parameter associated to a certain key
@ SUMO_TAG_TRIP
a single trip definition (used by router)
@ SUMO_ATTR_FROM_JUNCTION
@ SUMO_ATTR_REPLACED_AT_TIME
@ SUMO_ATTR_DEPARTPOS_LAT
@ SUMO_ATTR_EDGES
the edges of a route
@ SUMO_ATTR_REPLACED_ON_INDEX
@ SUMO_ATTR_COLOR
A color information.
@ SUMO_ATTR_STATE
The state of a link.
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
A class that stores a 2D geometrical boundary.
double ymin() const
Returns minimum y-coordinate.
double xmin() const
Returns minimum x-coordinate.
PositionVector getShape(const bool closeShape) const
get position vector (shape) based on this boundary
double ymax() const
Returns maximum y-coordinate.
double xmax() const
Returns maximum x-coordinate.
Writes the state of the tls to a file (in each second)
void error(const XERCES_CPP_NAMESPACE::SAXParseException &exception)
Handler for XML-errors.
const std::string & getFileName() const
returns the current file name
static const GeoConvHelper & getFinal()
the coordinate transformation for writing the location element and for tracking the original coordina...
bool x2cartesian_const(Position &from) const
Converts the given coordinate into a cartesian using the previous initialisation.
static MSLane * interpretOppositeStop(SUMOVehicleParameter::Stop &stop)
interpret stop lane on opposite side of the road
const MSParkingArea * getParkingArea() const
Get the parking area the charging station is placed on.
A road/street connecting two junctions.
static const MSEdgeVector & getAllEdges()
Returns all edges with a numerical id.
const std::vector< MSLane * > & getLanes() const
Returns this edge's lanes.
static void parseEdgesList(const std::string &desc, ConstMSEdgeVector &into, const std::string &rid)
Parses the given string assuming it contains a list of edge ids divided by spaces.
const MSEdge * getNormalSuccessor() const
if this edge is an internal edge, return its first normal successor, otherwise the edge itself
const MSJunction * getToJunction() const
double getLength() const
return the length of the edge
bool isInternal() const
return whether this edge is an internal edge
static bool dictionary(const std::string &id, MSEdge *edge)
Inserts edge into the static dictionary Returns true if the key id isn't already in the dictionary....
const MSEdge * getNormalBefore() const
if this edge is an internal edge, return its first normal predecessor, otherwise the edge itself
virtual void addEvent(Command *operation, SUMOTime execTimeStep=-1)
Adds an Event.
static bool gStateLoaded
Information whether a state has been loaded.
static bool gUsingInternalLanes
Information whether the simulation regards internal lanes.
const SUMOVehicleParameter * getFlowPars(const std::string &id) const
return parameters for the given flow
void add(SUMOVehicle *veh)
Adds a single vehicle for departure.
SUMOTime computeRandomDepartOffset() const
compute (optional) random offset to the departure time
Representation of a lane in the micro simulation.
double getLength() const
Returns the lane's length.
static bool dictionary(const std::string &id, MSLane *lane)
Static (sic!) container methods {.
MSEdge & getEdge() const
Returns the lane's edge.
double getWidth() const
Returns the lane's width.
The simulated network and simulation perfomer.
static MSNet * getInstance()
Returns the pointer to the unique instance of MSNet (singleton).
MSEventControl * getBeginOfTimestepEvents()
Returns the event control for events executed at the begin of a time step.
MSEventControl * getEndOfTimestepEvents()
Returns the event control for events executed at the end of a time step.
virtual MSTransportableControl & getContainerControl()
Returns the container control.
MSStoppingPlace * getStoppingPlace(const std::string &id, const SumoXMLTag category) const
Returns the named stopping place of the given category.
bool hasContainers() const
Returns whether containers are simulated.
bool hasPersons() const
Returns whether persons are simulated.
MSInsertionControl & getInsertionControl()
Returns the insertion control.
SUMOTime getStateLoaderTime() const
return the next time for route loading the time of state loading
MSVehicleControl & getVehicleControl()
Returns the vehicle control.
virtual MSTransportableControl & getPersonControl()
Returns the person control.
static const double RANDOM_POS_LAT
magic value to encode randomized lateral offset for persons when starting a walk
static const double UNSPECIFIED_POS_LAT
the default lateral offset for persons when starting a walk
A lane area vehicles can halt at.
void closePerson() override
Ends the processing of a person.
RandomDistributor< ConstMSRoutePtr > * myCurrentRouteDistribution
The currently parsed distribution of routes (probability->route)
void addRideOrTransport(const SUMOSAXAttributes &attrs, const SumoXMLTag modeTag)
Processing of a transport.
void closeContainerFlow() override
Ends the processing of a containerFlow.
void openFlow(const SUMOSAXAttributes &attrs) override
opens a flow for reading
ConstMSRoutePtr addVehicleStopsToImplicitRoute(ConstMSRoutePtr route, bool isPermanent)
adapt implicit route (edges derived from stops) to additional vehicle-stops
void addWalk(const SUMOSAXAttributes &attrs) override
add a fully specified walk
void myEndElement(int element) override
Called when a closing tag occurs.
void addTransport(const SUMOSAXAttributes &attrs) override
Processing of a transport.
void deleteActivePlanAndVehicleParameter()
delete already created MSTransportablePlans if error occurs before handing over responsibility to a M...
void initLaneTree(NamedRTree *tree) override
bool myAmLoadingState
whether a state file is being loaded
bool myStartTriggeredInFlow
whether we are loading a personFlow that is starting triggered in a vehicle flow
void resetActivePlanAndVehicleParameter()
reset MSTransportablePlans after transportable tag closes
SUMOTime myActiveRoutePeriod
bool myHaveVia
Whether an object with 'via'-attribute is being parsed.
int addFlowTransportable(SUMOTime depart, MSVehicleType *type, const std::string &baseID, int i)
delete already created MSTransportablePlans if error occurs before handing over responsibility to a M...
void closeTransportable()
ends the processing of a transportable (as person or container)
MSEdge * retrieveEdge(const std::string &id) override
std::size_t myDiscardedTransportableDepth
Stack depth of a discarded transportable, or zero during normal parsing.
MSStoppingPlace * retrieveStoppingPlace(const SUMOSAXAttributes &attrs, const std::string &errorSuffix, SUMOVehicleParameter::Stop *stopParam=nullptr)
Parse destination stop.
std::string myCurrentVTypeDistributionID
The id of the currently parsed vehicle type distribution.
void openRoute(const SUMOSAXAttributes &attrs) override
opens a route for reading
void closeVehicleTypeDistribution() override
closes (ends) the building of a distribution
void addTranship(const SUMOSAXAttributes &attrs) override
Processing of a tranship.
void closeRoute(const bool mayBeDisconnected=false) override
closes (ends) the building of a route.
void parseFromViaTo(SumoXMLTag tag, const SUMOSAXAttributes &attrs)
Called for parsing from and to and the corresponding taz attributes.
void closeFlow() override
Ends the processing of a flow.
MSTransportable::MSTransportablePlan * myActiveTransportablePlan
The plan of the current transportable (person or container)
virtual void myStartElement(int element, const SUMOSAXAttributes &attrs) override
Called on the opening of a tag;.
std::string myCurrentRouteDistributionID
The id of the currently parsed route distribution.
RandomDistributor< MSVehicleType * > * myCurrentVTypeDistribution
The currently parsed distribution of vehicle types (probability->vehicle type)
void closeContainer() override
Ends the processing of a container.
SUMOTime myActiveRouteReplacedAtTime
The time at which this route was replaced (from vehroute-output)
void closeTrip() override
Ends the processing of a trip.
void openTrip(const SUMOSAXAttributes &attrs) override
opens a trip for reading
void addPersonTrip(const SUMOSAXAttributes &attrs) override
add a routing request for a walking or intermodal person
ConstMSEdgeVector myActiveRoute
The current route.
int myActiveRouteRepeat
number of repetitions of the active route
ObjectTypeEnum myActiveType
The type of the current object.
SumoRNG * getRNG() override
const SUMOVTypeParameter * getVTypeParameter(const std::string &refid) override
void closePersonFlow() override
Ends the processing of a personFlow.
int myActiveRouteReplacedIndex
The index at which this route was replaced (from vehroute-output)
void closeRouteDistribution() override
closes (ends) the building of a distribution
MSRouteHandler(const std::string &file, bool addVehiclesDirectly)
standard constructor
std::string myScaleSuffix
prefix when copying vehicles with –scale
ObjectTypeEnum
enum for object type
double interpretDepartPosLat(const std::string &value, int departLane, const std::string &element)
virtual ~MSRouteHandler()
standard destructor
bool myAddVehiclesDirectly
Information whether vehicles shall be directly added to the network or kept within the buffer.
bool myReplayRerouting
whether loaded rerouting events shall be replayed
void openVehicleTypeDistribution(const SUMOSAXAttributes &attrs) override
opens a type distribution for reading
Parameterised * addStop(const SUMOSAXAttributes &attrs) override
Processing of a stop.
virtual void closeVehicle() override
Ends the processing of a vehicle (note: is virtual because is reimplemented in MSStateHandler)
void openRouteFlow(const SUMOSAXAttributes &attrs) override
opens a route flow for reading
void openRouteDistribution(const SUMOSAXAttributes &attrs) override
opens a route distribution for reading
void addRide(const SUMOSAXAttributes &attrs) override
Processing of a ride.
void parseWalkPositions(const SUMOSAXAttributes &attrs, const std::string &personID, const MSEdge *fromEdge, const MSEdge *&toEdge, double &departPos, double &arrivalPos, MSStoppingPlace *&bs, const MSStage *const lastStage, bool &ok)
@ brief parse depart- and arrival positions of a walk
bool myActiveRoutePermanent
whether the active route is stored indefinitely (used by state loader)
std::string myActiveTypeName
The name of the current object type.
void closeVType() override
Ends the processing of a vehicle type.
void addTransportable(const SUMOSAXAttributes &attrs, const bool isPerson) override
Processing of a person.
void closeTransportableFlow()
ends the flow of a transportable
void setReroute(bool reroute=true)
const ConstMSEdgeVector & getEdges() const
void setCosts(double costs)
Sets the costs of the route.
static bool dictionary(const std::string &id, ConstMSRoutePtr route)
Adds a route to the dictionary.
static RandomDistributor< ConstMSRoutePtr > * distDictionary(const std::string &id)
Returns the named route distribution.
void setPeriod(SUMOTime period)
sets the period
void setVehicleDistance(double dist)
restore further state during loading
void setVehicleID(const std::string vehID)
const MSEdge * getDestination() const
returns the destination edge
virtual double getArrivalPos() const
static const double ARRIVALPOS_UNSPECIFIED
sentinel value
void setDeparted(SUMOTime now)
logs beginning of stage
MSStoppingPlace * getDestinationStop() const
returns the destination stop (if any)
MSStageType getStageType() const
void setEnded(SUMOTime t)
sets end of stage
static const MSLane * checkDepartLane(const MSEdge *edge, SUMOVehicleClass svc, int laneIndex, const std::string &id)
interpret custom depart lane
void setTotalWaitingTime(SUMOTime t)
Restore waiting time when loading state.
const MSEdge * getEdge() const
Returns the current edge.
void setDepartPos(const double pos)
void setExitTimes(std::vector< SUMOTime > *exitTimes)
A lane area vehicles can halt at.
double getBeginLanePosition() const
Returns the begin position of this stop.
double getEndLanePosition() const
Returns the end position of this stop.
const MSLane & getLane() const
Returns the lane this stop is located at.
double getAccessPos(const MSEdge *edge, SumoRNG *rng=nullptr) const
the position on the given edge which is connected to this stop, -1 on failure
int getLoadedNumber() const
Returns the number of build transportables.
virtual MSTransportable * buildContainer(const SUMOVehicleParameter *pars, MSVehicleType *vtype, MSTransportable::MSTransportablePlan *plan) const
Builds a new container.
virtual MSTransportable * buildPerson(const SUMOVehicleParameter *pars, MSVehicleType *vtype, MSTransportable::MSTransportablePlan *plan, SumoRNG *rng) const
Builds a new person.
bool add(MSTransportable *transportable)
Adds a single transportable, returns false if an id clash occurred.
MSTransportable * get(const std::string &id) const
Returns the named transportable, if existing.
std::vector< MSStage * > MSTransportablePlan
the structure holding the plan of a transportable
The class responsible for building and deletion of vehicles.
VehicleDefinitionSource
possible origins of a vehicle definition
double getScale() const
sets the demand scaling factor
bool hasVTypeDistribution(const std::string &id) const
Asks for a vehicle type distribution.
virtual bool addVehicle(const std::string &id, SUMOVehicle *v)
Tries to insert the vehicle into the internal vehicle container.
SUMOVehicle * getVehicle(const std::string &id) const
Returns the vehicle with the given id.
int getQuota(double frac=-1, int loaded=-1) const
Returns the number of instances of the current vehicle that shall be emitted considering that "frac" ...
MSVehicleType * getVType(const std::string &id=DEFAULT_VTYPE_ID, SumoRNG *rng=nullptr, bool readOnly=false)
Returns the named vehicle type or a sample from the named distribution.
virtual SUMOVehicle * buildVehicle(SUMOVehicleParameter *defs, ConstMSRoutePtr route, MSVehicleType *type, const bool ignoreStopErrors, const VehicleDefinitionSource source=ROUTEFILE, bool addRouteStops=true)
Builds a vehicle, increases the number of built vehicles.
const RandomDistributor< MSVehicleType * > * getVTypeDistribution(const std::string &typeDistID) const
return the vehicle type distribution with the given id
virtual void deleteVehicle(SUMOVehicle *v, bool discard=false, bool wasKept=false)
Deletes the vehicle.
The car-following model and parameter.
double getDefaultProbability() const
Get the default probability of this vehicle type.
SUMOVehicleClass getVehicleClass() const
Get this vehicle type's vehicle class.
double getMaxSpeed() const
Get vehicle's (technical) maximum speed [m/s].
const std::string & getID() const
Returns the name of the vehicle type.
bool wasSet(long long int what) const
Returns whether the given parameter was set.
static MSVehicleType * build(SUMOVTypeParameter &from, const std::string &fileName="")
Builds the microsim vehicle type described by the given parameter.
const SUMOVTypeParameter & getParameter() const
void check()
Checks whether vehicle type parameters may be problematic (Currently, only the value for the action s...
Provides utility functions for matching locations to edges (during route parsing)
void parseGeoEdges(const PositionVector &positions, bool geo, SUMOVehicleClass vClass, std::vector< const MSEdge * > &into, const std::string &rid, bool isFrom, bool &ok, bool forceEdge=false)
static MsgHandler * getErrorInstance()
Returns the instance to add errors to.
const std::string & getID() const
Returns the id.
A RT-tree for efficient storing of SUMO's Named objects.
void Insert(const float a_min[2], const float a_max[2], Named *const &a_data)
Insert entry.
A storage for options typed value containers)
double getFloat(const std::string &name) const
Returns the double-value of the named option (only for Option_Float)
std::string getString(const std::string &name) const
Returns the string-value of the named option (only for Option_String)
bool getBool(const std::string &name) const
Returns the boolean-value of the named option (only for Option_Bool)
static OptionsCont & getOptions()
Retrieves the options.
An upper class for objects with additional parameters.
A point in 2D or 3D with translation and scaling methods.
Boundary getBoxBoundary() const
Returns a boundary enclosing this list of lines.
static double rand(SumoRNG *rng=nullptr)
Returns a random real number in [0, 1)
Represents a generic random distribution.
double getOverallProb() const
Return the sum of the probabilites assigned to the members.
bool add(T val, double prob, bool checkDuplicates=true)
Adds a value with an assigned probability to the distribution.
const std::vector< T > & getVals() const
Returns the members of the distribution.
void clear()
Clears the distribution.
const std::vector< double > & getProbs() const
Returns the probabilities assigned to the members of the distribution.
Parser for routes during their loading.
bool parseStop(SUMOVehicleParameter::Stop &stop, const SUMOSAXAttributes &attrs, std::string errorSuffix, MsgHandler *const errorOutput)
parses attributes common to all stops
std::set< std::string > mySkippedVehicles
IDs of skipped vehicles to suppress errors for the triggered transportables within.
void registerLastDepart()
save last depart (only to be used if vehicle is not discarded)
double myCurrentCosts
The currently parsed route costs.
std::string myActiveRouteID
The id of the current route.
std::vector< Parameterised * > myParamStack
The stack of currently parsed parameterised objects.
SUMOVehicleParameter * myVehicleParameter
Parameter of the current vehicle, trip, person, container or flow.
const bool myHardFail
flag to enable or disable hard fails
static SumoRNG myParsingRNG
A random number generator used to choose from vtype/route distributions and computing the speed facto...
std::vector< int > myElementStack
hierarchy of elements being parsed
StopParVector myActiveRouteStops
List of the stops on the parsed route.
std::string myCurrentVTypeRef
if the currently parsed vType is only a reference to an existing type, store the refId
SUMOVTypeParameter * myCurrentVType
The currently parsed vehicle type.
static StopPos checkStopPos(double &startPos, double &endPos, const double laneLength, const double minLength, const bool friendlyPos)
check start and end position of a stop
virtual void myStartElement(int element, const SUMOSAXAttributes &attrs)
Called on the opening of a tag;.
double myActiveRouteProbability
The probability of the current route.
double myCurrentVTypeProbability
if the currently parsed vType is only a reference, store the probability here
int myInsertStopEdgesAt
where stop edges can be inserted into the current route (-1 means no insertion)
std::string myActiveRouteRefID
The id of the route the current route references to.
const RGBColor * myActiveRouteColor
The currently parsed route's color.
virtual void myEndElement(int element)
Called when a closing tag occurs.
std::set< std::string > myScaledVehicles
IDs of vehicles that were removed by scaling (to warn for the triggered transportables)
virtual bool checkLastDepart()
Checks whether the route file is sorted by departure time if needed.
Encapsulated SAX-Attributes.
T getOpt(int attr, const char *objectid, bool &ok, T defaultValue=T(), bool report=true) const
Tries to read given attribute assuming it is an int.
SUMOTime getOptSUMOTimeReporting(int attr, const char *objectid, bool &ok, SUMOTime defaultValue, bool report=true) const
Tries to read given attribute assuming it is a SUMOTime.
T get(int attr, const char *objectid, bool &ok, bool report=true) const
Tries to read given attribute assuming it is an int.
virtual bool hasAttribute(int id) const =0
Returns the information whether the named (by its enum-value) attribute is within the current list.
virtual const SUMOVehicleParameter & getParameter() const =0
Returns the vehicle's parameter (including departure definition)
Structure representing possible vehicle parameter.
bool wasSet(long long int what) const
Returns whether the given parameter was set.
double scale
individual scaling factor (-1 for undefined)
SUMOVehicleClass vehicleClass
The vehicle's class.
Representation of a vehicle.
virtual const MSRoute & getRoute() const =0
Returns the current route.
Definition of vehicle stop (position and duration)
std::string edge
The edge to stop at.
ParkingType parking
whether the vehicle is removed from the net while stopping
std::string lane
The lane to stop at.
std::string parkingarea
(Optional) parking area if one is assigned to the stop
double startPos
The stopping position start.
std::string chargingStation
(Optional) charging station if one is assigned to the stop
int parametersSet
Information for the output which parameter were set.
SUMOTime jump
transfer time if there shall be a jump from this stop to the next route edge
SUMOTime until
The time at which the vehicle may continue its journey.
double endPos
The stopping position end.
SUMOTime duration
The stopping duration.
Structure representing possible vehicle parameter.
double repetitionProbability
The probability for emitting a vehicle per second.
void incrementFlow(double scale, SumoRNG *rng=nullptr)
increment flow
std::string vtypeid
The vehicle's type id.
SUMOTime repetitionOffset
The time offset between vehicle reinsertions.
long long int repetitionsDone
The number of times the vehicle was already inserted.
std::vector< std::string > via
List of the via-edges the vehicle must visit.
long long int repetitionNumber
SUMOTime repetitionTotalOffset
The offset between depart and the time for the next vehicle insertions.
long long int parametersSet
Information for the router which parameter were set, TraCI may modify this (when changing color)
RouteIndexDefinition arrivalEdgeProcedure
Information how the vehicle's final edge shall be chosen.
SVCPermissions modes
The modes a person or container can use.
SUMOTime repetitionEnd
The time at which the flow ends (only needed when using repetitionProbability)
bool wasSet(long long int what) const
Returns whether the given parameter was set.
std::string vTypes
The types of usable (auto-generated) vehicles for a person / container.
double departPos
(optional) The position the vehicle shall depart from
double arrivalPos
(optional) The position the vehicle shall arrive on
std::string routeid
The vehicle's route id.
std::string id
The vehicle's id.
std::vector< Stop > stops
List of the stops the vehicle will make, TraCI may add entries here.
int departEdge
(optional) The initial edge within the route of the vehicle
static bool parsePersonModes(const std::string &modes, const std::string &element, const std::string &id, SVCPermissions &modeSet, std::string &error)
Validates a given person modes value.
ArrivalPosDefinition arrivalPosProcedure
Information how the vehicle shall choose the arrival position.
static bool parseDepartPosLat(const std::string &val, const std::string &element, const std::string &id, double &pos, DepartPosLatDefinition &dpd, std::string &error)
Validates a given departPosLat value.
std::string toTaz
The vehicle's destination zone (district)
static double interpretEdgePos(double pos, double maximumValue, SumoXMLAttr attr, const std::string &id, bool silent=false)
Interprets negative edge positions and fits them onto a given edge.
DepartDefinition departProcedure
Information how the vehicle shall choose the depart time.
int arrivalEdge
(optional) The final edge within the route of the vehicle
std::string fromTaz
The vehicle's origin zone (district)
DepartPosDefinition departPosProcedure
Information how the vehicle shall choose the departure position.
RouteIndexDefinition departEdgeProcedure
Information how the vehicle's initial edge shall be chosen.
static bool parseStopTag(const SUMOSAXAttributes &attrs, const SUMOVehicleParameter::Stop *stopParam, SumoXMLTag &tag, std::string &id)
parse named stopping place attrs (or use stopParam attrs) and return it's tag and id
static double parseWalkPos(SumoXMLAttr attr, const bool hardFail, const std::string &id, double maxPos, const std::string &val, SumoRNG *rng=0)
parse departPos or arrivalPos for a walk
bool hasNext()
returns the information whether further substrings exist
std::string next()
returns the next substring when it exists. Otherwise the behaviour is undefined
static double toDoubleSecure(const std::string &sData, const double def)
converts a string into the integer value described by it