@sh.add_function(
dsp, inputs_kwargs=True, outputs=['rcb_corrected_co2_emission_value']
)
def calculate_rcb_corrected_co2_emission_value_v1(
co2_emission_value, batteries_phases_delta_energy,
kco2_wltp_correction_factor, phases_distances, rcb_correction=True,
is_hybrid=True, cycle_type='WLTP'):
"""
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 batteries_phases_delta_energy:
Phases delta energy of the batteries [Wh].
:type batteries_phases_delta_energy: numpy.array
:param kco2_wltp_correction_factor:
kco2 WLTP correction factor [CO2g/Wh].
:type kco2_wltp_correction_factor: float
:param phases_distances:
Cycle phases distances [km].
:type phases_distances: numpy.array
: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_wltp_correction_factor:
de = np.sum(batteries_phases_delta_energy) / np.sum(phases_distances)
return co2_emission_value - kco2_wltp_correction_factor * de
return co2_emission_value