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