A crane comprising: a power consumer system for providing energy; a primary energy source for feeding primary energy into the power consumer system; at least one secondary energy source, controllable independent from the primary energy source, for feeding secondary energy into the power consumer system, wherein the secondary energy source is connected to the power consumer system, and configured such that energy returned from operation of the at least one secondary energy source is at least partially fed as secondary energy into the power consumer system, said secondary energy source comprising at least one crane component; at least one energy storage unit arranged locally on the crane associated with the at least one crane component and connected to the power consumer system for storing primary energy and/or secondary energy; at least one drive motor connected to the power consumer system for operating the at least one crane component in response to energy fed into the power consumer system; and a control unit, which is in signal connection with the power consumer system, the primary energy source and the at least one secondary source to control energy supply to the at least one crane component; characterized in that the control unit comprises a non-transitory computer readable medium storing software that is adapted to perform the following steps: providing a total energy amount 121 comprising at least one of primary energy generated by means of the primary energy source and secondary energy generated by means of the at least one secondary energy source; determining an energy usage fraction 122 demanded by the at least one crane component; storing an energy storage fraction 126 in the at least one energy storage unit; and providing the energy usage fraction to the at least one crane component using the power from the at least one energy converter; wherein the total energy amount comprises the energy usage fraction and the energy storage fraction, and wherein the secondary energy is energy returned from operations performed by the at least one crane components; the crane further comprises at least one energy converter connected to the at least one crane component to convert energy from the at least one crane component into power; and the control unit controls a ratio of the energy usage fraction to the energy storage fraction. a power consumer system for providing energy; a primary energy source for feeding primary energy into the power consumer system; at least one secondary energy source, controllable independent from the primary energy source, for feeding secondary energy into the power consumer system, wherein the secondary energy source is connected to the power consumer system, and configured such that energy returned from operation of the at least one secondary energy source is at least partially fed as secondary energy into the power consumer system, said secondary energy source comprising at least one crane component; at least one energy storage unit arranged locally on the crane associated with the at least one crane component and connected to the power consumer system for storing primary energy and/or secondary energy; at least one drive motor connected to the power consumer system for operating the at least one crane component in response to energy fed into the power consumer system; and a control unit, which is in signal connection with the power consumer system, the primary energy source and the at least one secondary source to control energy supply to the at least one crane component; providing a total energy amount 121 comprising at least one of primary energy generated by means of the primary energy source and secondary energy generated by means of the at least one secondary energy source; determining an energy usage fraction 122 demanded by the at least one crane component; storing an energy storage fraction 126 in the at least one energy storage unit; and providing the energy usage fraction to the at least one crane component using the power from the at least one energy converter; wherein the total energy amount comprises the energy usage fraction and the energy storage fraction, and wherein the secondary energy is energy returned from operations performed by the at least one crane components; the crane further comprises at least one energy converter connected to the at least one crane component to convert energy from the at least one crane component into power; and the control unit controls a ratio of the energy usage fraction to the energy storage fraction.