A method for operating at least one distributed energy resource comprising a refrigeration system with a compressor rack with at least one compressor, at least one heat rejecting heat exchanger, and two or more cooling entities, each cooling entity comprising an evaporator and an expansion valve controlling a supply of refrigerant to the evaporator, characterized in that the method comprises the steps of: - a smart-grid setup requesting power consumption information related to expected minimum power consumption and/or expected maximum power consumption of the refrigeration system during a requested time slot, from the distributed energy resource, - for each of the cooling entities, a controller of the distributed energy resource estimating a power consumption contribution originating from the cooling entity, - for each of the cooling entities, the controller of the distributed energy resource determining whether the cooling entity is in a state in which refrigerant is supplied to the evaporator of the cooling entity or in a state in which refrigerant is not supplied to the evaporator of the cooling entity, and determining whether or not the cooling entity is ready to switch state, - the controller of the distributed energy resource calculating at least one parameter being representative for an expected maximum power consumption and/or an expected minimum power consumption of the refrigeration system during the requested time slot, based on the estimated power consumption contributions of the cooling entities, and based on the determined states of the cooling entities and whether or not the cooling entities are ready to switch state, - the controller of the distributed energy resource transmitting the requested power consumption information, in the form of the calculated expected maximum power consumption and/or expected minimum power consumption of the refrigeration system to the smart-grid setup, - the smart-grid setup transmitting a power reference to the distributed energy resource, the power reference being below the transmitted expected maximum power consumption and/or above the transmitted expected minimum power consumption, - the distributed energy resource controlling the cooling entities in order to obtain a power consumption of the refrigeration system which corresponds to the power reference, during the requested time slot. - a smart-grid setup requesting power consumption information related to expected minimum power consumption and/or expected maximum power consumption of the refrigeration system during a requested time slot, from the distributed energy resource, - for each of the cooling entities, a controller of the distributed energy resource estimating a power consumption contribution originating from the cooling entity, - for each of the cooling entities, the controller of the distributed energy resource determining whether the cooling entity is in a state in which refrigerant is supplied to the evaporator of the cooling entity or in a state in which refrigerant is not supplied to the evaporator of the cooling entity, and determining whether or not the cooling entity is ready to switch state, - the controller of the distributed energy resource calculating at least one parameter being representative for an expected maximum power consumption and/or an expected minimum power consumption of the refrigeration system during the requested time slot, based on the estimated power consumption contributions of the cooling entities, and based on the determined states of the cooling entities and whether or not the cooling entities are ready to switch state, - the controller of the distributed energy resource transmitting the requested power consumption information, in the form of the calculated expected maximum power consumption and/or expected minimum power consumption of the refrigeration system to the smart-grid setup, - the smart-grid setup transmitting a power reference to the distributed energy resource, the power reference being below the transmitted expected maximum power consumption and/or above the transmitted expected minimum power consumption, - the distributed energy resource controlling the cooling entities in order to obtain a power consumption of the refrigeration system which corresponds to the power reference, during the requested time slot.