@sh.add_function(
dsp, inputs_kwargs=True, outputs=['rcb_corrected_co2_emission_value']
)
def calculate_rcb_corrected_co2_emission_value_v2(
co2_emission_value, drive_battery_delta_state_of_charge,
drive_battery_capacity, kco2_nedc_correction_factor,
rcb_correction=True, is_hybrid=True, cycle_type='NEDC'):
"""
Calculates the CO2 emission value corrected for RCB [CO2g/km].
:param is_hybrid:
Is the vehicle hybrid?
:type is_hybrid: bool
:param cycle_type:
Cycle type (WLTP or NEDC).
:type cycle_type: str
:param co2_emission_value:
CO2 emission value of the cycle [CO2g/km].
:type co2_emission_value: float
:param drive_battery_delta_state_of_charge:
Overall delta state of charge of the drive battery [%].
:type drive_battery_delta_state_of_charge: numpy.array
:param kco2_nedc_correction_factor:
kco2 NEDC correction factor [CO2g/km/Ah].
:type kco2_nedc_correction_factor: float
:param drive_battery_capacity:
Drive battery capacity [Ah].
:type drive_battery_capacity: float
:param rcb_correction:
Apply RCB correction?
:type rcb_correction: bool
:return:
CO2 emission value corrected for RCB [CO2g/km].
:rtype: float
"""
if not is_hybrid or cycle_type != 'NEDC':
return sh.NONE
if rcb_correction and kco2_nedc_correction_factor:
di = drive_battery_delta_state_of_charge * drive_battery_capacity / 100
return co2_emission_value - kco2_nedc_correction_factor * di
return co2_emission_value