@sh.add_function(
dsp, inputs_kwargs=True, outputs=['rcb_corrected_co2_emission_value']
)
def calculate_rcb_corrected_co2_emission_value(
speed_distance_corrected_co2_emission_value, engine_type, fuel_type,
alternator_efficiency, phases_distances, theoretical_phases_distances,
batteries_phases_delta_energy, speed_distance_correction=True,
rcb_correction=True, is_hybrid=False, 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 speed_distance_corrected_co2_emission_value:
CO2 emission value corrected for speed & distance [CO2g/km].
:type speed_distance_corrected_co2_emission_value: float
:param batteries_phases_delta_energy:
Phases delta energy of the batteries [Wh].
:type batteries_phases_delta_energy: numpy.array
:param theoretical_phases_distances:
Theoretical cycle phases distances [km].
:type theoretical_phases_distances: numpy.array
:param phases_distances:
Cycle phases distances [km].
:type phases_distances: numpy.array
:param alternator_efficiency:
Alternator efficiency [-].
:type alternator_efficiency: float
:param engine_type:
Engine type (positive turbo, positive natural aspiration, compression).
:type engine_type: str
:param fuel_type:
Fuel type (diesel, gasoline, LPG, NG, ethanol, methanol, biodiesel,
propane).
:type fuel_type: str
:param rcb_correction:
Apply RCB correction?
:type rcb_correction: bool
:param speed_distance_correction:
Apply speed distance correction?
:type speed_distance_correction: bool
:return:
CO2 emission value corrected for RCB [CO2g/km].
:rtype: float
"""
if is_hybrid:
return sh.NONE
if cycle_type == 'WLTP' and rcb_correction:
d = phases_distances
if speed_distance_correction:
d = theoretical_phases_distances
return speed_distance_corrected_co2_emission_value + _rcb_correction(
np.sum(batteries_phases_delta_energy), np.sum(d), fuel_type,
engine_type, alternator_efficiency
)
return speed_distance_corrected_co2_emission_value