MODELLING AND OPTIMAL ENERGY MANAGEMENT FOR BATTERY ENERGY STORAGE