LCOV - code coverage report
Current view: top level - src/utils/emissions - HelpersEnergy.h (source / functions) Coverage Total Hit
Test: lcov.info Lines: 100.0 % 4 4
Test Date: 2024-12-21 15:45:41 Functions: 100.0 % 2 2

            Line data    Source code
       1              : /****************************************************************************/
       2              : // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
       3              : // Copyright (C) 2001-2024 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              : /****************************************************************************/
      14              : /// @file    HelpersEnergy.h
      15              : /// @author  Daniel Krajzewicz
      16              : /// @author  Michael Behrisch
      17              : /// @date    Mon, 10.05.2004
      18              : ///
      19              : // Helper methods for HBEFA-based emission computation
      20              : /****************************************************************************/
      21              : #pragma once
      22              : #include <config.h>
      23              : 
      24              : #include <vector>
      25              : #include <limits>
      26              : #include <cmath>
      27              : #include <utils/common/StdDefs.h>
      28              : #include <utils/geom/GeomHelper.h>
      29              : #include <utils/common/SUMOVehicleClass.h>
      30              : #include "PollutantsInterface.h"
      31              : #include "EnergyParams.h"
      32              : 
      33              : 
      34              : // ===========================================================================
      35              : // class definitions
      36              : // ===========================================================================
      37              : /**
      38              :  * @class HelpersEnergy
      39              :  * @brief Helper methods for energy-based electricity consumption computation based on the battery device
      40              :  */
      41              : class HelpersEnergy : public PollutantsInterface::Helper {
      42              : private:
      43              :     static const int ENERGY_BASE = 4 << 16;
      44              : 
      45              : public:
      46              :     /** @brief Constructor (initializes myEmissionClassStrings)
      47              :      */
      48              :     HelpersEnergy();
      49              : 
      50              :     /** @brief Returns the fuel type described by this emission class as described in the Amitran interface (Gasoline, Diesel, ...)
      51              :      * @param[in] c the emission class
      52              :      * @return always "Electricity"
      53              :      */
      54         1593 :     std::string getFuel(const SUMOEmissionClass /* c */) const {
      55         1593 :         return "Electricity";
      56              :     }
      57              : 
      58              :     /** @brief Returns a reference weight in kg described by this emission class
      59              :      * This implementation returns the default mass for this model.
      60              :      * @param[in] c the emission class
      61              :      * @return a reference weight
      62              :      */
      63           73 :     double getWeight(const SUMOEmissionClass /* c */) const {
      64           73 :         return myDefaultMass;
      65              :     }
      66              : 
      67              :     /** @brief Computes the emitted pollutant amount using the given speed and acceleration
      68              :      *
      69              :      * Returns only valid values for electricity all other types give 0.
      70              :      *
      71              :      * @param[in] c emission class for the function parameters to use
      72              :      * @param[in] e the type of emission (CO, CO2, ...), only electricity gives valid results
      73              :      * @param[in] v The vehicle's current velocity
      74              :      * @param[in] a The vehicle's current acceleration
      75              :      * @param[in] slope The road's slope at vehicle's position [deg]
      76              :      * @return The amount emitted by the given emission class when moving with the given velocity and acceleration [mg/s or ml/s]
      77              :      */
      78              :     double compute(const SUMOEmissionClass c, const PollutantsInterface::EmissionType e, const double v, const double a, const double slope, const EnergyParams* param) const;
      79              : 
      80              :     /** @brief Computes the achievable acceleration using the given speed and amount of consumed electric power
      81              :      *
      82              :      * @param[in] c emission class for the function parameters to use
      83              :      * @param[in] e the type of emission (CO, CO2, ...), only electricity gives valid results
      84              :      * @param[in] v The vehicle's current velocity
      85              :      * @param[in] P The vehicle's current power consumption
      86              :      * @param[in] slope The road's slope at vehicle's position [deg]
      87              :      * @return The amount emitted by the given emission class when moving with the given velocity and acceleration [mg/s or ml/s]
      88              :      */
      89              :     double acceleration(const SUMOEmissionClass c, const PollutantsInterface::EmissionType e, const double v, const double P, const double slope, const EnergyParams* param) const;
      90              : 
      91              : private:
      92              :     // default values from https://sumo.dlr.de/docs/Models/Electric.html#kia_soul_ev_2020
      93              :     static constexpr double myDefaultMass = 1830.;
      94              :     static constexpr double myDefaultFrontSurfaceArea = 2.6;
      95              :     static constexpr double myDefaultAirDragCoefficient = 0.35;
      96              :     static constexpr double myDefaultRotatingMass = 40.;
      97              :     static constexpr double myDefaultRadialDragCoefficient = 0.1;
      98              :     static constexpr double myDefaultRollDragCoefficient = 0.01;
      99              :     static constexpr double myDefaultConstantPowerIntake = 100.;
     100              :     static constexpr double myDefaultPropulsionEfficiency = 0.98;
     101              :     static constexpr double myDefaultRecuperationEfficiency = 0.96;
     102              :     static constexpr double myDefaultRecuperationEfficiencyByDeceleration = 0.0;
     103              : 
     104              : };
        

Generated by: LCOV version 2.0-1