Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
NLDetectorBuilder.h
Go to the documentation of this file.
1/****************************************************************************/
2// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
3// Copyright (C) 2001-2026 German Aerospace Center (DLR) and others.
4// This program and the accompanying materials are made available under the
5// terms of the Eclipse Public License 2.0 which is available at
6// https://www.eclipse.org/legal/epl-2.0/
7// This Source Code may also be made available under the following Secondary
8// Licenses when the conditions for such availability set forth in the Eclipse
9// Public License 2.0 are satisfied: GNU General Public License, version 2
10// or later which is available at
11// https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
12// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
13/****************************************************************************/
21// Builds detectors for microsim
22/****************************************************************************/
23#pragma once
24#include <config.h>
25
26#include <string>
30// #include <microsim/output/MSMultiLaneE2Collector.h>
31
32// ===========================================================================
33// class declarations
34// ===========================================================================
36class MSLane;
37class MSEdge;
38
39class MEInductLoop;
40class MESegment;
41
42
43// ===========================================================================
44// class definitions
45// ===========================================================================
54public:
60
61
63 virtual ~NLDetectorBuilder();
64
65
68
91 Parameterised* buildInductLoop(const std::string& id,
92 const std::string& lane, double pos, double length, SUMOTime splInterval,
93 const std::string& device, bool friendlyPos,
94 const std::string name, const std::string& vTypes, const std::string& nextEdges,
95 bool mesoTLS, int detectPersons);
96
97
114 Parameterised* buildInstantInductLoop(const std::string& id,
115 const std::string& lane, double pos,
116 const std::string& device, bool friendlyPos,
117 const std::string name, const std::string& vTypes,
118 const std::string& nextEdges,
119 int detectPersons);
120
121
133 Parameterised* buildE2Detector(const std::string& id, MSLane* lane, double pos, double endPos, double length,
134 const std::string& device, SUMOTime frequency,
135 SUMOTime haltingTimeThreshold, double haltingSpeedThreshold, double jamDistThreshold,
136 const std::string name, const std::string& vTypes,
137 const std::string& nextEdges,
138 int detectPersons, bool friendlyPos, bool showDetector,
139 MSTLLogicControl::TLSLogicVariants* tlls = 0, MSLane* toLane = 0);
140
141 Parameterised* buildE2Detector(const std::string& id, std::vector<MSLane*> lanes, double pos, double endPos,
142 const std::string& device, SUMOTime frequency,
143 SUMOTime haltingTimeThreshold, double haltingSpeedThreshold, double jamDistThreshold,
144 const std::string name, const std::string& vTypes,
145 const std::string& nextEdges,
146 int detectPersons, bool friendlyPos, bool showDetector,
147 MSTLLogicControl::TLSLogicVariants* tlls = 0, MSLane* toLane = 0);
148
149
163 Parameterised* beginE3Detector(const std::string& id, const std::string& device, SUMOTime splInterval,
164 double haltingSpeedThreshold, SUMOTime haltingTimeThreshold,
165 const std::string name, const std::string& vTypes,
166 const std::string& nextEdges,
167 int detectPersons, bool openEntry, bool expectArrival);
168
169
182 void addE3Entry(const std::string& lane, double pos, bool friendlyPos);
183
184
197 void addE3Exit(const std::string& lane, double pos, bool friendlyPos);
198
199
209 void endE3Detector();
210
211
219 std::string getCurrentE3ID() const;
220
221
235 void buildVTypeProbe(const std::string& id,
236 const std::string& vtype, SUMOTime frequency,
237 const std::string& device);
238
239
254 void buildRouteProbe(const std::string& id, const std::string& edge,
255 SUMOTime frequency, SUMOTime begin,
256 const std::string& device,
257 const std::string& vTypes);
259
260
261
266
278 virtual MSDetectorFileOutput* createInductLoop(const std::string& id,
279 MSLane* lane, double pos,
280 double length,
281 const std::string name, const std::string& vTypes,
282 const std::string& nextEdges,
283 int detectPersons,
284 bool show,
285 bool forceMicro = false);
286
287
297 virtual MSDetectorFileOutput* createInstantInductLoop(const std::string& id,
298 MSLane* lane, double pos, const std::string& od,
299 const std::string name, const std::string& vTypes,
300 const std::string& nextEdges,
301 int detectPersons);
302
303
310 virtual MSE2Collector* createE2Detector(const std::string& id,
311 DetectorUsage usage, MSLane* lane, double pos, double endPos, double length,
312 SUMOTime haltingTimeThreshold, double haltingSpeedThreshold, double jamDistThreshold,
313 const std::string name, const std::string& vTypes,
314 const std::string& nextEdges,
315 int detectPersons, bool showDetector);
316
317 virtual MSE2Collector* createE2Detector(const std::string& id,
318 DetectorUsage usage, std::vector<MSLane*> lanes, double pos, double endPos,
319 SUMOTime haltingTimeThreshold, double haltingSpeedThreshold, double jamDistThreshold,
320 const std::string name, const std::string& vTypes,
321 const std::string& nextEdges,
322 int detectPersons, bool showDetector);
323
334 virtual MSDetectorFileOutput* createE3Detector(const std::string& id,
335 const CrossSectionVector& entries, const CrossSectionVector& exits,
336 double haltingSpeedThreshold, SUMOTime haltingTimeThreshold,
337 const std::string name, const std::string& vTypes,
338 const std::string& nextEdges,
339 int detectPersons, bool openEntry, bool expectArrival);
340
341
365 void createEdgeLaneMeanData(const std::string& id, SUMOTime frequency,
366 SUMOTime begin, SUMOTime end, const std::string& type,
367 const bool useLanes, const std::string& excludeEmpty,
368 const bool withInternal, const bool trackVehicles, const int detectPersons,
369 const double maxTravelTime, const double minSamples,
370 const double haltSpeed, const double haltSpeedRel, const std::string& vTypes,
371 const std::string& writeAttributes,
372 std::vector<MSEdge*> edges,
373 AggregateType aggregate,
374 const std::string& device);
376
377
378protected:
384 public:
392 E3DetectorDefinition(const std::string& id,
393 const std::string& device, double haltingSpeedThreshold,
394 SUMOTime haltingTimeThreshold, SUMOTime splInterval,
395 const std::string name, const std::string& vTypes,
396 const std::string& nextEdges,
397 int detectPersons, bool openEntry, bool expectArrival);
398
400 virtual ~E3DetectorDefinition();
401
403 const std::string myID;
405 const std::string myDevice;
417 std::string myName;
419 const std::string myVehicleTypes;
421 const std::string myNextEdges;
429
430 private:
433
436
437 };
438
439
440protected:
457 double getPositionChecking(double pos, MSLane* lane, bool friendlyPos,
458 SumoXMLTag tag,
459 const std::string& detid);
460
461
464
471 MSEdge* getEdgeChecking(const std::string& edgeID, SumoXMLTag type,
472 const std::string& detid);
473
474public:
481 MSLane* getLaneChecking(const std::string& laneID, SumoXMLTag type,
482 const std::string& detid);
483
484protected:
492 void checkSampleInterval(SUMOTime splInterval, SumoXMLTag type, const std::string& id);
494
495
496protected:
499
500
501private:
504
505
506private:
509
512
513};
long long int SUMOTime
Definition GUI.h:36
std::vector< MSCrossSection > CrossSectionVector
SumoXMLTag
Numbers representing SUMO-XML - element names.
AggregateType
Numbers representing special SUMO-XML-attribute values Information on edgeData/laneData output should...
An induction loop for mesoscopic simulation.
A single mesoscopic segment (cell)
Definition MESegment.h:50
Base of value-generating classes (detectors)
An areal detector corresponding to a sequence of consecutive lanes.
A road/street connecting two junctions.
Definition MSEdge.h:77
Representation of a lane in the micro simulation.
Definition MSLane.h:84
The simulated network and simulation perfomer.
Definition MSNet.h:89
Storage for all programs of a single tls.
Holds the incoming definitions of an e3 detector unless the detector is build.
const std::string myVehicleTypes
The types to filter.
CrossSectionVector myEntries
List of detector's entries.
E3DetectorDefinition & operator=(const E3DetectorDefinition &)
Invalidated assignment operator.
const std::string myID
The id of the detector.
SUMOTime mySampleInterval
The aggregation interval.
bool myOpenEntry
Whether the detector is declared as having incomplete entry detectors.
E3DetectorDefinition(const E3DetectorDefinition &)
Invalidated copy constructor.
const std::string myNextEdges
The route edges to filter by.
double myHaltingSpeedThreshold
The speed a vehicle's speed must be below to be assigned as jammed.
bool myExpectArrival
Whether the detector expects vehicles to arrive inside (and doesn't issue a warning in this case)
const std::string myDevice
The device the detector shall use.
SUMOTime myHaltingTimeThreshold
The time a vehicle's speed must be below haltingSpeedThreshold to be assigned as jammed.
CrossSectionVector myExits
List of detector's exits.
Builds detectors for microsim.
NLDetectorBuilder & operator=(const NLDetectorBuilder &)
Invalidated assignment operator.
void checkSampleInterval(SUMOTime splInterval, SumoXMLTag type, const std::string &id)
Checks whether the given frequency (sample interval) is valid.
void endE3Detector()
Builds of an e3 detector using collected values.
MSNet & myNet
The net to fill.
MSLane * getLaneChecking(const std::string &laneID, SumoXMLTag type, const std::string &detid)
Returns the named lane.
void createEdgeLaneMeanData(const std::string &id, SUMOTime frequency, SUMOTime begin, SUMOTime end, const std::string &type, const bool useLanes, const std::string &excludeEmpty, const bool withInternal, const bool trackVehicles, const int detectPersons, const double maxTravelTime, const double minSamples, const double haltSpeed, const double haltSpeedRel, const std::string &vTypes, const std::string &writeAttributes, std::vector< MSEdge * > edges, AggregateType aggregate, const std::string &device)
Creates edge based mean data collector using the given specification.
double getPositionChecking(double pos, MSLane *lane, bool friendlyPos, SumoXMLTag tag, const std::string &detid)
Computes the position to use.
Parameterised * buildInstantInductLoop(const std::string &id, const std::string &lane, double pos, const std::string &device, bool friendlyPos, const std::string name, const std::string &vTypes, const std::string &nextEdges, int detectPersons)
Builds an instantenous induction and adds it to the net.
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 name, const std::string &vTypes, const std::string &nextEdges, int detectPersons, bool showDetector)
Creates a MSE2Collector instance, overridden by GUIE2Collector::createE2Detector()
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.
virtual MSDetectorFileOutput * createInductLoop(const std::string &id, MSLane *lane, double pos, double length, const std::string name, const std::string &vTypes, const std::string &nextEdges, int detectPersons, bool show, bool forceMicro=false)
Creates an instance of an e1 detector using the given values.
void addE3Exit(const std::string &lane, double pos, bool friendlyPos)
Builds an exit point of an e3 detector.
virtual ~NLDetectorBuilder()
Destructor.
MSEdge * getEdgeChecking(const std::string &edgeID, SumoXMLTag type, const std::string &detid)
Returns the named edge.
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.
Parameterised * buildInductLoop(const std::string &id, const std::string &lane, double pos, double length, SUMOTime splInterval, const std::string &device, bool friendlyPos, const std::string name, const std::string &vTypes, const std::string &nextEdges, bool mesoTLS, int detectPersons)
Builds an e1 detector and adds it to the net.
virtual MSDetectorFileOutput * createE3Detector(const std::string &id, const CrossSectionVector &entries, const CrossSectionVector &exits, double haltingSpeedThreshold, SUMOTime haltingTimeThreshold, const std::string name, const std::string &vTypes, const std::string &nextEdges, int detectPersons, bool openEntry, bool expectArrival)
Creates an instance of an e3 detector using the given values.
void addE3Entry(const std::string &lane, double pos, bool friendlyPos)
Builds an entry point of an e3 detector.
NLDetectorBuilder(const NLDetectorBuilder &)
Invalidated copy constructor.
virtual MSDetectorFileOutput * createInstantInductLoop(const std::string &id, MSLane *lane, double pos, const std::string &od, const std::string name, const std::string &vTypes, const std::string &nextEdges, int detectPersons)
Creates an instance of an e1 detector using the given values.
Parameterised * 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 name, const std::string &vTypes, const std::string &nextEdges, int detectPersons, 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...
Parameterised * beginE3Detector(const std::string &id, const std::string &device, SUMOTime splInterval, double haltingSpeedThreshold, SUMOTime haltingTimeThreshold, const std::string name, const std::string &vTypes, const std::string &nextEdges, int detectPersons, bool openEntry, bool expectArrival)
Stores temporary the initial information about an e3 detector to build.
E3DetectorDefinition * myE3Definition
definition of the currently parsed e3 detector
std::string getCurrentE3ID() const
Returns the id of the currently built e3 detector.
An upper class for objects with additional parameters.