Eclipse SUMO - Simulation of Urban MObility
|
Builds detectors for guisim. More...
#include <GUIDetectorBuilder.h>
Public Member Functions | |
GUIDetectorBuilder (MSNet &net) | |
Constructor. | |
~GUIDetectorBuilder () | |
Destructor. | |
Detector creating methods | |
Override NLDetectorBuilder methods. | |
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) override |
Creates an instance of an e1 detector using the given values. | |
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) override |
Creates an instance of an e1 detector using the given values. | |
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) override |
Creates a GUIE2Collector instance, overrides MSE2Collector::createE2Detector() | |
virtual MSE2Collector * | createE2Detector (const std::string &id, DetectorUsage usage, std::vector< MSLane * > lanes, double pos, double endPos, SUMOTime haltingTimeThreshold, double haltingSpeedThreshold, double jamDistThreshold, const std::string name, const std::string &vTypes, const std::string &nextEdges, int detectPersons, bool showDetector) override |
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) override |
Creates an instance of an e3 detector using the given values. | |
Value parsing and detector building methods | |
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, int detectPersons) |
Builds an e1 detector and adds it to the net. | |
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) |
Builds an instantenous induction and adds it to the net. | |
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 checks for the detector positioning and applies "friendly positioning". | |
Parameterised * | buildE2Detector (const std::string &id, std::vector< MSLane * > lanes, double pos, double endPos, 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) |
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. | |
void | addE3Entry (const std::string &lane, double pos, bool friendlyPos) |
Builds an entry point of an e3 detector. | |
void | addE3Exit (const std::string &lane, double pos, bool friendlyPos) |
Builds an exit point of an e3 detector. | |
void | endE3Detector () |
Builds of an e3 detector using collected values. | |
std::string | getCurrentE3ID () const |
Returns the id of the currently built e3 detector. | |
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 | 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. | |
Detector creating methods | |
Virtual, so they may be overwritten, for generating gui-versions of the detectors, for example. | |
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 &writeAttributes, std::vector< MSEdge * > edges, bool aggregate, const std::string &device) |
Creates edge based mean data collector using the given specification. | |
Protected Member Functions | |
double | getPositionChecking (double pos, MSLane *lane, bool friendlyPos, SumoXMLTag tag, const std::string &detid) |
Computes the position to use. | |
Protected Attributes | |
MSNet & | myNet |
The net to fill. | |
Private Attributes | |
E3DetectorDefinition * | myE3Definition |
definition of the currently parsed e3 detector | |
Value checking/adapting methods | |
MSLane * | getLaneChecking (const std::string &laneID, SumoXMLTag type, const std::string &detid) |
Returns the named lane. | |
MSEdge * | getEdgeChecking (const std::string &edgeID, SumoXMLTag type, const std::string &detid) |
Returns the named edge. | |
void | checkSampleInterval (SUMOTime splInterval, SumoXMLTag type, const std::string &id) |
Checks whether the given frequency (sample interval) is valid. | |
Builds detectors for guisim.
This class overrides NLDetectorBuilder's detector creation methods in order to build guisim-classes instead of microsim-classes.
Definition at line 46 of file GUIDetectorBuilder.h.
GUIDetectorBuilder::GUIDetectorBuilder | ( | MSNet & | net | ) |
Constructor.
[in] | net | The network to which's detector control built detector shall be added |
Definition at line 43 of file GUIDetectorBuilder.cpp.
GUIDetectorBuilder::~GUIDetectorBuilder | ( | ) |
Destructor.
Definition at line 47 of file GUIDetectorBuilder.cpp.
|
inherited |
Builds an entry point of an e3 detector.
If the lane is not known or the position information is not within the lane, an InvalidArgument is thrown. Otherwise a MSCrossSection is built using the obtained values and added to the list of entries of the e3 definition stored in "myE3Definition".
[in] | lane | The id of the lane the entry shall be placed at |
[in] | pos | The position on the lane the entry shall be placed at |
[in] | friendlyPos | Whether the position information shall be used "friendly" (see user docs) |
InvalidArgument | If one of the values is invalid |
Definition at line 328 of file NLDetectorBuilder.cpp.
References NLDetectorBuilder::getLaneChecking(), NLDetectorBuilder::getPositionChecking(), NLDetectorBuilder::myE3Definition, NLDetectorBuilder::E3DetectorDefinition::myEntries, NLDetectorBuilder::E3DetectorDefinition::myID, SUMO_TAG_DET_ENTRY, and SUMO_TAG_E3DETECTOR.
Referenced by NLHandler::addE3Entry().
|
inherited |
Builds an exit point of an e3 detector.
If the lane is not known or the position information is not within the lane, an InvalidArgument is thrown. Otherwise a MSCrossSection is built using the obtained values and added to the list of exits of the e3 definition stored in "myE3Definition".
[in] | lane | The id of the lane the exit shall be placed at |
[in] | pos | The position on the lane the exit shall be placed at |
[in] | friendlyPos | Whether the position information shall be used "friendly" (see user docs) |
InvalidArgument | If one of the values is invalid |
Definition at line 342 of file NLDetectorBuilder.cpp.
References NLDetectorBuilder::getLaneChecking(), NLDetectorBuilder::getPositionChecking(), NLDetectorBuilder::myE3Definition, NLDetectorBuilder::E3DetectorDefinition::myExits, NLDetectorBuilder::E3DetectorDefinition::myID, SUMO_TAG_DET_EXIT, and SUMO_TAG_E3DETECTOR.
Referenced by NLHandler::addE3Exit().
|
inherited |
Stores temporary the initial information about an e3 detector to build.
If the given sample interval is < 0, an InvalidArgument is thrown. Otherwise, the values are stored in a new instance of E3DetectorDefinition within "myE3Definition".
[in] | id | The id the detector shall have |
[in] | device | The output device the detector shall write into |
[in] | splInterval | The aggregation time span the detector shall use |
[in] | haltingTimeThreshold | Detector parameter: the time a vehicle's speed must be below haltingSpeedThreshold to be assigned as jammed |
[in] | haltingSpeedThreshold | Detector parameter: the speed a vehicle's speed must be below to be assigned as jammed |
InvalidArgument | If one of the values is invalid |
Definition at line 313 of file NLDetectorBuilder.cpp.
References NLDetectorBuilder::checkSampleInterval(), NLDetectorBuilder::myE3Definition, and SUMO_TAG_E3DETECTOR.
Referenced by NLHandler::beginE3Detector().
|
inherited |
Builds a new E2 detector and adds it to the net's detector control. Also performs some consistency checks for the detector positioning and applies "friendly positioning".
[in] | tlls | Traffic light logic associated to the detector |
[in] | toLane | Lane associated to the detector (only for tlls != 0) |
[in] | friendlyPos | Whether automatic adjustments of the detector position shall be applied in case of erroneous specification |
Definition at line 149 of file NLDetectorBuilder.cpp.
References MSDetectorControl::add(), NLDetectorBuilder::checkSampleInterval(), NLDetectorBuilder::createE2Detector(), DU_USER_DEFINED, MSNet::getCurrentTimeStep(), MSNet::getDetectorControl(), OutputDevice::getDevice(), Named::getID(), MSE2Collector::getLastLane(), MSLane::getLength(), MSLane::getLinkTo(), NLDetectorBuilder::myNet, SUMO_TAG_E2DETECTOR, SUMO_TAG_LANE_AREA_DETECTOR, and WRITE_WARNING.
Referenced by NLHandler::addE2Detector(), and NEMALogic::init().
|
inherited |
Definition at line 231 of file NLDetectorBuilder.cpp.
References MSDetectorControl::add(), NLDetectorBuilder::checkSampleInterval(), NLDetectorBuilder::createE2Detector(), DU_USER_DEFINED, MSNet::getCurrentTimeStep(), MSNet::getDetectorControl(), OutputDevice::getDevice(), Named::getID(), MSE2Collector::getLastLane(), MSLane::getLength(), MSLane::getLinkTo(), NLDetectorBuilder::myNet, SUMO_TAG_E2DETECTOR, SUMO_TAG_LANE_AREA_DETECTOR, and WRITE_WARNING.
|
inherited |
Builds an e1 detector and adds it to the net.
Checks the given values, first. If one of the values is invalid (lane is not known, sampling frequency<=0, position is larger than lane's length, the id is already in use), an InvalidArgument is thrown.
Otherwise the e1 detector is built by calling "createInductLoop".
Internally, there is also a distinction whether a mesosim e1 detector shall be built.
[in] | id | The id the detector shall have |
[in] | lane | The name of the lane the detector is placed at |
[in] | pos | The definition of the position on the lane the detector shall be placed at |
[in] | length | The optional length of the detector |
[in] | splInterval | The aggregation time span the detector shall use |
[in] | device | The output device the detector shall write into |
[in] | friendlyPos | Whether the position information shall be used "friendly" (see user docs) |
[in] | vTypes | which vehicle types are considered |
InvalidArgument | If one of the values is invalid |
Definition at line 99 of file NLDetectorBuilder.cpp.
References MSDetectorControl::add(), NLDetectorBuilder::checkSampleInterval(), NLDetectorBuilder::createInductLoop(), MSNet::getDetectorControl(), Named::getID(), NLDetectorBuilder::getLaneChecking(), MSLane::getLength(), NLDetectorBuilder::getPositionChecking(), MIN2(), NLDetectorBuilder::myNet, SUMO_TAG_E1DETECTOR, SUMO_TAG_INDUCTION_LOOP, and toString().
Referenced by NLHandler::addE1Detector().
|
inherited |
Builds an instantenous induction and adds it to the net.
Checks the given values, first. If one of the values is invalid (lane is not known, sampling frequency<=0, position is larger than lane's length, the id is already in use), an InvalidArgument is thrown.
Otherwise the e1 detector is built by calling "createInductLoop".
[in] | id | The id the detector shall have |
[in] | lane | The name of the lane the detector is placed at |
[in] | pos | The definition of the position on the lane the detector shall be placed at |
[in] | device | The output device the detector shall write into |
[in] | friendlyPos | Whether the position information shall be used "friendly" (see user docs) |
InvalidArgument | If one of the values is invalid |
Definition at line 130 of file NLDetectorBuilder.cpp.
References MSDetectorControl::add(), NLDetectorBuilder::createInstantInductLoop(), MSNet::getDetectorControl(), NLDetectorBuilder::getLaneChecking(), NLDetectorBuilder::getPositionChecking(), NLDetectorBuilder::myNet, and SUMO_TAG_INSTANT_INDUCTION_LOOP.
Referenced by NLHandler::addInstantE1Detector().
|
inherited |
Builds a routeProbe and adds it to the net.
Checks the given values, first. If one of the values is invalid (sampling frequency<=0), an InvalidArgument is thrown.
Otherwise the routeProbe is built (directly).
[in] | id | The id the detector shall have |
[in] | edge | The name of the edge the detector shall observe |
[in] | frequency | The reporting frequency |
[in] | begin | The start of the first reporting interval |
[in] | device | The output device the detector shall write into |
InvalidArgument | If one of the values is invalid |
Definition at line 403 of file NLDetectorBuilder.cpp.
References MSDetectorControl::add(), NLDetectorBuilder::checkSampleInterval(), MSNet::getDetectorControl(), NLDetectorBuilder::getEdgeChecking(), NLDetectorBuilder::myNet, SUMO_TAG_ROUTEPROBE, and toString().
Referenced by NLHandler::addRouteProbeDetector().
|
inherited |
Builds a vTypeProbe and adds it to the net.
Checks the given values, first. If one of the values is invalid (sampling frequency<=0), an InvalidArgument is thrown.
Otherwise the vTypeProbe is built (directly).
[in] | id | The id the detector shall have |
[in] | vtype | The name of the vehicle type the detector shall observe |
[in] | frequency | The reporting frequency |
[in] | device | The output device the detector shall write into |
InvalidArgument | If one of the values is invalid |
Definition at line 394 of file NLDetectorBuilder.cpp.
References NLDetectorBuilder::checkSampleInterval(), OutputDevice::getDevice(), and SUMO_TAG_VTYPEPROBE.
Referenced by NLHandler::addVTypeProbeDetector().
|
protectedinherited |
Checks whether the given frequency (sample interval) is valid.
[in] | splInterval | The sample interval |
[in] | type | The type of the detector (for error message generation) |
[in] | id | The id of the detector (for error message generation) |
InvalidArgument | If the given sample interval is invalid (<=0) |
Definition at line 581 of file NLDetectorBuilder.cpp.
References checkStepLengthMultiple(), and toString().
Referenced by NLDetectorBuilder::beginE3Detector(), NLDetectorBuilder::buildE2Detector(), NLDetectorBuilder::buildE2Detector(), NLDetectorBuilder::buildInductLoop(), NLDetectorBuilder::buildRouteProbe(), and NLDetectorBuilder::buildVTypeProbe().
|
overridevirtual |
Creates a GUIE2Collector instance, overrides MSE2Collector::createE2Detector()
Simply calls the GUIE2Collector constructor
Reimplemented from NLDetectorBuilder.
Definition at line 72 of file GUIDetectorBuilder.cpp.
|
overridevirtual |
Reimplemented from NLDetectorBuilder.
Definition at line 82 of file GUIDetectorBuilder.cpp.
|
overridevirtual |
Creates an instance of an e3 detector using the given values.
Simply calls the GUIE3Collector constructor.
[in] | id | The id the detector shall have |
[in] | entries | The list of this detector's entries |
[in] | exits | The list of this detector's exits |
[in] | haltingSpeedThreshold | Detector parameter: the speed a vehicle's speed must be below to be assigned as jammed |
[in] | haltingTimeThreshold | Detector parameter: the time a vehicle's speed must be below haltingSpeedThreshold to be assigned as jammed |
Reimplemented from NLDetectorBuilder.
Definition at line 92 of file GUIDetectorBuilder.cpp.
|
inherited |
Creates edge based mean data collector using the given specification.
[in] | id | The id the detector shall have |
[in] | frequency | The aggregation interval the detector shall use |
[in] | begin | dump begin time |
[in] | end | dump end time |
[in] | type | The type of values to be generated |
[in] | useLanes | Information whether lane-based or edge-based dump shall be generated |
[in] | withEmpty | Information whether empty lanes/edges shall be written |
[in] | withInternal | Information whether internal lanes/edges shall be written |
[in] | trackVehicles | Information whether information shall be collected per vehicle |
[in] | detectPersons | Whether pedestrians shall be detected instead of vehicles |
[in] | maxTravelTime | the maximum travel time to output |
[in] | minSamples | the minimum number of sample seconds before the values are valid |
[in] | haltSpeed | the maximum speed to consider a vehicle waiting |
[in] | vTypes | the set of vehicle types to consider |
InvalidArgument | If one of the values is invalid |
Definition at line 503 of file NLDetectorBuilder.cpp.
References MSDetectorControl::add(), checkStepLengthMultiple(), MSNet::getDetectorControl(), MSNet::getInstance(), SUMOTime_MAX, TL, and WRITE_WARNING.
Referenced by NLHandler::addEdgeLaneMeanData(), and NLBuilder::buildDefaultMeanData().
|
overridevirtual |
Creates an instance of an e1 detector using the given values.
Simply calls the GUIInductLoop constructor
[in] | id | The id the detector shall have |
[in] | lane | The lane the detector is placed at |
[in] | pos | The position on the lane the detector is placed at |
[in] | length | The optional length of the detector |
[in] | vTypes | which vehicle types are considered |
[in] | show | Whether to show the detector in the gui if available |
Reimplemented from NLDetectorBuilder.
Definition at line 51 of file GUIDetectorBuilder.cpp.
References MSLane::getEdge(), MSGlobals::gMesoNet, and MSGlobals::gUseMesoSim.
|
overridevirtual |
Creates an instance of an e1 detector using the given values.
Simply calls the MSInductLoop constructor
[in] | id | The id the detector shall have |
[in] | lane | The lane the detector is placed at |
[in] | pos | The position on the lane the detector is placed at |
[in] | od | The output device the loop shall use |
Reimplemented from NLDetectorBuilder.
Definition at line 65 of file GUIDetectorBuilder.cpp.
References OutputDevice::getDevice().
|
inherited |
Builds of an e3 detector using collected values.
The parameter collected are used to build an e3 detector using "createE3Detector". The resulting detector is added to the net.
[in] | lane | The id of the lane the exit shall be placed at |
[in] | pos | The position on the lane the exit shall be placed at |
InvalidArgument | If one of the values is invalid |
Definition at line 365 of file NLDetectorBuilder.cpp.
References MSDetectorControl::add(), NLDetectorBuilder::createE3Detector(), MSNet::getDetectorControl(), Parameterised::getParametersMap(), NLDetectorBuilder::E3DetectorDefinition::myDetectPersons, NLDetectorBuilder::E3DetectorDefinition::myDevice, NLDetectorBuilder::myE3Definition, NLDetectorBuilder::E3DetectorDefinition::myEntries, NLDetectorBuilder::E3DetectorDefinition::myExits, NLDetectorBuilder::E3DetectorDefinition::myExpectArrival, NLDetectorBuilder::E3DetectorDefinition::myHaltingSpeedThreshold, NLDetectorBuilder::E3DetectorDefinition::myHaltingTimeThreshold, NLDetectorBuilder::E3DetectorDefinition::myID, NLDetectorBuilder::E3DetectorDefinition::myName, NLDetectorBuilder::myNet, NLDetectorBuilder::E3DetectorDefinition::myNextEdges, NLDetectorBuilder::E3DetectorDefinition::myOpenEntry, NLDetectorBuilder::E3DetectorDefinition::mySampleInterval, NLDetectorBuilder::E3DetectorDefinition::myVehicleTypes, SUMO_TAG_DET_ENTRY, SUMO_TAG_DET_EXIT, SUMO_TAG_E3DETECTOR, SUMO_TAG_ENTRY_EXIT_DETECTOR, toString(), Parameterised::updateParameters(), and WRITE_WARNING.
Referenced by NLHandler::endE3Detector().
|
inherited |
Returns the id of the currently built e3 detector.
This is used for error-message generation only. If no id is known, "<unknown>" is returned.
Definition at line 356 of file NLDetectorBuilder.cpp.
References NLDetectorBuilder::myE3Definition, and NLDetectorBuilder::E3DetectorDefinition::myID.
Referenced by NLHandler::addE3Entry(), and NLHandler::addE3Exit().
|
protectedinherited |
Returns the named edge.
[in] | edgeID | The id of the lane |
[in] | type | The type of the detector (for error message generation) |
[in] | detid | The id of the currently built detector (for error message generation) |
InvalidArgument | If the named edge is not known |
Definition at line 557 of file NLDetectorBuilder.cpp.
References MSEdge::dictionary(), and toString().
Referenced by NLDetectorBuilder::buildRouteProbe().
|
inherited |
Returns the named lane.
[in] | laneID | The id of the lane |
[in] | type | The type of the detector (for error message generation) |
[in] | detid | The id of the currently built detector (for error message generation) |
InvalidArgument | If the named lane is not known |
Definition at line 569 of file NLDetectorBuilder.cpp.
References MSLane::dictionary(), and toString().
Referenced by NLHandler::addE2Detector(), NLDetectorBuilder::addE3Entry(), NLDetectorBuilder::addE3Exit(), NLDetectorBuilder::buildInductLoop(), and NLDetectorBuilder::buildInstantInductLoop().
|
protectedinherited |
Computes the position to use.
At first, it is checked whether the given position is negative. If so, the position is added to the lane's length to obtain the position counted backwards.
If the resulting position is beyond or in front (<0) of the lane, it is either set to the according lane's boundary (.1 or length-.1) if friendlyPos is set, or, if friendlyPos is not set, an InvalidArgument is thrown.
[in] | pos | Definition of the position on the lane |
[in] | lane | The lane the position must be valid for |
[in] | friendlyPos | Whether false positions shall be made acceptable |
[in] | detid | The id of the currently built detector (for error message generation) |
InvalidArgument | If the defined position is invalid |
Definition at line 476 of file NLDetectorBuilder.cpp.
References Named::getID(), MSLane::getLength(), and toString().
Referenced by NLDetectorBuilder::addE3Entry(), NLDetectorBuilder::addE3Exit(), NLDetectorBuilder::buildInductLoop(), and NLDetectorBuilder::buildInstantInductLoop().
|
privateinherited |
definition of the currently parsed e3 detector
Definition at line 494 of file NLDetectorBuilder.h.
Referenced by NLDetectorBuilder::addE3Entry(), NLDetectorBuilder::addE3Exit(), NLDetectorBuilder::beginE3Detector(), NLDetectorBuilder::endE3Detector(), NLDetectorBuilder::getCurrentE3ID(), and NLDetectorBuilder::~NLDetectorBuilder().
|
protectedinherited |
The net to fill.
Definition at line 489 of file NLDetectorBuilder.h.
Referenced by NLDetectorBuilder::buildE2Detector(), NLDetectorBuilder::buildE2Detector(), NLDetectorBuilder::buildInductLoop(), NLDetectorBuilder::buildInstantInductLoop(), NLDetectorBuilder::buildRouteProbe(), and NLDetectorBuilder::endE3Detector().