Skip to content

Commit

Permalink
fixing uninitialized variable #13596
Browse files Browse the repository at this point in the history
  • Loading branch information
behrisch committed Jan 30, 2024
1 parent 1763996 commit 4ff165f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
11 changes: 5 additions & 6 deletions src/microsim/trigger/MSChargingStation.cpp
Expand Up @@ -40,13 +40,12 @@ MSChargingStation::MSChargingStation(const std::string& chargingStationID, MSLan
const std::string& name, double chargingPower, double efficency, bool chargeInTransit,
SUMOTime chargeDelay, const std::string& chargeType, SUMOTime waitingTime) :
MSStoppingPlace(chargingStationID, SUMO_TAG_CHARGING_STATION, std::vector<std::string>(), lane, startPos, endPos, name),
myChargeInTransit(chargeInTransit),
myChargingVehicle(false) {
if (chargingPower < 0)
myChargeInTransit(chargeInTransit) {
if (chargingPower < 0) {
WRITE_WARNING(TLF("Attribute % for chargingStation with ID='%' is invalid (%).", toString(SUMO_ATTR_CHARGINGPOWER), getID(), toString(chargingPower)))
else {
myChargingPower = chargingPower;
}
} else {
myChargingPower = chargingPower;
}
if (efficency < 0 || efficency > 1) {
WRITE_WARNING(TLF("Attribute % for chargingStation with ID='%' is invalid (%).", toString(SUMO_ATTR_EFFICIENCY), getID(), toString(efficency)))
} else {
Expand Down
4 changes: 2 additions & 2 deletions src/microsim/trigger/MSChargingStation.h
Expand Up @@ -168,13 +168,13 @@ class MSChargingStation : public MSStoppingPlace {
SUMOTime myWaitingTime = 0;

/// @brief Check if in the current TimeStep chargingStation is charging a vehicle
bool myChargingVehicle;
bool myChargingVehicle = false;

/// @brief total energy charged by this charging station
double myTotalCharge = 0;

/// @brief parkingArea the charging station is placed on
const MSParkingArea* myParkingArea;
const MSParkingArea* myParkingArea = nullptr;

/// @brief map with the charges of this charging station (key = vehicleID)
std::map<std::string, std::vector<Charge> > myChargeValues;
Expand Down

0 comments on commit 4ff165f

Please sign in to comment.