An energy management system for managing a current flow in a machine having a lift element being vertically movable by a motor assembly, the energy management system comprising: - a power supplying bus for supplying the motor assembly; - a battery source being connected to the power supplying bus; - an energy storage device; - an energy-storage-device controller connected between the energy storage device and the power supplying bus, for controlling a current flow between the energy storage device and the power supplying bus; - sensors for detecting a height H and a movement of the lift element, said movement being selected from the group consisting of a lifting movement, a lowering movement and an immobile movement; characterized in that it further comprises: - a first calculator connected to the sensors for calculating a minimum energy E min required in the energy storage device as a function of the height H of the lift element; - a second calculator connected to the energy storage device for calculating an energy E available stored in the energy storage device based on a voltage V cap detected at terminals of the energy storage device and on a parameter of the energy storage device; - a comparator for calculating an Error where Error = E min - E available; - a third calculator for setting a lower limit I min of a current to be drawn from the energy storage device to 0A when the movement detected by the sensors is the immobile or lowering movement, and for calculating the lower limit I min as a function of Error when the movement detected by the sensors is the lifting movement; - a fourth calculator for calculating an upper limit I max of a current to be supplied to the energy storage device as a function of Error when the movement detected by the sensors is the immobile or lowering movement; and - a main controller for controlling the energy-storage-device controller as a function of I min, I max, and the movement detected, to adjust the current flow between the energy storage device and the power supplying bus. - a power supplying bus for supplying the motor assembly; - a battery source being connected to the power supplying bus; - an energy storage device; - an energy-storage-device controller connected between the energy storage device and the power supplying bus, for controlling a current flow between the energy storage device and the power supplying bus; - sensors for detecting a height H and a movement of the lift element, said movement being selected from the group consisting of a lifting movement, a lowering movement and an immobile movement; - a first calculator connected to the sensors for calculating a minimum energy E min required in the energy storage device as a function of the height H of the lift element; - a second calculator connected to the energy storage device for calculating an energy E available stored in the energy storage device based on a voltage V cap detected at terminals of the energy storage device and on a parameter of the energy storage device; - a comparator for calculating an Error where Error = E min - E available; - a third calculator for setting a lower limit I min of a current to be drawn from the energy storage device to 0A when the movement detected by the sensors is the immobile or lowering movement, and for calculating the lower limit I min as a function of Error when the movement detected by the sensors is the lifting movement; - a fourth calculator for calculating an upper limit I max of a current to be supplied to the energy storage device as a function of Error when the movement detected by the sensors is the immobile or lowering movement; and - a main controller for controlling the energy-storage-device controller as a function of I min, I max, and the movement detected, to adjust the current flow between the energy storage device and the power supplying bus.