Global warming and climate change are no longer just a topic for expert panel discussions since we started to observe real-life impacts of such phenomenon for more than a decade. Reducing and gradual elimination of greenhouse gas (GHG) emissions is the best and only solution. Buildings, districts, and cities are responsible for a significant portion of GHG emissions, and concepts such as sustainability, energy efficiency, and renewable energies support the transition towards zero-carbon districts. Efficient, reliable, and accessible tools are crucial to plan, design and analyze such districts and cities. The prepared manuscript-based thesis focuses on introducing an automated framework for designing and sizing energy systems in a zero-carbon district context. The framework has been developed using the simulation environment INSEL 8.2 combined with Python coding and contains a variety of complex components, including but not limited to heat pumps (HP), photovoltaic panels (PV), inverter, maximum power point tracker, domestic hot water tank, energy metering, and simplified battery and thermal storage systems. The integrated framework covers demand profiles, energy system sizing, components' interaction, and performance analysis. An urban energy system model (UESM) has been developed and used for different scenarios and use cases such as sensitivity analysis, optimization using genetic algorithm (GA), economic analysis, and the comparison of different energy systems configurations (Central vs. Decentral scenario). Simulation with an hourly resolution, while considering various detailed models, is the most critical capability of this framework compared to available UESMs. Moreover, all tools developed are open-source with a high level of flexibility, which can be the foundation for other researchers by adding and modifying different domains' components.