Energy sector is one of the largest polluters in the world and also in Latvia. Combustion of fossil fuels in energy sector accounted for 65.5 % of total GHG emissions in Latvia in 2018. It includes both centralized and decentralized energy production, as well as transport sector. At the end of 2019, the European Commission presented the Green Deal – a set of policy initiatives with the overarching goal to make European climate neutral by 2050. This means that all of the EU member states have to become climate neutral by 2050. To reach this goal, emission reduction is necessary in all sectors. To decide on the transformation pathway for energy sector and make informed and sustainable decisions, tools that can help to answer how the energy system might develop in the future are necessary. Energy sector is a complex system with a lot of elements, non-linearities and feedbacks that humans cannot process, therefore mathematical simulation tools are necessary to assist policy makers in making long term policies that are economically justifiable, socially fair and sustainable. The aim of the Thesis is to develop energy system simulation models for heating and power systems which can be used for local and national scale energy system modelling and can assess effects of different parameters and policy instruments. The model should be able to analyze the sector coupling influence on the system. The Doctoral Thesis is designed as a set of publications and is based on seven thematically unified scientific articles that are presented, and the results have been approbated in various scientific conferences. All articles are accessible in international citation databases.