Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
MSDevice_Battery.h
Go to the documentation of this file.
1/****************************************************************************/
2// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
3// Copyright (C) 2013-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/****************************************************************************/
19// The Battery parameters for the vehicle
20/****************************************************************************/
21#pragma once
22#include <config.h>
23
25#include <microsim/MSVehicle.h>
28
29
30// ===========================================================================
31// class declarations
32// ===========================================================================
33class SUMOVehicle;
36
37
38// ===========================================================================
39// class definitions
40// ===========================================================================
46public:
50 static void insertOptions(OptionsCont& oc);
51
62 static void buildVehicleDevices(SUMOVehicle& v, std::vector<MSVehicleDevice*>& into, MSDevice_StationFinder* sf);
63
64public:
67
70
79 bool notifyMove(SUMOTrafficObject& veh, double oldPos, double newPos, double newSpeed);
81
83 const std::string deviceName() const {
84 return "battery";
85 }
86
88 std::string getParameter(const std::string& key) const;
89
91 void setParameter(const std::string& key, const std::string& value);
92
94 void notifyParking();
95
96private:
104 MSDevice_Battery(SUMOVehicle& holder, const std::string& id, const double actualBatteryCapacity, const double maximumBatteryCapacity,
105 const double powerMax, const double stoppingThreshold);
106
107public:
109 double getActualBatteryCapacity() const;
110
112 double getMaximumBatteryCapacity() const;
113
115 double getMaximumPower() const;
116
118 bool isChargingStopped() const;
119
121 bool isChargingInTransit() const;
122
125
127 double getConsum() const;
128
130 double getTotalConsumption() const;
131
133 double getTotalRegenerated() const;
134
136 std::string getChargingStationID() const;
137
139 double getEnergyCharged() const;
140
142 int getVehicleStopped() const;
143
145 double getStoppingThreshold() const;
146
148 void setActualBatteryCapacity(const double actualBatteryCapacity);
149
151 void setMaximumBatteryCapacity(const double maximumBatteryCapacity);
152
154 void setPowerMax(const double new_Pmax);
155
157 void setStoppingThreshold(const double stoppingThreshold);
158
161
164
167
170
171protected:
174
177
180
183
186
189
192
195
197 double myConsum;
198
201
204
207
210
213
216
219
220private:
223
226};
227
228
long long int SUMOTime
Definition GUI.h:36
Battery device for electric vehicles.
SUMOTime getChargingStartTime() const
Get charging start time.
static void insertOptions(OptionsCont &oc)
Inserts MSDevice_Example-options.
void notifyParking()
called to update state for parking vehicles
int myVehicleStopped
Parameter, How many timestep the vehicle is stopped.
bool myChargingInTransit
Parameter, Flag: Vehicles it's charging in transit (by default is false)
double getActualBatteryCapacity() const
Get the actual vehicle's Battery Capacity in Wh.
int getVehicleStopped() const
Get number of timestep that vehicle is stopped.
double myMaximumBatteryCapacity
Parameter, The total vehicles's Battery Capacity in Wh, [myMaximumBatteryCapacity >= 0].
void increaseVehicleStoppedTimer()
Increase myVehicleStopped.
double myActualBatteryCapacity
Parameter, The actual vehicles's Battery Capacity in Wh, [myActualBatteryCapacity <= myMaximumBattery...
double myPowerMax
Parameter, The Maximum Power when accelerating, [myPowerMax >= 0].
bool notifyMove(SUMOTrafficObject &veh, double oldPos, double newPos, double newSpeed)
Checks for waiting steps when the vehicle moves.
void increaseChargingStartTime()
Increase Charging Start time.
MSChargingStation * myPreviousNeighbouringChargingStation
Parameter, Pointer to charging station neighbouring with myActChargingStation in which vehicle was pl...
void setStoppingThreshold(const double stoppingThreshold)
Set vehicle's stopping threshold.
double getMaximumBatteryCapacity() const
Get the total vehicle's Battery Capacity in Wh.
bool myChargingStopped
Parameter, Flag: Vehicles it's charging stopped (by default is false)
double getConsum() const
Get consum.
void setActualBatteryCapacity(const double actualBatteryCapacity)
Set actual vehicle's Battery Capacity in kWh.
bool myTrackFuel
whether to track fuel consumption instead of electricity
void setPowerMax(const double new_Pmax)
Set maximum power when accelerating.
double getMaximumPower() const
Get the maximum power when accelerating.
double myEnergyCharged
Parameter, Energy charged in each timestep.
double myLastAngle
Parameter, Vehicle's last angle.
double getStoppingThreshold() const
Get stopping threshold.
double myTotalRegenerated
Parameter, total vehicle energy regeneration.
SUMOTime myChargingStartTime
Parameter, Moment, wich the vehicle has beging to charging.
bool isChargingInTransit() const
Get true if Vehicle it's charging, false if not.
std::string getParameter(const std::string &key) const
try to retrieve the given parameter from this device. Throw exception for unsupported key
void resetChargingStartTime()
Reset charging start time.
double myTotalConsumption
Parameter, total vehicle energy consumption.
MSDevice_Battery & operator=(const MSDevice_Battery &)
Invalidated assignment operator.
const std::string deviceName() const
return the name for this type of device
void resetVehicleStoppedTimer()
Reset myVehicleStopped.
void setParameter(const std::string &key, const std::string &value)
try to set the given parameter for this device. Throw exception for unsupported key
double getTotalRegenerated() const
Get total regenerated.
double getTotalConsumption() const
Get total consumption.
MSChargingStation * myActChargingStation
Parameter, Pointer to current charging station in which vehicle is placed (by default is NULL)
~MSDevice_Battery()
Destructor.
double myConsum
Parameter, Vehicle consum during a time step (by default is 0.)
double getEnergyCharged() const
Get charged energy.
std::string getChargingStationID() const
Get current Charging Station ID.
void setMaximumBatteryCapacity(const double maximumBatteryCapacity)
Set total vehicle's Battery Capacity in kWh.
static void buildVehicleDevices(SUMOVehicle &v, std::vector< MSVehicleDevice * > &into, MSDevice_StationFinder *sf)
Build devices for the given vehicle, if needed.
double myStoppingThreshold
Parameter, stopping vehicle threshold [myStoppingThreshold >= 0].
bool isChargingStopped() const
Get true if Vehicle is charging, false if not.
MSDevice_Battery(const MSDevice_Battery &)
Invalidated copy constructor.
A device which collects vehicular emissions.
A device which triggers rerouting to nearby charging stations.
Abstract in-vehicle device.
A storage for options typed value containers)
Definition OptionsCont.h:89
Representation of a vehicle, person, or container.
Representation of a vehicle.
Definition SUMOVehicle.h:62