nrel.hive.model.vehicle.mechatronics

Subpackages

Submodules

Package Contents

Classes

BEV

Interface for creating energy sources

ICE

Mechatronics for an internal combustion engine (ICE)

MechatronicsInterface

Interface for creating energy sources

Powercurve

a powertrain has a behavior where it calculates energy consumption in KwH

Powertrain

a powertrain has the behavior where it calculate energy consumption in KwH

Functions

build_mechatronics_table(...)

constructs a dictionary containing all of the provided vehicle configurations where the key is the mechatronics ID

Attributes

MechatronicsId

class nrel.hive.model.vehicle.mechatronics.BEV[source]

Bases: nrel.hive.model.vehicle.mechatronics.mechatronics_interface.MechatronicsInterface

Interface for creating energy sources

mechatronics_id: nrel.hive.util.typealiases.MechatronicsId
battery_capacity_kwh: nrel.hive.util.units.KwH
idle_kwh_per_hour: nrel.hive.util.units.KwH_per_H
powertrain: nrel.hive.model.vehicle.mechatronics.powertrain.powertrain.Powertrain
powercurve: nrel.hive.model.vehicle.mechatronics.powercurve.powercurve.Powercurve
nominal_watt_hour_per_mile: nrel.hive.util.units.WattHourPerMile
charge_taper_cutoff_kw: nrel.hive.util.units.Kw
battery_full_threshold_kwh: nrel.hive.util.units.KwH = 0.1
classmethod from_dict(d: nrel.hive.util.units.Dict[str, str], custom_powertrain_constructor: Callable[[nrel.hive.util.units.Dict[str, Any]], nrel.hive.model.vehicle.mechatronics.powertrain.powertrain.Powertrain] | None = None, custom_powercurve_constructor: Callable[[nrel.hive.util.units.Dict[str, Any]], nrel.hive.model.vehicle.mechatronics.powercurve.powercurve.Powercurve] | None = None) BEV[source]

build from a dictionary

Parameters:
  • d – the dictionary to build from

  • custom_powertrain_constructor – An optional custom constuctor to build the Powertrain

  • custom_powercurve_constructor – An optional custom constuctor to build the Powercurve

Returns:

the built Mechatronics object

valid_charger(charger: nrel.hive.model.energy.charger.Charger) bool[source]

checks to make sure charger is electric energy type

Parameters:

charger – the charger to check

Returns:

true/false

initial_energy(percent_full: nrel.hive.util.units.Ratio) immutables.Map[nrel.hive.model.energy.energytype.EnergyType, float][source]

return an energy dictionary from an initial soc

Parameters:

percent_full

Returns:

range_remaining_km(vehicle: nrel.hive.model.vehicle.vehicle.Vehicle) nrel.hive.util.units.Kilometers[source]

how much range remains, in kilometers :return:

calc_required_soc(required_range: nrel.hive.util.units.Kilometers) nrel.hive.util.units.Ratio[source]

what is the required soc to travel a given distance :param required_range: the distance the vehicle needs to travel :return:

fuel_source_soc(vehicle: nrel.hive.model.vehicle.vehicle.Vehicle) nrel.hive.util.units.Ratio[source]

what is the state of charge of the battery :return:

is_empty(vehicle: nrel.hive.model.vehicle.vehicle.Vehicle) bool[source]

is the vehicle empty

Parameters:

vehicle

Returns:

is_full(vehicle: nrel.hive.model.vehicle.vehicle.Vehicle) bool[source]

is the vehicle full

Parameters:

vehicle

Returns:

consume_energy(vehicle: nrel.hive.model.vehicle.vehicle.Vehicle, route: nrel.hive.model.roadnetwork.route.Route) nrel.hive.model.vehicle.vehicle.Vehicle[source]

consume_energy over a route

Parameters:
  • vehicle

  • route

Returns:

idle(vehicle: nrel.hive.model.vehicle.vehicle.Vehicle, time_seconds: nrel.hive.util.units.Seconds) nrel.hive.model.vehicle.vehicle.Vehicle[source]

idle for a set amount of time

Parameters:
  • vehicle

  • time_seconds

Returns:

add_energy(vehicle: nrel.hive.model.vehicle.vehicle.Vehicle, charger: nrel.hive.model.energy.charger.Charger, time_seconds: nrel.hive.util.units.Seconds) Tuple[nrel.hive.model.vehicle.vehicle.Vehicle, nrel.hive.util.units.Seconds][source]

add energy into the system

Parameters:
  • vehicle

  • charger

  • time_seconds

Returns:

the updated vehicle, along with the time spent charging

class nrel.hive.model.vehicle.mechatronics.ICE[source]

Bases: nrel.hive.model.vehicle.mechatronics.mechatronics_interface.MechatronicsInterface

Mechatronics for an internal combustion engine (ICE)

