@sh.add_function(dsp, outputs=['tau_function'])
def define_tau_function(after_treatment_temperature_threshold):
"""
Defines tau-function of the extended Willans curve.
:param after_treatment_temperature_threshold:
Engine coolant temperature threshold when the after treatment system is
warm [°C].
:type after_treatment_temperature_threshold: (float, float)
:return:
Tau-function of the extended Willans curve.
:rtype: callable
"""
import scipy.stats as sci_sta
temp_mean, temp_end = np.array(after_treatment_temperature_threshold) + 273
s = np.log(temp_end / temp_mean) / sci_sta.norm.ppf(0.95)
f = sci_sta.lognorm(max(s, dfl.EPS), 0, temp_mean).cdf
def _tau_function(t0, t1, temp):
return t0 + (t1 - t0) * f(temp + 273)
return _tau_function