Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
eclipse
GitHub Repository: eclipse/sumo
Path: blob/main/src/netedit/elements/additional/GNEChargingStation.h
169684 views
1
/****************************************************************************/
2
// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
3
// Copyright (C) 2001-2025 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 GNEChargingStation.h
15
/// @author Pablo Alvarez Lopez
16
/// @date Nov 2015
17
///
18
// A class for visualizing chargingStation geometry (adapted from GUILaneWrapper)
19
/****************************************************************************/
20
#pragma once
21
#include <config.h>
22
23
#include "GNEStoppingPlace.h"
24
25
// ===========================================================================
26
// class definitions
27
// ===========================================================================
28
29
class GNEChargingStation : public GNEStoppingPlace {
30
31
public:
32
/// @brief default Constructor of charging station
33
GNEChargingStation(GNENet* net);
34
35
/**@brief Constructor of charging station
36
* @param[in] id charging station ID
37
* @param[in] net pointer to GNENet of this additional element belongs
38
* @param[in] filename file in which this element is stored
39
* @param[in] lane Lane of this StoppingPlace belongs
40
* @param[in] startPos Start position of the StoppingPlace
41
* @param[in] endPos End position of the StoppingPlace
42
* @param[in] name Name of busStop
43
* @param[in] chargingPower charging power of the charging station
44
* @param[in] efficiency efficiency of the charge [0,1]
45
* @param[in] chargeInTransit enable or disable charge in transit
46
* @param[in] chargeDelay delay in timeSteps in the charge
47
* @param[in] chargeType charge type (fuel or electric)
48
* @param[in] waitingTime waiting time until start charging
49
* @param[in] parkingAreaID parking area the charging station is located at
50
* @param[in] friendlyPos enable or disable friendly position
51
* @param[in] parameters generic parameters
52
*/
53
GNEChargingStation(const std::string& id, GNENet* net, const std::string& filename, GNELane* lane,
54
const double startPos, const double endPos, const std::string& name, const double chargingPower,
55
const double efficiency, const bool chargeInTransit, const SUMOTime chargeDelay,
56
const std::string& chargeType, const SUMOTime waitingTime, const std::string& parkingAreaID,
57
const bool friendlyPosition, const Parameterised::Map& parameters);
58
59
/// @brief Destructor
60
~GNEChargingStation();
61
62
/**@brief write additional element into a xml file
63
* @param[in] device device in which write parameters of additional element
64
*/
65
void writeAdditional(OutputDevice& device) const;
66
67
/// @name Functions related with geometry of element
68
/// @{
69
70
/// @brief update pre-computed geometry information
71
void updateGeometry();
72
73
/// @}
74
75
/// @name inherited from GUIGlObject
76
/// @{
77
78
/**@brief Draws the object
79
* @param[in] s The settings for the current view (may influence drawing)
80
* @see GUIGlObject::drawGL
81
*/
82
void drawGL(const GUIVisualizationSettings& s) const;
83
84
/// @}
85
86
/// @name inherited from GNEAttributeCarrier
87
/// @{
88
89
/* @brief method for getting the Attribute of an XML key
90
* @param[in] key The attribute key
91
* @return string with the value associated to key
92
*/
93
std::string getAttribute(SumoXMLAttr key) const;
94
95
/* @brief method for getting the Attribute of an XML key in double format (to avoid unnecessary parse<double>(...) for certain attributes)
96
* @param[in] key The attribute key
97
* @return double with the value associated to key
98
*/
99
double getAttributeDouble(SumoXMLAttr key) const;
100
101
/* @brief method for setting the attribute and letting the object perform additional changes
102
* @param[in] key The attribute key
103
* @param[in] value The new value
104
* @param[in] undoList The undoList on which to register changes
105
*/
106
void setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList);
107
108
/* @brief method for checking if the key and their correspond attribute are valids
109
* @param[in] key The attribute key
110
* @param[in] value The value associated to key key
111
* @return true if the value is valid, false in other case
112
*/
113
bool isValid(SumoXMLAttr key, const std::string& value);
114
115
/// @}
116
117
protected:
118
/// @brief Charging power pro timestep
119
double myChargingPower = 0;
120
121
/// @brief efficiency of the charge
122
double myEfficiency = 0;
123
124
/// @brief enable or disable charge in transit
125
bool myChargeInTransit = false;
126
127
/// @brief delay in the starting of charge
128
SUMOTime myChargeDelay = 0;
129
130
/// @brief charging type
131
std::string myChargeType = "normal";
132
133
/// @brief waiting time before start charging
134
SUMOTime myWaitingTime = 0;
135
136
/// @brief parking area ID
137
std::string myParkingAreaID;
138
139
private:
140
/// @brief set attribute after validation
141
void setAttribute(SumoXMLAttr key, const std::string& value);
142
143
/// @brief Invalidated copy constructor.
144
GNEChargingStation(const GNEChargingStation&) = delete;
145
146
/// @brief Invalidated assignment operator.
147
GNEChargingStation& operator=(const GNEChargingStation&) = delete;
148
};
149
150