BMS function of battery system