In district heating (DH) systems, the time of use of energy is becoming more important. For example, the use of sustainable baseload units over peak units is favored. Also heat production units coupled to the electricity grid, such as cogeneration plants and heat pumps, can profit from fluctuating prices and balance the electricity network at the same time.