43 #ifdef CHECK_MEMORY_LEAKS 45 #endif // CHECK_MEMORY_LEAKS 72 actualBatteryCapacity = maximumBatteryCapacity / 2.0;
109 actualBatteryCapacity, maximumBatteryCapacity, powerMax, mass, frontSurfaceArea, airDragCoefficient,
110 internalMomentOfInertia, radialDragCoefficient, rollDragCoefficient,
111 constantPowerIntake, propulsionEfficiency, recuperationEfficiency, 0, 0);
114 into.push_back(device);
156 if (ChargingStationID !=
"") {
251 MSDevice_Battery::MSDevice_Battery(
SUMOVehicle& holder,
const std::string&
id,
const SUMOReal actualBatteryCapacity,
const SUMOReal maximumBatteryCapacity,
const SUMOReal powerMax,
const SUMOReal mass,
const SUMOReal frontSurfaceArea,
const SUMOReal airDragCoefficient,
const SUMOReal internalMomentOfInertia,
const SUMOReal radialDragCoefficient,
const SUMOReal rollDragCoefficient,
const SUMOReal constantPowerIntake,
const SUMOReal propulsionEfficiency,
const SUMOReal recuperationEfficiency,
const SUMOReal lastAngle,
const SUMOReal lastEnergy) :
274 if (maximumBatteryCapacity < 0)
275 WRITE_WARNING(
"Battery builder: Vehicle '" +
getID() +
"' doesn't have a valid value for parameter maximum battery capacity (" +
TplConvert::_2str(maximumBatteryCapacity) +
").")
280 if (actualBatteryCapacity > maximumBatteryCapacity) {
281 WRITE_WARNING(
"Battery builder: Vehicle '" +
getID() +
"' has a actual battery capacity (" +
TplConvert::_2str(actualBatteryCapacity) +
") greater than it's max battery capacity(" +
TplConvert::_2str(maximumBatteryCapacity) +
"). A max battery capacity value will be asigned");
299 if (frontSurfaceArea < 0)
305 if (airDragCoefficient < 0)
311 if (internalMomentOfInertia < 0)
312 WRITE_WARNING(
"Battery builder: Vehicle '" +
getID() +
"' doesn't have a valid value for parameter internal moment of insertia (" +
TplConvert::_2str(internalMomentOfInertia) +
").")
317 if (radialDragCoefficient < 0)
318 WRITE_WARNING(
"Battery builder: Vehicle '" +
getID() +
"' doesn't have a valid value for parameter radial friction coefficient (" +
TplConvert::_2str(radialDragCoefficient) +
").")
323 if (rollDragCoefficient < 0)
324 WRITE_WARNING(
"Battery builder: Vehicle '" +
getID() +
"' doesn't have a valid value for parameter roll friction coefficient (" +
TplConvert::_2str(rollDragCoefficient) +
").")
329 if (constantPowerIntake < 0)
330 WRITE_WARNING(
"Battery builder: Vehicle '" +
getID() +
"' doesn't have a valid value for parameter constant power intake (" +
TplConvert::_2str(constantPowerIntake) +
").")
335 if (propulsionEfficiency < 0 || propulsionEfficiency > 1)
336 WRITE_WARNING(
"Battery builder: Vehicle '" +
getID() +
"' doesn't have a valid value for parameter propulsion efficiency (" +
TplConvert::_2str(propulsionEfficiency) +
").")
341 if (recuperationEfficiency < 0 || recuperationEfficiency > 1)
342 WRITE_WARNING(
"Battery builder: Vehicle '" +
getID() +
"' doesn't have a valid value for parameter Recuparation efficiency (" +
TplConvert::_2str(recuperationEfficiency) +
").")
355 if (actualBatteryCapacity < 0) {
368 WRITE_WARNING(
"Function setMaximumBatteryCapacity: Trying to insert into a battery device of vehicle '" +
getID() +
"' a invalid maximum battery capacity (" +
TplConvert::_2str(maximumBatteryCapacity) +
").")
388 WRITE_WARNING(
"Function setPowerMax: Trying to insert into a battery device of vehicle '" +
getID() +
"' a invalid power max value (" +
TplConvert::_2str(powerMax) +
").")
398 WRITE_WARNING(
"Function setFrontSurfaceArea: Trying to insert into a battery device of vehicle '" +
getID() +
"' a invalid front surface Area value (" +
TplConvert::_2str(frontSurfaceArea) +
").")
408 WRITE_WARNING(
"Function setAirDragCoefficient: Trying to insert into a battery device of vehicle '" +
getID() +
"' a invalid drag coefficient value (" +
TplConvert::_2str(airDragCoefficient) +
").")
418 WRITE_WARNING(
"Function setInternalMomentOfInertia: Trying to insert into a battery device of vehicle '" +
getID() +
"' a invalid internal moment of insertia value (" +
TplConvert::_2str(internalMomentOfInertia) +
").")
428 WRITE_WARNING(
"Function setRadialDragCoefficient: Trying to insert into a battery device of vehicle '" +
getID() +
"' a invalid radial friction coefficient value (" +
TplConvert::_2str(radialDragCoefficient) +
").")
438 WRITE_WARNING(
"Function setRollDragCoefficient: Trying to insert into a battery device of vehicle '" +
getID() +
"' a invalid roll friction coefficient value (" +
TplConvert::_2str(rollDragCoefficient) +
").")
448 WRITE_WARNING(
"Function setConstantPowerIntake: Trying to insert into a battery device of vehicle '" +
getID() +
"' a invalid constant power intake value (" +
TplConvert::_2str(constantPowerIntake) +
").")
457 if (myPropulsionEfficiency < 0 || myPropulsionEfficiency > 1)
458 WRITE_WARNING(
"Function setPropulsionEfficiency: Trying to insert into a battery device of vehicle '" +
getID() +
"' a invalid propulsion efficiency value (" +
TplConvert::_2str(propulsionEfficiency) +
").")
467 if (myRecuperationEfficiency < 0 || myRecuperationEfficiency > 1)
468 WRITE_WARNING(
"Function setRecuperationEfficiency: Trying to insert into a battery device of vehicle '" +
getID() +
"' a invalid recuparation efficiency value (" +
TplConvert::_2str(recuperationEfficiency) +
").")
653 currentEnergy +=
getMass() * 9.81 * height_cur;
691 if (radius < 0.0001) {
693 }
else if (radius > 10000) {
708 if (EnergyLoss > 0) {
717 EnergyLoss = EnergyLoss / 3600 ;
SUMOReal getPropEnergy(SUMOVehicle &veh)
get propulsion energy
void setFrontSurfaceArea(const SUMOReal frontSurfaceArea)
Set vehicle's front surface Area.
SUMOReal myActualBatteryCapacity
Parameter, The actual vehicles's Battery Capacity in kWh [myActualBatteryCapacity <= myMaximumBatter...
SUMOReal getLastEnergy() const
Get vehicles's last Energy.
SUMOReal getLength() const
Returns the lane's length.
MSChargingStation * myActChargingStation
Parameter, Pointer to current charging station in which vehicle is placed by default is NULL...
void setLastEnergy(const SUMOReal lastEnergy)
Set vehicle's last Energy.
void setPowerMax(const SUMOReal new_Pmax)
Set maximum power when accelerating.
SUMOReal myFrontSurfaceArea
Parameter, Vehicle's front surface Area [myFrontSurfaceArea >= 0].
void setRollDragCoefficient(const SUMOReal rollDragCoefficient)
Set vehicle's roll friction coefficient.
SUMOReal getMaximumBatteryCapacity() const
Get the total vehicle's Battery Capacity in kWh.
SUMOReal getEfficency() const
Get efficiency of the charging station.
void increaseVehicleStoppedTimer()
Increase myVehicleStopped.
static SUMOReal _2SUMOReal(const E *const data)
converts a char-type array into the SUMOReal value described by it
SUMOReal getEnergyCharged() const
Get charged energy.
static void buildVehicleDevices(SUMOVehicle &v, std::vector< MSDevice *> &into)
Build devices for the given vehicle, if needed.
SUMOReal myChargingStartTime
Parameter, Moment, wich the vehicle has beging to charging none.
virtual SUMOReal getPositionOnLane() const =0
Get the vehicle's position along the lane.
void setActualBatteryCapacity(const SUMOReal actualBatteryCapacity)
Set actual vehicle's Battery Capacity in kWh.
int myVehicleStopped
Parameter, How many timestep the vehicle is stopped.
SUMOReal myLastAngle
Parameter, Vehicle's last angle none.
virtual SUMOReal getAngle() const =0
Get the vehicle's angle.
SUMOReal getFrontSurfaceArea() const
Get vehicle's front surface Area.
Notification
Definition of a vehicle state.
virtual MSLane * getLane() const =0
Returns the lane the vehicle is on.
SUMOReal getLastAngle() const
Get vehicles's last angle.
SUMOReal getActualBatteryCapacity() const
Get the actual vehicle's Battery Capacity in kWh.
static MSNet * getInstance()
Returns the pointer to the unique instance of MSNet (singleton).
std::string getChargingStationID() const
Get current Charging Station ID.
SUMOReal getRecuperationEfficiency() const
Get vehicles's Recuparation efficiency.
const PositionVector & getShape() const
Returns this lane's shape.
SUMOReal getPropulsionEfficiency() const
Get vehicles's Propulsion efficiency.
const std::string & getID() const
Returns the id.
bool notifyMove(SUMOVehicle &veh, SUMOReal oldPos, SUMOReal newPos, SUMOReal newSpeed)
Checks for waiting steps when the vehicle moves.
int getVehicleStopped() const
Get number of timestep that vehicle is stopped.
static SUMOReal angleDiff(const SUMOReal angle1, const SUMOReal angle2)
Returns the difference of the second angle to the first angle in radiants.
MSChargingStation * getChargingStation(const std::string &id) const
Returns the named charging station.
SUMOReal myAirDragCoefficient
Parameter, Vehicle's drag coefficient [myAirDragCoefficient >=0].
bool myChargingStopped
Parameter, Flag: Vehicles it's charging stopped by default is false.
#define WRITE_WARNING(msg)
SUMOReal getAirDragCoefficient() const
Get vehicle's drag coefficient.
SUMOReal myPropulsionEfficiency
Parameter, Vehicle's propulsion efficiency [1 >= myPropulsionEfficiency >= 0].
static OptionsCont & getOptions()
Retrieves the options.
bool isChargingStopped() const
Get true if Vehicle is charging, false if not.
SUMOReal myPowerMax
Parameter, The Maximum Power when accelerating [myPowerMax >= 0].
SUMOReal getRollDragCoefficient() const
Get vehicles's roll friction coefficient.
SUMOReal getChargeDelay() const
Get Charge Delay.
SUMOReal beginEndAngle() const
returns the angle in radians of the line connecting the first and the last position ...
SUMOReal myConsum
Parameter, Vehicle consum during a time step by default is 0.
bool getChargeInTransit() const
Get chargeInTransit.
void setRadialDragCoefficient(const SUMOReal radialDragCoefficient)
Set vehicle's radial friction coefficient.
void resetVehicleStoppedTimer()
Reset myVehicleStopped.
SUMOReal myLastEnergy
Parameter, Vehicle's last energy none.
void setPropulsionEfficiency(const SUMOReal propulsionEfficiency)
Set vehicle's Propulsion efficiency.
Representation of a vehicle.
void setMass(const SUMOReal mass)
Set vehicle's myMass.
SUMOReal getConstantPowerIntake() const
Get vehicles's constant power intake.
SUMOReal myMaximumBatteryCapacity
Parameter, The total vehicles's Battery Capacity in kWh [myMaximumBatteryCapacity >= 0]...
void setLastAngle(const SUMOReal lastAngle)
Set vehicle's last Angle.
void resetChargingStartTime()
Reset charging start time.
SUMOReal getInternalMomentOfInertia() const
Get vehicles's internal moment of inertia.
void setChargingVehicle(bool value)
enable or disable charging vehicle
static void insertDefaultAssignmentOptions(const std::string &deviceName, const std::string &optionsTopic, OptionsCont &oc)
Adds common command options that allow to assign devices to vehicles.
void setRecuperationEfficiency(const SUMOReal recuperationEfficiency)
Set vehicle's Recuparation efficiency.
bool myChargingInTransit
Parameter, Flag: Vehicles it's charging in transit by default is false.
const SUMOVTypeParameter & getParameter() const
SUMOReal myRecuperationEfficiency
Parameter, Vehicle's recuparation efficiency [1 >= myRecuperationEfficiency >= 0].
SUMOReal getChargingPower() const
Get charging station's charging power.
void setInternalMomentOfInertia(const SUMOReal internalMomentOfInertia)
Set vehicle's internal moment of inertia.
SUMOReal myInternalMomentOfInertia
Parameter, Vehicle's internal moment of inertia [myInternalMomentOfInertia >= 0].
Abstract in-vehicle device.
const std::string & getParameter(const std::string &key, const std::string &defaultValue) const
Returns the value for a given key.
static bool equippedByDefaultAssignmentOptions(const OptionsCont &oc, const std::string &deviceName, SUMOVehicle &v)
Determines whether a vehicle should get a certain device.
The vehicle has departed (was inserted into the network)
virtual SUMOReal getSpeed() const =0
Returns the vehicle's current speed.
Battery device for electric vehicles.
void increaseChargingStartTime()
Increase Charging Start time.
virtual const SUMOVehicleParameter & getParameter() const =0
Returns the vehicle's parameter (including departure definition)
SUMOReal myConstantPowerIntake
Parameter, Vehicle's constant power intake [myConstantPowerIntake >= 0].
static void insertOptions(OptionsCont &oc)
Inserts MSDevice_Example-options.
A storage for options typed value containers)
SUMOReal getConsum() const
Get consum.
void setMaximumBatteryCapacity(const SUMOReal maximumBatteryCapacity)
Set total vehicle's Battery Capacity in kWh.
bool notifyEnter(SUMOVehicle &veh, MSMoveReminder::Notification reason)
Saves departure info on insertion.
SUMOReal myRollDragCoefficient
Parameter, Vehicle's roll friction coefficient [myRollDragCoefficient >= 0].
const SUMOReal SUMO_const_haltingSpeed
the speed threshold at which vehicles are considered as halting
SUMOReal myRadialDragCoefficient
Parameter, Vehicle's radial friction coefficient [myRadialDragCoefficient >=0].
SUMOReal getChargingStartTime() const
Get charging start time.
void generateOutput() const
Called on writing tripinfo output.
bool isChargingInTransit() const
Get true if Vehicle it's charging, false if not.
SUMOReal myMass
Parameter, Vehicle's myMass [myMass >= 0].
MSDevice_Battery(SUMOVehicle &holder, const std::string &id, const SUMOReal actualBatteryCapacity, const SUMOReal maximumBatteryCapacity, const SUMOReal powerMax, const SUMOReal mass, const SUMOReal frontSurfaceArea, const SUMOReal airDragCoefficient, const SUMOReal internalMomentOfInertia, const SUMOReal radialDragCoefficient, const SUMOReal rollDragCoefficient, const SUMOReal constantPowerIntake, const SUMOReal propulsionEfficiency, const SUMOReal recuperationEfficiency, const SUMOReal lastAngle, const SUMOReal lastEnergy)
Constructor.
SUMOReal getMaximumPower() const
Get the maximum power when accelerating.
void setConstantPowerIntake(const SUMOReal constantPowerIntake)
Set vehicle's constant power intake.
void setAirDragCoefficient(const SUMOReal new_C_Veh)
Set vehicle's drag coefficient.
static std::string _2str(const int var)
convert int to string
SUMOReal getRadialDragCoefficient() const
Get vehicles's radial friction coefficient.
SUMOReal getMass() const
Get vehicle's mass.
virtual const std::string & getID() const =0
Get the vehicle's ID.
std::string getChargingStationID(const MSLane *lane, const SUMOReal pos) const
Returns the charging station close to the given position.
SUMOReal myEnergyCharged
Parameter, Energy charged in each timestep.
~MSDevice_Battery()
Destructor.
virtual const MSVehicleType & getVehicleType() const =0
Returns the vehicle's type.