The aim of this document is to present the topic of modeling district heating systems in order to enable optimization of their operation, with special focus on thermal energy storage in the pipelines. Two mathematical models for simulation of transient behavior of district heating networks have been described, and their results have been compared in a case study. The operational optimization in a DH system, especially if this system is supplied from a combined heat and power plant, is a difficult and complicated task. Finding a global financial optimum requires considering long periods of time and including thermal energy storage possibilities into consideration. One of the most interesting options for thermal energy storage is utilization of thermal inertia of the network itself. This approach requires no additional investment, while providing significant possibilities for heat load shifting. It is not feasible to use full topological models of the networks, comprising thousands of substations and network sections, for the purpose of operational optimization with thermal energy storage, because such models require long calculation times. In order to optimize planned thermal energy storage actions, it is necessary to model the transient behavior of the network in a very simple way - allowing for fast and reliable calculations. Two approaches to building such models have been presented. Both have been tested by comparing the results of simulation of the behavior of the same network. The characteristic features, advantages and disadvantages of both kinds of models have been identified. The results can prove useful for district heating system operators in the near future.