 |
Eclipse SUMO - Simulation of Urban MObility
|
Go to the documentation of this file.
46 const std::string& vTypes) :
50 myPosition(positionInMeters), myLastExitTime(-1) {
51 assert(
myPosition >= 0 && myPosition <= myLane->getLength());
62 double newPos,
double newSpeed) {
79 const double entryTime =
SIMTIME -
TS + timeBeforeEnter;
84 write(
"enter", entryTime, veh, enterSpeed);
91 std::map<SUMOTrafficObject*, double>::iterator i =
myEntryTimes.find(&veh);
95 const double leaveTime =
SIMTIME -
TS + timeBeforeLeave;
96 write(
"leave", leaveTime, veh, newSpeed,
"occupancy", leaveTime - (*i).second);
115 if (add !=
nullptr) {
129 std::map<SUMOTrafficObject*, double>::iterator i =
myEntryTimes.find(&veh);
Representation of a vehicle or person.
const std::string & getID() const
Returns the name of the vehicle type.
Base of value-generating classes (detectors)
Representation of a lane in the micro simulation.
OutputDevice & myOutputDevice
The output device to use.
Static storage of an output device and its base (abstract) implementation.
void writeXMLDetectorProlog(OutputDevice &dev) const
Open the XML-output.
virtual const MSVehicleType & getVehicleType() const =0
Returns the vehicle's type.
virtual const std::string & getID() const =0
Get the vehicle's ID.
const double myPosition
Detector's position on lane [m].
static int gNumSimThreads
how many threads to use for simulation
std::map< SUMOTrafficObject *, double > myEntryTimes
The last exit time.
MSInstantInductLoop(const std::string &id, OutputDevice &od, MSLane *const lane, double positionInMeters, const std::string &vTypes)
Constructor.
Something on a lane to be noticed about vehicle movement.
bool closeTag(const std::string &comment="")
Closes the most recently opened tag and optionally adds a comment.
~MSInstantInductLoop()
Destructor.
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 & writeAttr(const SumoXMLAttr attr, const T &val)
writes a named attribute
A scoped lock which only triggers on condition.
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...
OutputDevice & openTag(const std::string &xmlElement)
Opens an XML tag.
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
virtual double getPreviousSpeed() const =0
Returns the vehicle's previous speed.
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 getLength() const
Get vehicle's length [m].
void write(const char *state, double t, SUMOTrafficObject &veh, double speed, const char *add=0, double addValue=-1)
Writes an event line.
bool vehicleApplies(const SUMOTrafficObject &veh) const
Checks whether the detector measures vehicles of the given type.
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...
double myLastExitTime
The last exit time.
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.
static bool gSemiImplicitEulerUpdate
const std::string & getID() const
Returns the id.
Notification
Definition of a vehicle state.
@ NOTIFICATION_JUNCTION
The vehicle arrived at a junction.
virtual double getSpeed() const =0
Returns the vehicle's current speed.