/****************************************************************************/1// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo2// Copyright (C) 2001-2025 German Aerospace Center (DLR) and others.3// This program and the accompanying materials are made available under the4// terms of the Eclipse Public License 2.0 which is available at5// https://www.eclipse.org/legal/epl-2.0/6// This Source Code may also be made available under the following Secondary7// Licenses when the conditions for such availability set forth in the Eclipse8// Public License 2.0 are satisfied: GNU General Public License, version 29// or later which is available at10// https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html11// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later12/****************************************************************************/13/// @file HelpersEnergy.h14/// @author Daniel Krajzewicz15/// @author Michael Behrisch16/// @date Mon, 10.05.200417///18// Helper methods for HBEFA-based emission computation19/****************************************************************************/20#pragma once21#include <config.h>2223#include <vector>24#include <limits>25#include <cmath>26#include <utils/common/StdDefs.h>27#include <utils/geom/GeomHelper.h>28#include <utils/common/SUMOVehicleClass.h>29#include "PollutantsInterface.h"30#include "EnergyParams.h"313233// ===========================================================================34// class definitions35// ===========================================================================36/**37* @class HelpersEnergy38* @brief Helper methods for energy-based electricity consumption computation based on the battery device39*/40class HelpersEnergy : public PollutantsInterface::Helper {41private:42static const int ENERGY_BASE = 4 << 16;4344public:45/** @brief Constructor (initializes myEmissionClassStrings)46*/47HelpersEnergy();4849/** @brief Returns the fuel type described by this emission class as described in the Amitran interface (Gasoline, Diesel, ...)50* @param[in] c the emission class51* @return always "Electricity"52*/53std::string getFuel(const SUMOEmissionClass /* c */) const {54return "Electricity";55}5657/** @brief Returns a reference weight in kg described by this emission class58* This implementation returns the default mass for this model.59* @param[in] c the emission class60* @return a reference weight61*/62double getWeight(const SUMOEmissionClass /* c */) const {63return myDefaultMass;64}6566/** @brief Computes the emitted pollutant amount using the given speed and acceleration67*68* Returns only valid values for electricity all other types give 0.69*70* @param[in] c emission class for the function parameters to use71* @param[in] e the type of emission (CO, CO2, ...), only electricity gives valid results72* @param[in] v The vehicle's current velocity73* @param[in] a The vehicle's current acceleration74* @param[in] slope The road's slope at vehicle's position [deg]75* @return The amount emitted by the given emission class when moving with the given velocity and acceleration [mg/s or ml/s]76*/77double compute(const SUMOEmissionClass c, const PollutantsInterface::EmissionType e, const double v, const double a, const double slope, const EnergyParams* param) const;7879/** @brief Computes the achievable acceleration using the given speed and amount of consumed electric power80*81* @param[in] c emission class for the function parameters to use82* @param[in] e the type of emission (CO, CO2, ...), only electricity gives valid results83* @param[in] v The vehicle's current velocity84* @param[in] P The vehicle's current power consumption85* @param[in] slope The road's slope at vehicle's position [deg]86* @return The amount emitted by the given emission class when moving with the given velocity and acceleration [mg/s or ml/s]87*/88double acceleration(const SUMOEmissionClass c, const PollutantsInterface::EmissionType e, const double v, const double P, const double slope, const EnergyParams* param) const;8990private:91// default values from https://sumo.dlr.de/docs/Models/Electric.html#kia_soul_ev_202092static constexpr double myDefaultMass = 1830.;93static constexpr double myDefaultFrontSurfaceArea = 2.6;94static constexpr double myDefaultAirDragCoefficient = 0.35;95static constexpr double myDefaultRotatingMass = 40.;96static constexpr double myDefaultRadialDragCoefficient = 0.1;97static constexpr double myDefaultRollDragCoefficient = 0.01;98static constexpr double myDefaultConstantPowerIntake = 100.;99static constexpr double myDefaultPropulsionEfficiency = 0.98;100static constexpr double myDefaultRecuperationEfficiency = 0.96;101static constexpr double myDefaultRecuperationEfficiencyByDeceleration = 0.0;102103};104105106