41 const std::string& name,
double chargingPower,
double efficency,
bool chargeInTransit,
44 myChargeInTransit(chargeInTransit), myChargeType(stringToChargeType(chargeType)) {
45 if (chargingPower < 0) {
50 if (efficency < 0 || efficency > 1) {
55 if (chargeDelay < 0) {
60 if (waitingTime < 0) {
72 double efficency,
bool chargeInTransit,
SUMOTime chargeDelay,
const std::string& chargeType,
SUMOTime waitingTime) :
73 MSChargingStation(chargingStationID, const_cast<
MSLane&>(parkingArea->getLane()), parkingArea->getBeginLanePosition(), parkingArea->getEndLanePosition(),
74 name, chargingPower, efficency, chargeInTransit, chargeDelay, chargeType, waitingTime) {
181 std::string status =
"";
184 status =
"chargingStopped";
186 status =
"chargingInTransit";
188 status =
"noCharging";
192 status =
"waitingChargeInTransit";
194 status =
"waitingChargeStopped";
196 status =
"noWaitingCharge";
215 int chargingSteps = 0;
217 chargingSteps += (int)item.second.size();
228 while (iStart < (
int)chargeSteps.size()) {
229 int iEnd = iStart + 1;
230 double charged = chargeSteps[iStart].WCharged;
231 while (iEnd < (
int)chargeSteps.size() && chargeSteps[iEnd].timeStep == chargeSteps[iEnd - 1].timeStep +
DELTA_T) {
232 charged += chargeSteps[iEnd].WCharged;
235 writeVehicle(output, chargeSteps, iStart, iEnd, charged);
247 std::vector<std::string> terminatedChargers;
249 const Charge& lastCharge = item.second.back();
252 if (finished || includeUnfinished) {
254 terminatedChargers.push_back(item.first);
260 double minCharge = lastCharge.
WCharged;
261 double maxCharge = lastCharge.
WCharged;
264 for (
const auto& charge : item.second) {
265 charged += charge.WCharged;
266 if (charge.chargingPower < minPower) {
267 minPower = charge.chargingPower;
269 if (charge.chargingPower > maxPower) {
270 maxPower = charge.chargingPower;
272 if (charge.WCharged < minCharge) {
273 minCharge = charge.WCharged;
275 if (charge.WCharged > maxCharge) {
276 maxCharge = charge.WCharged;
278 if (charge.chargingEfficiency < minEfficiency) {
279 minEfficiency = charge.chargingEfficiency;
281 if (charge.chargingEfficiency > maxEfficiency) {
282 maxEfficiency = charge.chargingEfficiency;
308 for (
auto vehID : terminatedChargers) {
316 const Charge& first = chargeSteps[iStart];
323 for (
int i = iStart; i < iEnd; i++) {
324 const Charge& c = chargeSteps[i];
#define WRITE_WARNING(msg)
std::string time2string(SUMOTime t, bool humanReadable)
convert SUMOTime to string (independently of global format setting)
@ SUMO_TAG_CHARGING_STATION
A Charging Station.
@ SUMO_TAG_CHARGING_EVENT
A charging event (charging a vehicle at a charging station)
@ SUMO_TAG_STEP
trigger: a step description
@ SUMO_TAG_VEHICLE
description of a vehicle
@ SUMO_ATTR_PARTIALCHARGE
energy provided by charging station at certain timestep
@ SUMO_ATTR_TOTALENERGYCHARGED
@ SUMO_ATTR_MINPOWER
minimum charging power encountered during the charging event
@ SUMO_ATTR_MAXIMUMBATTERYCAPACITY
Maxium battery capacity.
@ SUMO_ATTR_MINEFFICIENCY
minimum charging efficiency encountered during the charging event
@ SUMO_ATTR_MAXCHARGE
maximum energy charged during one time step of the charging event
@ SUMO_ATTR_TOTALENERGYCHARGED_VEHICLE
total energy charged into a single vehicle
@ SUMO_ATTR_CHARGINGSTATIONID
Charging Station ID.
@ SUMO_ATTR_ACTUALBATTERYCAPACITY
@ SUMO_ATTR_ENERGYCHARGED
tgotal of Energy charged
@ SUMO_ATTR_CHARGINGPOWER
@ SUMO_ATTR_MAXEFFICIENCY
maximum charging efficiency encountered during the charging event
@ SUMO_ATTR_CHARGINGSTEPS
number of steps that a vehicle is charging
@ SUMO_ATTR_CHARGINGEND
timesteps in which charging ends
@ SUMO_ATTR_EFFICIENCY
Eficiency of the charge in Charging Stations.
@ SUMO_ATTR_CHARGINGBEGIN
timestep in which charging begins
@ SUMO_ATTR_MINCHARGE
minimum energy charged during one time step of the charging event
@ SUMO_ATTR_CHARGEDELAY
Delay in the charge of charging stations (different of waiting time)
@ SUMO_ATTR_TIME
trigger: the time of the step
@ SUMO_ATTR_CHARGING_STATUS
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
double myChargingPower
Charging station's charging power.
void setChargeInTransit(bool value)
set charging in transit
void writeChargingStationOutput(OutputDevice &output)
write charging station values
double myTotalCharge
total energy charged by this charging station
static void writeVehicle(OutputDevice &out, const std::vector< Charge > &chargeSteps, int iStart, int iEnd, double charged)
double getChargingPower(bool usingFuel) const
Get charging station's charging power.
const ChargeType myChargeType
charge type
bool getChargeInTransit() const
Get chargeInTransit.
void setChargingVehicle(bool value)
enable or disable charging vehicle
std::vector< std::string > myChargedVehicles
order vehicles by time of first charge
double myEfficiency
Efficiency of the charging station.
void setEfficiency(double efficiency)
set efficiency of the charging station
void setChargingPower(double chargingPower)
set charging station's charging power
SUMOTime myWaitingTime
waiting time
bool myChargeInTransit
Allow charge in transit.
bool vehicleIsInside(const double position) const
Check if a vehicle is inside in the Charge Station.
const MSParkingArea * myParkingArea
parkingArea the charging station is placed on
std::map< std::string, std::vector< Charge > > myChargeValues
map with the charges of this charging station (key = vehicleID)
void addChargeValueForOutput(double WCharged, MSDevice_Battery *battery)
add charge value for output
MSChargingStation(const std::string &chargingStationID, MSLane &lane, double startPos, double endPos, const std::string &name, double chargingPower, double efficency, bool chargeInTransit, SUMOTime chargeDelay, const std::string &chargeType, SUMOTime waitingTime)
constructor
SUMOTime getChargeDelay() const
Get Charge Delay.
void writeAggregatedChargingStationOutput(OutputDevice &output, bool includeUnfinished=false)
write ungrouped output (flush data after writing)
void setChargeDelay(SUMOTime delay)
set charging delay of the charging station
double getEfficency() const
Get efficiency of the charging station.
ChargeType getChargeType() const
Get charge type.
SUMOTime myChargeDelay
Charge Delay.
~MSChargingStation()
destructor
bool myChargingVehicle
Check if in the current TimeStep chargingStation is charging a vehicle.
bool isCharging() const
Return true if in the current time step charging station is charging a vehicle.
SUMOTime getWaitingTime() const
Get waiting time.
const MSParkingArea * getParkingArea() const
Get the parking area the charging station is placed on.
Battery device for electric vehicles.
SUMOTime getChargingStartTime() const
Get charging start time.
double getActualBatteryCapacity() const
Get the actual vehicle's Battery Capacity in Wh.
double getMaximumBatteryCapacity() const
Get the total vehicle's Battery Capacity in Wh.
double getStoppingThreshold() const
Get stopping threshold.
Representation of a lane in the micro simulation.
static MSNet * getInstance()
Returns the pointer to the unique instance of MSNet (singleton).
A lane area vehicles can halt at.
A lane area vehicles can halt at.
double getBeginLanePosition() const
Returns the begin position of this stop.
double getEndLanePosition() const
Returns the end position of this stop.
SUMOVehicle & getHolder() const
Returns the vehicle that holds this device.
const std::string & getID() const
Returns the name of the vehicle type.
std::string myID
The name of the object.
const std::string & getID() const
Returns the id.
static OptionsCont & getOptions()
Retrieves the options.
Static storage of an output device and its base (abstract) implementation.
OutputDevice & writeAttr(const SumoXMLAttr attr, const T &val)
writes a named attribute
OutputDevice & openTag(const std::string &xmlElement)
Opens an XML tag.
bool closeTag(const std::string &comment="")
Closes the most recently opened tag and optionally adds a comment.
virtual const MSVehicleType & getVehicleType() const =0
Returns the object's "vehicle" type.
virtual double getSpeed() const =0
Returns the object's current speed.
struct to save information for the chargingStation output
double totalEnergyCharged
double maxBatteryCapacity
double actualBatteryCapacity
double chargingEfficiency