SUMO - Simulation of Urban MObility
MSChargingStation.cpp
Go to the documentation of this file.
1 /****************************************************************************/
9 // Chargin Station for Electric vehicles
10 /****************************************************************************/
11 // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/
12 // Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors
13 /****************************************************************************/
14 //
15 // This file is part of SUMO.
16 // SUMO is free software: you can redistribute it and/or modify
17 // it under the terms of the GNU General Public License as published by
18 // the Free Software Foundation, either version 3 of the License, or
19 // (at your option) any later version.
20 //
21 /****************************************************************************/
22 
23 // ===========================================================================
24 // included modules
25 // ===========================================================================
26 
27 #ifdef _MSC_VER
28 #include <windows_config.h>
29 #else
30 #include <config.h>
31 #endif
32 
33 #include <cassert>
35 #include <microsim/MSVehicleType.h>
37 #include "MSChargingStation.h"
38 #include "MSTrigger.h"
39 
40 
41 #ifdef CHECK_MEMORY_LEAKS
42 #include <foreign/nvwa/debug_new.h>
43 #endif // CHECK_MEMORY_LEAKS
44 
45 // ===========================================================================
46 // member method definitions
47 // ===========================================================================
48 
49 MSChargingStation::MSChargingStation(const std::string& new_ChargingStationID,
50  const std::vector<std::string>& new_lines,
51  MSLane& new_Lane, SUMOReal new_StartPos, SUMOReal new_EndPos, SUMOReal new_ChrgPower,
52  SUMOReal new_Efficency, SUMOReal new_ChargeInTransit, SUMOReal new_ChargeDelay) :
53  MSStoppingPlace(new_ChargingStationID, new_lines, new_Lane, new_StartPos, new_EndPos),
54  ChrgPower(new_ChrgPower),
55  Efficency(new_Efficency),
56  ChargeInTransit(new_ChargeInTransit),
57  ChargeDelay(new_ChargeDelay) {
58  if (getChrgPower() < 0) {
59  std::cout << std::string("Warning: Charging Station with ID = " + getID() + " doesn't have a valid charging power(" + SUMOReal_str(getChrgPower()) + ").");
60  }
61 
62  if (getEfficency() < 0 || getEfficency() > 1) {
63  std::cout << std::string("Warning: Charging Station with ID = " + getID() + " doesn't have a valid Efficency (" + SUMOReal_str(getEfficency()) + ").");
64  }
65 
67  std::cout << std::string("Warning: Charging Station with ID = " + getID() + " doesn't have a valid range (" + SUMOReal_str(getBeginLanePosition()) + " < " + SUMOReal_str(getEndLanePosition()) + ").");
68  }
69 }
70 
71 
73 }
74 
75 
76 // GET FUNCTIONS
77 
78 
81  return ChrgPower;
82 }
83 
86  return Efficency;
87 }
88 
91  return ChargeInTransit;
92 }
93 
96  return ChargeDelay;
97 }
98 
99 
100 // SET FUNCTIONS
101 
103  ChrgPower = new_ChrgPower;
104 
105  if (new_ChrgPower < 0) {
106  std::cout << std::string("Warning: Chargin Station with ID = " + getID() + " doesn't have a valid charging power(" + SUMOReal_str(getChrgPower()) + ").");
107  }
108 }
109 
110 
112  if (new_Efficency < 0 || new_Efficency > 1) {
113  std::cout << std::string("Warning: Chargin Station with ID = " + getID() + " doesn't have a valid Efficency (" + SUMOReal_str(getEfficency()) + ").");
114  }
115 
116  Efficency = new_Efficency;
117 }
118 
120  if ((position >= getBeginLanePosition()) && (position <= getEndLanePosition())) {
121  return true;
122  } else {
123  return false;
124  }
125 }
126 
127 // Private methods
128 
129 std::string MSChargingStation::SUMOReal_str(const SUMOReal& var) {
130  std::ostringstream convert;
131  convert << var;
132  return convert.str();
133 }
SUMOReal ChargeInTransit
Parameter 03, Allow charge in transit.
A lane area vehicles can halt at.
void setEfficency(SUMOReal new_Efficency)
Set parameter 06, efficiency of the charging station.
SUMOReal getEndLanePosition() const
Returns the end position of this stop.
std::string SUMOReal_str(const SUMOReal &var)
convert from SUMOReal to String
SUMOReal ChrgPower
Parameter 01, charging station&#39;s charging power.
SUMOReal ChargeDelay
Parameter 03, Charge Delay.
const std::string & getID() const
Returns the id.
Definition: Named.h:65
SUMOReal getChrgPower() const
Get parameter 01, charging station&#39;s charging power.
bool vehicleIsInside(const SUMOReal position)
Check if a vehicle is inside in the Charge Station.
SUMOReal getEfficency() const
Get parameter 02, efficiency of the charging station.
SUMOReal getChargeInTransit() const
Get parameter 03, get chargeInTransit.
SUMOReal getChargeDelay() const
Get parameter 03, get Charge Delay.
SUMOReal getBeginLanePosition() const
Returns the begin position of this stop.
#define SUMOReal
Definition: config.h:213
MSChargingStation(const std::string &new_ChargingStationID, const std::vector< std::string > &new_lines, MSLane &new_Lane, SUMOReal new_StartPos, SUMOReal new_EndPos, SUMOReal new_ChrgPower, SUMOReal new_Efficency, SUMOReal new_ChargeInTransit, SUMOReal new_ChargeDelay)
Representation of a lane in the micro simulation.
Definition: MSLane.h:77
SUMOReal Efficency
Parameter 02, efficiency of the charging station.
void setChrgPower(SUMOReal new_ChrgPower)
Set parameter 05, charging station&#39;s charging power.