Eclipse SUMO - Simulation of Urban MObility
MSDevice_Emissions.h
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3 // Copyright (C) 2001-2022 German Aerospace Center (DLR) and others.
4 // This program and the accompanying materials are made available under the
5 // terms of the Eclipse Public License 2.0 which is available at
6 // https://www.eclipse.org/legal/epl-2.0/
7 // This Source Code may also be made available under the following Secondary
8 // Licenses when the conditions for such availability set forth in the Eclipse
9 // Public License 2.0 are satisfied: GNU General Public License, version 2
10 // or later which is available at
11 // https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
12 // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
13 /****************************************************************************/
19 // A device which collects vehicular emissions
20 /****************************************************************************/
21 #pragma once
22 #include <config.h>
23 
24 #include <set>
25 #include <vector>
26 #include <map>
27 #include <utils/common/SUMOTime.h>
30 #include <microsim/MSVehicle.h>
31 #include "MSVehicleDevice.h"
32 
33 
34 // ===========================================================================
35 // class declarations
36 // ===========================================================================
37 class MSLane;
38 
39 
40 // ===========================================================================
41 // class definitions
42 // ===========================================================================
56 public:
59  static void insertOptions(OptionsCont& oc);
60 
61 
74  static void buildVehicleDevices(SUMOVehicle& v, std::vector<MSVehicleDevice*>& into);
75 
76 
77 public:
80 
95  bool notifyMove(SUMOTrafficObject& veh, double oldPos, double newPos, double newSpeed);
96 
106  bool notifyIdle(SUMOTrafficObject& veh);
107 
109 
111  const std::string deviceName() const {
112  return "emissions";
113  }
114 
121  void generateOutput(OutputDevice* tripinfoOut) const;
122 
123 
126 
127 protected:
131  void notifyMoveInternal(const SUMOTrafficObject& veh,
132  const double frontOnLane,
133  const double timeOnLane,
134  const double meanSpeedFrontOnLane,
135  const double meanSpeedVehicleOnLane,
136  const double travelledDistanceFrontOnLane,
137  const double travelledDistanceVehicleOnLane,
138  const double meanLengthOnLane);
139 
140 private:
146  MSDevice_Emissions(SUMOVehicle& holder, const std::string& id);
147 
148 
149 private:
152 
153 
154 private:
157 
160 
161 
162 };
A device which collects vehicular emissions.
void generateOutput(OutputDevice *tripinfoOut) const
Called on writing tripinfo output.
bool notifyIdle(SUMOTrafficObject &veh)
Computes idling emission values and adds them to the emission sums.
MSDevice_Emissions & operator=(const MSDevice_Emissions &)
Invalidated assignment operator.
bool notifyMove(SUMOTrafficObject &veh, double oldPos, double newPos, double newSpeed)
Computes current emission values and adds them to their sums.
const std::string deviceName() const
return the name for this type of device
static void insertOptions(OptionsCont &oc)
Inserts MSDevice_Emissions-options.
static void buildVehicleDevices(SUMOVehicle &v, std::vector< MSVehicleDevice * > &into)
Build devices for the given vehicle, if needed.
MSDevice_Emissions(SUMOVehicle &holder, const std::string &id)
Constructor.
void notifyMoveInternal(const SUMOTrafficObject &veh, const double frontOnLane, const double timeOnLane, const double meanSpeedFrontOnLane, const double meanSpeedVehicleOnLane, const double travelledDistanceFrontOnLane, const double travelledDistanceVehicleOnLane, const double meanLengthOnLane)
Internal notification about the vehicle moves, see MSMoveReminder::notifyMoveInternal()
PollutantsInterface::Emissions myEmissions
Internal storages for pollutant/fuel sum in mg or ml.
~MSDevice_Emissions()
Destructor.
MSDevice_Emissions(const MSDevice_Emissions &)
Invalidated copy constructor.
Representation of a lane in the micro simulation.
Definition: MSLane.h:82
Abstract in-vehicle device.
A storage for options typed value containers)
Definition: OptionsCont.h:89
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:61
Representation of a vehicle, person, or container.
Representation of a vehicle.
Definition: SUMOVehicle.h:60
Storage for collected values of all emission types.