Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
EnergyParams.h
Go to the documentation of this file.
1/****************************************************************************/
2// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
3// Copyright (C) 2002-2023 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/****************************************************************************/
18// A class for parameters used by the emission models
19/****************************************************************************/
20#pragma once
21#include <config.h>
22#include <map>
23#include <string>
24#include <vector>
27
28
29// ===========================================================================
30// class declarations
31// ===========================================================================
33
34// ===========================================================================
35// class definitions
36// ===========================================================================
42public:
44 EnergyParams(const SUMOVTypeParameter* typeParams = nullptr);
45
47 EnergyParams(const EnergyParams* secondaryParams) : mySecondaryParams(secondaryParams) {}
48
51
55 void setSecondary(const EnergyParams* secondaryParams) {
56 mySecondaryParams = secondaryParams;
57 }
58
63 void setDouble(SumoXMLAttr attr, double value);
64
65 double getDouble(SumoXMLAttr attr) const;
66
71 const std::vector<double>& getDoubles(SumoXMLAttr attr) const;
72
80
81 void checkParam(const SumoXMLAttr paramKey, const std::string& id, const double lower = 0., const double upper = std::numeric_limits<double>::infinity());
82
86 bool isEngineOff() const;
87
91 bool isOff() const;
92
93 static const EnergyParams* getDefault() {
94 if (myDefault == nullptr) {
95 myDefault = new EnergyParams();
96 }
97 return myDefault;
98 }
99
100private:
102 std::map<SumoXMLAttr, double> myMap;
103 std::map<SumoXMLAttr, std::vector<double> > myVecMap;
104 std::map<SumoXMLAttr, CharacteristicMap> myCharacteristicMapMap;
106
107 static const EnergyParams* myDefault;
108};
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
The purpose of this class is to store a characteristic map (German: Kennfeld) of arbitrary dimensions...
An upper class for objects with additional parameters.
double getDouble(SumoXMLAttr attr) const
bool isOff() const
Returns whether the vehicle is currently consuming any energy derived from the parking state.
static const EnergyParams * myDefault
void setDouble(SumoXMLAttr attr, double value)
Sets a parameter.
std::map< SumoXMLAttr, double > myMap
The key->value maps.
std::map< SumoXMLAttr, std::vector< double > > myVecMap
std::map< SumoXMLAttr, CharacteristicMap > myCharacteristicMapMap
bool isEngineOff() const
Returns the state of the engine when the vehicle is not moving.
EnergyParams(const EnergyParams *secondaryParams)
Constructor.
const EnergyParams * mySecondaryParams
const CharacteristicMap & getCharacteristicMap(SumoXMLAttr attr) const
Return the CharacteristicMap that belongs to a given attribute.
void setSecondary(const EnergyParams *secondaryParams)
Set secondary params.
~EnergyParams()
Destructor.
static const EnergyParams * getDefault()
const std::vector< double > & getDoubles(SumoXMLAttr attr) const
Returns the value for a given key.
void checkParam(const SumoXMLAttr paramKey, const std::string &id, const double lower=0., const double upper=std::numeric_limits< double >::infinity())
Structure representing possible vehicle parameter.