45 #include <mesosim/MELoop.h>
46 #include <mesosim/MESegment.h>
49 #ifdef CHECK_MEMORY_LEAKS
51 #endif // CHECK_MEMORY_LEAKS
63 const std::set<std::string>*
const vTypes,
66 nVehDeparted(0), nVehArrived(0), nVehEntered(0), nVehLeft(0),
67 nVehVaporized(0), waitSeconds(0),
68 nVehLaneChangeFrom(0), nVehLaneChangeTo(0),
69 vehLengthSum(0), myParent(parent) {}
83 nVehLaneChangeFrom = 0;
86 travelledDistance = 0;
111 sampleSeconds += timeOnLane;
112 travelledDistance += speed * timeOnLane;
114 if (myParent != 0 && speed < myParent->
myHaltSpeed) {
115 waitSeconds += timeOnLane;
122 if (vehicleApplies(veh) && (getLane() == 0 || getLane() == static_cast<MSVehicle&>(veh).getLane())) {
125 myLastVehicleUpdateValues.erase(&veh);
131 ++nVehLaneChangeFrom;
150 if (vehicleApplies(veh)) {
151 if (getLane() == 0 || getLane() == static_cast<MSVehicle&>(veh).getLane()) {
168 return sampleSeconds == 0 && nVehDeparted == 0 && nVehArrived == 0 && nVehEntered == 0
169 && nVehLeft == 0 && nVehVaporized == 0 && nVehLaneChangeFrom == 0 && nVehLaneChangeTo == 0;
175 const SUMOReal numLanes,
const SUMOReal defaultTravelTime,
const int numVehicles)
const {
177 if (sampleSeconds > 0) {
180 .
writeAttr(
"waitingTime", waitSeconds).
writeAttr(
"speed", travelledDistance / sampleSeconds);
183 if (nVehVaporized > 0) {
184 dev.
writeAttr(
"vaporized", nVehVaporized);
189 if (sampleSeconds > myParent->myMinSamples) {
190 SUMOReal traveltime = myParent->myMaxTravelTime;
191 if (travelledDistance > 0.f) {
192 traveltime =
MIN2(traveltime, myLaneLength * sampleSeconds / travelledDistance);
194 if (numVehicles > 0) {
195 dev.
writeAttr(
"traveltime", sampleSeconds / numVehicles).
writeAttr(
"waitingTime", waitSeconds).
writeAttr(
"speed", travelledDistance / sampleSeconds);
200 .
writeAttr(
"waitingTime", waitSeconds).
writeAttr(
"speed", travelledDistance / sampleSeconds);
202 }
else if (defaultTravelTime >= 0.) {
203 dev.
writeAttr(
"traveltime", defaultTravelTime).
writeAttr(
"speed", myLaneLength / defaultTravelTime);
206 .
writeAttr(
"laneChangedFrom", nVehLaneChangeFrom).
writeAttr(
"laneChangedTo", nVehLaneChangeTo);
207 if (nVehVaporized > 0) {
208 dev.
writeAttr(
"vaporized", nVehVaporized);
218 const SUMOTime dumpEnd,
const bool useLanes,
219 const bool withEmpty,
const bool printDefaults,
220 const bool withInternal,
221 const bool trackVehicles,
225 const std::set<std::string> vTypes)
226 :
MSMeanData(id, dumpBegin, dumpEnd, useLanes, withEmpty, printDefaults,
227 withInternal, trackVehicles, maxTravelTime, minSamples, vTypes),
Data collector for edges/lanes.
OutputDevice & writeAttr(const SumoXMLAttr attr, const T &val)
writes a named attribute
virtual ~MSLaneMeanDataValues()
Destructor.
MSLaneMeanDataValues(MSLane *const lane, const SUMOReal length, const bool doAdd, const std::set< std::string > *const vTypes=0, const MSMeanData_Net *parent=0)
Constructor.
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.
unsigned 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].
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::set< std::string > vTypes)
Constructor.
The vehicle got vaporized.
The vehicle changes the segment (meso only)
unsigned nVehLaneChangeFrom
The number of vehicles that changed from this lane.
const std::set< std::string > myVehicleTypes
The vehicle types to look for (empty means all)
Data structure for mean (aggregated) edge/lane values.
SUMOReal waitSeconds
The number of vehicle probes with small speed.
The vehicle changes lanes (micro only)
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.
void notifyMoveInternal(SUMOVehicle &veh, SUMOReal timeOnLane, SUMOReal speed)
Internal notification about the vehicle moves.
unsigned nVehArrived
The number of vehicles that finished on the lane.
unsigned nVehLaneChangeTo
The number of vehicles that changed to this lane.
unsigned nVehEntered
The number of vehicles that entered this lane within the sample interval.
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.
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.
unsigned nVehLeft
The number of vehicles that left this lane within the sample interval.
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.
static const bool gUseMesoSim
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.