The report considers the optimal design of roof photovoltaic systems (PVS) for municipal buildings. PVSs reduce energy expenses by saving the costs of supply of power, which are a component of the total energy cost. The report addresses the question how big and what type of PVS should be selected when the energy produced by the PVS is guaranteed to be sold. Given known annual electricity needs for the building, a criterion for optimization of the inputs to the PVS is the minimum cost per unit of energy consumed (BGN/MWh), whether produced by the PVS or purchased by the system. The energy used can be either bought from the system or taken from batteries that store the energy produced by the PVS during the day. The optimal strategy is determined by the battery prices, the converters used (network or hybrid inverters) and by the 24-hour energy consumption schedule of the building's consumers.