The possibility of usage of one of the most conventional and affordable local renewable energy resources – water resources of small and medium-sized rivers, in Latvian energy sector has been analyzed. The already known material of this issue, which has been obtained on the basis of previous studies by other authors published in different sources that vary in certainty and reliability, is presented. Actually the presence of this material to some extent was the basis of further research in this direction. Development of the algorithm of small hydropower optimization is in fact the basis of its control system and is based on dynamic programming. The approbation of algorithm is performed on the example of optimization of certain hydropower.