/****************************************************************************/1// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo2// Copyright (C) 2013-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 PHEMCEPHandler.h14/// @author Nikolaus Furian15/// @author Daniel Krajzewicz16/// @author Michael Behrisch17/// @author Marek Heinrich18/// @date Thu, 13.06.201319///20// Helper singleton class for PHEM Light, holds CEP data for emission computation21/****************************************************************************/22#pragma once23#include <config.h>2425#include <vector>26#include <utils/common/StringBijection.h>27#include "PHEMCEP.h"282930// ===========================================================================31// class definitions32// ===========================================================================33/**34* @class PHEMCEPHandler35* @brief Data Handler for all CEP emission and vehicle Data36*/37class PHEMCEPHandler {38public:39/// @brief Destructor40~PHEMCEPHandler();414243/** @brief Implementatio of Singelton pattern44* @return reference on the actual instance45*/46static PHEMCEPHandler& getHandlerInstance();474849/** @brief Returns the CEP data for a PHEM emission class50* @param[in] emissionClass desired PHEM emission class51* @return CEP Data52*/53PHEMCEP* GetCep(SUMOEmissionClass emissionClass);545556/** @brief Helper method to load CEP and vehicle files from file system57* @param[in] emissionClass desired PHEM emission class58* @return Indicator if loading was successul59*/60bool Load(SUMOEmissionClass emissionClass, const std::string& emissionClassIdentifier);616263private:64/** @brief Helper method to read a vehicle file from file system65* @param[in] path The possible paths to PHEMlight data files66* @param[in] emissionClass desired PHEM emission class67* @param[in] vehicleMass out variable for vehicle mass68* @param[in] vehivleLoading out variable for vehicle loading69* @param[in] crossArea out variable for crosssectional area of vehicle70* @param[in] cwValue dout variable for cd value of vehivle71* @param[in] f0 out variable for rolling resistance coefficient f072* @param[in] f1 out variable for rolling resistance coefficient f173* @param[in] f2 out variable for rolling resistance coefficient f274* @param[in] f3 out variable for rolling resistance coefficient f375* @param[in] f4 out variable for rolling resistance coefficient f476* @param[in] ratedPower out variable for rated power of vehicle77* @param[in] vehicleMassType out variable for mass tyepe of vehicle, light (LV) or heavy (HV)78* @param[in] vehicleFuelType out variable for fuel type (D, G) of vehicle, needed for density of fuel79* @param[in] pNormV0 out variable for step function to get maximum normalized rated power over speed80* @param[in] pNormP0 out variable for step function to get maximum normalized rated power over speed81* @param[in] pNormV1 out variable for step function to get maximum normalized rated power over speed82* @param[in] pNormP1 out variable for step function to get maximum normalized rated power over speed83* @param[in] matrixRotFactor out variable for rotational factors over speed for more accurate power calculation84* @return Indicator if reading was successul85*/86bool ReadVehicleFile(const std::vector<std::string>& path, const std::string& emissionClass,87double& vehicleMass,88double& vehicleLoading,89double& vehicleMassRot,90double& crossArea,91double& cWValue,92double& f0,93double& f1,94double& f2,95double& f3,96double& f4,97double& axleRatio,98double& ratedPower,99double& engineIdlingSpeed,100double& engineRatedSpeed,101double& effectiveWheelDiameter,102std::string& vehicleMassType,103std::string& vehicleFuelType,104double& pNormV0,105double& pNormP0,106double& pNormV1,107double& pNormP1,108std::vector< std::vector<double> >& matrixSpeedInertiaTable,109std::vector< std::vector<double> >& normedDragTable);110111112113/** @brief Helper method to read a CEP file from file system114* @param[in] path The possible paths to PHEMlight data files115* @param[in] emissionClass desired PHEM emission class116* @param[in] header vector of pollutant identifiers117* @param[in] matrix matrix holding power pattern and CEP curves118* @return Indicator if reading was successul119*/120bool ReadEmissionData(bool readFC, const std::vector<std::string>& path, const std::string& emissionClass,121std::vector<std::string>& header, std::vector<std::vector<double> >& matrix, std::vector<double>& idlingValues);122123124private:125/// @brief bijection between PHEMEmissionClass and CEPs126std::map<SUMOEmissionClass, PHEMCEP*> _ceps;127// StringBijection<PHEMEmissionClass> _stringRepsPhemEmissionClass;128129130private:131/** @brief Implementation of Singelton pattern132* private (copy) constructor and =operator to avoid more than one instances133*/134PHEMCEPHandler();135PHEMCEPHandler(PHEMCEPHandler const&);136void operator=(PHEMCEPHandler const&);137138};139140141