In this paper, a universal approach is considered, based on which the optimal flow and temperature conditions in a district heating system network could be calculated. The optimality is determined by the least operational costs. The developed calculation model has been tested on the Ludza district heating system based on the technical parameters of this system.