champpy.ChargingModel

The ChargingModel class is used to generate charging profiles based on driving profiles and user parameters.

Before using the charging model, synthetic mobility profiles must be generated using the MobModel class.

Basic workflow:

  1. Initialize the model ChargingModel with synthetic mobility profiles MobProfiles

  2. Configure charging parameters using UserParamsChargingModel

  3. Call generate_charging_profiles() to generate synthetic charging profiles

  4. Access the generated ChargingProfiles instance

class champpy.ChargingModel(mob_profiles)[source]

Model for generating charging profiles from mobility data and user parameters.

The model uses an algorithm that iterates over each time step and each vehicle to determine the charging status, energy consumption, energy stored, and missing energy based on the mobility data and user parameters. The resulting charging profiles are stored in a ChargingProfiles object.

Parameters:

mob_profiles (MobProfiles) – Mobility profiles containing vehicle movement data and temporal information.

Examples

Generate charging profiles for synthetic mobility data:

from champpy import MobModel, ChargingModel, UserParamsChargingModel

# Generate synthetic mobility profiles
mob_model = MobModel(model_params)
mob_profiles = mob_model.generate_mob_profiles(num_vehicles=100, days=7)

# Create charging model
charging_model = ChargingModel(mob_profiles)

# Configure charging parameters
charging_params = UserParamsChargingModel(
    energy_consumption_kwh_per_km=[0.2],
    battery_capacity_kwh=[60.0],
    charging_power_max_kw=[7.0],
    charging_locations=[1]  # Charge at locations 1
)

# Generate charging profiles
charging_profiles = charging_model.generate_charging_profiles(charging_params)
generate_charging_profiles(user_params)[source]

Generate charging profiles from mobility data and charging parameters.

Parameters:

user_params (UserParamsChargingModel) – User-defined charging model parameters.

Returns:

Generated charging profiles including timeseries, electric vehicles, and clusters.

Return type:

ChargingProfiles

class champpy.UserParamsChargingModel(*args, **kwargs)[source]

Data class to define user parameters for the charging profile generation.

This configuration class defines electric vehicle properties and charging behavior used by ChargingModel.

Examples

>>> params = UserParamsChargingModel(
...     energy_consumption_kwh_per_km=[0.2],
...     battery_capacity_kwh=[60.0],
...     charging_power_max_kw=[11.0],
...     charging_locations=[1, 2],
...     temp_res=0.25,
... )
battery_capacity_kwh: list[float]

Battery capacity in kWh per vehicle or as a scalar list.

charging_locations: list[int]

Location IDs where charging is allowed.

charging_power_max_kw: list[float]

Maximum charging power in kW per vehicle or as a scalar list.

distribute_energy_consumption: bool = True

If True, distribute trip energy over all trip time steps.

efficiency_charging: list[float]

Charging efficiency in the interval $(0, 1]$ per vehicle or as a scalar list.

energy_consumption_kwh_per_km: list[float]

Energy consumption in kWh/km per vehicle or as a scalar list.

soc_initial: float = 1

Initial SoC at simulation start in the interval $[0, 1]$.

soc_min: list[float]

Minimum state of charge (SoC) in the interval $[0, 1)$ per vehicle.

soc_min_dep: list[float]

Minimum SoC required at departure in the interval $(0, 1]$ per vehicle.

temp_res: float = 0.25

Temporal resolution in hours used for charging simulation.