128 const double timeOnLane,
const double ,
129 const double meanSpeedVehicleOnLane,
130 const double travelledDistanceFrontOnLane,
131 const double travelledDistanceVehicleOnLane,
132 const double meanLengthOnLane) {
133#ifdef DEBUG_OCCUPANCY
135 std::cout <<
SIMTIME <<
"\n MSMeanData_Net::MSLaneMeanDataValues::notifyMoveInternal()\n"
137 <<
", timeOnLane=" << timeOnLane
138 <<
", meanSpeedVehicleOnLane=" << meanSpeedVehicleOnLane
139 <<
",\ntravelledDistanceFrontOnLane=" << travelledDistanceFrontOnLane
140 <<
", travelledDistanceVehicleOnLane=" << travelledDistanceVehicleOnLane
141 <<
", meanLengthOnLane=" << meanLengthOnLane
169 timeLoss += timeOnLane *
MAX2(0.0, vmax - meanSpeedVehicleOnLane) / vmax;
179#ifdef DEBUG_OCCUPANCY2
218#ifdef DEBUG_NOTIFY_ENTER
219 std::cout <<
"\n" <<
SIMTIME <<
" MSMeanData_Net::MSLaneMeanDataValues: veh '" << veh.
getID() <<
"' enters lane '" << enteredLane->
getID() <<
"'" << std::endl;
255 const int numLanes,
const double speedLimit,
const double defaultTravelTime,
const int numVehicles)
const {
264 const double laneDensity = density / (double)numLanes;
265 const double occupancy =
getOccupancy(period, numLanes);
266#ifdef DEBUG_OCCUPANCY2
268 if (occupancy > 100) {
269 std::cout <<
SIMTIME <<
" Encountered bad occupancy: " << occupancy
275 <<
"\ndensity=" << density <<
"\n";
299 const bool haveSamplesOrDefault = haveSamples || defaultTravelTime >= 0.;
300 bool haveTravelTime = haveSamplesOrDefault;
301 double traveltime =
myParent->myMaxTravelTime;
303 if (numVehicles > 0) {
306 traveltime =
myParent->myMaxTravelTime;
309 }
else if (defaultTravelTime >= 0.) {
310 traveltime = defaultTravelTime;
312 haveTravelTime =
false;
315 }
else if (defaultTravelTime >= 0.) {
316 traveltime = defaultTravelTime;
319 double overlapTraveltime =
myParent->myMaxTravelTime;
335 }
else if (defaultTravelTime > 0.) {
355 const SUMOTime period,
const double numLanes,
const double speedLimit)
const {
364 return density / numLanes;
369 return overlapDensity / numLanes;
397 return density * speed * 3.6;
409 const SUMOTime dumpEnd,
const bool useLanes,
410 const bool withEmpty,
const bool printDefaults,
411 const bool withInternal,
412 const bool trackVehicles,
413 const int detectPersons,
414 const double maxTravelTime,
415 const double minSamples,
416 const double haltSpeed,
417 const std::string& vTypes,
418 const std::string& writeAttributes,
419 const std::vector<MSEdge*>& edges,
421 MSMeanData(id, dumpBegin, dumpEnd, useLanes, withEmpty, printDefaults,
422 withInternal, trackVehicles, detectPersons, maxTravelTime, minSamples, vTypes, writeAttributes, edges, aggregate),
436std::vector<std::string>
438 std::vector<std::string> result;
459 double result = defaultValue;
461 if (edgeValues ==
nullptr) {
466 values = (*edgeValues)[lane->
getIndex()];
470 meanData->addTo(*sumData);
std::bitset< 96 > SumoXMLAttrMask
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
@ SUMO_ATTR_OVERLAPDENSITY
@ SUMO_ATTR_OVERLAPTRAVELTIME
@ SUMO_ATTR_LANECHANGEDFROM
@ SUMO_ATTR_LANECHANGEDTO
const double INVALID_DOUBLE
invalid double
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
double getVehicleMaxSpeed(const SUMOTrafficObject *const veh) const
Returns the maximum speed the vehicle may use on this edge.
static double gLateralResolution
static int gNumSimThreads
how many threads to use for simulation
Representation of a lane in the micro simulation.
double getSpeedLimit() const
Returns the lane's maximum allowed speed.
double getLength() const
Returns the lane's length.
double getVehicleMaxSpeed(const SUMOTrafficObject *const veh) const
Returns the lane's maximum speed, given a vehicle's speed limit adaptation.
int getIndex() const
Returns the lane's index.
MSEdge & getEdge() const
Returns the lane's edge.
Data structure for mean (aggregated) edge/lane values.
MeanDataValues(MSLane *const lane, const double length, const bool doAdd, const MSMeanData *const parent)
Constructor.
double travelledDistance
The sum of the distances the vehicles travelled.
const double myLaneLength
The length of the lane / edge the data collector is on.
virtual double getAttributeValue(SumoXMLAttr a, const SUMOTime period, const double numLanes, const double speedLimit) const
return attribute value
SUMOTime resetTime
time at which collection was reset;
Data structure for mean (aggregated) edge/lane values.
bool notifyLeave(SUMOTrafficObject &veh, double lastPos, MSMoveReminder::Notification reason, const MSLane *enteredLane=0)
Called if the vehicle leaves the reminder's lane.
const MSMeanData_Net * myParent
The meandata parent.
double frontTravelledDistance
The travelled distance regarding the vehicle front.
void addTo(MSMeanData::MeanDataValues &val) const
Add the values of this to the given one and store them there.
void write(OutputDevice &dev, const SumoXMLAttrMask &attributeMask, const SUMOTime period, const int numLanes, const double speedLimit, const double defaultTravelTime, const int numVehicles=-1) const
Writes output values into the given stream.
int nVehLaneChangeTo
The number of vehicles that changed to this lane.
double getAttributeValue(SumoXMLAttr a, const SUMOTime period, const double numLanes, const double speedLimit) const
return attribute value
int nVehVaporized
The number of vehicles that left this lane via vaporization within the sample interval.
double minimalVehicleLength
minimal vehicle length in the current interval (used to determine a maximal density,...
double getOccupancy(SUMOTime period, int numLanes) const
bool isEmpty() const
Returns whether any data was collected.
bool notifyEnter(SUMOTrafficObject &veh, MSMoveReminder::Notification reason, const MSLane *enteredLane=0)
Computes current values and adds them to their sums.
MSLaneMeanDataValues(MSLane *const lane, const double length, const bool doAdd, const MSMeanData_Net *parent)
Constructor.
void notifyMoveInternal(const SUMOTrafficObject &veh, const double frontOnLane, const double timeOnLane, const double, const double meanSpeedVehicleOnLane, const double travelledDistanceFrontOnLane, const double travelledDistanceVehicleOnLane, const double meanLengthOnLane)
Internal notification about the vehicle moves.
int nVehLeft
The number of vehicles that left this lane within the sample interval.
int nVehLaneChangeFrom
The number of vehicles that changed from this lane.
int nVehTeleported
The number of vehicles that left this lane via teleporting within the sample interval.
double timeLoss
The time loss accrued by vehicle probes.
double frontSampleSeconds
The number of vehicle probes regarding the vehicle front.
int nVehArrived
The number of vehicles that finished on the lane.
double waitSeconds
The number of vehicle probes with small speed.
virtual ~MSLaneMeanDataValues()
Destructor.
double occupationSum
The sum of the occupation of the lane.
int nVehEntered
The number of vehicles that entered this lane within the sample interval.
double vehLengthSum
The sum of the lengths the vehicles had.
void reset(bool afterWrite=false)
Resets values so they may be used for the next interval.
virtual ~MSMeanData_Net()
Destructor.
double getAttributeValue(const MSLane *lane, SumoXMLAttr a, double defaultValue) const
return attribute value for the given lane
MSMeanData_Net(const std::string &id, const SUMOTime dumpBegin, const SUMOTime dumpEnd, const bool useLanes, const bool withEmpty, const bool printDefaults, const bool withInternal, const bool trackVehicles, const int detectPersons, const double maxTravelTime, const double minSamples, const double haltSpeed, const std::string &vTypes, const std::string &writeAttributes, const std::vector< MSEdge * > &edges, bool aggregate)
Constructor.
std::vector< std::string > getAttributeNames() const
return all attributes that are (potentially) written by this output
MSMeanData::MeanDataValues * createValues(MSLane *const lane, const double length, const bool doAdd) const
Create an instance of MeanDataValues.
const double myHaltSpeed
the minimum sample seconds
const bool myAmEdgeBased
Information whether the output shall be edge-based (not lane-based).
const std::vector< MeanDataValues * > * getEdgeValues(const MSEdge *edge) const
MSMeanData(const std::string &id, const SUMOTime dumpBegin, const SUMOTime dumpEnd, const bool useLanes, const bool withEmpty, const bool printDefaults, const bool withInternal, const bool trackVehicles, const int detectPersons, const double minSamples, const double maxTravelTime, const std::string &vTypes, const std::string &writeAttributes, const std::vector< MSEdge * > &edges, bool aggregate)
Constructor.
const std::string & getDescription() const
Notification
Definition of a vehicle state.
@ NOTIFICATION_ARRIVED
The vehicle arrived at its destination (is deleted).
@ NOTIFICATION_TELEPORT_ARRIVED
The vehicle was teleported out of the net.
@ NOTIFICATION_VAPORIZED_CALIBRATOR
The vehicle got removed by a calibrator.
@ NOTIFICATION_DEPARTED
The vehicle has departed (was inserted into the network).
@ NOTIFICATION_SEGMENT
The vehicle changes the segment (meso only).
@ NOTIFICATION_LANE_CHANGE
The vehicle changes lanes (micro only).
@ NOTIFICATION_JUNCTION
The vehicle arrived at a junction.
@ NOTIFICATION_TELEPORT
The vehicle is being teleported.
void removeFromVehicleUpdateValues(SUMOTrafficObject &veh)
const MSLane * getLane() const
Returns the lane the reminder works on.
Representation of a vehicle in the micro simulation.
double getLengthWithGap() const
Get vehicle's length including the minimum gap [m].
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.
bool closeTag(const std::string &comment="")
Closes the most recently opened tag and optionally adds a comment.
OutputDevice & writeOptionalAttr(const SumoXMLAttr attr, const T &val, const SumoXMLAttrMask &attributeMask, const bool isNull=false)
writes a named attribute unless filtered
Representation of a vehicle, person, or container.
virtual bool isVehicle() const
Whether it is a vehicle.
virtual const MSVehicleType & getVehicleType() const =0
Returns the object's "vehicle" type.
virtual const MSLane * getLane() const =0
Returns the lane the object is currently at.
virtual SUMOTime getWaitingTime(const bool accumulated=false) const =0
virtual bool isStopped() const =0
Returns whether the object is at a stop.
virtual const MSEdge * getEdge() const =0
Returns the edge the object is currently at.
A scoped lock which only triggers on condition.
#define UNUSED_PARAMETER(x)