@sh.add_function(dsp, outputs=['after_treatment_temperature_threshold'])
def calculate_after_treatment_temperature_threshold(
engine_thermostat_temperature, initial_engine_temperature):
"""
Calculates the engine coolant temperature when the after treatment system
is warm [°C].
:param engine_thermostat_temperature:
Engine thermostat temperature [°C].
:type engine_thermostat_temperature: float
:param initial_engine_temperature:
Initial engine temperature [°C].
:type initial_engine_temperature: float
:return:
Engine coolant temperature threshold when the after treatment system is
warm [°C].
:rtype: (float, float)
"""
ti = 273 + initial_engine_temperature
t = (273 + engine_thermostat_temperature) / ti - 1
temp_mean = 40 * t + initial_engine_temperature
temp_end = 40 * t ** 2 + temp_mean
return temp_mean, temp_end