## 2 Background
### Related Work  
In this section, we will see some studies related to the development of software architectures oriented to energy efficiency in SG, smart energy, and smart cities. In the work of [PERSON] et al. [58], they propose a distributed smart home architecture involving home sensors that communicate directly with a smart gateway installed inside the home. The gateway decides which data should be sent to the central processor for further analysis. They use an open data set to feed sensor data into the test setup and show that local data processing can improve efficiency by effectively utilizing the available network bandwidth. [PERSON] et al. [24] present a practical composition method that helps solve IoT interoperability conundrums used in SG. The described approach results in a higher-level abstraction, protecting user applications under a high-level domain API, decisively demonstrating the method's feasibility, power, and utility. [PERSON] et al. [59] presents a smart energy community management approach that enables P2P trading and manages domestic energy storage systems. It proposes a smart residential community concept where domestic users and a local energy pool can trade, providing access to cheap renewable energy without new power generation equipment. The proposed energy trading process is modeled as a Markov decision process, and a reinforcement learning algorithm is used to find the optimal decision. A fuzzy inference system is employed to use Q-learning in continuous state space problems (Fuzzy Q-learning) for infinite possibilities in the energy trading process. The performance of the proposed demand-side management system is evaluated by comparing electricity costs before and after its implementation in a community. [PERSON] et al. [51] presents a cloud-based platform based on a service-oriented architecture to perform service analysis of smart energy systems. It is the result of the European FISMEP (FIWARE for Smart Energy Platform) project to demonstrate an information and communication technology (ICT) architecture for the smart energy sector. The architecture presented is powered by FIWARE, customizable and open-source building blocks for future Internet applications and services. A general list of functional and non-functional system requirements that can be considered in any other system in the energy sector is specified. In addition, the proposed ICT architecture has been demonstrated in the different field tests of the project. In this research, FIWARE has a great potential for application in the investigated use cases. However, due to its modular structure and its goal to provide an API for everything possible, it becomes quite difficult to maintain and requires expert knowledge to operate in production. In the work of [PERSON] et al. [60], they present a new philosophy for the digitization and automation of distribution networks, based on a modular architecture of microservices implemented through container technology. This architecture enables a service-oriented de ployment of the intelligence needed in distribution management Systems, going beyond the traditional vision of monolithic software installations in control rooms. The proposed architecture unlocks a broad set of possibilities, including cloud-based deployments, extension of legacy systems, and rapid integration of machine-learning-based analytical tools. In the work of [PERSON] et al. [61], they present an active demand side management methodology that optimizes energy storage management for domestic consumers with distributed generation. The objective is to reduce electricity costs and postpone investments in grid expansion if the highest load period coincides with the highest electricity tariff of the day. The methodology employs a validated neural network decision-making system trained with optimized data that can be used in households meeting specific conditions: location, electricity tariff, and consumption profile verified by the local electricity company.