44 #include <mesosim/MELoop.h>
45 #include <mesosim/MESegment.h>
48 #ifdef CHECK_MEMORY_LEAKS
50 #endif // CHECK_MEMORY_LEAKS
62 const std::set<std::string>*
const vTypes,
65 nVehDeparted(0), nVehArrived(0), nVehEntered(0), nVehLeft(0),
66 nVehVaporized(0), waitSeconds(0),
67 nVehLaneChangeFrom(0), nVehLaneChangeTo(0),
68 vehLengthSum(0), myParent(parent) {}
82 nVehLaneChangeFrom = 0;
85 travelledDistance = 0;
110 sampleSeconds += timeOnLane;
111 travelledDistance += speed * timeOnLane;
113 if (myParent != 0 && speed < myParent->
myHaltSpeed) {
114 waitSeconds += timeOnLane;
121 if (vehicleApplies(veh) && (getLane() == 0 || getLane() == static_cast<MSVehicle&>(veh).getLane())) {
124 myLastVehicleUpdateValues.erase(&veh);
130 ++nVehLaneChangeFrom;
149 if (vehicleApplies(veh)) {
150 if (getLane() == 0 || getLane() == static_cast<MSVehicle&>(veh).getLane()) {
167 return sampleSeconds == 0 && nVehDeparted == 0 && nVehArrived == 0 && nVehEntered == 0
168 && nVehLeft == 0 && nVehVaporized == 0 && nVehLaneChangeFrom == 0 && nVehLaneChangeTo == 0;
174 const SUMOReal numLanes,
const SUMOReal defaultTravelTime,
const int numVehicles)
const {
176 if (sampleSeconds > 0) {
177 dev <<
"\" density=\"" << sampleSeconds /
STEPS2TIME(period) *(
SUMOReal) 1000 / myLaneLength <<
178 "\" occupancy=\"" << vehLengthSum /
STEPS2TIME(period) / myLaneLength / numLanes *(
SUMOReal) 100 <<
179 "\" waitingTime=\"" << waitSeconds <<
180 "\" speed=\"" << travelledDistance / sampleSeconds;
182 dev <<
"\" departed=\"" << nVehDeparted <<
183 "\" arrived=\"" << nVehArrived <<
184 "\" entered=\"" << nVehEntered <<
185 "\" left=\"" << nVehLeft <<
"\"";
186 if (nVehVaporized > 0) {
187 dev <<
" vaporized=\"" << nVehVaporized <<
"\"";
192 if (sampleSeconds > myParent->myMinSamples) {
193 SUMOReal traveltime = myParent->myMaxTravelTime;
194 if (travelledDistance > 0.f) {
195 traveltime =
MIN2(traveltime, myLaneLength * sampleSeconds / travelledDistance);
197 if (numVehicles > 0) {
198 dev <<
"\" traveltime=\"" << sampleSeconds / numVehicles <<
199 "\" waitingTime=\"" << waitSeconds <<
200 "\" speed=\"" << travelledDistance / sampleSeconds;
202 dev <<
"\" traveltime=\"" << traveltime <<
203 "\" density=\"" << sampleSeconds /
STEPS2TIME(period) *(
SUMOReal) 1000 / myLaneLength <<
204 "\" occupancy=\"" << vehLengthSum /
STEPS2TIME(period) / myLaneLength / numLanes *(
SUMOReal) 100 <<
205 "\" waitingTime=\"" << waitSeconds <<
206 "\" speed=\"" << travelledDistance / sampleSeconds;
208 }
else if (defaultTravelTime >= 0.) {
209 dev <<
"\" traveltime=\"" << defaultTravelTime <<
210 "\" speed=\"" << myLaneLength / defaultTravelTime;
212 dev <<
"\" departed=\"" << nVehDeparted <<
213 "\" arrived=\"" << nVehArrived <<
214 "\" entered=\"" << nVehEntered <<
215 "\" left=\"" << nVehLeft <<
216 "\" laneChangedFrom=\"" << nVehLaneChangeFrom <<
217 "\" laneChangedTo=\"" << nVehLaneChangeTo <<
"\"";
218 if (nVehVaporized > 0) {
219 dev <<
" vaporized=\"" << nVehVaporized <<
"\"";
229 const SUMOTime dumpEnd,
const bool useLanes,
230 const bool withEmpty,
const bool printDefaults,
231 const bool withInternal,
232 const bool trackVehicles,
236 const std::set<std::string> vTypes)
237 :
MSMeanData(id, dumpBegin, dumpEnd, useLanes, withEmpty, printDefaults,
238 withInternal, trackVehicles, maxTravelTime, minSamples, vTypes),
Data collector for edges/lanes.
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.