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<SUMOVehicle*, 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<SUMOVehicle*, 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 SUMOVehicle &veh) const
Checks whether the detector measures vehicles of the given type.
The vehicle arrived at a junction.
void writeXMLDetectorProlog(OutputDevice &dev) const
Open the XML-output.
Notification
Definition of a vehicle state.
bool notifyMove(SUMOVehicle &veh, double oldPos, double newPos, double newSpeed)
Checks whether the vehicle shall be counted and/or shall still touch this MSMoveReminder.
const std::string & getID() const
Returns the id.
bool notifyLeave(SUMOVehicle &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.
MSInstantInductLoop(const std::string &id, OutputDevice &od, MSLane *const lane, double positionInMeters, const std::string &vTypes)
Constructor.
std::map< SUMOVehicle *, double > myEntryTimes
The last exit time.
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
~MSInstantInductLoop()
Destructor.
Representation of a vehicle.
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.
Something on a lane to be noticed about vehicle movement.
const double myPosition
Detector's position on lane [m].
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.
void write(const char *state, double t, SUMOVehicle &veh, double speed, const char *add=0, double addValue=-1)
Writes an event line.
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.
virtual double getPreviousSpeed() const =0
Returns the vehicle's previous speed.
virtual const std::string & getID() const =0
Get the vehicle's ID.
OutputDevice & openTag(const std::string &xmlElement)
Opens an XML tag.
Base of value-generating classes (detectors)
virtual const MSVehicleType & getVehicleType() const =0
Returns the vehicle's type.