42 #define PI 3.141592654
44 #ifdef CHECK_MEMORY_LEAKS
46 #endif // CHECK_MEMORY_LEAKS
73 SUMOReal new_AirDragCoefficient = 0.4;
74 SUMOReal new_InternalMomentOfInertia = 10;
75 SUMOReal new_RadialDragCoefficient = 1;
76 SUMOReal new_RollDragCoefficient = 0.5;
77 SUMOReal new_ConstantPowerIntake = 10;
78 SUMOReal new_PropulsionEfficiency = 0.5;
79 SUMOReal new_RecuperationEfficiency = 0;
88 new_ActBatKap = new_MaxBatKap / 2.0;
125 new_ActBatKap, new_MaxBatKap, new_PowerMax, new_Mass, new_FrontSurfaceArea, new_AirDragCoefficient,
126 new_InternalMomentOfInertia, new_RadialDragCoefficient, new_RollDragCoefficient,
127 new_ConstantPowerIntake, new_PropulsionEfficiency, new_RecuperationEfficiency,
128 new_LastAngle, new_LastEnergy);
130 into.push_back(device);
170 if (ChargingStationID !=
"") {
279 MSDevice_Battery::MSDevice_Battery(
SUMOVehicle& holder,
const std::string&
id,
const SUMOReal new_ActBatKap,
const SUMOReal new_MaxBatKap,
const SUMOReal new_PowerMax,
const SUMOReal new_Mass,
const SUMOReal new_FrontSurfaceArea,
const SUMOReal new_AirDragCoefficient,
const SUMOReal new_InternalMomentOfInertia,
const SUMOReal new_RadialDragCoefficient,
const SUMOReal new_RollDragCoefficient,
const SUMOReal new_ConstantPowerIntake,
const SUMOReal new_PropulsionEfficiency,
const SUMOReal new_RecuperationEfficiency,
const SUMOReal new_LastAngle,
const SUMOReal new_LastEnergy)
282 ActBatKap(new_ActBatKap),
283 MaxBatKap(new_MaxBatKap),
284 PowerMax(new_PowerMax),
286 FrontSurfaceArea(new_FrontSurfaceArea),
287 AirDragCoefficient(new_AirDragCoefficient),
288 InternalMomentOfInertia(new_InternalMomentOfInertia),
289 RadialDragCoefficient(new_RadialDragCoefficient),
290 RollDragCoefficient(new_RollDragCoefficient),
291 ConstantPowerIntake(new_ConstantPowerIntake),
292 PropulsionEfficiency(new_PropulsionEfficiency),
293 RecuperationEfficiency(new_RecuperationEfficiency),
294 LastAngle(new_LastAngle),
295 LastEnergy(new_LastEnergy) {
352 if (PropulsionEfficiency < 0 || PropulsionEfficiency > 1) {
356 if (RecuperationEfficiency < 0 || RecuperationEfficiency > 1) {
460 if (PropulsionEfficiency < 0 || PropulsionEfficiency > 1) {
469 if (RecuperationEfficiency < 0 || RecuperationEfficiency > 1) {
596 currentEnergy +=
getMass() * 9.81 * height_cur;
641 if (EnergyLoss > 0) {
650 EnergyLoss = EnergyLoss / 3600 ;
664 std::ostringstream convert;
666 return convert.str();
bool isChargingStopped() const
Get parameter 15, true if Vehicle it's charging, false if not.
SUMOReal getPropEnergy(SUMOVehicle &veh)
get propulsion energy
void setFrontSurfaceArea(const SUMOReal new_FrontSurfaceArea)
Set parameter 05, vehicle's front surface Area.
SUMOReal getFrontSurfaceArea() const
Get parameter 05, vehicle's front surface Area.
SUMOReal getConsum() const
Get parameter 18, consum (Strange error with linker)
void setPowerMax(const SUMOReal new_Pmax)
Set parameter 03, The maximum power when accelerating.
SUMOReal ActBatKap
Parameter 01, The actual vehicles' Battery Capacity in kWh [ActBatKap <= MaxBatKap].
SUMOReal getEfficency() const
Get parameter 02, efficiency of the charging station.
SUMOReal getChargeDelay() const
Get parameter 03, get Charge Delay.
void increaseVehicleStoppedTimer()
Set parameter 21a, increase vehicleStopped.
static SUMOReal _2SUMOReal(const E *const data)
SUMOReal ChargingStartTime
Parameter 17, Moment, wich the vehicle has beging to charging none.
SUMOReal getLength() const
Returns the lane's length.
virtual SUMOReal getPositionOnLane() const =0
Get the vehicle's position along the lane.
virtual SUMOReal getAngle() const =0
Get the vehicle's angle.
Notification
Definition of a vehicle state.
SUMOReal getActBatKap() const
Get parameter 01, the actual vehicles' Battery Capacity in kWh.
SUMOReal energyCharged
Parameter 20, Energy charged in each timestep.
std::string getChrgStnID(const MSLane *lane, const SUMOReal pos) const
Returns the charging station close to the given position.
virtual MSLane * getLane() const =0
Returns the lane the vehicle is on.
static MSNet * getInstance()
Returns the pointer to the unique instance of MSNet (singleton).
SUMOReal getChrgPower() const
Get parameter 01, charging station's charging power.
void setConstantPowerIntake(const SUMOReal new_ConstantPowerIntake)
Set parameter 10, vehicles' constant power intake.
SUMOReal getRadialDragCoefficient() const
Get parameter 08, vehicles' radial friction coefficient.
int getVehicleStopped() const
Get parameter 20, charging energy.
SUMOReal getMaxBatKap() const
Get parameter 02, the total vehicles' Battery Capacity in kWh.
MSChrgStn * getChrgStn(const std::string &id) const
Returns the named charging station.
bool notifyMove(SUMOVehicle &veh, SUMOReal oldPos, SUMOReal newPos, SUMOReal newSpeed)
Checks for waiting steps when the vehicle moves // IMPLEMENTADA!!
SUMOReal getRollDragCoefficient() const
Get parameter 09, vehicles' roll friction coefficient.
SUMOReal MaxBatKap
Parameter 02, The total vehicles' Battery Capacity in kWh [MaxBatKap >= 0].
SUMOReal getAirDragCoefficient() const
Get parameter 06, vehicle's drag coefficient.
SUMOReal beginEndAngle() const
const std::string & getParameter(const std::string &key, const std::string &defaultValue) const
Returns the value for a given key.
#define WRITE_WARNING(msg)
static OptionsCont & getOptions()
Retrieves the options.
const std::string & getID() const
Returns the id.
SUMOReal getConstantPowerIntake() const
Get parameter 10, vehicles' constant power intake.
void resetVehicleStoppedTimer()
Set parameter 21a, reset vehicleStopped.
int vehicleStopped
Parameter 21, How many timestep the vehicle is stopped.
std::string SUMOReal_str(const SUMOReal &var)
convert from SUMOReal to String
const SUMOVTypeParameter & getParameter() const
Representation of a vehicle.
SUMOReal getChargeInTransit() const
Get parameter 03, get chargeInTransit.
SUMOReal PowerMax
Parameter 03, The Maximum Power when accelerating [PowerMax >= 0].
SUMOReal getLastAngle() const
Get parameter 13, vehicles' last angle.
SUMOReal RollDragCoefficient
Parameter 09, Vehicles' roll friction coefficient [RollDragCoefficient >= 0].
bool ItsChargingStopped
Parameter 15, Flag: Vehicles it's charging stopped by default is false.
void resetChargingStartTime()
Set parameter 17a, reset charging start time.
void setMass(const SUMOReal new_Mass)
Set parameter 04, vehicle's Mass.
static void insertDefaultAssignmentOptions(const std::string &deviceName, const std::string &optionsTopic, OptionsCont &oc)
Adds common command options that allow to assign devices to vehicles.
SUMOReal LastEnergy
Parameter 14, Vehicles' last energy none.
SUMOReal getPropulsionEfficiency() const
Get parameter 11, vehicles' Propulsion efficiency.
bool isChargingInTransit() const
Get parameter 16, true if Vehicle it's charging, false if not.
SUMOReal LastAngle
Parameter 13, Vehicles' last angle none.
SUMOReal getChrgEnergy() const
Get parameter 20, charging energy.
SUMOReal getChargingStartTime() const
Get parameter 17, charging start time.
SUMOReal PropulsionEfficiency
Parameter 11, Vehicles' propulsion efficiency [1 >= PropulsionEfficiency >= 0].
bool ItsChargingInTransit
Parameter 16, Flag: Vehicles it's charging in transit by default is false.
MSDevice_Battery(SUMOVehicle &holder, const std::string &id, const SUMOReal new_ActBatKap, const SUMOReal new_MaxBatKap, const SUMOReal new_PowerMax, const SUMOReal new_Mass, const SUMOReal new_FrontSurfaceArea, const SUMOReal new_AirDragCoefficient, const SUMOReal new_InternalMomentOfInertia, const SUMOReal new_RadialDragCoefficient, const SUMOReal new_RollDragCoefficient, const SUMOReal new_ConstantPowerIntake, const SUMOReal new_PropulsionEfficiency, const SUMOReal new_RecuperationEfficiency, const SUMOReal new_LastAngle, const SUMOReal new_LastEnergy)
Constructor.
SUMOReal getRecuperationEfficiency() const
Get parameter 12, vehicles' Recuparation efficiency.
void setRadialDragCoefficient(const SUMOReal new_RadialDragCoefficient)
Set parameter 08, Vehicles' radial friction coefficient.
SUMOReal Consum
Parameter 18, Vehicle consum during a time step by default is 0.
std::string actChrgStn
Parameter 19, Vehicle consum during a time step by default is "".
Abstract in-vehicle device.
void setRollDragCoefficient(const SUMOReal new_RollDragCoefficient)
Set parameter 09, vehicles' roll friction coefficient.
static bool equippedByDefaultAssignmentOptions(const OptionsCont &oc, const std::string &deviceName, SUMOVehicle &v)
Determines whether a vehicle should get a certain device.
void setRecuperationEfficiency(const SUMOReal new_RecuperationEfficiency)
Set parameter 12, vehicles' Recuparation efficiency.
SUMOReal getPowerMax() const
Get parameter 03, the maximum power when accelerating.
virtual SUMOReal getSpeed() const =0
Returns the vehicle's current speed.
The battery parametereter.
SUMOReal getLastEnergy() const
Get parameter 14, vehicles' last Energy.
SUMOReal InternalMomentOfInertia
Parameter 07, Vehicles' internal moment of inertia [InternalMomentOfInertia >= 0].
SUMOReal RadialDragCoefficient
Parameter 08, Vehicles' radial friction coefficient [RadialDragCoefficient >=0]. ...
SUMOReal Mass
Parameter 04, Vehicle's Mass [Mass >= 0].
static void buildVehicleDevices(SUMOVehicle &v, std::vector< MSDevice * > &into)
Build devices for the given vehicle, if needed.
void increaseChargingStartTime()
Set parameter 17b, increase Charging Start time.
virtual const SUMOVehicleParameter & getParameter() const =0
Returns the vehicle's parameter (including departure definition)
static void insertOptions(OptionsCont &oc)
Inserts MSDevice_Example-options.
void setPropulsionEfficiency(const SUMOReal new_PropulsionEfficiency)
Set parameter 11, vehicles' Propulsion efficiency.
void setInternalMomentOfInertia(const SUMOReal new_InternalMomentOfInertia)
Set parameter 07, vehicles' internal moment of inertia.
A storage for options typed value containers)
void setMaxBatKap(const SUMOReal new_MaxBatKap)
Set parameter 02, The total vehicles' Battery Capacity in kWh.
bool notifyEnter(SUMOVehicle &veh, MSMoveReminder::Notification reason)
Saves departure info on insertion.
const std::string & getChrgStnID() const
Get parameter 19, Charging Station I.
SUMOReal AirDragCoefficient
Parameter 06, Vehicle's drag coefficient [AirDragCoefficient >=0].
const PositionVector & getShape() const
Returns this lane's shape.
void setLastEnergy(const SUMOReal new_LastEnergy)
Set parameter 14, vehicles' last Energy.
SUMOReal FrontSurfaceArea
Parameter 05, Vehicle's front surface Area [FrontSurfaceArea >= 0].
SUMOReal ConstantPowerIntake
Parameter 10, Vehicles' constant power intake [ConstantPowerIntake >= 0].
SUMOReal RecuperationEfficiency
Parameter 12, Vehicles' recuparation efficiency [1 >= RecuperationEfficiency >= 0].
void setAirDragCoefficient(const SUMOReal new_C_Veh)
Set parameter 06, vehicle's drag coefficient.
void generateOutput() const
Called on writing tripinfo output.
SUMOReal getInternalMomentOfInertia() const
Get parameter 07, vehicles' internal moment of inertia.
void setActBatKap(const SUMOReal new_ActBatKap)
Set parameter 01, The actual vehicles' Battery Capacity in kWh.
virtual const std::string & getID() const =0
Get the vehicle's ID.
void setLastAngle(const SUMOReal new_LastAngle)
Set parameter 13, vehicles' last Angle.
SUMOReal getMass() const
Get parameter 04, vehicle's Mass.
~MSDevice_Battery()
Destructor.
virtual const MSVehicleType & getVehicleType() const =0
Returns the vehicle's type.