Skip to content

Electrics Model

stefanosts edited this page Aug 6, 2016 · 1 revision

In the present section the electric model of CO2MPAS is presented.

Inputs

Name Units Source / Comments Parameter
Alternator Charging Currents A Parametric Calculated Input alternator_charging_currents
Alternator Efficiency - Parametric Calculated Input alternator_efficiency
Alternator Nominal Voltage V Parametric Calculated Input alternator_nominal_voltage
Balance State of Charge % Default Input state_of_charge_balance
Balance Window State of Charge % Default Input state_of_charge_balance_window
Energy Recuperation System - Default Input has_energy_recuperation
Battery Capacity Ah Parametric Calculated Input battery_capacity
Max Battery Charging Current A Parametric Calculated Input max_battery_charging_current
Starting Current Demand A Parametric Calculated Input start_demand
Electric Loads kW Parametric Calculated Input electric_load
Starting State of Charge % Default Input initial_state_of_charge
Velocity Profile km/hr, sec Input velocities, times
Acceleration m/sec2 Calculated by Vehicle Model accelerations
Powers Clutch / Torque Converter kW Calculated by Clutch / Torque Converter Model clutch_tc_powers
Engine Status On/Off Calculated by Start/Stop Model on_engine
Engine Starts - Calculated by Start/Stop Model engine_starts

Output

Alternator Powers Demand [kW] / alternator_powers_demand

Source Code

def define_alternator_status_model(
        state_of_charge_balance, state_of_charge_balance_window,
        has_energy_recuperation):

    dn_soc = state_of_charge_balance - state_of_charge_balance_window / 2
    up_soc = state_of_charge_balance + state_of_charge_balance_window / 2

    def model(prev_status, soc, gear_box_power_in):
        status = 0

        if soc < 100:
            if soc < dn_soc or (prev_status == 1 and soc < up_soc):
                status = 1

            elif has_energy_recuperation and gear_box_power_in < 0:
                status = 2

        return status

    return model

def define_alternator_current_model(alternator_charging_currents):
    
    def model(alt_status, prev_soc, gb_power, on_engine, acc):
        b = gb_power > 0 or (gb_power == 0 and acc >= 0)
        return alternator_charging_currents[b]

    return model

def predict_vehicle_electrics(
        battery_capacity, alternator_status_model, alternator_current_model,
        max_battery_charging_current, alternator_nominal_voltage, start_demand,
        electric_load, initial_state_of_charge, times, clutch_tc_powers,
        on_engine, engine_starts, accelerations):

    from .electrics_prediction import _predict_electrics

    func = partial(
        _predict_electrics, battery_capacity, alternator_status_model,
        alternator_current_model, max_battery_charging_current,
        alternator_nominal_voltage, start_demand, electric_load, )

    delta_times = np.append([0], np.diff(times))
    o = (0, initial_state_of_charge, 0, None)
    res = [o]
    for x in zip(delta_times, clutch_tc_powers, on_engine, engine_starts,
                 accelerations):
        o = tuple(func(*(x + o[1:])))
        res.append(o)

    alt_c, soc, alt_stat, bat_c = zip(*res[1:])

    return np.array(alt_c), np.array(bat_c), np.array(soc), np.array(alt_stat)

def calculate_alternator_powers_demand(
        alternator_nominal_voltage, alternator_currents, alternator_efficiency):

    c = alternator_nominal_voltage / (1000.0 * alternator_efficiency)

    return alternator_currents * c