A first apparatus for managing a battery energy storage system for storing energy supplied via a point of common coupling of an electric power supply network for use by one or more electrical load devices, the first apparatus comprising means for: maintaining, in a first database, a first trained machine learning algorithm trained for predicting an expected load profile at the point of common coupling defining excess load to be covered by the battery energy storage system for a time interval of a pre-defined length based on one or more values of a set of prediction parameters, wherein the set of prediction parameters comprise at least one or more first parameters of the point of common coupling and one or more second parameters of the one or more electrical load devices, the one or more first parameters being electrical parameters and the one or more second parameters comprising at least load demand; maintaining, in the first database, a second trained machine learning algorithm trained for predicting an optimal charging strategy for maximizing lifespan of at least one battery of the battery energy storage system for a time interval of a pre-defined length based on the expected load profile and a current state of charge level of said at least one battery; obtaining one or more recent values of the set of prediction parameters relating to one or more previous time intervals of the pre-defined length; calculating, using the first trained machine learning algorithm, an expected load profile at the point of common coupling defining excess load to be covered by the battery energy storage system for the next time interval of the pre-defined length based at least on the one or more recent values of the set of prediction parameters; and predicting, using the second trained machine learning algorithm, an optimal charging strategy for said next time interval based on a calculated expected load profile and a current state of charge level of said at least one battery of the battery energy storage system; and operating the battery energy storage system using the predicted optimal charging strategy during said next time interval. maintaining, in a first database, a first trained machine learning algorithm trained for predicting an expected load profile at the point of common coupling defining excess load to be covered by the battery energy storage system for a time interval of a pre-defined length based on one or more values of a set of prediction parameters, wherein the set of prediction parameters comprise at least one or more first parameters of the point of common coupling and one or more second parameters of the one or more electrical load devices, the one or more first parameters being electrical parameters and the one or more second parameters comprising at least load demand; maintaining, in the first database, a second trained machine learning algorithm trained for predicting an optimal charging strategy for maximizing lifespan of at least one battery of the battery energy storage system for a time interval of a pre-defined length based on the expected load profile and a current state of charge level of said at least one battery; obtaining one or more recent values of the set of prediction parameters relating to one or more previous time intervals of the pre-defined length; calculating, using the first trained machine learning algorithm, an expected load profile at the point of common coupling defining excess load to be covered by the battery energy storage system for the next time interval of the pre-defined length based at least on the one or more recent values of the set of prediction parameters; and predicting, using the second trained machine learning algorithm, an optimal charging strategy for said next time interval based on a calculated expected load profile and a current state of charge level of said at least one battery of the battery energy storage system; and operating the battery energy storage system using the predicted optimal charging strategy during said next time interval.