45 const std::string& vTypes) :
49 myLastRouteDistribution(nullptr),
50 myCurrentRouteDistribution(nullptr),
54 while (seg !=
nullptr) {
60 for (std::vector<MSLane*>::const_iterator it = edge->
getLanes().begin(); it != edge->
getLanes().end(); ++it) {
61 (*it)->addMoveReminder(
this);
95 if (vehicle !=
nullptr) {
111 for (
int j = 0; j < (int)routes.size(); ++j) {
113 dev.
openTag(
"route") <<
" id=\"" << r->getID() +
"_" +
time2string(startTime) <<
"\" edges=\"";
115 if (i != r->begin()) {
118 dev << (*i)->getID();
120 dev <<
"\" probability=\"" << probs[j] <<
"\"";
ConstMSEdgeVector::const_iterator MSRouteIterator
std::shared_ptr< const MSRoute > ConstMSRoutePtr
std::string time2string(SUMOTime t, bool humanReadable)
convert SUMOTime to string (independently of global format setting)
#define UNUSED_PARAMETER(x)
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
MESegment * getSegmentForEdge(const MSEdge &e, double pos=0)
Get the segment for a given edge at a given position.
A single mesoscopic segment (cell)
void addDetector(MSMoveReminder *data, int queueIndex=-1)
Adds a data collector for a detector to this segment.
MESegment * getNextSegment() const
Returns the following segment on the same edge (0 if it is the last).
Base of value-generating classes (detectors)
bool vehicleApplies(const SUMOTrafficObject &veh) const
Checks whether the detector measures vehicles of the given type.
A road/street connecting two junctions.
const std::vector< MSLane * > & getLanes() const
Returns this edge's lanes.
static MELoop * gMesoNet
mesoscopic simulation infrastructure
Representation of a lane in the micro simulation.
Something on a lane to be noticed about vehicle movement.
Notification
Definition of a vehicle state.
@ NOTIFICATION_SEGMENT
The vehicle changes the segment (meso only)
@ NOTIFICATION_LANE_CHANGE
The vehicle changes lanes (micro only)
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.
static void checkDist(const std::string &id)
Checks the distribution whether it is permanent and deletes it if not.
void clearState(SUMOTime step) override
Remove all vehicles before quick-loading state.
void writeXMLDetectorProlog(OutputDevice &dev) const override
Opens the XML-output using "detector" as root element.
virtual ~MSRouteProbe()
Destructor.
RandomDistributor< ConstMSRoutePtr > * myCurrentRouteDistribution
The current distribution of routes (probability->route)
MSRouteProbe(const std::string &id, const MSEdge *edge, const std::string &distID, const std::string &lastID, const std::string &vTypes)
Constructor.
RandomDistributor< ConstMSRoutePtr > * myLastRouteDistribution
The previous distribution of routes (probability->route)
ConstMSRoutePtr sampleRoute(bool last=true) const
bool notifyEnter(SUMOTrafficObject &veh, MSMoveReminder::Notification reason, const MSLane *enteredLane=0) override
Returns whether the vehicle shall be aware of this entry.
void writeXMLOutput(OutputDevice &dev, SUMOTime startTime, SUMOTime stopTime) override
Writes values into the given stream.
const std::string & getID() const
Returns the id.
Static storage of an output device and its base (abstract) implementation.
OutputDevice & openTag(const std::string &xmlElement)
Opens an XML tag.
bool closeTag(const std::string &comment="")
Closes the most recently opened tag and optionally adds a comment.
bool writeXMLHeader(const std::string &rootElement, const std::string &schemaFile, std::map< SumoXMLAttr, std::string > attrs=std::map< SumoXMLAttr, std::string >(), bool includeConfig=true)
Writes an XML header with optional configuration.
Represents a generic random distribution.
double getOverallProb() const
Return the sum of the probabilites assigned to the members.
T get(SumoRNG *which=nullptr) const
Draw a sample of the distribution.
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.
Representation of a vehicle, person, or container.
Representation of a vehicle.
virtual ConstMSRoutePtr getRoutePtr() const =0
Returns the current route.