@sh.add_function(dsp, outputs=[
'service_battery_state_of_charges', 'service_battery_charging_statuses',
'dcdc_converter_currents', 'alternator_currents'
])
def predict_service_battery_flows(
service_battery_model, times, motive_powers, accelerations, on_engine,
starter_currents):
"""
Predict the service battery currents flows.
:param service_battery_model:
Service battery model.
:type service_battery_model: ServiceBatteryModel
:param times:
Time vector [s].
:type times: numpy.array
:param motive_powers:
Motive power [kW].
:type motive_powers: numpy.array
:param accelerations:
Acceleration [m/s2].
:type accelerations: numpy.array
:param on_engine:
If the engine is on [-].
:type on_engine: numpy.array
:param starter_currents:
Starter currents [A].
:type starter_currents: numpy.array
:return:
- State of charge of the service battery [%].
- Service battery charging statuses (0: Discharge, 1: Charging, 2: BERS,
3: Initialization) [-].
- DC/DC converter currents [A].
- Alternator currents [A].
:rtype: numpy.array
"""
service_battery_model.reset()
it = zip(times, motive_powers, accelerations, on_engine, starter_currents)
return np.array([service_battery_model(*a) for a in it]).T