47 const std::string& vTypes) :
51 myPosition(positionInMeters), myLastExitTime(-1) {
52 assert(
myPosition >= 0 && myPosition <= myLane->getLength());
63 double newPos,
double newSpeed) {
77 const double entryTime =
SIMTIME -
TS + timeBeforeEnter;
82 write(
"enter", entryTime, veh, enterSpeed);
89 std::map<SUMOTrafficObject*, double>::iterator i =
myEntryTimes.find(&veh);
93 const double leaveTime =
SIMTIME -
TS + timeBeforeLeave;
94 write(
"leave", leaveTime, veh, newSpeed,
"occupancy", leaveTime - (*i).second);
110 "vehID", veh.
getID()).writeAttr(
"speed",
toString(speed)).writeAttr(
113 if (add !=
nullptr) {
127 std::map<SUMOTrafficObject*, double>::iterator i =
myEntryTimes.find(&veh);
static double speedAfterTime(const double t, const double oldSpeed, const double dist)
Calculates the speed after a time t [0,TS] given the initial speed and the distance traveled in an i...
OutputDevice & writeAttr(const SumoXMLAttr attr, const T &val)
writes a named attribute
bool vehicleApplies(const SUMOTrafficObject &veh) const
Checks whether the detector measures vehicles of the given type.
virtual const MSVehicleType & getVehicleType() const =0
Returns the vehicle's type.
virtual const std::string & getID() const =0
Get the vehicle's ID.
The vehicle arrived at a junction.
void writeXMLDetectorProlog(OutputDevice &dev) const
Open the XML-output.
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.
Notification
Definition of a vehicle state.
const std::string & getID() const
Returns the id.
void write(const char *state, double t, SUMOTrafficObject &veh, double speed, const char *add=0, double addValue=-1)
Writes an event line.
double myLastExitTime
The last exit time.
MSInstantInductLoop(const std::string &id, OutputDevice &od, MSLane *const lane, double positionInMeters, const std::string &vTypes)
Constructor.
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
~MSInstantInductLoop()
Destructor.
bool writeXMLHeader(const std::string &rootElement, const std::string &schemaFile, std::map< SumoXMLAttr, std::string > attrs=std::map< SumoXMLAttr, std::string >())
Writes an XML header with optional configuration.
std::map< SUMOTrafficObject *, double > myEntryTimes
The last exit time.
Something on a lane to be noticed about vehicle movement.
const double myPosition
Detector's position on lane [m].
virtual double getPreviousSpeed() const =0
Returns the vehicle's previous speed.
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...
OutputDevice & myOutputDevice
The output device to use.
Representation of a vehicle or person.
const std::string & getID() const
Returns the name of the vehicle type.
double getLength() const
Get vehicle's length [m].
Static storage of an output device and its base (abstract) implementation.
bool closeTag(const std::string &comment="")
Closes the most recently opened tag and optionally adds a comment.
static bool gSemiImplicitEulerUpdate
virtual double getSpeed() const =0
Returns the vehicle's current speed.
Representation of a lane in the micro simulation.
bool notifyMove(SUMOTrafficObject &veh, double oldPos, double newPos, double newSpeed)
Checks whether the vehicle shall be counted and/or shall still touch this MSMoveReminder.
OutputDevice & openTag(const std::string &xmlElement)
Opens an XML tag.
Base of value-generating classes (detectors)