53 #define INVALID -std::numeric_limits<double>::max() 55 #define DEFAULT_FREQUENCY 30.0 57 #define DEFAULT_RANGE 50.0 62 #define AVAILABLE_SSMS "TTC DRAC PET" 63 #define DEFAULT_THRESHOLD_TTC 3. // in [s.], events get logged if below threshold 64 #define DEFAULT_THRESHOLD_DRAC 4. // in [m/s^2], events get logged if above threshold 65 #define DEFAULT_THRESHOLD_PET 2. // in seconds, events get logged if below threshold 76 const std::set<MSDevice*>&
85 for (std::set<MSDevice*>::iterator ii =
instances->begin(); ii !=
instances->end(); ++ii) {
100 oc.
addDescription(
"device.ssm.measures",
"SSM Device",
"Specifies which measures will be logged (as a space seperated sequence of IDs in ('TTC', 'DRAC', 'PET')).");
102 oc.
addDescription(
"device.ssm.thresholds",
"SSM Device",
"Specifies thresholds corresponding to the specified measures (see documentation and watch the order!). Only events exceeding the thresholds will be logged.");
104 oc.
addDescription(
"device.ssm.trajectories",
"SSM Device",
"Specifies whether trajectories will be logged (if false, only the extremal values and times are reported).");
106 oc.
addDescription(
"device.ssm.frequency",
"SSM Device",
"Specifies the maximal length of stored conflict trajectories in seconds (the frequency of logging, default is " +
toString(
DEFAULT_FREQUENCY) +
"s.).");
108 oc.
addDescription(
"device.ssm.range",
"SSM Device",
"Specifies the detection range in meters (default is " +
toString(
DEFAULT_RANGE) +
"m.). For vehicles below this distance from the equipped vehicle, SSM values are traced.");
115 WRITE_WARNING(
"SSM Device for vehicle '" + v.
getID() +
"' will not be built. (SSMs not supported in MESO)");
119 std::string deviceID =
"ssm_" + v.
getID();
124 std::vector<double> thresholds;
125 std::vector<std::string> measures;
145 into.push_back(device);
157 std::cout <<
"\n" <<
SIMTIME <<
" Constructing encounter of '" 164 std::cout <<
"\n" <<
SIMTIME <<
" Destroying encounter of '" 193 std::cout <<
"\n" <<
SIMTIME <<
" Device '" <<
getID() <<
"' update()\n" 217 std::cout <<
"\n" <<
SIMTIME <<
" Device '" <<
getID() <<
"' createEncounters()" << std::endl;
218 std::cout <<
"New foes:\n";
219 for (FoeInfoMap::const_iterator vi = foes.begin(); vi != foes.end(); ++vi) {
220 std::cout << vi->first->getID() <<
"\n";
222 std::cout << std::endl;
225 for (FoeInfoMap::const_iterator
foe = foes.begin();
foe != foes.end(); ++
foe) {
226 std::pair<MSLane*, MSLane*> conflictLanes;
244 std::cout <<
"\n" <<
SIMTIME <<
" Device '" <<
getID() <<
"' processEncounters()" << std::endl;
245 std::cout <<
"Currently present foes:\n";
246 for (FoeInfoMap::const_iterator vi = foes.begin(); vi != foes.end(); ++vi) {
247 std::cout << vi->first->getID() <<
"\n";
249 std::cout << std::endl;
260 if (foes.find(e->
foe) != foes.end()) {
286 std::cout <<
SIMTIME <<
" qualifiesAsConflict() for encounter of vehicles '" 298 std::cout <<
SIMTIME <<
" closeEncounter() of vehicles '" 308 std::cout <<
SIMTIME <<
" updateEncounter() of vehicles '" 329 double foeDistToConflictLane;
333 std::cout <<
"egoConflictLane: '" << (egoConflictLane == 0 ?
"NULL" : egoConflictLane->
getID()) <<
"'\n" 334 <<
"foeConflictLane: '" << (foeConflictLane == 0 ?
"NULL" : foeConflictLane->
getID()) <<
"'" 335 <<
"\nEgo's distance to conflict lane: " << egoDistToConflictLane
336 <<
"\nFoe's distance to conflict lane: " << foeDistToConflictLane
346 double egoEncounterDist =
INVALID;
347 double foeEncounterDist =
INVALID;
349 if (foeConflictLane == 0) {
353 std::cout <<
"-> Encounter type: No conflict." << std::endl;
355 }
else if (!egoConflictLane->isInternal()) {
357 if (egoConflictLane == egoLane) {
359 if (foeLane == egoLane) {
363 std::cout <<
"-> Encounter type: Lead/follow-situation on non-internal lane '" << egoLane->
getID() <<
"'" << std::endl;
370 std::cout <<
"-> Encounter type: No conflict (adjacent lanes)." << std::endl;
377 std::cout <<
"-> Encounter type: Ego '" << e->
ego->
getID() <<
"' on lane '" << egoLane->
getID() <<
"' leads foe '" 378 << e->
foe->
getID() <<
"' on lane '" << foeLane->
getID() <<
"'" 379 <<
" (gap = " << foeEncounterDist <<
")" 382 assert(foeConflictLane == egoLane);
391 std::cout <<
"-> Encounter type: Ego '" << e->
ego->
getID() <<
"' on lane '" << egoLane->
getID() <<
"' follows foe '" 392 << e->
foe->
getID() <<
"' on lane '" << foeLane->
getID() <<
"'" 393 <<
" (gap = " << egoEncounterDist <<
")" 396 assert(foeLane == egoConflictLane);
397 assert(foeDistToConflictLane <= 0);
402 MSLink* egoEntryLink = egoConflictLane->getEntryLink();
405 if (egoEntryLink != foeEntryLink) {
409 std::cout <<
"-> Encounter type: No conflict (adjacent lanes)." << std::endl;
413 if (egoLane == egoConflictLane && foeLane != foeConflictLane) {
418 std::cout <<
"-> Encounter type: Ego '" << e->
ego->
getID() <<
"' on lane '" << egoLane->
getID() <<
"' leads foe '" 419 << e->
foe->
getID() <<
"' on lane '" << foeLane->
getID() <<
"'" 420 <<
" (gap = " << foeEncounterDist <<
")" 423 }
else if (egoLane != egoConflictLane && foeLane == foeConflictLane) {
428 std::cout <<
"-> Encounter type: Ego '" << e->
ego->
getID() <<
"' on lane '" << egoLane->
getID() <<
"' follows foe '" 429 << e->
foe->
getID() <<
"' on lane '" << foeLane->
getID() <<
"'" 430 <<
" (gap = " << egoEncounterDist <<
")" 437 assert(egoLane == egoConflictLane);
438 assert(foeLane == foeConflictLane);
441 std::cout <<
"-> Encounter type: Lead/follow-situation on connection from '" << egoEntryLink->
getLaneBefore()->
getID()
442 <<
"' to '" << egoEntryLink->
getLane()->
getID() <<
"'" << std::endl;
449 const std::vector<MSLink*>& egoFoeLinks = egoEntryLink->
getFoeLinks();
450 const std::vector<MSLink*>& foeFoeLinks = foeEntryLink->
getFoeLinks();
452 bool crossOrMerge = (find(egoFoeLinks.begin(), egoFoeLinks.end(), foeEntryLink) != egoFoeLinks.end()
453 || find(foeFoeLinks.begin(), foeFoeLinks.end(), egoEntryLink) != foeFoeLinks.end());
459 std::cout <<
"-> Encounter type: No conflict (adjacent lanes)." << std::endl;
464 std::cout <<
"-> Encounter type: No conflict." << std::endl;
472 std::cout <<
"-> Encounter type: Merging situation of ego '" << e->
ego->
getID() <<
"' on lane '" << egoLane->
getID() <<
"' and foe '" 473 << e->
foe->
getID() <<
"' on lane '" << foeLane->
getID() <<
"'" 474 <<
"\nDistances to merge-point: ego: " << egoEncounterDist <<
", foe: " << foeEncounterDist
483 std::cout <<
"-> Encounter type: Crossing situation of ego '" << e->
ego->
getID() <<
"' on lane '" << egoLane->
getID() <<
"' and foe '" 484 << e->
foe->
getID() <<
"' on lane '" << foeLane->
getID() <<
"'" 485 <<
"\nDistances to crossing-point: ego: " << egoEncounterDist <<
", foe: " << foeEncounterDist
503 std::cout <<
SIMTIME <<
" findFoeConflictLane() for foe '" 510 assert(foeLane->
isInternal() || *laneIter == foeLane);
516 if (conflictJunction != 0) {
517 std::cout <<
"Potential conflict on junction '" << conflictJunction->
getID()
529 while (laneIter != foeBestLanesEnd && *laneIter == 0) {
531 distToConflictLane += foeLane->
getLength();
537 while (laneIter != foeBestLanesEnd && distToConflictLane <=
myRange) {
543 std::cout <<
"Found conflict lane for foe: '" << foeLane->
getID() <<
"'" << std::endl;
549 distToConflictLane += foeLane->
getLength();
553 if (laneIter == foeBestLanesEnd) {
556 MSLane* nextNonInternalLane = *laneIter;
563 std::cout <<
"Found conflict lane for foe: '" << foeLane->
getID() <<
"'" << std::endl;
570 foeLane = nextNonInternalLane;
581 std::cout <<
SIMTIME <<
" computeSSMs() for vehicles '" 602 std::cout <<
"\n" <<
SIMTIME <<
" Device '" <<
getID() <<
"' flushConflicts()" << std::endl;
620 std::cout <<
SIMTIME <<
"writeOutConflict() of vehicles '" 653 bool trajectories,
double frequency,
double range) :
680 std::cout <<
"Initialized ssm device '" <<
id <<
"' with " 684 <<
", myRange=" <<
myRange <<
", output file=" << outputFilename <<
"\n";
702 std::cout <<
"device '" <<
getID() <<
"' notifyEnter: reason=" << reason <<
" currentEdge=" << veh.
getLane()->
getEdge().
getID() <<
"\n";
711 std::cout <<
"device '" <<
getID() <<
"' notifyLeave: reason=" << reason <<
" currentEdge=" << veh.
getLane()->
getEdge().
getID() <<
"\n";
718 double ,
double newSpeed) {
720 std::cout <<
"device '" <<
getID() <<
"' notifyMove: newSpeed=" << newSpeed <<
"\n";
729 std::cout <<
SIMTIME <<
" Looking for surrounding vehicles for ego vehicle '" << veh.
getID()
746 assert(*edgeIter != 0);
750 std::vector<MSLane*>::const_iterator laneIter = egoBestLanes.begin();
754 assert(lane->
isInternal() || lane == *laneIter);
757 const MSLane* nextNonInternalLane = 0;
765 double remainingDownstreamRange = range;
767 double distToConflictLane = -pos;
776 std::cout <<
SIMTIME <<
" Vehicle '" << veh.
getID() <<
"' is on internal edge " << edge->
getID() <<
"'.\n" 777 <<
"Previous edge of its route: '" << (*edgeIter)->getID() <<
"'" << std::endl;
790 for (ConstMSEdgeVector::const_iterator ei = incoming.begin(); ei != incoming.end(); ++ei) {
791 if ((*ei)->isInternal()) {
794 getUpstreamVehicles(*ei, (*ei)->getLength(), range, distToConflictLane, lane, foeCollector);
798 remainingDownstreamRange -= lane->
getLength() - pos;
807 lane = *(++laneIter);
820 while (remainingDownstreamRange > 0.) {
822 std::cout <<
SIMTIME <<
" Scanning downstream for vehicle '" << veh.
getID() <<
"'.\n" 823 <<
"Considering edge '" << edge->
getID() <<
"' Remaining downstream range = " << remainingDownstreamRange
829 assert(pos == 0 || lane == veh.
getLane());
830 if (pos + remainingDownstreamRange < lane->getLength()) {
832 getUpstreamVehicles(edge, pos + remainingDownstreamRange, remainingDownstreamRange, distToConflictLane, lane, foeCollector);
840 remainingDownstreamRange -= lane->getLength() - pos;
841 distToConflictLane += lane->getLength();
846 assert(laneIter == egoBestLanes.end() || *laneIter != 0);
849 if (laneIter != egoBestLanes.end()) {
851 const MSJunction* junction = lane->getEdge().getToJunction();
854 nextNonInternalLane = *laneIter;
855 MSLink* link = lane->getLinkTo(nextNonInternalLane);
865 for (ConstMSEdgeVector::const_iterator ei = incoming.begin(); ei != incoming.end(); ++ei) {
869 getUpstreamVehicles(*ei, (*ei)->getLength(), range, distToConflictLane, lane, foeCollector);
874 remainingDownstreamRange -= linkLength;
875 distToConflictLane += linkLength;
878 lane = nextNonInternalLane;
879 edge = &(lane->getEdge());
884 foeCollector.erase(&veh);
890 std::cout <<
SIMTIME <<
" getUpstreamVehicles() for edge '" << edge->
getID() <<
"'" 891 <<
" pos = " << pos <<
" range = " << range
892 <<
"\nFound vehicles:" 899 const std::vector<MSLane*>& lanes = edge->
getLanes();
901 for (std::vector<MSLane*>::const_iterator li = lanes.begin(); li != lanes.end(); ++li) {
904 for (MSLane::VehCont::const_iterator vi = vehicles.begin(); vi != vehicles.end(); ++vi) {
908 std::cout << veh->
getID() <<
"\n";
913 foeCollector[veh] = c;
919 std::cout << std::endl;
942 for (ConstMSEdgeVector::const_iterator ei = incoming.begin(); ei != incoming.end(); ++ei) {
943 if ((*ei)->isInternal()) {
946 const MSEdge* inEdge = *ei;
949 if (distOnJunction >= range) {
960 std::cout <<
SIMTIME <<
" getVehiclesOnJunction() for junction '" << junction->
getID() <<
"'" 961 <<
"\nFound vehicles:" 966 for (std::vector<MSLane*>::const_iterator li = lanes.begin(); li != lanes.end(); ++li) {
972 for (MSLane::VehCont::const_iterator vi = vehicles.begin(); vi != vehicles.end(); ++vi) {
976 foeCollector[*vi] = c;
978 for (MSLane::VehCont::const_iterator vi = vehicles.begin(); vi != vehicles.end(); ++vi) {
979 std::cout << (*vi)->getID() <<
"\n";
994 for (MSLane::VehCont::const_iterator vi = vehicles2.begin(); vi != vehicles2.end(); ++vi) {
998 foeCollector[*vi] = c;
1000 for (MSLane::VehCont::const_iterator vi = vehicles.begin(); vi != vehicles.end(); ++vi) {
1001 std::cout << (*vi)->getID() <<
"\n";
1009 std::cout << std::endl;
1027 std::string file = deviceID +
".xml";
1041 std::cout <<
"vehicle '" << v.
getID() <<
"' does not supply vehicle parameter 'device.ssm.file'. Using default of '" << file <<
"'\n";
1064 range = oc.
getFloat(
"device.ssm.range");
1066 std::cout <<
"vehicle '" << v.
getID() <<
"' does not supply vehicle parameter 'device.ssm.range'. Using default of '" << range <<
"'\n";
1089 frequency = oc.
getFloat(
"device.ssm.frequency");
1091 std::cout <<
"vehicle '" << v.
getID() <<
"' does not supply vehicle parameter 'device.ssm.frequency'. Using default of '" << frequency <<
"'\n";
1100 bool trajectories =
false;
1114 trajectories = oc.
getBool(
"device.ssm.trajectories");
1116 std::cout <<
"vehicle '" << v.
getID() <<
"' does not supply vehicle parameter 'device.ssm.trajectories'. Using default of '" << trajectories <<
"'\n";
1119 return trajectories;
1128 std::string measures_str =
"";
1142 measures_str = oc.
getString(
"device.ssm.measures");
1143 std::cout <<
"vehicle '" << v.
getID() <<
"' does not supply vehicle parameter 'device.ssm.measures'. Using default of '" << measures_str <<
"'\n";
1147 if (measures_str ==
"") {
1148 WRITE_WARNING(
"No measures specified for ssm device of vehicle '" + v.
getID() +
"'. Registering all available SSMs.");
1152 std::vector<std::string> available = st.
getVector();
1155 for (std::vector<std::string>::const_iterator i = measures.begin(); i != measures.end(); ++i) {
1156 if (std::find(available.begin(), available.end(), *i) == available.end()) {
1158 WRITE_ERROR(
"SSM identifier '" + *i +
"' is not supported. Aborting construction of SSM device '" + deviceID +
"'.");
1164 std::string thresholds_str =
"";
1178 thresholds_str = oc.
getString(
"device.ssm.thresholds");
1180 std::cout <<
"vehicle '" << v.
getID() <<
"' does not supply vehicle parameter 'device.ssm.thresholds'. Using default of '" << thresholds_str <<
"'\n";
1185 if (thresholds_str !=
"") {
1190 if (thresholds.size() != measures.size()) {
1191 WRITE_ERROR(
"Given list of thresholds ('" + thresholds_str +
"') has not the same length as the assumed list of measures ('" + measures_str +
"').");
1196 for (std::vector<std::string>::const_iterator i = measures.begin(); i != measures.end(); ++i) {
1199 }
else if (*i ==
"DRAC") {
1201 }
else if (*i ==
"PET") {
1204 WRITE_ERROR(
"Unknown SSM identifier '" + (*i) +
"'. Aborting construction of ssm device.");
void doRegister(const std::string &name, Option *v)
Adds an option under the given name.
void processEncounters(FoeInfoMap &foes)
Finds encounters for which the foe vehicle has disappeared from range and if an ended encounter is qu...
std::vector< double > timespan
time points corresponding to the trajectories
OutputDevice & writeAttr(const SumoXMLAttr attr, const T &val)
writes a named attribute
static const std::set< MSDevice * > & getInstances()
returns all currently existing SSM devices
MSEdge & getEdge() const
Returns the lane's edge.
static void getVehiclesOnJunction(const MSJunction *, double egoDistToConflictLane, const MSLane *const egoConflictLane, FoeInfoMap &foeCollector)
Collects all vehicles on the junction into foeCollector.
Representation of a vehicle in the micro simulation.
static bool getMeasuresAndThresholds(const SUMOVehicle &v, std::string deviceID, std::vector< double > &thresholds, std::vector< std::string > &measures)
void createEncounters(FoeInfoMap &foes)
Makes new encounters for all given vehicles (these should be the ones entering the device's range in ...
bool notifyLeave(SUMOVehicle &veh, double lastPos, MSMoveReminder::Notification reason, const MSLane *enteredLane=0)
Called whenever the holder leaves a lane.
MSLane * getLane() const
Returns the connected lane.
Position getVelocityVector() const
Returns the vehicle's direction in radians.
static void cleanup()
Clean up remaining devices instances.
EncounterType
Different types of encounters corresponding to relative positions of the vehicles. The name describes the type from the ego perspective.
MSLane * getLane() const
Returns the lane the vehicle is on.
static bool _2bool(const E *const data)
converts a 0-terminated char-type array into the boolean value described by it
static void insertOptions(OptionsCont &oc)
Inserts MSDevice_SSM-options.
SUMOVehicle & myHolder
The vehicle that stores the device.
A device which collects info on the vehicle trip (mainly on departure and arrival) ...
The base class for an intersection.
const MSLane * getLaneBefore() const
return the internalLaneBefore if it exists and the laneBefore otherwise
double getPositionOnLane() const
Get the vehicle's position along the lane.
EncounterVector myActiveEncounters
const MSLane * findFoeConflictLane(const MSVehicle *foe, const MSLane *egoConflictLane, double &distToConflictLane)
Computes the conflict lane for the foe.
static double getLoggingFrequency(const SUMOVehicle &v)
Notification
Definition of a vehicle state.
virtual MSLane * getLane() const =0
Returns the lane the vehicle is on.
const std::vector< MSLane * > & getLanes() const
Returns this edge's lanes.
double getLength() const
Returns the lane's length.
virtual const VehCont & getVehiclesSecure() const
Returns the vehicles container; locks it for microsimulation.
void closeEncounter(Encounter *e)
Finalizes the encounter and calculates SSM values.
MSLink * getLinkTo(const MSLane *) const
returns the link to the given lane or 0, if it is not connected
Position getPosition(const double offset=0) const
Return current position (x/y, cartesian)
static double getDetectionRange(const SUMOVehicle &v)
std::vector< const MSEdge * > ConstMSEdgeVector
bool getBool(const std::string &name) const
Returns the boolean-value of the named option (only for Option_Bool)
const std::string & getID() const
Returns the id.
#define DEFAULT_THRESHOLD_PET
double getInternalLengthsAfter() const
Returns the cumulative length of all internal lanes after this link.
double getLength() const
return the length of the edge
const MSJunction * getToJunction() const
void updateEncounter(Encounter *e, FoeInfo *foeInfo)
Updates the encounter (adds a new trajectory point) and deletes the foeInfo.
void generateOutput() const
Finalizes output. Called on vehicle removal.
#define UNUSED_PARAMETER(x)
#define WRITE_WARNING(msg)
static OptionsCont & getOptions()
Retrieves the options.
static bool requestsTrajectories(const SUMOVehicle &v)
double egoDistToConflictLane
double getLengthBeforeCrossing(const MSLink *foeEntryLink) const
Returns the complete internal lengths from the link until the crossing point with the given foe link'...
ENCOUNTER_TYPE_FOLLOWING_LEADER.
A road/street connecting two junctions.
bool isOnRoad() const
Returns the information whether the vehicle is on a road (is simulated)
int maxTrajectorySize
Corresponding maximal trajectory size in points, derived from myFrequency.
void add(double time, Position egoX, Position egoV, Position foeX, Position foeV)
add a new data point
Encounter(const MSVehicle *_ego, const MSVehicle *const _foe, double _begin)
Constructor.
void computeSSMs(Encounter *e)
double myFrequency
Maximal timespan duration for a single encounter.
MSLink * getEntryLink() const
Returns the entry link if this is an internal lane, else 0.
bool knowsParameter(const std::string &key) const
Returns whether the parameter is known.
MSLane * getViaLane() const
Returns the following inner lane.
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
static void getUpstreamVehicles(const MSEdge *edge, double pos, double range, double egoDistToConflictLane, const MSLane *const egoConflictLane, FoeInfoMap &foeCollector)
Collects all vehicles within range 'range' upstream of the position 'pos' on the edge 'edge' into foe...
Representation of a vehicle.
#define DEFAULT_THRESHOLD_DRAC
A point in 2D or 3D with translation and scaling methods.
bool myComputeTTC
Flags for switching on / off comutation of different SSMs, derived from myMeasures.
OutputDevice * myOutputFile
Output device.
void resetEncounters()
Closes all current Encounters and moves conflicts to myPastConflicts,.
const std::vector< MSLane * > & getBestLanesContinuation() const
Returns the best sequence of lanes to continue the route starting at myLane.
std::string getString(const std::string &name) const
Returns the string-value of the named option (only for Option_String)
ENCOUNTER_TYPE_FOLLOWING_FOLLOWER.
MSDevice_SSM(SUMOVehicle &holder, const std::string &id, std::string outputFilename, std::vector< std::string > measures, std::vector< double > thresholds, bool trajectories, double frequency, double range)
Constructor.
bool notifyEnter(SUMOVehicle &veh, MSMoveReminder::Notification reason, const MSLane *enteredLane=0)
Called whenever the holder enteres a lane.
const ConstMSEdgeVector & getIncoming() const
bool qualifiesAsConflict(Encounter *e)
Tests if the SSM values exceed the threshold for qualification as conflict.
static void insertDefaultAssignmentOptions(const std::string &deviceName, const std::string &optionsTopic, OptionsCont &oc)
Adds common command options that allow to assign devices to vehicles.
void addOptionSubTopic(const std::string &topic)
Adds an option subtopic.
virtual bool isOnRoad() const =0
Returns the information whether the vehicle is on a road (is simulated)
void updateAndWriteOutput()
This is called once per time step in MSNet::writeOutput() and collects the surrounding vehicles...
bool isInternal() const
return whether this edge is an internal edge
ENCOUNTER_TYPE_FOLLOWING.
const SUMOVTypeParameter & getParameter() const
static std::string getOutputFilename(const SUMOVehicle &v, std::string deviceID)
double getFloat(const std::string &name) const
Returns the double-value of the named option (only for Option_Float)
std::vector< MSVehicle * > VehCont
Container for vehicles.
std::vector< std::string > myMeasures
void flushConflicts(bool all=false)
Writes out all past conflicts that have begun earlier than time t-myFrequency (i.e. no active encounter can have an earlier begin)
std::vector< std::string > getVector()
Abstract in-vehicle device.
const std::string & getParameter(const std::string &key, const std::string &defaultValue) const
Returns the value for a given key.
std::vector< Encounter * > EncounterVector
std::vector< double > myThresholds
static bool equippedByDefaultAssignmentOptions(const OptionsCont &oc, const std::string &deviceName, SUMOVehicle &v)
Determines whether a vehicle should get a certain device.
std::map< const MSVehicle *, FoeInfo * > FoeInfoMap
const MSLane * egoConflictLane
Trajectory egoTrajectory
Trajectory of the ego vehicle.
const std::vector< MSLink * > & getFoeLinks()
static OutputDevice & getDevice(const std::string &name)
Returns the described OutputDevice.
virtual const SUMOVehicleParameter & getParameter() const =0
Returns the vehicle's parameter (including departure definition)
static std::set< MSDevice * > * instances
All currently existing SSM devices.
~MSDevice_SSM()
Destructor.
const MSJunction * getFromJunction() const
#define DEFAULT_FREQUENCY
A storage for options typed value containers)
static double _2double(const E *const data)
converts a char-type array into the double value described by it
double getInternalFollowingLengthTo(const MSEdge *followerAfterInternal) const
returns the length of all internal edges on the junction until reaching the non-internal edge followe...
ENCOUNTER_TYPE_NOCONFLICT.
double getBackPositionOnLane(const MSLane *lane) const
Get the vehicle's position relative to the given lane.
An encounter is an episode involving two vehicles, which are closer to each other than some specified...
bool closeTag()
Closes the most recently opened tag.
virtual const std::vector< MSLane * > & getInternalLanes() const
Returns all internal lanes on the junction.
#define DEFAULT_THRESHOLD_TTC
void addDescription(const std::string &name, const std::string &subtopic, const std::string &description)
Adds a description for an option.
const MSLinkCont & getLinkCont() const
returns the container with all links !!!
void writeOutConflict(Encounter *e)
const MSRouteIterator & getCurrentRouteEdge() const
Returns an iterator pointing to the current edge in this vehicles route.
bool notifyMove(SUMOVehicle &veh, double oldPos, double newPos, double newSpeed)
Checks for waiting steps when the vehicle moves.
const std::string & getID() const
Returns the name of the vehicle.
Representation of a lane in the micro simulation.
const MSVehicle *const foe
virtual const std::string & getID() const =0
Get the vehicle's ID.
std::string joinToString(const std::vector< T > &v, const T_BETWEEN &between, std::streamsize accuracy=gPrecision)
EncounterQueue myPastConflicts
Past encounters that where qualified as conflicts and are not yet flushed to the output file...
OutputDevice & openTag(const std::string &xmlElement)
Opens an XML tag.
static void buildVehicleDevices(SUMOVehicle &v, std::vector< MSDevice *> &into)
Build devices for the given vehicle, if needed.
Trajectory foeTrajectory
Trajectory of the foe vehicle.
static void findSurroundingVehicles(const MSVehicle &veh, double range, FoeInfoMap &foeCollector)
Returns all vehicles, which are within the given range of the given vehicle.
virtual const MSVehicleType & getVehicleType() const =0
Returns the vehicle's type.
std::priority_queue< Encounter *, std::vector< Encounter * >, Encounter::compare > EncounterQueue