mechatronics_id: nrel.hive.util.typealiases.MechatronicsId
tank_capacity_gallons: nrel.hive.util.units.GallonGasoline
idle_gallons_per_hour: nrel.hive.util.units.GallonPerHour
powertrain: nrel.hive.model.vehicle.mechatronics.powertrain.powertrain.Powertrain
nominal_miles_per_gallon: nrel.hive.util.units.MilesPerGallon
classmethod from_dict(d: nrel.hive.util.units.Dict, custom_powertrain_constructor: Callable[[nrel.hive.util.units.Dict[str, Any]], nrel.hive.model.vehicle.mechatronics.powertrain.powertrain.Powertrain] | None = None) ICE[source]

build from a dictionary

Parameters:

d – the dictionary to build from

Returns:

the built Mechatronics object

valid_charger(charger: nrel.hive.model.energy.charger.charger.Charger) bool[source]

checks to make sure charger is gasoline energy type

Parameters:

charger – the charger to check

Returns:

true/false

initial_energy(percent_full: nrel.hive.util.units.Ratio) immutables.Map[nrel.hive.model.energy.energytype.EnergyType, float][source]

return an energy dictionary from an initial soc

Parameters:

percent_full

Returns:

range_remaining_km(vehicle: nrel.hive.model.vehicle.vehicle.Vehicle) nrel.hive.util.units.Kilometers[source]

how much range remains, in kilometers :return:

calc_required_soc(required_range: nrel.hive.util.units.Kilometers) nrel.hive.util.units.Ratio[source]

what is the required tank capacity to travel a given distance :param required_range: the distance the vehicle needs to travel :return:

fuel_source_soc(vehicle: nrel.hive.model.vehicle.vehicle.Vehicle) nrel.hive.util.units.Ratio[source]

what is the level of the fuel tank :return:

is_empty(vehicle: nrel.hive.model.vehicle.vehicle.Vehicle) bool[source]

is the vehicle empty

Parameters:

vehicle

Returns:

is_full(vehicle: nrel.hive.model.vehicle.vehicle.Vehicle) bool[source]

is the vehicle full

Parameters:

vehicle

Returns:

consume_energy(vehicle: nrel.hive.model.vehicle.vehicle.Vehicle, route: nrel.hive.model.roadnetwork.route.Route) nrel.hive.model.vehicle.vehicle.Vehicle[source]

consume energy over a route

Parameters:
  • vehicle

  • route

Returns:

idle(vehicle: nrel.hive.model.vehicle.vehicle.Vehicle, time_seconds: nrel.hive.util.units.Seconds) nrel.hive.model.vehicle.vehicle.Vehicle[source]

idle for a set amount of time

Parameters:
  • vehicle

  • time_seconds

Returns:

add_energy(vehicle: nrel.hive.model.vehicle.vehicle.Vehicle, charger: nrel.hive.model.energy.charger.charger.Charger, time_seconds: nrel.hive.util.units.Seconds) Tuple[nrel.hive.model.vehicle.vehicle.Vehicle, nrel.hive.util.units.Seconds][source]

add energy into the system. units for the charger are gallons per second

Parameters:
  • vehicle

  • charger

  • time_seconds

Returns:

the updated vehicle, along with the time spent charging

class nrel.hive.model.vehicle.mechatronics.MechatronicsInterface[source]

Bases: MechatronicsMixin, MechatronicsInterfaceABC

Interface for creating energy sources

class nrel.hive.model.vehicle.mechatronics.Powercurve[source]

Bases: abc.ABC

a powertrain has a behavior where it calculates energy consumption in KwH

abstract charge(start_soc: nrel.hive.util.units.Ratio, full_soc: nrel.hive.util.units.Ratio, power_kw: nrel.hive.util.units.Kw, duration_seconds: nrel.hive.util.units.Seconds = 1) Tuple[nrel.hive.util.units.KwH, nrel.hive.util.units.Seconds][source]
Parameters:
  • start_soc

  • full_soc

  • power_kw

  • duration_seconds

Returns:

the charge amount along with the time spent charging

class nrel.hive.model.vehicle.mechatronics.Powertrain[source]

Bases: PowertrainMixin, PowertrainABC

a powertrain has the behavior where it calculate energy consumption in KwH

nrel.hive.model.vehicle.mechatronics.MechatronicsId
nrel.hive.model.vehicle.mechatronics.build_mechatronics_table(mechatronics_file: str, scenario_directory: str, custom_powertrain_constructor: Callable[[Dict[str, Any]], powertrain.powertrain.Powertrain] | None = None, custom_powercurve_constructor: Callable[[Dict[str, Any]], powercurve.powercurve.Powercurve] | None = None) immutables.Map[nrel.hive.util.typealiases.MechatronicsId, mechatronics_interface.MechatronicsInterface][source]

constructs a dictionary containing all of the provided vehicle configurations where the key is the mechatronics ID and the contents are the appropriate mechatronics models with the desired attributes

Parameters:
  • mechatronics_file – the mechatronics configuration yaml file

  • scenario_directory – the directory with the required scenario files

Returns:

a dictionary of the different vehicle configurations where the keys are the mechatronics IDs

:raises Exception due to IOErrors, missing required parameters in the mechatronics yaml :raises Exception due to FileNotFoundErrors, missing the mechatronics, powertrain, or powercurve file(s)