49 const std::string name,
const std::string& vTypes,
50 const std::string& nextEdges,
56 myPosition(positionInMeters), myLastExitTime(-1) {
57 assert(
myPosition >= 0 && myPosition <= myLane->getLength());
94 double newPos,
double newSpeed) {
111 const double entryTime =
SIMTIME -
TS + timeBeforeEnter;
116 write(
"enter", entryTime, veh, enterSpeed);
123 std::map<SUMOTrafficObject*, double>::iterator i =
myEntryTimes.find(&veh);
127 const double leaveTime =
SIMTIME -
TS + timeBeforeLeave;
128 write(
"leave", leaveTime, veh, newSpeed,
"occupancy", leaveTime - (*i).second);
153 return a.time < b.time || (a.time == b.time && a.numericalID < b.numericalID);
159 "length",
toString(e.length)).writeAttr(
161 if (e.add !=
nullptr) {
180 std::map<SUMOTrafficObject*, double>::iterator i =
myEntryTimes.find(&veh);
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
static double speedAfterTime(const double t, const double oldSpeed, const double dist)
Calculates the speed after a time t \in [0,TS] given the initial speed and the distance traveled in a...
static double passingTime(const double lastPos, const double passedPos, const double currentPos, const double lastSpeed, const double currentSpeed)
Calculates the time at which the position passedPosition has been passed In case of a ballistic updat...
Base of value-generating classes (detectors)
bool vehicleApplies(const SUMOTrafficObject &veh) const
Checks whether the detector measures vehicles of the given type.
static bool gSemiImplicitEulerUpdate
static int gNumSimThreads
how many threads to use for simulation
std::map< SUMOTrafficObject *, double > myEntryTimes
The last exit time.
std::vector< Event > myEvents
the events of this step
void detectorUpdate(const SUMOTime step)
writes the events of this step (detectors are updated serially in a fixed order)
MSInstantInductLoop(const std::string &id, OutputDevice &od, MSLane *const lane, double positionInMeters, const std::string name, const std::string &vTypes, const std::string &nextEdges, int detectPersons)
Constructor.
bool notifyEnter(SUMOTrafficObject &veh, Notification reason, const MSLane *enteredLane=0)
Checks whether the reminder is activated by a vehicle entering the lane.
OutputDevice & myOutputDevice
The output device to use.
void writeXMLDetectorProlog(OutputDevice &dev) const
Open the XML-output.
~MSInstantInductLoop()
Destructor.
void write(const char *state, double t, SUMOTrafficObject &veh, double speed, const char *add=0, double addValue=-1)
Writes an event line.
const double myPosition
Detector's position on lane [m].
bool notifyLeave(SUMOTrafficObject &veh, double lastPos, MSMoveReminder::Notification reason, const MSLane *enteredLane=0)
Dismisses the vehicle if it is on the detector due to a lane change.
double myLastExitTime
The last exit time.
bool notifyMove(SUMOTrafficObject &veh, double oldPos, double newPos, double newSpeed)
Checks whether the vehicle shall be counted and/or shall still touch this MSMoveReminder.
Representation of a lane in the micro simulation.
Something on a lane to be noticed about vehicle movement.
Notification
Definition of a vehicle state.
@ NOTIFICATION_JUNCTION
The vehicle arrived at a junction.
MSLane * myLane
Lane on which the reminder works.
const std::string & getID() const
Returns the name of the vehicle type.
double getLength() const
Get vehicle's length [m].
const std::string & getID() const
Returns the id.
Static storage of an output device and its base (abstract) implementation.
OutputDevice & openTag(const std::string &xmlElement)
Opens an XML tag.
OutputDevice & writeAttr(const ATTR_TYPE &attr, const T &val, const bool isNull=false, const bool escape=false)
writes a named attribute
virtual bool isNull()
returns the information whether the device will discard all output
bool closeTag(const std::string &comment="")
Closes the most recently opened tag and optionally adds a comment.
bool writeXMLHeader(const std::string &rootElement, const std::string &schemaFile, std::map< SumoXMLAttr, std::string > attrs=std::map< SumoXMLAttr, std::string >(), bool includeConfig=true)
Writes an XML header with optional configuration.
Representation of a vehicle, person, or container.
virtual NumericalID getNumericalID() const =0
return the numerical ID which is only for internal usage
virtual const MSVehicleType & getVehicleType() const =0
Returns the object's "vehicle" type.
virtual double getPreviousSpeed() const =0
Returns the object's previous speed.
virtual double getSpeed() const =0
Returns the object's current speed.
virtual double getBackPositionOnLane(const MSLane *lane) const =0
Get the object's back position along the given lane.
virtual double getPositionOnLane() const =0
Get the object's position along the lane.
A scoped lock which only triggers on condition.
an event of this step, written in detectorUpdate