63 #include <mesosim/MEInductLoop.h> 64 #include <mesosim/MELoop.h> 65 #include <mesosim/MESegment.h> 68 #ifdef CHECK_MEMORY_LEAKS 70 #endif // CHECK_MEMORY_LEAKS 80 const std::string& device,
SUMOReal haltingSpeedThreshold,
82 : myID(id), myDevice(device),
83 myHaltingSpeedThreshold(haltingSpeedThreshold),
84 myHaltingTimeThreshold(haltingTimeThreshold),
85 mySampleInterval(splInterval) {}
104 const std::string& device,
bool friendlyPos,
bool splitByType) {
119 const std::string& lane,
SUMOReal pos,
120 const std::string& device,
bool friendlyPos) {
136 const std::string& device,
139 SUMOReal jamDistThreshold,
bool friendlyPos) {
161 const std::string& device,
164 SUMOReal jamDistThreshold,
bool friendlyPos) {
166 throw InvalidArgument(
"The detector '" +
id +
"' refers to the unknown lsa.");
190 const std::string& tolane,
191 const std::string& device,
194 SUMOReal jamDistThreshold,
bool friendlyPos) {
196 throw InvalidArgument(
"The detector '" +
id +
"' refers to the unknown lsa.");
203 "The detector output can not be build as no connection between lanes '" 204 + lane +
"' and '" + tolane +
"' exists.");
239 throw InvalidArgument(
"The length of detector '" +
id +
"' lies beyond the lane's '" + clane->
getID() +
"' length.");
246 throw InvalidArgument(
"The length of detector '" +
id +
"' is almost 0.");
264 const std::string& device,
SUMOTime splInterval,
327 const std::string& vtype,
SUMOTime frequency,
328 const std::string& device) {
337 const std::string& device) {
355 length, haltingTimeThreshold, haltingSpeedThreshold,
367 lane, pos, haltingTimeThreshold, haltingSpeedThreshold,
379 return new MEInductLoop(
id, MSGlobals::gMesoNet->getSegmentForEdge(lane->
getEdge(), pos), pos);
397 return new MSE2Collector(
id, usage, lane, pos, length, haltingTimeThreshold, haltingSpeedThreshold, jamDistThreshold);
415 return new MSE3Collector(
id, entries, exits, haltingSpeedThreshold, haltingTimeThreshold);
421 const std::string& detid) {
431 throw InvalidArgument(
"The position of detector '" + detid +
"' lies beyond the lane's '" + lane->
getID() +
"' length.");
438 throw InvalidArgument(
"The position of detector '" + detid +
"' lies beyond the lane's '" + lane->
getID() +
"' length.");
448 const bool useLanes,
const bool withEmpty,
const bool printDefaults,
449 const bool withInternal,
const bool trackVehicles,
451 const SUMOReal haltSpeed,
const std::string& vTypes,
452 const std::string& device) {
454 throw InvalidArgument(
"Negative begin time for meandata dump '" +
id +
"'.");
460 throw InvalidArgument(
"End before or at begin for meandata dump '" +
id +
"'.");
462 std::set<std::string> vt;
465 vt.insert(st.
next());
468 if (type ==
"" || type ==
"performance" || type ==
"traffic") {
470 printDefaults, withInternal, trackVehicles, maxTravelTime, minSamples, haltSpeed, vt);
471 }
else if (type ==
"emissions" || type ==
"hbefa") {
472 if (type ==
"hbefa") {
473 WRITE_WARNING(
"The netstate type 'hbefa' is deprecated. Please use the type 'emissions' instead.");
476 printDefaults, withInternal, trackVehicles, maxTravelTime, minSamples, vt);
477 }
else if (type ==
"harmonoise") {
479 printDefaults, withInternal, trackVehicles, maxTravelTime, minSamples, vt);
480 }
else if (type ==
"amitran") {
482 printDefaults, withInternal, trackVehicles, maxTravelTime, minSamples, haltSpeed, vt);
484 throw InvalidArgument(
"Invalid type '" + type +
"' for meandata dump '" +
id +
"'.");
488 frequency = end - begin;
500 const std::string& detid) {
504 throw InvalidArgument(
"The lane with the id '" + edgeID +
"' is not known (while building " +
toString(type) +
" '" + detid +
"').");
512 const std::string& detid) {
516 throw InvalidArgument(
"The lane with the id '" + laneID +
"' is not known (while building " +
toString(type) +
" '" + detid +
"').");
524 if (splInterval < 0) {
527 if (splInterval == 0) {
Data collector for edges/lanes.
SumoXMLTag
Numbers representing SUMO-XML - element names.
MSEdge & getEdge() const
Returns the lane's edge.
Storage for all programs of a single tls.
MSLane * getLaneChecking(const std::string &laneID, SumoXMLTag type, const std::string &detid)
Returns the named lane.
A simple description of a position on a lane (crossing of a lane)
An areal (along a single lane) detector.
void addE3Entry(const std::string &lane, SUMOReal pos, bool friendlyPos)
Builds an entry point of an e3 detector.
Network state mean data collector for edges/lanes.
E3DetectorDefinition(const std::string &id, const std::string &device, SUMOReal haltingSpeedThreshold, SUMOTime haltingTimeThreshold, SUMOTime splInterval)
Constructor.
A detector which joins E2Collectors over consecutive lanes (backward)
Writes routes of vehicles passing a certain edge.
SUMOReal getLength() const
Returns the lane's length.
void buildInductLoop(const std::string &id, const std::string &lane, SUMOReal pos, SUMOTime splInterval, const std::string &device, bool friendlyPos, bool splitByType)
Builds an e1 detector and adds it to the net.
void addE3Exit(const std::string &lane, SUMOReal pos, bool friendlyPos)
Builds an exit point of an e3 detector.
std::vector< MSCrossSection > CrossSectionVector
An instantaneous induction loop.
static MSNet * getInstance()
Returns the pointer to the unique instance of MSNet (singleton).
MSDetectorFileOutput * buildMultiLaneE2Det(const std::string &id, DetectorUsage usage, MSLane *lane, SUMOReal pos, SUMOReal length, SUMOTime haltingTimeThreshold, SUMOReal haltingSpeedThreshold, SUMOReal jamDistThreshold)
Builds an e2 detector that continues on preceeding lanes.
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...
~E3DetectorDefinition()
Destructor.
void createEdgeLaneMeanData(const std::string &id, SUMOTime frequency, SUMOTime begin, SUMOTime end, const std::string &type, const bool useLanes, const bool withEmpty, const bool printDefaults, const bool withInternal, const bool trackVehicles, const SUMOReal maxTravelTime, const SUMOReal minSamples, const SUMOReal haltSpeed, const std::string &vTypes, const std::string &device)
Creates edge based mean data collector using the given specification.
MSDetectorFileOutput * buildSingleLaneE2Det(const std::string &id, DetectorUsage usage, MSLane *lane, SUMOReal pos, SUMOReal length, SUMOTime haltingTimeThreshold, SUMOReal haltingSpeedThreshold, SUMOReal jamDistThreshold)
Builds an e2 detector that lies on only one lane.
Noise data collector for edges/lanes.
SUMOTime getCurrentTimeStep() const
Returns the current simulation step.
void buildVTypeProbe(const std::string &id, const std::string &vtype, SUMOTime frequency, const std::string &device)
Builds a vTypeProbe and adds it to the net.
void endE3Detector()
Builds of an e3 detector using collected values.
void convUncontE2PosLength(const std::string &id, MSLane *clane, SUMOReal &pos, SUMOReal &length, bool frinedly_pos)
Converts the length and the position information for an e2 detector.
#define WRITE_WARNING(msg)
The simulated network and simulation perfomer.
virtual MSDetectorFileOutput * createSingleLaneE2Detector(const std::string &id, DetectorUsage usage, MSLane *lane, SUMOReal pos, SUMOReal length, SUMOTime haltingTimeThreshold, SUMOReal haltingSpeedThreshold, SUMOReal jamDistThreshold)
Creates an instance of an e2 detector using the given values.
const std::string & getID() const
Returns the id.
A road/street connecting two junctions.
Holds the incoming definitions of an e3 detector unless the detector is build.
MSTrafficLightLogic * getActive() const
Writes positions of vehicles that have a certain (named) type.
An instantenous induction loop.
std::string getCurrentE3ID() const
Returns the id of the currently built e3 detector.
Writes e2 state on each tls switch.
SUMOReal myHaltingSpeedThreshold
The speed a vehicle's speed must be below to be assigned as jammed.
void add(SumoXMLTag type, MSDetectorFileOutput *d, const std::string &device, SUMOTime splInterval, SUMOTime begin=-1)
Adds a detector/output combination into the containers.
Emission data collector for edges/lanes.
void buildRouteProbe(const std::string &id, const std::string &edge, SUMOTime frequency, SUMOTime begin, const std::string &device)
Builds a routeProbe and adds it to the net.
std::string toString(const T &t, std::streamsize accuracy=OUTPUT_ACCURACY)
MSDetectorControl & getDetectorControl()
Returns the detector control.
CrossSectionVector myExits
List of detector's exits.
MSEdge * getEdgeChecking(const std::string &edgeID, SumoXMLTag type, const std::string &detid)
Returns the named edge.
SUMOTime mySampleInterval
The aggregation interval.
virtual MSDetectorFileOutput * createE3Detector(const std::string &id, const CrossSectionVector &entries, const CrossSectionVector &exits, SUMOReal haltingSpeedThreshold, SUMOTime haltingTimeThreshold)
Creates an instance of an e3 detector using the given values.
static bool dictionary(const std::string &id, MSLane *lane)
Static (sic!) container methods {.
void convContE2PosLength(const std::string &id, MSLane *clane, SUMOReal &pos, SUMOReal &length, bool frinedly_pos)
Converts the length and the position information for an e2ol-detector.
static MSLink * getConnectingLink(const MSLane &from, const MSLane &to)
Returns the link connecting both lanes Both lanes have to be non-internal; 0 may be returned if no co...
static OutputDevice & getDevice(const std::string &name)
Returns the described OutputDevice.
NLDetectorBuilder(MSNet &net)
Constructor.
virtual MSDetectorFileOutput * createInstantInductLoop(const std::string &id, MSLane *lane, SUMOReal pos, const std::string &od)
Creates an instance of an e1 detector using the given values.
virtual MSDetectorFileOutput * createMultiLaneE2Detector(const std::string &id, DetectorUsage usage, MSLane *lane, SUMOReal pos, SUMOTime haltingTimeThreshold, SUMOReal haltingSpeedThreshold, SUMOReal jamDistThreshold)
Creates an instance of an e2ol-detector using the given values.
void checkSampleInterval(SUMOTime splInterval, SumoXMLTag type, const std::string &id)
Checks whether the given frequency (sample interval) is valid.
A detector of vehicles passing an area between entry/exit points.
void buildE2Detector(const std::string &id, const std::string &lane, SUMOReal pos, SUMOReal length, bool cont, SUMOTime splInterval, const std::string &device, SUMOTime haltingTimeThreshold, SUMOReal haltingSpeedThreshold, SUMOReal jamDistThreshold, bool friendlyPos)
Builds an e2 detector with a fixed interval and adds it to the net.
Network state mean data collector for edges/lanes.
static const bool gUseMesoSim
void buildInstantInductLoop(const std::string &id, const std::string &lane, SUMOReal pos, const std::string &device, bool friendlyPos)
Builds an instantenous induction and adds it to the net.
virtual ~NLDetectorBuilder()
Destructor.
E3DetectorDefinition * myE3Definition
definition of the currently parsed e3 detector
MSNet & myNet
The net to fill.
Writes e2 state of a link for the time the link has yellow/red.
CrossSectionVector myEntries
List of detector's entries.
void beginE3Detector(const std::string &id, const std::string &device, SUMOTime splInterval, SUMOReal haltingSpeedThreshold, SUMOTime haltingTimeThreshold)
Stores temporary the initial information about an e3 detector to build.
Representation of a lane in the micro simulation.
SUMOReal getPositionChecking(SUMOReal pos, MSLane *lane, bool friendlyPos, const std::string &detid)
Computes the position to use.
const std::string myDevice
The device the detector shall use.
std::string myID
The id of the detector.
Base of value-generating classes (detectors)
virtual MSDetectorFileOutput * createInductLoop(const std::string &id, MSLane *lane, SUMOReal pos, bool splitByType, bool show=true)
Creates an instance of an e1 detector using the given values.
An unextended detector measuring at a fixed position on a fixed lane.
SUMOTime myHaltingTimeThreshold
The time a vehicle's speed must be below haltingSpeedThreshold to be assigned as jammed.