45#define JUNCTION_TAZ_MISSING_HELP "\nSet option '--junction-taz' or load a TAZ-file"
58 myActiveRouteRepeat(0),
59 myActiveRoutePeriod(0),
62 myActiveTransportablePlan(nullptr),
63 myAddVehiclesDirectly(addVehiclesDirectly),
64 myCurrentVTypeDistribution(nullptr),
65 myCurrentRouteDistribution(nullptr),
66 myAmLoadingState(false),
67 myScaleSuffix(
OptionsCont::getOptions().getString(
"scale-suffix")),
68 myReplayRerouting(
OptionsCont::getOptions().getBool(
"replay-rerouting")) {
99 const std::string element =
toString(tag);
111 const std::string tazType = useJunction ?
"junction" :
"taz";
114 if (fromTaz ==
nullptr) {
117 }
else if (fromTaz->getNumSuccessors() == 0 && tag !=
SUMO_TAG_PERSON) {
135 if (viaSink ==
nullptr) {
138 viaEdges.push_back(viaSink);
145 if (!viaEdges.empty()) {
148 for (
const MSEdge* e : viaEdges) {
157 const std::string tazType = useJunction ?
"junction" :
"taz";
160 if (toTaz ==
nullptr) {
163 }
else if (toTaz->getNumPredecessors() == 0 && tag !=
SUMO_TAG_PERSON) {
224 std::vector<double> probs;
234 while (st.hasNext()) {
235 std::string vtypeID = st.next();
237 if (type ==
nullptr) {
240 const double prob = ((int)probs.size() > probIndex ? probs[probIndex] : type->
getDefaultProbability());
244 if (probs.size() > 0 && probIndex != (int)probs.size()) {
317 WRITE_WARNING(
TL(
"Attribute 'period' is deprecated for route. Use 'cycleTime' instead."));
322 std::string errSuffix =
".";
326 if (vtype !=
nullptr) {
332 throw ProcessError(
TLF(
"Disconnected route % when repeating. Last edge '%' is not connected to first edge '%'%",
364 std::string type =
"vehicle";
365 if (mayBeDisconnected) {
386 if (route !=
nullptr) {
409 if (stop.until > 0) {
414 throw ProcessError(
TLF(
"Cannot repeat stops with 'until' in route % because no cycleTime is defined.", description));
418 if (stop.arrival > 0) {
423 throw ProcessError(
TLF(
"Cannot repeat stops with 'arrival' in route % because no cycleTime is defined.", description));
484 std::vector<double> probs;
497 std::string routeID = st.
next();
499 if (route ==
nullptr) {
502 const double prob = ((int)probs.size() > probIndex ? probs[probIndex] : 1.0);
506 if (probs.size() > 0 && probIndex != (int)probs.size()) {
544 if (rDist !=
nullptr && rDist->
getVals().size() > 0) {
545 route = rDist->
getVals().front();
548 if (route ==
nullptr) {
565 if (vtype ==
nullptr) {
582 if (route ==
nullptr) {
596 if (route->mustReroute()) {
643 if (rDist !=
nullptr) {
644 for (
int i = 0; i < (int)rDist->
getVals().size() - 1; i++) {
657 for (
int i = 1; i < quota; i++) {
688 std::string scaleWarning =
"";
690 scaleWarning =
"\n (Possibly duplicate id due to using option --scale. Set option --scale-suffix to prevent this)";
692 throw ProcessError(
"Another vehicle with the id '" + veh_id +
"' exists." + scaleWarning);
700 if (vehicle !=
nullptr) {
714 assert(route->getStops().size() > 0);
718 if (stop.
index == 0) {
719 if (edges.front() != stopEdge ||
720 route->getStops().front().endPos < stop.
endPos) {
721 edges.insert(edges.begin(), stopEdge);
724 if (edges.back() != stopEdge ||
725 route->getStops().back().endPos > stop.
endPos) {
726 edges.push_back(stopEdge);
733 isPermanent,
new RGBColor(route->getColor()), route->getStops());
863 for (
int j = 0; j < quota; j++) {
864 if (i > 0 || j > 0) {
871 copyPlan->push_back(s->clone());
881 + (j > 0 ?
"." +
toString(j) :
""));
887 if (!tc.
add(transportable)) {
889 delete transportable;
912 const std::string
id = vehType->
getID();
915 throw ProcessError(
TLF(
"Another vehicle type (or distribution) with the id '%' exists.",
id));
954 if (route ==
nullptr) {
957 if (route->mustReroute()) {
1019 const std::string mode = modeTag ==
SUMO_TAG_RIDE ?
"ride" :
"transport";
1020 std::string agent =
"person";
1021 std::string stop =
"bus stop";
1023 agent =
"container";
1024 stop =
"container stop";
1029 throw ProcessError(
"Found " + mode +
" inside " + agent +
" element");
1033 const MSEdge* from =
nullptr;
1046 if (st.size() != 1) {
1047 throw ProcessError(
"Triggered departure for " + agent +
" '" + aid +
"' requires a unique lines value.");
1051 const std::string vehID = st.front();
1053 if (startVeh ==
nullptr) {
1054 throw ProcessError(
"Unknown vehicle '" + vehID +
"' in triggered departure for " + agent +
" '" + aid +
"'.");
1057 throw ProcessError(
"Cannot use triggered vehicle '" + vehID +
"' in triggered departure for " + agent +
" '" + aid +
"'.");
1063 const std::string fromID = attrs.
get<std::string>(
SUMO_ATTR_FROM, aid.c_str(), ok);
1065 if (from ==
nullptr) {
1066 throw ProcessError(
"The from edge '" + fromID +
"' within a " + mode +
" of " + agent +
" '" + aid +
"' is not known.");
1071 const bool transferAtJunction = (from->getFromJunction() ==
myActiveTransportablePlan->back()->getDestination()->getFromJunction()
1073 if (!(stopWithAccess || transferAtJunction)) {
1074 throw ProcessError(
"Disconnected plan for " + agent +
" '" + aid +
1078 if (startVeh !=
nullptr && startVeh->getRoute().getEdges().front() != from) {
1079 throw ProcessError(
"Disconnected plan for triggered " + agent +
" '" + aid +
1080 "' (edge '" + fromID +
"' != edge '" + startVeh->getRoute().getEdges().front()->getID() +
"').");
1082 }
else if (startVeh !=
nullptr) {
1083 from = startVeh->getRoute().getEdges().front();
1086 if (from ==
nullptr) {
1087 throw ProcessError(
"The start edge for " + agent +
" '" + aid +
"' is not known.");
1095 const std::string toID = attrs.
get<std::string>(
SUMO_ATTR_TO, aid.c_str(), ok);
1097 if (to ==
nullptr) {
1098 throw ProcessError(
"The to edge '" + toID +
"' within a " + mode +
" of " + agent +
" '" + aid +
"' is not known.");
1117 if (stopParam !=
nullptr) {
1130 if (toStop ==
nullptr) {
1136 if (toStop ==
nullptr) {
1142 if (toStop ==
nullptr) {
1149 if (toStop ==
nullptr) {
1156 if (toStop ==
nullptr) {
1171 std::string errorSuffix;
1189 const MSEdge* edge =
nullptr;
1192 if (toStop !=
nullptr) {
1207 if (ok && stop.
edge !=
"") {
1210 throw ProcessError(
"The edge '" + stop.
edge +
"' for a stop is not known" + errorSuffix);
1212 }
else if (ok && stop.
lane !=
"") {
1214 if (stopLane ==
nullptr) {
1217 if (stopLane !=
nullptr) {
1224 throw ProcessError(
"The lane '" + stop.
lane +
"' for a stop is not known" + errorSuffix);
1229 if (toStop !=
nullptr) {
1241 const std::string msg =
TL(
"A stop must be placed on a busStop, a chargingStation, an overheadWireSegment, a containerStop, a parkingArea, an edge or a lane") + errorSuffix;
1252 WRITE_WARNING(
"Deprecated attribute 'pos' in description of stop" + errorSuffix);
1260 throw ProcessError(
"Invalid start or end position for stop on "
1262 ? (
"lane '" + stop.
lane)
1263 : (
"edge '" + stop.
edge)) +
"'" + errorSuffix);
1284 if (start > prevAr + NUMERICAL_EPS || end < prevAr - NUMERICAL_EPS) {
1286 +
"' (stop range " +
toString(start) +
"-" +
toString(end) +
" does not cover previous arrival position " +
toString(prevAr) + +
").");
1335 const MSStage*
const lastStage,
bool& ok) {
1337 const std::string description =
"person '" + personID +
"' walking from edge '" + fromEdge->
getID() +
"'";
1340 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."));
1343 if (lastStage !=
nullptr) {
1354 if (bs !=
nullptr) {
1356 if (arrivalPos < 0) {
1357 throw ProcessError(
"Bus stop '" + bs->
getID() +
"' is not connected to arrival edge '" + toEdge->
getID() +
"' for " + description +
".");
1364 arrivalPos = arrPos;
1371 if (toEdge ==
nullptr) {
1394 const MSEdge* from =
nullptr;
1395 const MSEdge* to =
nullptr;
1414 double departPos = 0;
1415 double arrivalPos = 0;
1422 std::string errorMsg;
1430 const std::string vtypeid = st.next();
1431 if (vehControl.
getVType(vtypeid) ==
nullptr) {
1453 stoppingPlace, duration, modeSet, types, speed, walkFactor, group,
1485 double departPos = 0;
1486 double arrivalPos = 0;
1491 if (route ==
nullptr) {
1543 if (lane ==
nullptr) {
1546 const double usableWidth = lane->
getWidth() - 0.5;
1549 pos = -usableWidth / 2;
1552 pos = usableWidth / 2;
1607 const MSEdge* from =
nullptr;
1608 const MSEdge* to =
nullptr;
1616 throw ProcessError(
TLF(
"Could not read tranship speed for container '%'.", cid));
1624 throw ProcessError(
TLF(
"Non-positive tranship speed for container '%'.", cid));
1627 const MSEdge* preEdge =
nullptr;
1641 const std::string fromID = attrs.
get<std::string>(
SUMO_ATTR_FROM, cid.c_str(), ok);
1643 if (from ==
nullptr) {
1644 throw ProcessError(
"The from edge '" + fromID +
"' within a tranship of container '" + cid +
"' is not known.");
1646 if (preEdge !=
nullptr && preEdge != from) {
1647 throw ProcessError(
"Disconnected plan for container '" + cid +
"' (" + from->getID() +
"!=" + preEdge->
getID() +
").");
1649 }
else if (preEdge ==
nullptr) {
1650 throw ProcessError(
TLF(
"The start edge for container '%' is not known.", cid));
1658 if (cs ==
nullptr) {
1659 throw ProcessError(
"Unknown container stop '" + csID +
"' for container '" + cid +
"'.");
1661 to = &cs->getLane().getEdge();
1663 const std::string toID = attrs.
get<std::string>(
SUMO_ATTR_TO, cid.c_str(), ok);
1665 if (to ==
nullptr) {
1666 throw ProcessError(
"The to edge '" + toID +
"' within a tranship of container '" + cid +
"' is not known.");
1669 throw ProcessError(
TLF(
"Inconsistent tranship for container '%', only one option is allowed: 'edges', 'to', 'containerStop'", cid));
1677 if (preEdge ==
nullptr) {
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
const long long int VTYPEPARS_MAXSPEED_SET
const long long int VTYPEPARS_VEHICLECLASS_SET
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_PEDESTRIAN
pedestrian
const double DEFAULT_VEH_PROB
const std::string DEFAULT_VTYPE_ID
int SVCPermissions
bitset where each bit declares whether a certain SVC may use this edge/lane
const double DEFAULT_CONTAINER_TRANSHIP_SPEED
@ GIVEN
The edge index is given.
@ DEFAULT
No information given; use default.
const int VEHPARS_ROUTE_SET
const int VEHPARS_TO_TAZ_SET
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
The position is set by the vehroute device.
const int VEHPARS_DEPARTPOS_SET
const int VEHPARS_FROM_TAZ_SET
const int VEHPARS_FORCE_REROUTE
const double MIN_STOP_LENGTH
const int VEHPARS_ARRIVALPOS_SET
@ 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_CONTAINER_STOP
A container stop.
@ SUMO_TAG_BUS_STOP
A bus stop.
@ SUMO_TAG_FLOW
a flow definition using from and to edges or a route
@ SUMO_TAG_PARKING_AREA
A parking area.
@ SUMO_TAG_OVERHEAD_WIRE_SEGMENT
An overhead wire segment.
@ SUMO_TAG_TRIP
a single trip definition (used by router)
@ SUMO_ATTR_REPLACED_AT_TIME
@ SUMO_ATTR_CONTAINER_STOP
@ SUMO_ATTR_DEPARTPOS_LAT
@ SUMO_ATTR_EDGES
the edges of a route
@ SUMO_ATTR_CHARGING_STATION
@ SUMO_ATTR_OVERHEAD_WIRE_SEGMENT
@ SUMO_ATTR_REPLACED_ON_INDEX
@ SUMO_ATTR_COLOR
A color information.
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
Writes the state of the tls to a file (in each second)
void error(const XERCES_CPP_NAMESPACE::SAXParseException &exception)
Handler for XML-errors.
static MSLane * interpretOppositeStop(SUMOVehicleParameter::Stop &stop)
interpret stop lane on opposite side of the road
A road/street connecting two junctions.
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.
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.
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
RandomDistributor< ConstMSRoutePtr > * myCurrentRouteDistribution
The currently parsed distribution of routes (probability->route)
void addRideOrTransport(const SUMOSAXAttributes &attrs, const SumoXMLTag modeTag)
Processing of a transport.
virtual void myStartElement(int element, const SUMOSAXAttributes &attrs)
Called on the opening of a tag;.
ConstMSRoutePtr addVehicleStopsToImplicitRoute(ConstMSRoutePtr route, bool isPermanent)
adapt implicit route (edges derived from stops) to additional vehicle-stops
void deleteActivePlanAndVehicleParameter()
delete already created MSTransportablePlans if error occurs before handing over responsibility to a M...
bool myAmLoadingState
whether a state file is being loaded
void resetActivePlanAndVehicleParameter()
reset MSTransportablePlans after transportable tag closes
SUMOTime myActiveRoutePeriod
bool myHaveVia
Wether an object with 'via'-attribute is being parsed.
void closeContainerFlow()
Ends the processing of a containerFlow.
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)
void closeVType()
Ends the processing of a vehicle type.
void openTrip(const SUMOSAXAttributes &attrs)
opens a trip for reading
MSStoppingPlace * retrieveStoppingPlace(const SUMOSAXAttributes &attrs, const std::string &errorSuffix, SUMOVehicleParameter::Stop *stopParam=nullptr)
Parse destination stop.
void closeVehicleTypeDistribution()
closes (ends) the building of a distribution
std::string myCurrentVTypeDistributionID
The id of the currently parsed vehicle type distribution.
Parameterised * addStop(const SUMOSAXAttributes &attrs)
Processing of a stop.
void closeRouteDistribution()
closes (ends) the building of a distribution
static SumoRNG myParsingRNG
A random number generator used to choose from vtype/route distributions and computing the speed facto...
void parseFromViaTo(SumoXMLTag tag, const SUMOSAXAttributes &attrs)
Called for parsing from and to and the corresponding taz attributes.
void closeFlow()
Ends the processing of a flow.
MSTransportable::MSTransportablePlan * myActiveTransportablePlan
The plan of the current transportable (person or container)
void closeContainer()
Ends the processing of a container.
std::string myCurrentRouteDistributionID
The id of the currently parsed route distribution.
void closePersonFlow()
Ends the processing of a personFlow.
void openRouteFlow(const SUMOSAXAttributes &attrs)
opens a route flow for reading
RandomDistributor< MSVehicleType * > * myCurrentVTypeDistribution
The currently parsed distribution of vehicle types (probability->vehicle type)
SUMOTime myActiveRouteReplacedAtTime
The time at which this route was replaced (from vehroute-output)
void closePerson()
Ends the processing of a person.
void closeTrip()
Ends the processing of a trip.
void openRouteDistribution(const SUMOSAXAttributes &attrs)
opens a route distribution for reading
ConstMSEdgeVector myActiveRoute
The current route.
int myActiveRouteRepeat
number of repetitions of the active route
ObjectTypeEnum myActiveType
The type of the current object.
void addPersonTrip(const SUMOSAXAttributes &attrs)
add a routing request for a walking or intermodal person
void addTranship(const SUMOSAXAttributes &attrs)
Processing of a tranship.
virtual void closeVehicle()
Ends the processing of a vehicle (note: is virtual because is reimplemented in MSStateHandler)
void openVehicleTypeDistribution(const SUMOSAXAttributes &attrs)
opens a type distribution for reading
int myActiveRouteReplacedIndex
The index at which this route was replaced (from vehroute-output)
void openFlow(const SUMOSAXAttributes &attrs)
opens a flow for reading
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.
void addWalk(const SUMOSAXAttributes &attrs)
add a fully specified walk
bool myReplayRerouting
whether loaded rerouting events shall be replayed
void openRoute(const SUMOSAXAttributes &attrs)
opens a route for reading
void addTransport(const SUMOSAXAttributes &attrs)
Processing of a transport.
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
void checkTransportableType()
Check if vtype of given transportable exists.
std::string myActiveTypeName
The name of the current object type.
void addRide(const SUMOSAXAttributes &attrs)
Processing of a ride.
void addPerson(const SUMOSAXAttributes &attrs)
Processing of a person.
void closeTransportableFlow()
ends the flow of a transportable
void closeRoute(const bool mayBeDisconnected=false)
closes (ends) the building of a route.
void addContainer(const SUMOSAXAttributes &attrs)
Processing of a container.
void setReroute(bool reroute=true)
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
const MSEdge * getDestination() const
returns the destination edge
virtual double getArrivalPos() const
MSStoppingPlace * getDestinationStop() const
returns the destination stop (if any)
static const MSLane * checkDepartLane(const MSEdge *edge, SUMOVehicleClass svc, int laneIndex, const std::string &id)
interpret custom depart lane
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) 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.
virtual SUMOVehicle * buildVehicle(SUMOVehicleParameter *defs, ConstMSRoutePtr route, MSVehicleType *type, const bool ignoreStopErrors, const bool fromRouteFile=true, bool addRouteStops=true)
Builds a vehicle, increases the number of built vehicles.
double getScale() const
sets the demand scaling factor
bool hasVTypeDistribution(const std::string &id) const
Asks for a vehicle type distribution.
virtual void deleteVehicle(SUMOVehicle *v, bool discard=false)
Deletes the vehicle.
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.
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.
static MSVehicleType * build(SUMOVTypeParameter &from)
Builds the microsim vehicle type described by the given parameter.
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(int what) const
Returns whether the given parameter was set.
const SUMOVTypeParameter & getParameter() const
void check()
Checks whether vehicle type parameters may be problematic (Currently, only the value for the action s...
static MsgHandler * getErrorInstance()
Returns the instance to add errors to.
const std::string & getID() const
Returns the id.
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.
static double rand(SumoRNG *rng=nullptr)
Returns a random real number in [0, 1)
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.
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::vector< SUMOVehicleParameter::Stop > myActiveRouteStops
List of the stops on the parsed route.
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.
SUMOVehicleParameter * myVehicleParameter
Parameter of the current vehicle, trip, person, container or flow.
const bool myHardFail
flag to enable or disable hard fails
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.
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 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)
bool wasSet(long long int what) const
Returns whether the given parameter was set.
double scale
individual scaling factor (-1 for undefined)
Representation of a vehicle.
Definition of vehicle stop (position and duration)
std::string edge
The edge to stop at (used only in netedit)
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
std::string overheadWireSegment
(Optional) overhead line segment if one is assigned to the stop
int parametersSet
Information for the output which parameter were set.
int index
at which position in the stops list
SUMOTime until
The time at which the vehicle may continue its journey.
double endPos
The stopping position end.
std::string busstop
(Optional) bus stop if one is assigned to the stop
std::string containerstop
(Optional) container stop if one is assigned to the stop
SUMOTime duration
The stopping duration.
Structure representing possible vehicle parameter.
double repetitionProbability
The probability for emitting a vehicle per second.
int parametersSet
Information for the router which parameter were set, TraCI may modify this (when changing color)
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.
std::vector< std::string > via
List of the via-edges the vehicle must visit.
int repetitionsDone
The number of times the vehicle was already inserted.
SUMOTime repetitionTotalOffset
The offset between depart and the time for the next vehicle insertions.
RouteIndexDefinition arrivalEdgeProcedure
Information how the vehicle's final edge shall be chosen.
SUMOTime repetitionEnd
The time at which the flow ends (only needed when using repetitionProbability)
double departPos
(optional) The position the vehicle shall depart from
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.
bool wasSet(int what) const
Returns whether the given parameter was set.
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.
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
DepartPosDefinition departPosProcedure
Information how the vehicle shall choose the departure position.
RouteIndexDefinition departEdgeProcedure
Information how the vehicle's initial edge shall be chosen.
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