The decline in power quality within electrical networks is adversely impacting the energy efficiency and safety of transmission elements. The growing prevalence of power electronics has elevated harmonic levels in the grid to an extent where their significance cannot be overlooked. Additionally, the increasing integration of renewable energy sources introduces heightened fluctuations, rendering the prediction and simulation of working modes more challenging. This paper presents an improved algorithm for calculating power transformer losses attributed to harmonics, with a comprehensive validation against simulation results obtained from the Power Factory application and real-world measurements. The advantages of the algorithm are that all evaluations are performed in real-time based on single-point measurements, and the algorithm was easy to implement in a Programmable Logic Controller (PLC). This allows us to receive the exchange of information to energy monitoring systems (EMSs) or with Power factor Correction Units (PFCUs) and control it. To facilitate a more intuitive understanding and visualization of potential hazardous scenarios related to resonance, an extra Dijkstra algorithm was implemented. This augmentation enables the identification of conditions, wherein certain branches exhibit lower resistance than the grid connection point, indicating a heightened risk of resonance and the presence of highly distorted currents. Recognizing that monitoring alone does not inherently contribute to increased energy efficiency, the algorithm was further expanded to assess transformer losses across a spectrum of Power Factory Correction Units power levels. Additionally, a command from a PLC to a PFCU can now be initiated to change the capacitance level and near-resonance working mode. These advancements collectively contribute to a more robust and versatile methodology for evaluating power transformer losses, offering enhanced accuracy and the ability to visualize potentially critical resonance scenarios.