44std::vector<std::string>
45ChargingStation::getIDList() {
46 std::vector<std::string> ids;
48 ids.push_back(item.first);
50 std::sort(ids.begin(), ids.end());
56ChargingStation::getIDCount() {
57 return (
int)getIDList().size();
62ChargingStation::getLaneID(
const std::string& stopID) {
63 return getChargingStation(stopID)->getLane().getID();
67ChargingStation::getStartPos(
const std::string& stopID) {
68 return getChargingStation(stopID)->getBeginLanePosition();
73ChargingStation::getEndPos(
const std::string& stopID) {
74 return getChargingStation(stopID)->getEndLanePosition();
79ChargingStation::getName(
const std::string& stopID) {
80 return getChargingStation(stopID)->getMyName();
85ChargingStation::getVehicleCount(
const std::string& stopID) {
86 return (
int)getChargingStation(stopID)->getStoppedVehicles().size();
90std::vector<std::string>
91ChargingStation::getVehicleIDs(
const std::string& stopID) {
92 std::vector<std::string> result;
93 for (
const SUMOVehicle* veh : getChargingStation(stopID)->getStoppedVehicles()) {
94 result.push_back(veh->getID());
101ChargingStation::getChargingPower(
const std::string& stopID) {
102 return dynamic_cast<MSChargingStation*
>(getChargingStation(stopID))->getChargingPower(
true);
107ChargingStation::getEfficiency(
const std::string& stopID) {
108 return dynamic_cast<MSChargingStation*
>(getChargingStation(stopID))->getEfficency();
113ChargingStation::getChargeDelay(
const std::string& stopID) {
119ChargingStation::getChargeInTransit(
const std::string& stopID) {
120 return dynamic_cast<MSChargingStation*
>(getChargingStation(stopID))->getChargeInTransit();
125ChargingStation::setChargingPower(
const std::string& stopID,
double chargingpower) {
126 dynamic_cast<MSChargingStation*
>(getChargingStation(stopID))->setChargingPower(chargingpower);
131ChargingStation::setEfficiency(
const std::string& stopID,
double efficiency) {
132 dynamic_cast<MSChargingStation*
>(getChargingStation(stopID))->setEfficiency(efficiency);
137ChargingStation::setChargeDelay(
const std::string& stopID,
double delay) {
143ChargingStation::setChargeInTransit(
const std::string& stopID,
bool value) {
144 dynamic_cast<MSChargingStation*
>(getChargingStation(stopID))->setChargeInTransit(value);
149ChargingStation::getParameter(
const std::string& stopID,
const std::string& param) {
150 return getChargingStation(stopID)->
getParameter(param,
"");
157ChargingStation::setParameter(
const std::string& stopID,
const std::string& key,
const std::string& value) {
158 getChargingStation(stopID)->setParameter(key, value);
166ChargingStation::getChargingStation(
const std::string&
id) {
171std::shared_ptr<VariableWrapper>
172ChargingStation::makeWrapper() {
173 return std::make_shared<Helper::SubscriptionWrapper>(handleVariable, mySubscriptionResults, myContextSubscriptionResults);
178ChargingStation::handleVariable(
const std::string& objID,
const int variable, VariableWrapper* wrapper,
tcpip::Storage* paramData) {
181 return wrapper->wrapStringList(objID, variable, getIDList());
183 return wrapper->wrapInt(objID, variable, getIDCount());
185 return wrapper->wrapString(objID, variable, getLaneID(objID));
187 return wrapper->wrapDouble(objID, variable, getStartPos(objID));
189 return wrapper->wrapDouble(objID, variable, getEndPos(objID));
191 return wrapper->wrapString(objID, variable, getName(objID));
193 return wrapper->wrapInt(objID, variable, getVehicleCount(objID));
195 return wrapper->wrapStringList(objID, variable, getVehicleIDs(objID));
197 return wrapper->wrapDouble(objID, variable, getChargingPower(objID));
199 return wrapper->wrapDouble(objID, variable, getEfficiency(objID));
201 return wrapper->wrapDouble(objID, variable,
STEPS2TIME(getChargeDelay(objID)));
203 return wrapper->wrapInt(objID, variable, getChargeInTransit(objID));
206 return wrapper->wrapString(objID, variable, getParameter(objID, paramData->
readString()));
209 return wrapper->wrapStringPair(objID, variable, getParameterWithKey(objID, paramData->
readString()));
@ SUMO_TAG_CHARGING_STATION
A Charging Station.
#define LIBSUMO_SUBSCRIPTION_IMPLEMENTATION(CLASS, DOM)
#define LIBSUMO_GET_PARAMETER_WITH_KEY_IMPLEMENTATION(CLASS)
C++ TraCI client API implementation.
The simulated network and simulation perfomer.
A lane area vehicles can halt at.
virtual const std::string getParameter(const std::string &key, const std::string defaultValue="") const
Returns the value for a given key.
Representation of a vehicle.
static MSStoppingPlace * getStoppingPlace(const std::string &id, const SumoXMLTag type)
virtual std::string readString()
virtual int readUnsignedByte()
TRACI_CONST int VAR_STOP_STARTING_VEHICLES_NUMBER
TRACI_CONST int VAR_CS_POWER
TRACI_CONST int TRACI_ID_LIST
std::map< std::string, libsumo::SubscriptionResults > ContextSubscriptionResults
TRACI_CONST int VAR_CS_CHARGE_DELAY
TRACI_CONST int VAR_CS_EFFICIENCY
TRACI_CONST int VAR_CS_CHARGE_IN_TRANSIT
TRACI_CONST int VAR_POSITION
std::map< std::string, libsumo::TraCIResults > SubscriptionResults
{object->{variable->value}}
TRACI_CONST int VAR_PARAMETER
TRACI_CONST int VAR_LANEPOSITION
TRACI_CONST int VAR_LANE_ID
TRACI_CONST int VAR_PARAMETER_WITH_KEY
TRACI_CONST int VAR_STOP_STARTING_VEHICLES_IDS