@sh.add_function(dsp, outputs=['fmep_model'])
def define_fmep_model(
full_bmep_curve, engine_max_speed, engine_stroke,
active_cylinder_ratios, engine_has_cylinder_deactivation,
engine_has_variable_valve_actuation, has_lean_burn,
has_exhausted_gas_recirculation, has_selective_catalytic_reduction,
engine_type, idle_engine_speed, after_treatment_temperature_threshold):
"""
Defines the vehicle FMEP model.
:param full_bmep_curve:
Vehicle full bmep curve.
:type full_bmep_curve: function
:param engine_max_speed:
Maximum allowed engine speed [RPM].
:type engine_max_speed: float
:param engine_stroke:
Engine stroke [mm].
:type engine_stroke: float
:param active_cylinder_ratios:
Possible active cylinder ratios [-].
:type active_cylinder_ratios: tuple[float]
:param engine_has_cylinder_deactivation:
Does the engine have cylinder deactivation technology?
:type engine_has_cylinder_deactivation: bool
:param engine_has_variable_valve_actuation:
Does the engine feature variable valve actuation? [-].
:type engine_has_variable_valve_actuation: bool
:param has_lean_burn:
Does the engine have lean burn technology?
:type has_lean_burn: bool
:param has_exhausted_gas_recirculation:
Does the engine have exhaust gas recirculation technology?
:type has_exhausted_gas_recirculation: bool
:param has_selective_catalytic_reduction:
Does the engine have selective catalytic reduction technology?
:type has_selective_catalytic_reduction: bool
:param engine_type:
Engine type (positive turbo, positive natural aspiration, compression).
:type engine_type: str
:param idle_engine_speed:
Engine speed idle median and std [RPM].
:type idle_engine_speed: (float, float)
: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:
Vehicle FMEP model.
:rtype: FMEP
"""
d = dfl.functions.define_fmep_model
acr_fbcp = d.acr_full_bmep_curve_percentage
lb_fbcp = d.lb_full_bmep_curve_percentage
egr_fbcp = d.egr_full_bmep_curve_percentage
acr_maps = d.acr_max_mean_piston_speeds_percentage * engine_max_speed
acr_mips = d.acr_min_mean_piston_speeds_percentage * idle_engine_speed[0]
lb_mps = d.lb_max_mean_piston_speeds_percentage * engine_max_speed
egr_mps = d.egr_max_mean_piston_speeds_percentage * engine_max_speed
from . import calculate_mean_piston_speeds
bmep = calculate_mean_piston_speeds
model = FMEP(
full_bmep_curve,
active_cylinder_ratios=active_cylinder_ratios,
has_cylinder_deactivation=engine_has_cylinder_deactivation,
acr_full_bmep_curve_percentage=acr_fbcp,
acr_max_mean_piston_speeds=bmep(acr_maps, engine_stroke),
acr_min_mean_piston_speeds=bmep(acr_mips, engine_stroke),
acr_after_treatment_temp=after_treatment_temperature_threshold[0],
has_variable_valve_actuation=engine_has_variable_valve_actuation,
has_lean_burn=has_lean_burn,
lb_max_mean_piston_speeds=bmep(lb_mps, engine_stroke),
lb_full_bmep_curve_percentage=lb_fbcp,
has_exhausted_gas_recirculation=has_exhausted_gas_recirculation,
has_selective_catalytic_reduction=has_selective_catalytic_reduction,
egr_max_mean_piston_speeds=bmep(egr_mps, engine_stroke),
egr_full_bmep_curve_percentage=egr_fbcp,
engine_type=engine_type
)
return model