The optimized tool for analysis of existing buildings with technical systems in scope of achieving nearly zero energy building in building refurbishment is developed in the presented thesis. The approach is based on the application of numerical dynamic simulation of a building with integrated technical system in a complete parametric optimization. The mutual interaction of building with its technical system is comprised through its design and features that affect energy consumption, characteristic of equipment, design and management strategy of a technical system, including dynamic boundary conditions. The feasibility of numerical simulations application for dynamic analysis of nearly zero energy buildings technical systems is determined through the development of numerical dynamic models which are validated by comparison with field measurements results. Heat consumption modelling is carried out on a multi-zone building model using Trnsys software. The set of numerical dynamic simulations of technical systems is created which enables new scientific conclusions on system configuration and criteria for the application. These simulations facilitate the design of technical systems of nearly zero energy buildings in connection with passive energy efficiency measures. New numerical models of water to water and air to water compression heat pumps are created by implementing the characteristics at partial load conditions and the possibility of partial and total heat recovery. The models are suitable for operation in Trnsys simulations. The formulated optimization problem determines the physical properties of building envelope in interaction with building technical systems. This specialized optimization method is based on a genetic algorithm. This simulation tool provides a detailed analysis for the achievement of complete optimal technical solutions through energy, economic and environmental indicators. In scope of thesis, the tool has been tested and applied in the area of mild Mediterranean climate, the Croatian part of Adriatic coast. The optimal solutions that can ensure the achievement of the consumption level of nearly zero energy building are recommended. The shortcomings of the existing definition of nearly zero energy buildings it the Croatian regulations are pointed out. This tool can be used for better analysis and establishing of criteria for the nearly zero energy reference buildings. It is suitable for application in Croatia and beyond in order to help in decision on future regulations because it represents an unique approach to identify solutions.