47 #ifdef CHECK_MEMORY_LEAKS
49 #endif // CHECK_MEMORY_LEAKS
63 nVehDeparted(0), nVehArrived(0), nVehEntered(0), nVehLeft(0),
64 nVehVaporized(0), waitSeconds(0),
65 nVehLaneChangeFrom(0), nVehLaneChangeTo(0),
66 frontSampleSeconds(0), frontTravelledDistance(0),
67 vehLengthSum(0), myParent(parent) {}
81 nVehLaneChangeFrom = 0;
84 travelledDistance = 0;
86 frontSampleSeconds = 0;
87 frontTravelledDistance = 0;
113 sampleSeconds += timeOnLane;
114 travelledDistance += travelledDistanceVehicleOnLane;
117 if (myParent != 0 && meanSpeedVehicleOnLane < myParent->
myHaltSpeed) {
118 waitSeconds += timeOnLane;
120 frontSampleSeconds += frontOnLane;
121 frontTravelledDistance += travelledDistanceFrontOnLane;
127 if ((myParent == 0 || myParent->vehicleApplies(veh)) && (getLane() == 0 || getLane() ==
static_cast<MSVehicle&
>(veh).getLane())) {
129 removeFromVehicleUpdateValues(veh);
134 ++nVehLaneChangeFrom;
151 if (myParent == 0 || myParent->vehicleApplies(veh)) {
152 if (getLane() == 0 || getLane() ==
static_cast<MSVehicle&
>(veh).getLane()) {
169 return sampleSeconds == 0 && nVehDeparted == 0 && nVehArrived == 0 && nVehEntered == 0
170 && nVehLeft == 0 && nVehVaporized == 0 && nVehLaneChangeFrom == 0 && nVehLaneChangeTo == 0;
176 const SUMOReal numLanes,
const SUMOReal defaultTravelTime,
const int numVehicles)
const {
178 if (sampleSeconds > 0) {
181 .
writeAttr(
"waitingTime", waitSeconds).
writeAttr(
"speed", travelledDistance / sampleSeconds);
184 if (nVehVaporized > 0) {
185 dev.
writeAttr(
"vaporized", nVehVaporized);
190 if (sampleSeconds > myParent->myMinSamples) {
191 SUMOReal overlapTraveltime = myParent->myMaxTravelTime;
192 if (travelledDistance > 0.f) {
195 overlapTraveltime =
MIN2(overlapTraveltime, (myLaneLength + vehLengthSum / sampleSeconds) * sampleSeconds / travelledDistance);
197 if (numVehicles > 0) {
198 dev.
writeAttr(
"traveltime", sampleSeconds / numVehicles).
writeAttr(
"waitingTime", waitSeconds).
writeAttr(
"speed", travelledDistance / sampleSeconds);
200 SUMOReal traveltime = myParent->myMaxTravelTime;
201 if (frontTravelledDistance > 0.f) {
202 traveltime =
MIN2(traveltime, myLaneLength * frontSampleSeconds / frontTravelledDistance);
204 }
else if (defaultTravelTime >= 0.) {
205 dev.
writeAttr(
"traveltime", defaultTravelTime);
207 dev.
writeAttr(
"overlapTraveltime", overlapTraveltime)
210 .
writeAttr(
"waitingTime", waitSeconds).
writeAttr(
"speed", travelledDistance / sampleSeconds);
212 }
else if (defaultTravelTime >= 0.) {
213 dev.
writeAttr(
"traveltime", defaultTravelTime).
writeAttr(
"speed", myLaneLength / defaultTravelTime);
216 .
writeAttr(
"laneChangedFrom", nVehLaneChangeFrom).
writeAttr(
"laneChangedTo", nVehLaneChangeTo);
217 if (nVehVaporized > 0) {
218 dev.
writeAttr(
"vaporized", nVehVaporized);
228 const SUMOTime dumpEnd,
const bool useLanes,
229 const bool withEmpty,
const bool printDefaults,
230 const bool withInternal,
231 const bool trackVehicles,
235 const std::string& vTypes)
236 :
MSMeanData(id, dumpBegin, dumpEnd, useLanes, withEmpty, printDefaults,
237 withInternal, trackVehicles, maxTravelTime, minSamples, vTypes),
Data collector for edges/lanes.
OutputDevice & writeAttr(const SumoXMLAttr attr, const T &val)
writes a named attribute
int nVehEntered
The number of vehicles that entered this lane within the sample interval.
virtual ~MSLaneMeanDataValues()
Destructor.
Representation of a vehicle in the micro simulation.
void write(OutputDevice &dev, const SUMOTime period, const SUMOReal numLanes, const SUMOReal defaultTravelTime, const int numVehicles=-1) const
Writes output values into the given stream.
MSLaneMeanDataValues(MSLane *const lane, const SUMOReal length, const bool doAdd, const MSMeanData_Net *parent)
Constructor.
int nVehVaporized
The number of vehicles that left this lane within the sample interval.
The vehicle arrived at a junction.
SUMOReal travelledDistance
The sum of the distances the vehicles travelled.
void addTo(MSMeanData::MeanDataValues &val) const
Add the values of this to the given one and store them there.
Notification
Definition of a vehicle state.
SUMOReal getLength() const
Get vehicle's length [m].
The vehicle got vaporized.
The vehicle changes the segment (meso only)
SUMOReal frontSampleSeconds
The number of vehicle probes regarding the vehicle front.
Data structure for mean (aggregated) edge/lane values.
SUMOReal waitSeconds
The number of vehicle probes with small speed.
The vehicle changes lanes (micro only) XXX: What if a vehicle changes lanes and passes a junction sim...
int nVehLaneChangeTo
The number of vehicles that changed to this lane.
SUMOReal vehLengthSum
The sum of the lengths the vehicles had.
bool notifyEnter(SUMOVehicle &veh, MSMoveReminder::Notification reason)
Computes current values and adds them to their sums.
Representation of a vehicle.
Data structure for mean (aggregated) edge/lane values.
virtual ~MSMeanData_Net()
Destructor.
The vehicle arrived at its destination (is deleted)
bool isEmpty() const
Returns whether any data was collected.
const SUMOReal myHaltSpeed
the minimum sample seconds
bool notifyLeave(SUMOVehicle &veh, SUMOReal lastPos, MSMoveReminder::Notification reason)
Called if the vehicle leaves the reminder's lane.
int nVehLeft
The number of vehicles that left this lane within the sample interval.
int nVehArrived
The number of vehicles that finished on the 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 SUMOReal maxTravelTime, const SUMOReal minSamples, const SUMOReal haltSpeed, const std::string &vTypes)
Constructor.
The vehicle has departed (was inserted into the network)
MSMeanData::MeanDataValues * createValues(MSLane *const lane, const SUMOReal length, const bool doAdd) const
Create an instance of MeanDataValues.
SUMOReal frontTravelledDistance
The travelled distance regarding the vehicle front.
int nVehLaneChangeFrom
The number of vehicles that changed from this lane.
Static storage of an output device and its base (abstract) implementation.
Network state mean data collector for edges/lanes.
bool closeTag()
Closes the most recently opened tag.
void notifyMoveInternal(const SUMOVehicle &veh, const SUMOReal frontOnLane, const SUMOReal timeOnLane, const SUMOReal meanSpeedFrontOnLane, const SUMOReal meanSpeedVehicleOnLane, const SUMOReal travelledDistanceFrontOnLane, const SUMOReal travelledDistanceVehicleOnLane)
Internal notification about the vehicle moves.
void reset(bool afterWrite=false)
Resets values so they may be used for the next interval.
Representation of a lane in the micro simulation.
virtual const MSVehicleType & getVehicleType() const =0
Returns the vehicle's type.