 |
Eclipse SUMO - Simulation of Urban MObility
|
Go to the documentation of this file.
67 const std::string& device,
double haltingSpeedThreshold,
69 const std::string& vTypes,
bool openEntry) :
70 myID(id), myDevice(device),
71 myHaltingSpeedThreshold(haltingSpeedThreshold),
72 myHaltingTimeThreshold(haltingTimeThreshold),
73 mySampleInterval(splInterval),
74 myVehicleTypes(vTypes),
75 myOpenEntry(openEntry) {
96 const std::string& lane,
double pos,
SUMOTime splInterval,
97 const std::string& device,
bool friendlyPos,
98 const std::string& vTypes) {
113 const std::string& lane,
double pos,
114 const std::string& device,
bool friendlyPos,
115 const std::string& vTypes) {
129 const std::string& device,
SUMOTime frequency,
130 SUMOTime haltingTimeThreshold,
double haltingSpeedThreshold,
double jamDistThreshold,
131 const std::string& vTypes,
bool friendlyPos,
bool showDetector,
134 bool tlsGiven = tlls !=
nullptr;
135 bool toLaneGiven = toLane !=
nullptr;
136 bool posGiven = pos != std::numeric_limits<double>::max();
137 bool endPosGiven = endPos != std::numeric_limits<double>::max();
139 assert(posGiven || endPosGiven);
144 std::stringstream ss;
145 ss <<
"The given position (=" << pos <<
") for detector '" <<
id
146 <<
"' does not lie on the given lane '" << lane->
getID()
147 <<
"' with length " << lane->
getLength();
150 ss <<
" (adjusting to new position " << newPos;
154 ss <<
" (0 <= pos < lane->getLength() is required)";
161 std::stringstream ss;
162 ss <<
"The given end position (=" << endPos <<
") for detector '" <<
id
163 <<
"' does not lie on the given lane '" << lane->
getID()
164 <<
"' with length " << lane->
getLength();
167 ss <<
" (adjusting to new position " << newEndPos;
171 std::stringstream ss;
172 ss <<
" (0 <= pos < lane->getLength() is required)";
181 det =
createE2Detector(
id,
DU_USER_DEFINED, lane, pos, endPos, length, haltingTimeThreshold, haltingSpeedThreshold, jamDistThreshold, vTypes, showDetector);
188 if (link ==
nullptr) {
190 "The detector '" +
id +
"' cannot be build as no connection between lanes '"
191 + lastLane->
getID() +
"' and '" + toLane->
getID() +
"' exists.");
201 det =
createE2Detector(
id,
DU_USER_DEFINED, lane, pos, endPos, length, haltingTimeThreshold, haltingSpeedThreshold, jamDistThreshold, vTypes, showDetector);
209 const std::string& device,
SUMOTime frequency,
210 SUMOTime haltingTimeThreshold,
double haltingSpeedThreshold,
double jamDistThreshold,
211 const std::string& vTypes,
bool friendlyPos,
bool showDetector,
214 bool tlsGiven = tlls !=
nullptr;
215 bool toLaneGiven = toLane !=
nullptr;
216 assert(pos != std::numeric_limits<double>::max());
217 assert(endPos != std::numeric_limits<double>::max());
218 assert(lanes.size() != 0);
220 MSLane* firstLane = lanes[0];
221 MSLane* lastLane = lanes[lanes.size() - 1];
224 if (pos >= firstLane->getLength() || (pos < 0 && -pos > firstLane->getLength())) {
225 std::stringstream ss;
226 ss <<
"The given position (=" << pos <<
") for detector '" <<
id
227 <<
"' does not lie on the given lane '" << firstLane->
getID()
228 <<
"' with length " << firstLane->getLength();
230 double newPos = pos > 0 ? firstLane->getLength() -
POSITION_EPS : 0.;
231 ss <<
" (adjusting to new position " << newPos;
235 ss <<
" (0 <= pos < lane->getLength() is required)";
239 if (endPos > lastLane->
getLength() || (endPos <= 0 && -endPos >= lastLane->
getLength())) {
240 std::stringstream ss;
241 ss <<
"The given end position (=" << endPos <<
") for detector '" <<
id
242 <<
"' does not lie on the given lane '" << lastLane->
getID()
243 <<
"' with length " << lastLane->
getLength();
246 ss <<
" (adjusting to new position " << newEndPos;
250 ss <<
" (0 <= pos < lane->getLength() is required)";
265 if (link ==
nullptr) {
267 "The detector '" +
id +
"' cannot be build as no connection between lanes '"
268 + lastLane->
getID() +
"' and '" + toLane->
getID() +
"' exists.");
289 const std::string& device,
SUMOTime splInterval,
290 double haltingSpeedThreshold,
292 const std::string& vTypes,
bool openEntry) {
300 double pos,
bool friendlyPos) {
314 double pos,
bool friendlyPos) {
360 const std::string& vtype,
SUMOTime frequency,
361 const std::string& device) {
370 const std::string& device,
371 const std::string& vTypes) {
382 const std::string& vTypes,
bool) {
392 MSLane* lane,
double pos,
const std::string& od,
393 const std::string& vTypes) {
401 SUMOTime haltingTimeThreshold,
double haltingSpeedThreshold,
double jamDistThreshold,
402 const std::string& vTypes,
bool ) {
403 return new MSE2Collector(
id, usage, lane, pos, endPos, length, haltingTimeThreshold, haltingSpeedThreshold, jamDistThreshold, vTypes);
408 DetectorUsage usage, std::vector<MSLane*> lanes,
double pos,
double endPos,
409 SUMOTime haltingTimeThreshold,
double haltingSpeedThreshold,
double jamDistThreshold,
410 const std::string& vTypes,
bool ) {
411 return new MSE2Collector(
id, usage, lanes, pos, endPos, haltingTimeThreshold, haltingSpeedThreshold, jamDistThreshold, vTypes);
418 double haltingSpeedThreshold,
420 const std::string& vTypes,
422 return new MSE3Collector(
id, entries, exits, haltingSpeedThreshold, haltingTimeThreshold, vTypes, openEntry);
428 const std::string& detid) {
438 throw InvalidArgument(
"The position of detector '" + detid +
"' lies beyond the lane's '" + lane->
getID() +
"' end.");
445 throw InvalidArgument(
"The position of detector '" + detid +
"' lies before the lane's '" + lane->
getID() +
"' begin.");
455 const bool useLanes,
const bool withEmpty,
const bool printDefaults,
456 const bool withInternal,
const bool trackVehicles,
const int detectPersons,
457 const double maxTravelTime,
const double minSamples,
458 const double haltSpeed,
const std::string& vTypes,
459 const std::string& device) {
461 throw InvalidArgument(
"Negative begin time for meandata dump '" +
id +
"'.");
467 throw InvalidArgument(
"End before or at begin for meandata dump '" +
id +
"'.");
470 if (type ==
"" || type ==
"performance" || type ==
"traffic") {
472 printDefaults, withInternal, trackVehicles, detectPersons, maxTravelTime, minSamples, haltSpeed, vTypes);
473 }
else if (type ==
"emissions" || type ==
"hbefa") {
474 if (type ==
"hbefa") {
475 WRITE_WARNING(
"The netstate type 'hbefa' is deprecated. Please use the type 'emissions' instead.");
478 printDefaults, withInternal, trackVehicles, maxTravelTime, minSamples, vTypes);
479 }
else if (type ==
"harmonoise") {
481 printDefaults, withInternal, trackVehicles, maxTravelTime, minSamples, vTypes);
482 }
else if (type ==
"amitran") {
484 printDefaults, withInternal, trackVehicles, detectPersons, maxTravelTime, minSamples, haltSpeed, vTypes);
486 throw InvalidArgument(
"Invalid type '" + type +
"' for meandata dump '" +
id +
"'.");
488 if (det !=
nullptr) {
490 frequency = end - begin;
502 const std::string& detid) {
505 if (edge ==
nullptr) {
506 throw InvalidArgument(
"The lane with the id '" + edgeID +
"' is not known (while building " +
toString(type) +
" '" + detid +
"').");
514 const std::string& detid) {
517 if (lane ==
nullptr) {
518 throw InvalidArgument(
"The lane with the id '" + laneID +
"' is not known (while building " +
toString(type) +
" '" + detid +
"').");
526 if (splInterval < 0) {
529 if (splInterval == 0) {
virtual MSE2Collector * createE2Detector(const std::string &id, DetectorUsage usage, MSLane *lane, double pos, double endPos, double length, SUMOTime haltingTimeThreshold, double haltingSpeedThreshold, double jamDistThreshold, const std::string &vTypes, bool showDetector=true)
Creates a MSE2Collector instance, overridden by GUIE2Collector::createE2Detector()
SUMOTime myHaltingTimeThreshold
The time a vehicle's speed must be below haltingSpeedThreshold to be assigned as jammed.
static bool dictionary(const std::string &id, MSLane *lane)
Static (sic!) container methods {.
MSLane * getLaneChecking(const std::string &laneID, SumoXMLTag type, const std::string &detid)
Returns the named lane.
MSDetectorControl & getDetectorControl()
Returns the detector control.
#define WRITE_WARNING(msg)
Base of value-generating classes (detectors)
Representation of a lane in the micro simulation.
double getPositionChecking(double pos, MSLane *lane, bool friendlyPos, const std::string &detid)
Computes the position to use.
CrossSectionVector myEntries
List of detector's entries.
A detector of vehicles passing an area between entry/exit points.
void buildInductLoop(const std::string &id, const std::string &lane, double pos, SUMOTime splInterval, const std::string &device, bool friendlyPos, const std::string &vTypes)
Builds an e1 detector and adds it to the net.
void addE3Entry(const std::string &lane, double pos, bool friendlyPos)
Builds an entry point of an e3 detector.
virtual MSDetectorFileOutput * createInductLoop(const std::string &id, MSLane *lane, double pos, const std::string &vTypes, bool show=true)
Creates an instance of an e1 detector using the given values.
Noise data collector for edges/lanes.
MSEdge * getEdgeChecking(const std::string &edgeID, SumoXMLTag type, const std::string &detid)
Returns the named edge.
Writes routes of vehicles passing a certain edge.
The simulated network and simulation perfomer.
E3DetectorDefinition(const std::string &id, const std::string &device, double haltingSpeedThreshold, SUMOTime haltingTimeThreshold, SUMOTime splInterval, const std::string &vTypes, bool openEntry)
Constructor.
const std::string myID
The id of the detector.
alternative tag for e2 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...
Holds the incoming definitions of an e3 detector unless the detector is build.
An induction loop for mesoscopic simulation.
An unextended detector measuring at a fixed position on a fixed lane.
An areal detector corresponding to a sequence of consecutive lanes.
A simple description of a position on a lane (crossing of a lane)
SUMOTime mySampleInterval
The aggregation interval.
SumoXMLTag
Numbers representing SUMO-XML - element names.
Writes e2 state of a link for the time the link has yellow/red.
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 int detectPersons, const double maxTravelTime, const double minSamples, const double haltSpeed, const std::string &vTypes, const std::string &device)
Creates edge based mean data collector using the given specification.
Data collector for edges/lanes.
Emission data collector for edges/lanes.
CrossSectionVector myExits
List of detector's exits.
Writes e2 state on each tls switch.
Network state mean data collector for edges/lanes.
SUMOTime getCurrentTimeStep() const
Returns the current simulation step.
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....
MSNet & myNet
The net to fill.
double getLength() const
Returns the lane's length.
const std::string myVehicleTypes
The device the detector shall use.
A road/street connecting two junctions.
void buildInstantInductLoop(const std::string &id, const std::string &lane, double pos, const std::string &device, bool friendlyPos, const std::string &vTypes)
Builds an instantenous induction and adds it to the net.
Network state mean data collector for edges/lanes.
An instantaneous induction loop.
void beginE3Detector(const std::string &id, const std::string &device, SUMOTime splInterval, double haltingSpeedThreshold, SUMOTime haltingTimeThreshold, const std::string &vTypes, bool openEntry)
Stores temporary the initial information about an e3 detector to build.
void endE3Detector()
Builds of an e3 detector using collected values.
MSEdge & getEdge() const
Returns the lane's edge.
void buildE2Detector(const std::string &id, MSLane *lane, double pos, double endPos, double length, const std::string &device, SUMOTime frequency, SUMOTime haltingTimeThreshold, double haltingSpeedThreshold, double jamDistThreshold, const std::string &vTypes, bool friendlyPos, bool showDetector, MSTLLogicControl::TLSLogicVariants *tlls=0, MSLane *toLane=0)
Builds a new E2 detector and adds it to the net's detector control. Also performs some consistency ch...
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
alternative tag for e3 detector
~E3DetectorDefinition()
Destructor.
static OutputDevice & getDevice(const std::string &name)
Returns the described OutputDevice.
static MSNet * getInstance()
Returns the pointer to the unique instance of MSNet (singleton).
static MELoop * gMesoNet
mesoscopic simulation infrastructure
virtual ~NLDetectorBuilder()
Destructor.
E3DetectorDefinition * myE3Definition
definition of the currently parsed e3 detector
bool myOpenEntry
Whether the detector is declared as having incomplete entry detectors.
MSLane * getLastLane() const
Returns the id of the detector's last lane.
std::string getCurrentE3ID() const
Returns the id of the currently built e3 detector.
NLDetectorBuilder(MSNet &net)
Constructor.
double myHaltingSpeedThreshold
The speed a vehicle's speed must be below to be assigned as jammed.
virtual MSDetectorFileOutput * createInstantInductLoop(const std::string &id, MSLane *lane, double pos, const std::string &od, const std::string &vTypes)
Creates an instance of an e1 detector using the given values.
Storage for all programs of a single tls.
void add(SumoXMLTag type, MSDetectorFileOutput *d, const std::string &device, SUMOTime splInterval, SUMOTime begin=-1)
Adds a detector/output combination into the containers.
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 checkSampleInterval(SUMOTime splInterval, SumoXMLTag type, const std::string &id)
Checks whether the given frequency (sample interval) is valid.
void addE3Exit(const std::string &lane, double pos, bool friendlyPos)
Builds an exit point of an e3 detector.
alternative tag for e1 detector
virtual MSDetectorFileOutput * createE3Detector(const std::string &id, const CrossSectionVector &entries, const CrossSectionVector &exits, double haltingSpeedThreshold, SUMOTime haltingTimeThreshold, const std::string &vTypes, bool openEntry)
Creates an instance of an e3 detector using the given values.
const std::string & getID() const
Returns the id.
std::vector< MSCrossSection > CrossSectionVector
void buildRouteProbe(const std::string &id, const std::string &edge, SUMOTime frequency, SUMOTime begin, const std::string &device, const std::string &vTypes)
Builds a routeProbe and adds it to the net.
const std::string myDevice
The device the detector shall use.
An instantenous induction loop.
Writes positions of vehicles that have a certain (named) type.