The rapid evolution of decentralized and intelligent power systems has increased the need for effective energy measurement schemes that can reliably identify users and prosumers and quantify their consumption or production levels. Traditional unidirectional energy measurement systems have been found ineffective at capturing the two-way, probabilistic flow of electricity due to the inclusion of renewable energy sources in the distribution network. This paper provides a detailed description of an Artificial Intelligence (AI) algorithm for classifying users and measuring their electrical attributes. The algorithm employs Decision Tree (DT) and Random Forest (RF) classifiers trained on a normalized and cleaned dataset of 100 energy profile data points. The DT classifier achieved 97% accuracy, while the RF classifier achieved 98%. Both classifiers were free from false positives and negatives. Feature importance analysis indicated that Property Size (0.4) and Power Consumed (0.3) were more significant than Power Generated (0.2) and Time of Use (0.1). Comparison against other models demonstrated that the algorithm performed better than existing ones in terms of accuracy, adaptability, and computation time. The proposed AI-based framework enables real-time detection of energy producers and consumers, contributing significantly to grid management, intelligent tariff control, and distributed generation systems.

