0% found this document useful (0 votes)
18 views18 pages

M Mahad Malik, Abdullah Altamimi, Syed Ali Abbas Kazmi, Zafar A. Khan, M Waleed Ansari, Kamran Mujahid, Jiechao Gao

The article discusses a multi-agent system designed for smart cities, focusing on energy balance, optimal electricity forecasting, and enhancing individual comfort while maximizing financial gains. The proposed model employs advanced forecasting techniques, including a Smart Hybrid model that integrates LSTM and GNN, achieving improved accuracy in energy consumption predictions and significantly reducing electricity costs. The research highlights the importance of decentralized energy markets and robust communication systems to facilitate efficient energy management and trading within smart city infrastructures.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
18 views18 pages

M Mahad Malik, Abdullah Altamimi, Syed Ali Abbas Kazmi, Zafar A. Khan, M Waleed Ansari, Kamran Mujahid, Jiechao Gao

The article discusses a multi-agent system designed for smart cities, focusing on energy balance, optimal electricity forecasting, and enhancing individual comfort while maximizing financial gains. The proposed model employs advanced forecasting techniques, including a Smart Hybrid model that integrates LSTM and GNN, achieving improved accuracy in energy consumption predictions and significantly reducing electricity costs. The research highlights the importance of decentralized energy markets and robust communication systems to facilitate efficient energy management and trading within smart city infrastructures.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 18

This article has been accepted for publication in IEEE Access.

This is the author's version which has not been fully edited and
content may change prior to final publication. Citation information: DOI 10.1109/ACCESS.2024.3497752

Date of publication xxxx 00, 0000, date of current version xxxx 00, 0000.
Digital Object Identifier 10.1109/ACCESS.2017.Doi Number

A full-fledged, multi-agent system representing the


architecture of smart cities by balancing energy
with optimal electricity forecasting, integrating
individual comfort, and extracting financial gains.
M Mahad Malik1, Abdullah Altamimi 2,3*, Syed Ali Abbas Kazmi1*, Zafar A. Khan4, M Waleed Ansari5,
Kamran Mujahid1, Jiechao Gao6
1
US-Pakistan Center for Advanced Studies in Energy (USPCAS-E), National University of Sciences and Technology (NUST), H-12 Campus, Islamabad 44000, Pakistan;
[email protected], [email protected], [email protected]
2
Department of Electrical Engineering, College of Engineering, Majmaah University, Al-Majmaah 11952, Saudi Arabia; [email protected]
3
Engineering and Applied Science Research Center, Majmaah University, Al-Majmaah 11952, Riyadh, Saudi Arabia; [email protected]
4
Department of Electrical Engineering, Mirpur University of Science and Technology, Mirpur AJK 10250, Pakistan; [email protected]
5
University of Oldenburg (Germany) [email protected]
6
Department of Computer Science, University of Virginia, USA; [email protected]

Correspondence*: [email protected]; [email protected]

ABSTRACT Moving from smart homes to smart cities is a complex but essential task to consider. Setting up a
modern smart city has many problems, such as unstable power generation systems, a lack of integration of demand-
side loads, low profits, more pollution, and agents that cannot communicate quickly and smartly. Our model has
the following steps to deal with all of these problems. It performs consumption forecasting through GNN and the
Smart Hybrid model (LSTM + GNN) to get optimal forecasting results. The smart hybrid model outperformed the
LSTM model by 1.14% in MAPE. The LSTM and Smart Hybrid models have MAPE values of 0.0787 and 0.0776,
respectively. This infrastructure uses GNN, Smart Hybrid Model, MOPnP, MOPPnP, and knapsack algorithms to
maximize personal comfort, lower costs, profit the community through transaction agents, reduce unwanted peaks
by shifting loads, and use an intelligent and robust structure for agent communication. The integration of
renewables, optimum consumption forecasts, adjusting consumer comfort, decentralized energy market structure
and formulated algorithms have combined to reduce monthly electricity expenses by up to 94%. For the four trade
setups that were examined, the unrealized PnL rates were +116%, +78%, +71.631%, and +250%, in that order.

INDEX TERMS Energy forecasting, neural network, load forecasting, smart grids, energy balancing, multi-
microgrid, real time pricing, energy trading.

I. INTRODUCTION We considered Spain's electrical consumption and simulated


The developing world's energy problems might be solved by the available data. According to previous research, a similar
combining different energy sources and organizations that study of real data from the Australian states [1] and
smartly use energy. Energy interactions make it easier for compared MAPE and MAE for the Bi-LSTM model with
stakeholders to work together for better energy management, AM and RU. The authors of the research study [2] examine
improve economic stability, and help grow a more the most recent advances in electric load forecasting
substantial power exchange market. Combining renewable technologies, such as LSTM, SVN, and ANN. They also
energy sources (RES) with the finest means to store energy conduct a thorough analysis of the benefits, drawbacks, and
may observe optimal generating patterns. A developing functionalities of the load forecasting model. The authors in
engaging, sustainable, and environmentally responsible [3] initially suggest a model that uses variational mode
model that offers optimum forecasting, energy balancing, decomposition (VMD) and seasonal-trend decomposition
robust connectivity, a high profit rate, and user-friendliness techniques to decrease sequence complexity and efficiently
is necessary. extract the changing characteristics of power demand. The
The first stage of our complete smart city energy study in [4] investigates the most recent machine learning
management infrastructure involves electrical forecasting. methods used for load forecasting to ensure the overall

This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 License. For more information, see https://creativecommons.org/licenses/by-nc-nd/4
This article has been accepted for publication in IEEE Access. This is the author's version which has not been fully edited and
content may change prior to final publication. Citation information: DOI 10.1109/ACCESS.2024.3497752

M. M. Malik et al.: A full-fledged, multi-agent system representing the architecture of smart cities by balancing energy with optimal electricity
forecasting, integrating individual comfort, and extracting financial gains.

energy management system operates sustainably. It looks at study [17] sought to lower prosumers' discomfort index (DI)
how metaheuristic (or optimizer) algorithms like the PSO from moving burdens to peak hours. Economically, LVDC
and HS algorithms are incorporated into the standalone SVM microgrid technology in neighborhood’s P2P electricity
model. The research model under discussion [5] proposes a marketplaces may provide cheap, locally generated energy
framework that uses SML and DL approaches to anticipate and improve energy efficiency [18].
electricity usage. The accuracy rates of the enhanced The proposed model for setting up a smart
methods, CNN-GRU-EWO and SVM-GWO, are 96.33% community moves forward with following:
and 90.67%, respectively. The CNN-GRU-EWO and SVM- Stage 1: A cutting-edge and unique study to leverage
GWO algorithms that have been recommended perform historical power consumption data to enhance
better than the State-Of-The-Art (SOTA) by 7% and 3%, load forecasting by utilizing Smart Hybrid
respectively. Models (LSTM and GNN) and Graph Neural
This research [6] proposes a one-hour-ahead demand Networks (GNN). The first stage is to increase
response algorithm for residential energy management the accuracy of load forecasts and energy
systems and an artificial neural network-based stable price balancing. It helps to model the generation,
forecast model to alleviate future pricing uncertainty. This lower the electricity consumption cost and
study [7] presents an effective home energy management emissions profile of a smart community.
system (HEMS) using solar (PV) and battery energy storage Stage 2: This stage provides a model containing (i) A smart
devices. A thorough predictive control approach based on a home where all devices are interconnected
mixed-integer quadratic programming model based on the through Python agent development, multi-
building energy management system is described in [8]. objective plug and play (MOPnP) (multi-
This study [9] suggests that sustainable energy objective plug and play), and MOPPnP (multi-
smart cities should create infrastructure and introduce a new objective prioritized plug and play). (ii) A smart
energy trading technique in distributed energy systems to thermostat (ST) for all power flexible devices
improve their advanced energy conservation systems. The like HVAC, AC, and refrigerators.
study [10] presents a multi-agent system-blockchain Stage 3: It offers a smart city infrastructure that evaluates
integration concept. In this paradigm, an artificial institution two setups of high-RES penetration and low-
ties abstract asset transaction ideas to system components. A RES penetration to look for different
blockchain-based smart system for DSM of residential consumption, generation, electricity cost and
constructions in a community increases power load Peaks to energy trading for each of them. To scale down
Average Ratios (PAR) [11]. Decentralized multi-agent the overall cost and adopt intelligent algorithm-
systems (MAS) implement the top layer of intelligent control based efficient procedures, the MMG structure
based on robust and secure communication [12]. is separated and integrated into smart city
Economic dispatch and MAS power balance structures for improved practical scenarios.
control are two of the coating's control systems. Blockchain MOPPnP and MOPPnP are employed with a
technology is a topic that many people who work in, control, specified target function to provide the best
or want to work in the energy sector are particularly possible outcome in terms of cost, efficiency,
interested in. The authors describe the multi-agent genetic user comfort, and a regulated influence on a
algorithm and discover improved optimization with an heavy-load thermostat, such as an HVAC
average operating efficiency of 23% and a decrease in total system.
energy consumption of 40% while analyzing the variety of Stage 4: A complete model for energy trading that helps in
power sources on all operating modes considered in [13]. efficient payback period planning, high ROI,
Additionally, the energy consumption of a swarm of Internet and profit-based structures for consumers and
of Things devices has been stabilized far more effectively by stakeholders involving smart city infrastructure.
the multi-agent system for monitoring and optimizing energy Four decentralized trading setups are
use. In the research [14], the authors review the role of considered.
blockchain in enabling IoT-based smart cities. Four aspects
are considered: (i) The development of blockchain systems. When a smart city setup is implemented, it enables robust
(ii) A critical assessment of the many intelligent apps. (iii). communication and a smart energy setup with increase in
Case studies of blockchain implementations in smart cities. efficiency, higher ROI, intelligent forecasting and a more
(iv).The essential conditions for integrating blockchain power-effective energy management solution, as shown in
technology with smart cities. Figure 1.
This study used a game-theory-based decentralized
trading system [15] to evaluate how DER ownership affects
P2P trading market participants' benefits. In [16], the authors
propose using Gaussian-based regularized particle swarm
optimization and fuzzy clustering to determine the best cost-
effective and dependable energy management system. The

This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 License. For more information, see https://creativecommons.org/licenses/by-nc-nd/4
This article has been accepted for publication in IEEE Access. This is the author's version which has not been fully edited and
content may change prior to final publication. Citation information: DOI 10.1109/ACCESS.2024.3497752

M. M. Malik et al.: A full-fledged, multi-agent system representing the architecture of smart cities by balancing energy with optimal electricity
forecasting, integrating individual comfort, and extracting financial gains.

FIGURE 1. Proposed Suggested Smart City Setup

GTA Grid MG Microgrid


A. Nomenclature
Transaction
P2P Peer to Peer PADE Python Agent Agent
Development DERs Distributed PV Photovoltaic
Environment energy
HVAC Heating BESS Battery Energy resources
Ventilation and Storage System MAS Multi Agent PIrCC Power at Inter
Air System Community
Conditioning Controller
DD Demand HEMS Home Energy IaCC Intra PIaCC Power at Intra
Dispatch Management Community Community
System Controller Controller
DR Demand FL Fixed Loads SIC Smart PSCC Power at smart
Response Industrial city Controller
RTP Real Time TCL Time Controller
Pricing Controllable SHC Smart Home Eth Ethereum Coin
Load Community
RES Renewable PFlL Power Flexible IrCC Inter APE Bored Ape
energy sources Load Community Coin
DER Distributed Psur Power Surplus Controller
Energy SCC Smart City Dot Polka Dot Coin
Resources Controller
MOPnP Multi Pdef Power Deficit ROI Return on Sol Solana Coin
Objective Plug Investment
and Play MMG Multi Micro SDG Sustainable
MOPPnP Multi EV Electric Grid development
Objective Vehicle goals
Prioritized TOU Time of Use PnL Profit and Loss
Plug and Play (at time of
closing trading)

This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 License. For more information, see https://creativecommons.org/licenses/by-nc-nd/4
This article has been accepted for publication in IEEE Access. This is the author's version which has not been fully edited and
content may change prior to final publication. Citation information: DOI 10.1109/ACCESS.2024.3497752

M. M. Malik et al.: A full-fledged, multi-agent system representing the architecture of smart cities by balancing energy with optimal electricity
forecasting, integrating individual comfort, and extracting financial gains.

II. RELATED WORK In [34], a sustainable network microgrid model balances


As we proceed toward our multistage smart city energy economic, environmental, and social constraints of meeting
management setup, we start with the literature related to consumer demands. A peer-to-peer energy trading strategy
electricity consumption forecasting to check out how our for EBSP that respects market flexibility is presented in [35].
forecasting technique can perform optimally. To do precise The numerical simulations in [36] indicate that the
short-term power load forecasting, we began with research recommended strategy can increase fair-trade pricing,
[19] that suggested an attention-based encoder-decoder minimize community expenses, and boost local PV energy
network with Bayesian optimization. The proposed model exchanges. According to a study [37], prosumers control
uses an encoder-decoder architecture with a highly robust household energy in a decentralized approach to make the
gated recurrent unit (GRU) RNN to represent time-series system robust and easy to connect devices from different
data. Researchers [20] described and displayed regional and manufacturers.
temporal correlations of prior load data using a novel spatial-
temporal graph representation approach. Graph-structured III. DESIGN FOR SMART COMMUNITY
data is then sent into the Spatial-Temporal Synchronous 3.1 AUTONOMOUS AGENTS
Graph Convolutional Network (STSGCN) to extract the Each agent contributes data and then uses self-adaptive skills
inherent spatial-temporal features of past load measurements to guide decisions. Agents that have been configured to
and forecast load. Using end-to-end inference latency conduct their activities very effectively. The process
prediction, [21] presents a direct resource-aware efficiency operation should focus on making intelligent judgments and
indicator to empower the NAS process. A new deep learning maintaining control over them. These agents can be
model estimates electric load consumption using Dual-Stage reconfigured, their settings can be adjusted, and they are fed
Attention-Based Recurrent Neural Networks in [22]. an algorithm to make decisions based on cost and surplus or
As we approach the second and third phases of our deficit power. First, the Knapsack is implemented to ensure
project, we are objectively studying advanced and optimum that the device's rating matches the power supplied. Then,
energy balancing and smart home energy modeling. This the MOPnP and MOPPnP layers make choices to reach the
work [23] uses a multi-objective evolutionary algorithm to goal of optimal consumption, get the results each layer
reduce appliance execution times and energy costs. Harmony wants, and make themselves susceptible to objective
search, enhanced differential evolution, and harmony search functions to facilitate intelligent community creation.
differential evolution are heuristic approaches used in [24] to
compare HEM controller performance. A stochastic program 3.2 SMART HOME CONTROLLER SETUP
is constructed in [25] to lower the time average estimated Smart communities considered in this research work are
total cost while accounting for power price, outside 1. Smart Homes Community (SHC)
temperature, renewable energy output, and electrical demand 2. Smart Industrial Community (SIC)
uncertainties. Both communities have devices that function as agents
After the first phases, trading infrastructures are that can communicate through Python agent development
studied, and theoretical analysis and computer simulation on
(PADE). This part talks about the intra-community
multiple MGs indicate a cooperative trading CT model [26].
configuration, where each load works like a device and talks
This study [27] examines smart home energy management
to the others.
systems (SHEMs) for trends and issues. Heuristic
1) Smart Homes Community (SHC)
optimization was used to minimize customers' electrical day- A smart home controller integrates the load devices in a
ahead price charges in the authors' energy management
specific home, which can be modified to meet the needs of
system [28]. Researchers in [29] monitored multi-microgrids
homes with varying incomes and comfort levels, such as
in real time using MAS. When assessing high-power quality high- and average-income homes. Alterations to
and energy management, they usually employed AI to
consumption patterns are brought about as a result of the fact
account for weather, sun irradiance, and load uncertainty.
that the smart home controller receives generation signals in
Power production and load demand have been real-time from the IrCC. Every house has its controller,
examined for renewable energy resources (RES). Adding which connects loads of the houses through bilateral
smart houses to the network reduces running expenses by communication of generation and consumption signals to
16% and greenhouse gas emissions by 17% [30]. The
operate the devices optimally. This controller comes under
recommended model [31] examines time-of-use pricing the umbrella term for distinct features covered in the
(TOU) and real-time pricing (RTP) price-based DRPs. This algorithm-based portion of the paper and depends on the
study [32] explores sustainable microgrid architecture with
lifestyle choices of residents. Signals are then passed to
varied demand locations and peer-to-peer energy trading
IrCC. The knapsack is used to calculate the load ratings, and
with seasonal factors and uncertainties to optimize profit and the MOPnP algorithm is installed in flexible power loads
decrease environmental costs while satisfying demand. This
while MOPPnP is applied to time-flexible loads. Loads are
study [33] examines blockchain and auction methods for altered and forecasted based on how customers live their
microgrid energy trading autonomy. They use Ethereum
lives based on income, consumption, comfort, and
smart contracts on two frameworks.

This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 License. For more information, see https://creativecommons.org/licenses/by-nc-nd/4
This article has been accepted for publication in IEEE Access. This is the author's version which has not been fully edited and
content may change prior to final publication. Citation information: DOI 10.1109/ACCESS.2024.3497752

M. M. Malik et al.: A full-fledged, multi-agent system representing the architecture of smart cities by balancing energy with optimal electricity
forecasting, integrating individual comfort, and extracting financial gains.

emissions. IaCCSHC receives the load profile from each home signal, thermostat decisions and device power on/off are
and relays the signals to IrCC. made. Power flexible loads have various behaviors. They run
on a 24-hour basis under a variable power structure.
LTAh=∑! '( % % %
"#$ ∑)#$( ∑&#$ 𝐹𝐿 + ∑&#$ 𝑇𝐶𝐿 ∑&#$ PFlL (1)

(𝟏). 𝑫𝑻𝑭𝑳 ;%&' D=3


House type = {High income, Middle Income) (𝑆𝑡𝑎𝑡𝑒 𝑂𝑁)

(𝟐). 𝑫𝑷𝑭𝒍𝑳 ;%&' D=3
∑))D$ 𝑃&3E (𝑡ℎ𝑒𝑟𝑚𝑜𝑠𝑡𝑎𝑡 𝑚𝑖𝑛) (4)
In eq. (1), we calculate the total load attached with ⎨ (𝟑). 𝑫𝑻𝑭𝑳 ;%&' D=3
these houses' communities. All loads and their types are ⎩ (𝑆𝑡𝑎𝑡𝑒 𝑂𝑓𝑓)
summed into LTAh. FL, TCL, and PFlL are summed
according to the living habits of the residents. It determines Eq. 4 elaborates on when power is a deficit. Then,
the total residential load (LTAh) by summing all household thermostats would operate at lower points to consume less
energy demands, tailored to reflect varying lifestyle patterns power. In the same way, flexible loads should be kept off, as
and income levels within the community. High-income seen in the equation. Table 1 and Table 2 show the load
houses can have higher personal comfort due to their high installed in High and Middle-income homes, respectively.
share of investments in cryptocurrencies in the GTA (IrCC).
PFlL Thermostat levels depend upon the profits of the TABLE 1
investment and Psur. LOAD FOR HIGH INCOME HOME
Device Upper TIMINGS ON Total
SHCload=∑5)#$ ∑0#2130)4 (𝑆𝑡*$ × 7𝐿𝑇𝐴ℎ()) : ∗ 𝑃. 𝑊(-.)/01) lower and Off quantity
0#$
limits
AC 3kW – 24 hrs ON 1 per house
(2)
thermostat 1.5kW
Light(Bulb) 0.05kW 16 hrs ON 8 per house
Total load at time slot t is considered in SHCload eq (2). It
Fan 0.15kW 16 hrs ON 4 per house
indicates the time t. It calculates the total load operated
during that period and the total operational load at each time Refrigerator 0.2kW 24 hrs ON 1 per house
slot, enabling optimized scheduling based on available Dish Washer 0.4kW 2 hrs ON on 1 per house
power and device priority signals. This equation is essential (No Peak)
to ensure operations' actions are required at t+1. It also helps Iron 0.8kw 2 hrs ON on 1 per house
to run the devices on different schedules and take PSUR, (No Peak)
PDEF, and GTAIrCC signals into account. TABLE 2
LOAD FOR MIDDLE INCOME HOME
(𝟏). 𝑫𝑻𝑭𝑳 ;%&' <=3
⎧ (𝑆𝑡𝑎𝑡𝑒 𝑂𝑁) Device Upper TIMINGS ON Total
⎪(𝟐). 𝑫𝑷𝑭𝒍𝑳 ;%&' <=3 lower and Off quantity
(𝑡ℎ𝑒𝑟𝑚𝑜𝑠𝑡𝑎𝑡 𝑚𝑎𝑥)
∑))D$ 𝑃46- ?52@'
(3) limits
(𝟑). 𝑫𝑷𝑭𝒍𝑳 ;%&' <=3
⎨ ?52B'
(𝑡ℎ𝑒𝑟𝑚𝑜𝑠𝑡𝑎𝑡 𝑚𝑖𝑛) Light(Bulb) 0.05kW 16 hrs ON 8 per house
⎪ (𝟒). 𝑫𝑻𝑭𝑳 ;%&' <=3 Fan 0.15kW 16 hrs ON 4 per house
⎩ (𝑆𝑡𝑎𝑡𝑒 𝑂𝑁)
Refrigerator 0.2kW 24 hrs ON 1 per house
Iron 0.8kw 2 hrs ON on 1 per house
Power signals for the houses connected with IaCCSHC are
(No Peak)
found in the time (t-1) slot. PSUR eq (3) is applied in cases
of excess power availability. Because of the input power
signal, thermostat decisions and device power on/off are 2) Smart Industries Community (SIC):
made. In Equation 3, power surplus management is achieved The IaCCSIC is connected to smart industries.
by dynamically adjusting thermostat and device settings, When RES generation is at its peak, DR signals are passed
facilitating efficient energy usage during surplus periods. to the SIC side to balance the maximum load. When RES
Power flexible loads have various behaviors. They run on a generation is at its minimum, this community carries up DD
24-hour basis under a variable power structure. signals, so only critical loads should be balanced to avoid a
blackout or instability of generation and load. At the time of
(𝟏). 𝑫𝑻𝑭𝑳 ;%&' D=3 DR, all loads are met, while in DD, only critical loads are
(𝑆𝑡𝑎𝑡𝑒 𝑂𝑁) met to lower the overall consumption pattern.

(𝟐). 𝑫𝑷𝑭𝒍𝑳 ;%&' D=3
∑))D$ 𝑃&3E (𝑡ℎ𝑒𝑟𝑚𝑜𝑠𝑡𝑎𝑡 𝑚𝑖𝑛) (4)
⎨(𝟑). LTAi=∑! '( % % %
𝑫𝑻𝑭𝑳 ;%&' D=3
(𝑆𝑡𝑎𝑡𝑒 𝑂𝑓𝑓) "#$ ∑)#$( ∑&#$ 𝐹𝐿 + ∑&#$ 𝑇𝐶𝐿 ∑&#$ PFlL (5)

Industry type = {Type (1), Type (n)}
Power signals for the houses connected with IaCCSHC are
found in the time (t-1) slot. PSUR eq (3) is applied in cases
of excess power availability. Because of the input power
5

This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 License. For more information, see https://creativecommons.org/licenses/by-nc-nd/4
This article has been accepted for publication in IEEE Access. This is the author's version which has not been fully edited and
content may change prior to final publication. Citation information: DOI 10.1109/ACCESS.2024.3497752

M. M. Malik et al.: A full-fledged, multi-agent system representing the architecture of smart cities by balancing energy with optimal electricity
forecasting, integrating individual comfort, and extracting financial gains.

In eq. (5) we calculate the total load attached to (1) 0 𝑁𝑜 𝑝𝑟𝑜𝑓𝑖𝑡


*-. (2)𝑇𝑟𝑎𝑛𝑠
∑//01 𝐺𝑇𝐴. 𝑇𝑟𝑎𝑛𝑠*+,
these industries. All loads and types are added to FL, TCL, + < 2 (𝐿𝑒𝑠𝑠 𝐶𝑜𝑚𝑓𝑜𝑟𝑡) (8)
and PFlL based on the industrial equipment in place. (3)𝑇𝑟𝑎𝑛𝑠 ≥ 2 (𝐻𝑖𝑔ℎ 𝐶𝑜𝑚𝑓𝑜𝑟𝑡)
Industries have a high share in the total energy mix because
they consume a lot of energy, pay their bills, trade energy GTAV = 𝐺𝑇𝐴. 𝑇𝑟𝑎𝑛𝑠 ∗ 𝑃𝑟𝑖𝑐𝑒 𝑜𝑓 𝑐𝑦𝑝𝑡𝑜𝑐𝑢𝑟𝑟𝑒𝑛𝑐𝑦 (9)
through GTA, and invest a lot to make profits and reduce the
time of ROI. It aggregates industrial load (LTAi) across Considered cryptocurrencies: (Eth, Ape, Dot, Sol) (10)
diverse equipment types, assisting in accurate load
forecasting and resource allocation within industrial sectors GTA is a transaction agent that works on the
principle of lower buying and higher selling on the
SICload=∑/$+" ∑)+,*-)$. (𝑆𝑡!" × &𝐿𝑇𝐴𝑖($) + ∗ 𝑃. 𝑊(&'$()*) (6)
price(divides the chart into different grid points). If the
)+"
consumption price (bills) for IaCC is greater than the value
of GTA (GTAV), then HVAC and AC thermostats will
In eq (6), the entire load at time slot t is considered. It shows
continue to operate on the low thermostat and lower comfort
the current time, t, while determining the overall load used.
zones, and vice versa. Equation (7-9) calculates the actual
This equation is necessary to guarantee that operations are
value and transaction of the cryptocurrency in real time and
needed at time t+1. It calculates the total industrial load
day ahead regimes. These equations collectively assess
(SICload) at each time slot t, enabling load scheduling and
consumer comfort and profitability based on GTA
operational adjustments based on energy signals like Psur
transactions and cryptocurrency values, dynamically
and Pdef. It is also helpful to pay attention to PSUR, PDEF,
adjusting thermostat settings to optimize comfort relative to
and GTAIrCC signals and run the devices on different
market conditions
schedules. Table 3 shows the load installed in Smart
industries. ;46-
𝑃𝐼𝑟𝐶𝐶;&3E =∑5)#$ ∑0#FGG
0#$ (𝑆𝐶𝑔𝑒𝑛 − 𝑆𝐻𝐶𝑙𝑜𝑎𝑑) (11)
TABLE 3
LOAD FOR SMART INDUSTRY 𝑃𝐼𝑟𝐶𝐶 (𝑃𝑠𝑢𝑟) = (Charge devices on priority basis) (12)
Device Upper TIMINGS Total quantity
lower ON and Off 𝑃𝐼𝑟𝐶𝐶 (𝑃𝑑𝑒𝑓) = (discharge devices on need basis) (13)
limits
Laptop – 0.05kW 12 hrs ON 25 per industry The inter-community controller receives
Computer consumption and generation signals simultaneously from
Critical load 3kW- 24 hrs ON 1 per Industry IrCC and SCC. Here it decides whether to sell the power or
(with 8kW use it to charge the EV and batteries in case of a
thermostats) 𝑃𝐼𝑟𝐶𝐶 (𝑃𝑠𝑢𝑟) as calculated by equation (11-13). It
HVAC 4 kw - 24 hrs ON 1 per industry calculates the surplus or deficit power at the inter-
6kw community level (PIrCC), determining whether to charge
Light(Bulb) 0.05kW 16 hrs ON 50 per Industry devices or source additional power based on real-time
Fan 0.15kW 16 hrs ON 25 per Industry signals. In the power deficit case, it either buys the power
Refrigerator 0.2kW 24 hrs ON 5 per Industry from the traders or uses that battery station as the source to
Dish Washer 0.4kW 2 hrs ON on 4 per manage that power gap.
)
(No Peak) Industry 𝐷H- (1,2): 𝐵𝐸𝑆𝑆, 𝐸𝑉 = mD$
D$
(G".-13) I344
(G".-13)JK
n (14)
)D$
)
𝐷H- (1,2): 𝐵𝐸𝑆𝑆, 𝐸𝑉 = m<$
<$
(%/4L".-13) I344
(%/4L".-13)JK
n (15)
)D$
3.3 Inter Community Controller Setup From equation (14-15), we can check the status of the
Devices at this layer act as a sink and source throughout Batteries and EV’s. These devices are activated for sink and
the day. Surplus and deficit power signals have a lot to do
source modes. Equations 14 and 15 indicate the charge or
with this layer. The sink/source decision of BESS and EVs
discharge status of Battery Energy Storage Systems (BESS)
is based on the signal at the previous hours’ time slot (t-1).
Monthly bills and profits for the amounts that the home and and EVs, activating them as power sources or sinks as
industrial communities have invested are also communicated required.
in this layer. Consumer comfort is calculated based on Psur
and GTA signals in this layer. 3.4 Inter Community Controller Setup
These devices, a complete setup of a smart city, are
(1) 0 "%&
𝐺𝑇𝐴𝑉"#$ accumulated in this section with a grid transaction agent,
∑''() 𝑇𝑃(𝐼𝑟𝐶𝐶) ) (2) 𝐺𝑟. 𝐶𝑂𝑁𝑆. 𝑃𝑅 > 𝐺𝑇𝐴𝑉 (𝐿𝑒𝑠𝑠 𝐶𝑜𝑚𝑓𝑜𝑟𝑡) (7) linking up with other smart cities and trading with all
(3) 𝐺𝑟. 𝐶𝑂𝑁𝑆. 𝑃𝑅 < 𝐺𝑇𝐴𝑉 (𝐻𝑖𝑔ℎ 𝐶𝑜𝑚𝑓𝑜𝑟𝑡) stakeholders. Solar, wind, and smart city traders are
considered for trading electricity on a priority basis. This
section concerns a central control that receives signals from

This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 License. For more information, see https://creativecommons.org/licenses/by-nc-nd/4
This article has been accepted for publication in IEEE Access. This is the author's version which has not been fully edited and
content may change prior to final publication. Citation information: DOI 10.1109/ACCESS.2024.3497752

M. M. Malik et al.: A full-fledged, multi-agent system representing the architecture of smart cities by balancing energy with optimal electricity
forecasting, integrating individual comfort, and extracting financial gains.

(𝟏). 𝑺𝑪𝑵 9-:: $; .<'&$ =($(-.


the IrCC and SCC(n). It will balance the energy demand and

generation before deciding whether to charge the agents in ∑$$F" 𝑃𝑆𝑆𝐶 0.3& (𝟐). 𝑴𝑮𝑹𝑰𝑫 9-:: $; <'() @&(1
(23)
IrCC or sell the power to another SCC or the primary grid. ⎨ (𝟑). 𝑮𝑻𝑨𝑺𝑺𝑪(𝑵) 9-:: $; ;$E-& /&'1-&.

(1) 0 𝑁𝑜 𝑝𝑟𝑜𝑓𝑖𝑡
∑''() 𝐺𝑇𝐴. 𝑆𝐶𝐶"#$
"%&
) (2)𝑇𝑟𝑎𝑛𝑠 < 2 (𝑃𝑟𝑜𝑓𝑖𝑡) (16) (𝟏). 𝑷𝑹𝑬𝑺 H3I <'J(<3< 2;&< KL9
(3)𝑇𝑟𝑎𝑛𝑠 ≥ 2 (𝑃𝑟𝑜𝑓𝑖𝑡 + 𝐸𝑛𝑒𝑟𝑔𝑦 𝑡𝑟𝑎𝑑𝑖𝑛𝑔) ⎧
⎪ (𝟐). 𝑺𝑪𝑵 H3I 2&;< ;$E-& 9M.
∑$$F" 𝑃𝑆𝑆𝐶01-2 (𝟑). 𝑴𝑮𝑹𝑰𝑫 H3I 2&;< <'() @&(1
(24)
GTAV = 𝐺𝑇𝐴. 𝑆𝐶𝐶 ∗ 𝑃𝑟𝑖𝑐𝑒 𝑜𝑓 𝑐𝑦𝑝𝑡𝑜𝑐𝑢𝑟𝑟𝑒𝑛𝑐𝑦 (17) ⎨
⎪ (𝟒). 𝑮𝑻𝑨𝑺𝑺𝑪(𝑵) H3I 2&;< ;$E-& /&'1-&.

GTA.SCC and GTAV calculate the total grid transactions
and the value of the profit earned in each hour. It computes
Equations 22 through 24 assess surplus and deficit power
GTA-based transactions and corresponding profits, adjusting
conditions, determining optimal actions for buying or selling
the grid’s trading and cryptocurrency value (GTAV) to
energy. In surplus (Psur), power can be sold to other smart
optimize hourly returns. Price can vary, and multiple grid
cities, the main grid, or traders; in deficit (Pdef), energy can
transactions can occur in a single hour.
be sourced from renewables, neighboring smart cities, the
?())
main grid, or external traders.
∑5)#$ 𝑃;K (𝑡) = q r + 𝑃-.)3&,?#$*** + Ƞ(𝐸𝑓𝑓) (18)
$***
3.5 Power Flexible Load
SCC takes the signal from the solar agent to get maximum The HVAC system uses most of the energy (above
power generated at the time (t) by evaluating irradiance (G), 50%) used in residential buildings [38]. The smart thermostat
rated power, and efficiency at the same instance, as shown in inputs real-time signals and determines whether to modify
equation (18). the temperature within the given range. According to the
ASHRAE 55-2017 standard, both upper and lower
0 𝑣 < 𝑣-.'#$ limitations of the user comfort are addressed while
⎧ 0
⎪ 𝑃"%& W
/(/"#$%&
X 𝑣-.'#$ < 𝑣 < 𝑣1%'23 constructing a thermostat controlled by power and cost
∑*'+) 𝑃, (𝑡) = /'($)* (/"#$%& (19)
⎨ 𝑃 𝑟𝑎𝑡𝑒𝑑, max 𝑣1%'23 < 𝑣 < 𝑣-.'4.'
signals received from the local controller on a real-time
⎪ basis.
⎩ 0 𝑣 > 𝑣-.'4.'
The ASHRAE standard employs an 80% acceptable
In equation (19), v is the current wind speed at time level for outdoor temperature conditions and provides two
interval t and Pmax is the maximum output power (kW) and operational bands. Smart thermostats satisfy ASHRAE
vcutout is the cut-out speed (kW), respectively. It models wind standards for tracking the outside temperature [39]. By
power output based on wind speed, adjusting for cut-in, ASHRAE Standard 55-2017, a smart thermostat makes sure
rated, and cut-out speeds to calculate Pmax dynamically. HVAC and AC systems run between 19.44°C and 27.77°C
Wind power output uncertainty is present while expanding [40]
wind power facilities in equation (20). The major difficulty 3.5.1 HVAC THERMOSTAT AGENT (HThA)
in establishing wind power systems is the technical nature of
the problems, such as real-world simulations and weather 3.5.1.1 Cooling Mode
predictions, while interacting with real-time information.
Psur and Pdef signals are received from IrCC at time
∑)#'( 0 intervals t to IaCCs. Both industrial and home HVAC work
)#$ ∑$ 𝑃NJF = 𝑃;K (𝑡) + 𝑃O (t) (20)
on the same algorithm. On the safer side, after taking the
∑)#'( 0 parameters setting from the ASHRAE standard. We set the
)#$ 𝑆𝐶𝐶𝑔𝑒𝑛 = (∑$ 𝑃NJF ) + 𝑃1-/& (21)
minimum and maximum temperatures to 20 °C and 27 °C,
respectively. TTH is taken as 23 °C.
Equation 20 shows how much energy the RES can produce
and how much can be used at peak times. The rest can be
sold to other smart cities or traders willing to buy at good 𝐶𝑜𝑚𝑓𝑜𝑟𝑡 𝑇𝑒𝑚𝑝P2Q (𝑡) = ∑5)#$(𝑇5! − 𝑇𝐻𝐸𝑅𝑀P2Q ) (25)
prices. Equation 21 provides power taken from renewables
and the power taken from the grid if renewables cannot 𝐶𝑜𝑚𝑓𝑜𝑟𝑡 𝑇𝑒𝑚𝑝PRS (𝑡) = ∑5)#$(𝑇5! + 𝑇𝐻𝐸𝑅𝑀PRS ) (26)
balance generation and consumption at some point in the
day. It determines total generation (SCCgen) by combining 𝐶𝑜𝑚𝑓𝑜𝑟𝑡 𝑇𝑒𝑚𝑝P2Q and 𝐶𝑜𝑚𝑓𝑜𝑟𝑡 𝑇𝑒𝑚𝑝PRS (𝑡) are room
renewable power with grid supply, ensuring balance during temperatures for maximum and minimum personal comfort
consumption peaks. based on Psur, Pdef and GTA signals.

0.3&
𝑃𝑆𝑆𝐶01-2 =∑/$+"(𝑆𝐶𝐶𝑔𝑒𝑛 − 𝑃𝐼𝑟𝐶𝐶) (22)

This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 License. For more information, see https://creativecommons.org/licenses/by-nc-nd/4
This article has been accepted for publication in IEEE Access. This is the author's version which has not been fully edited and
content may change prior to final publication. Citation information: DOI 10.1109/ACCESS.2024.3497752

M. M. Malik et al.: A full-fledged, multi-agent system representing the architecture of smart cities by balancing energy with optimal electricity
forecasting, integrating individual comfort, and extracting financial gains.

D𝟏℃ ;U-GG V '* WO .0& ?52V' For the most comfort in the winter, the two conditions in
D𝟐℃ ;U-GG V (* WO .0& ?52V' equation (30) must be met for the thermostats to be turned up
∑))D$ 𝑇𝐻𝐸𝑅𝑀P2Q = w (27)
to warm levels.
D𝟑℃ ;U-GG V (* WO .0& ?52VX

D𝟏℃ ;U-GG B '* WO



Equations 25 through 27 define maximum and minimum ⎪D𝟐℃ ;U-GG B (* WO
comfort temperatures, adjusting HVAC settings based on ∑))D$ 𝑇𝐻𝐸𝑅𝑀PRS = (31)
⎨D𝟑℃ ;U-GG B Y* WO
Psur, Pdef, and GTA signals. Using ASHRAE guidelines, ⎪
the thermostat adjusts toward comfort levels within a range ⎩
of 20 °C to 27 °C, influenced by conditions such as power
availability (Psur, Pdef) and grid signals, as tested with our HVAC and ACs will continuously operate in 𝑇𝐻𝐸𝑅𝑀PRS
MOPnP, MOPPnP, and knapsack algorithms. In summers, conditions as shown in equation 31, until all conditions of
THERMMAX is calculated to be comfortable moving toward 𝑇𝐻𝐸𝑅𝑀P2Q are satisfied as seen in figure 3.
lower thermostat readings from TTH. conditions for every 1
°C are written in this equation after proper modeling and
prediction of the solution through our tested knapsack,
MOPnP, and MOPPnP. For HVAC to operate at maximum
comfort, it must satisfy the conditions mentioned as shown
in figure 2.

FIGURE 3. HVAC Winter (Heating Mode)

3.6 Algorithms and agent Setup


3.6.1 PADE (Agent Setup):
Python has a specialized setting for initializing and
interacting with agents. OsBrain, developed by
FIGURE 2. HVAC Summer (Cooling Mode) OpenSistemas, is utilized in this multi-agent communication
configuration. OsBrain makes multi-hierarchical structure
3.5.1.2 Heating Mode: design and development more accessible. While conducting
simulations, entities can be reorganized and function as
𝐶𝑜𝑚𝑓𝑜𝑟𝑡 𝑇𝑒𝑚𝑝P2Q (𝑡) = ∑5)#$(𝑇5! + 𝑇𝐻𝐸𝑅𝑀P2Q ) (28) agents. This enables the creation of robust, intelligent, and
adaptable multi-agent systems. The core components of this
𝐶𝑜𝑚𝑓𝑜𝑟𝑡 𝑇𝑒𝑚𝑝PRS (𝑡) = ∑5)#$(𝑇5! − 𝑇𝐻𝐸𝑅𝑀PRS ) (29) library are numerical computing, automated data, and
analytical tools. In the suggested approach, MOPnP AND
MOPPnP each have distinct classes. When necessary,
𝐶𝑜𝑚𝑓𝑜𝑟𝑡 𝑇𝑒𝑚𝑝P2Q is user comfort temperature with
controllers use these agents' capabilities.
modification due to PSUR, PDEF and GTA signals.
Equation 28 and 29 elaborate the maximum and minimum
3.6.2 Graph Neural Network:
comfort setting of the thermostat.
Using this approach in our model comprises a graph
<𝟏℃ ;U-GG V '* WO .0& ?52V' that is divided into its constituent components, each of which
⎧ functions as a node and communicates with the others
⎪ <𝟐℃ ;U-GG V (* WO .0& ?52V'
∑))D$ 𝑇𝐻𝐸𝑅𝑀P2Q = <𝟑℃ ;U-GG V (* WO .0& ?52VX (30)

⎪ <𝟒℃ ;U-GG V Y* WO .0& ?52V(

This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 License. For more information, see https://creativecommons.org/licenses/by-nc-nd/4
This article has been accepted for publication in IEEE Access. This is the author's version which has not been fully edited and
content may change prior to final publication. Citation information: DOI 10.1109/ACCESS.2024.3497752

M. M. Malik et al.: A full-fledged, multi-agent system representing the architecture of smart cities by balancing energy with optimal electricity
forecasting, integrating individual comfort, and extracting financial gains.

through the graph's edges, as elaborated in Figure 4. Where:


Xt is the input at time step t.
ht is the hidden state at time step t.
ct is the cell state at time step t.
it, ft , gt, and ot, are the input gate, forget gate, cell state,
and output gate activations, respectively.
W and b are weight matrices and bias vectors for
different gates (e.g., Wii corresponds to the
input gate weight matrix for input-to-input
connections).
σ is the sigmoid activation function
FIGURE 4. GNN Model Forecast Framework tanh is the hyperbolic tangent activation
function.
Each node locally calculates the GNN's final output
depending on the unit's current state and updates the previous
local best value. Carefully regulating the rate of this diffusion
process ensures that there is always just one stable
equilibrium.

𝑔 = (𝑝, 𝑜)

𝑄(Z<$) = 𝜎 (𝐾𝑄(Z) 𝑤 (Z) ) (32)


FIGURE 5. Smart Hybrid Model Forecast Framework
𝑌 = ∑UZ#* 𝑄Z (33)
3.6.4 GTA: (Grid Price Transaction Agent)
Where 𝑝[ ∈ 𝑝 show the nodes and 𝑜[\ ∈ 𝜀 is the directed It was made to keep track of every price change within
edge from 𝑜[ to 𝑜\ . The quantitative connections between the parameters set. The agent divides the range into
nodes are also represented by an adjacency matrix 𝐾. The numerous grid levels, placing a purchase or sell limit order
features extracted from the layer 𝑙 are represented by 𝑄(Z) on each level. This lets the agent buy when the price of an
and the weights of layer are given by 𝑤 (Z) . The output of the asset goes down and sell when it goes up each day. It would
GNN model which is the forecasted value of load is given by help if you had both coins and USDT to trade.
𝑌. i. Upper and lower grid levels are the range limits
where the GTA trades.
3.6.3 Smart Hybrid Algorithm ii. These levels are decided w.r.t specific
The suggested model, which forecasts load cryptocurrencies. as the grid does constant
demand, is built on a hybrid architecture that combines the lower buying and upper selling, for the safety
use of GNN and LSTM, to determine the optimal value or of the investor (trader), the lower grid is far
global maximum. This architecture is shown in figure 5. more critical than the upper one to avoid losses.
Several simulations take place between these layers to iii. The GTA algorithm will not place any orders
acquire the best outcomes. This novel method combines the at the starting price level, because of this, GTA
power and potential of two algorithmic layers to improve the will not be able to purchase and sell coins at the
model's prediction performance.
same price, which will prohibit it from making
a 0% profit deal.
This novel method simulates both eq (33) and eq (34) for
getting the best possible value of electricity forecasting, iv. The algorithm converts all levels lower than the
referred to as the global best between the layers of these current price into buy orders, and levels higher
algorithms. than the current price are converted into sell
orders. Figure 6 and 7 show trading setup 2 and
1 applied on Solana and Ethereum blockchains.
it=σ(Wii⋅xt+bii+Whi⋅ht−1+bhi v. When the price of the cryptocurrency on the
ft=σ(Wif⋅xt+bif+Whf⋅ht−1+bhf) chart rises and passes through a sell grid level,
gt=tanh(Wig⋅xt+big+Whg⋅ht−1+bhg) (34) a profit is earned since the coin is sold and the
ct=ft⋅ct−1+it⋅gt sell order is filled.
ot=σ(Wio⋅xt+bio+Who⋅ht−1+bho) vi. Whenever the chart price falls and crosses a
ht=ot⋅tanh(ct) buy grid level, the buy limit order created by

This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 License. For more information, see https://creativecommons.org/licenses/by-nc-nd/4
This article has been accepted for publication in IEEE Access. This is the author's version which has not been fully edited and
content may change prior to final publication. Citation information: DOI 10.1109/ACCESS.2024.3497752

M. M. Malik et al.: A full-fledged, multi-agent system representing the architecture of smart cities by balancing energy with optimal electricity
forecasting, integrating individual comfort, and extracting financial gains.

the grid algorithm earlier is filled. GTA then 4. All appliances should only utilize the amount of
places a new sell order one level higher. electricity per hour, calculated in the
linked knapsack (t).

𝑃(𝑡) ≤ ∑5)#$ ∑0#2130)4


0#$ (𝑆𝑡*$ ∗ 𝑃. 𝑊(-.)/01) ) (35)

Total power required P(t) should be lower than or equal to


the total power calculated at each time. and 𝑆𝑡*$ stands for the
states of the appliances. At most, the total amount of
electricity required throughout each hour must be lower than
the 𝑃. 𝑊(-.)/01) and sum of the ratings of the loads.
FIGURE 6. GTA Applied On Energy Trading setup 2 (Solana)
3.6.7 Multi Objective Plug and play: (MOPnP)
An iterative online method is the MOPnP. In every
iteration, subsets of measurements are supplied to the
controllers, who subsequently systematically make decisions
for the devices. Plugging devices at low and high price
patterns creates optimal demand dispatch patterns on the
consumption side. This algorithm works on managing the
generation and load-side patterns.
FIGURE 7. GTA Applied On Energy Trading setup 1 (Ethereum)
3.6.8 Multi Objective Prioritized Plug and play:
3.6.5 HThA Algorithm MOPPnP is an advanced and complex version of
Its value depends on surplus power (Psur), deficit power PnP and MOPnP. Iterations are done for demand dispatch
(Pdef), and GTA price signals. through MOPPnP. It takes in knapsack for power rating
1. The intra-community controller (IaCC) sends calculations. First, demand response signals from Psur are
formulated and passed on by MOPnP. After their successful
demand-dispatch consumption signals to determine
implementation, demand dispatch signals are calculated by
the energy gap. The cryptocurrency trading bot's
RTP and day-ahead alerts can adjust the thermostat. MOPPnP to close the energy gap. It prioritizes the timings of
Based on hourly and daily profits, the thermostat devices by taking signals from GTA and PSCC and checking
adjusts. for the most critical loads when RES generates the least
2. GTA communities that pick Ethereum coins gained power.
a profit in the previous hour. The next hour, the
IV. RESULTS AND DISCUSSIONS
HVAC would function at greater personal comfort
levels. A smart city consists of multiple connected cities. First,
3. Surplus signals require simple access to cheap RES we took Spain's electricity consumption data. We applied our
and profit signals from the GTA the previous hour neural network networks, such as GNN and the smart hybrid
(t-1) or day for real-time and day-ahead energy model, to get optimal electricity consumption forecasting
planning. results, as shown in Figure 8. It shows the load forecast for
the next thirty days without the smart hybrid model
3.6.6 Knapsack outperforming other techniques. The forecasting parameters
The main goals of this knapsack are to save costs and results are shown in Table 4. After getting these results,
and optimally set the scheduling time. In this part, we we applied these models to a smart home setup, as seen in
use the Multiple Knapsack Problem (MKP) criteria to Figure 9. From the consumption data, we considered five
figure out the best possible power ratings at which middle-income homes, five high-income homes, five smart
devices should operate. The MKP is a resource industries, RES, battery storage, and investors connected
allocation problem with (m) resource capacity, a through a smart city structure.
collection of n items (agents), and j knapsacks (Power Considering DR and DD consumption signals, we
rating). considered two cases. Case 1 comprises high renewable-
1. Take each time slot's "j" number of knapsacks as a generation integration, monthly billing, and capital costs.
power rating. Total agents behave as the total However, Case 2 is a low renewable generation case with
number of Knapsack(J). lower capital and operational costs. Everyone can easily
2. Power usage by any component during any time "t" adopt this system according to their needs and priorities.
is treated as weight in the knapsack. A coding framework like this could input any
3. Depending on the state of the electrical device, the parameters according to the consumer's needs and type of
binary variable "St" can be either 0 or 1. system. The computation workstation specification is
LENOVO system model 30BBS2UV00 with an Intel®
10

This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 License. For more information, see https://creativecommons.org/licenses/by-nc-nd/4
This article has been accepted for publication in IEEE Access. This is the author's version which has not been fully edited and
content may change prior to final publication. Citation information: DOI 10.1109/ACCESS.2024.3497752

M. M. Malik et al.: A full-fledged, multi-agent system representing the architecture of smart cities by balancing energy with optimal electricity
forecasting, integrating individual comfort, and extracting financial gains.

Xeon® Gold 5118 CPU @ 2.30 (48 CPUs) processor and 32


GB memory.
4.1 Complete Setup Profiles:
4.1.1 Case 1: (High – RES Penetration)
Case 1 is integrated with a high volume of RES. The
high share of RES allows the maximum load to settle during
high-generation renewables. Figure 10 illustrates the
complete smart city energy setup while showing that excess
power can be sold to other SCs and the main grid. The
consumption patterns are forecasted through our smart
hybrid model, and all energy planning is done according to FIGURE 9. Consumption Forecasting (24 Hours)
the optimal forecast we get for the next day.
Figure 11 shows the consumption patterns according to
the unscheduled load, the load scheduled with MOPnP, and
the load scheduled with MOPPnP. These signals are then
sent to GTA, which check the transactions from the day
before and makes critical changes to the HVAC thermostat
based on transaction signals of the desired cryptocurrencies.
For adjusting the power consumption

FIGURE 10. Case 1 Complete Setup (Signals at IrCC)

FIGURE 8. Consumption Forecasting (30 Days)

TABLE 4
ELECTRICITY FORECASTING TECHNIQUES AND PARAMETERS
Electricity Forecasting parameters
Technique Mean Mean Mean FIGURE 11. Load Profile Case 1
applied Squared Absolute Absolute
Error Error Percentage
Error
GNN 3946616017 52671.64105 0.078719119
Smart
Hybrid 4082942556 52378.62965 0.077603803
Model

FIGURE 12. Forecasted Load with GNN, SMH, High Comfort and MOPPnP

MOPPnP integrates with the current model, and


HVAC has to be adjusted according to GTA and power
signals in this section, as shown in the figure. Now, Figure
12 explains the load forecasted with our algorithms and how
the load is adjusted for higher comfort using MOPPnP. Once
MOPPnP adjusts the load, our trading setups further adjust it

11

This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 License. For more information, see https://creativecommons.org/licenses/by-nc-nd/4
This article has been accepted for publication in IEEE Access. This is the author's version which has not been fully edited and
content may change prior to final publication. Citation information: DOI 10.1109/ACCESS.2024.3497752

M. M. Malik et al.: A full-fledged, multi-agent system representing the architecture of smart cities by balancing energy with optimal electricity
forecasting, integrating individual comfort, and extracting financial gains.

by integrating GTA. First, the load is forecasted, then


adjusted with MOPPnP, and then through efficient trading, it
is adjusted more, as shown in Figure 13.

FIGURE 13. Load Adjustments with Electricity Market (Case 1)

In Figures 14 and 15, the lower and upper comfort


HVAC statuses are adjusted according to the surplus and
deficit kWh signals. All conditions are checked according to
the GTA algorithm and MOPPnP before being dispatched.
GTA operates at both SCC and IrCC levels. We have utilized
GTA transactions for inter-community energy trading based
on transactions in 1 day, later towards 30 days, and finally
towards 90 days, encapsulating completely.

FIGURE 15. Energy Signals at LrCC with Trading setup 3 (Dot), Trading
setup 2 (Sol) and HVAC thermostats

After looking at how much energy is used, made,


and stored, these signals are sent to the pricing agent. Real-
time pricing of unscheduled consumption (U C), Lowest
consumer comfort (L C C), and scheduled consumption with
MOPPnP consumption (S M C) is shown in figure 16 and 17.
A considerable curtailment can be seen with the integration
of RES, forecasting algorithms, and investigating MOPPnP
for the trade-off between comfort and price (through GTA).

FIGURE 16. Energy Signals at LrCC with Trading setup 3 (Dot), Trading
setup 2 (Sol) and HVAC thermostats

FIGURE 14. Energy Signals at LrCC with Trading setup 1 (ETH), Trading
setup 2 (APE) and HVAC thermostats

12

This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 License. For more information, see https://creativecommons.org/licenses/by-nc-nd/4
This article has been accepted for publication in IEEE Access. This is the author's version which has not been fully edited and
content may change prior to final publication. Citation information: DOI 10.1109/ACCESS.2024.3497752

M. M. Malik et al.: A full-fledged, multi-agent system representing the architecture of smart cities by balancing energy with optimal electricity
forecasting, integrating individual comfort, and extracting financial gains.

FIGURE 17. Monthly Billing (Case 1) FIGURE 20. Forecasted Load with GNN, SHM, High Comfort and MOPPnP

4.1.2. Case 2: (Lower-RES penetration)


Case 2 incorporates a lower amount of RES for the
forecasted load. The maximum load can be met when
renewables produce peak power, and the rest of the electrical
consumption requirement is taken care of by buying from
other SCs, traders, or the main grid. Excess electricity can be
sold to other SCs and the main grid, as shown in Figure 18.
In this case, lower capital costs ensure a higher ROI and short
payback periods. Figure 19 shows the unscheduled load, the
load that is scheduled based on low consumer comfort using
MOPnP, and the load that is scheduled using MOPPnP. It
FIGURE 21. Load Adjustments With Electricity Market (Case 2)
affects the amount of energy required to balance the
consumption side. Considerably lower values can be seen in
total generation due to less integrated RES generation and
low consumer comfort. Figure 20 shows how the load is
predicted using our algorithms and how MOPPnP is used to
modulate the load for increased comfort.

FIGURE 18. Case 2 Complete Setup (Signals at IrCC)

FIGURE 22. Energy Signals at LrCC with Trading setup 1 (ETH), Trading
FIGURE 19. Load Profile Case 2 (Before Vs Adjusted) setup 2 (APE) and HVAC thermostats

13

This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 License. For more information, see https://creativecommons.org/licenses/by-nc-nd/4
This article has been accepted for publication in IEEE Access. This is the author's version which has not been fully edited and
content may change prior to final publication. Citation information: DOI 10.1109/ACCESS.2024.3497752

M. M. Malik et al.: A full-fledged, multi-agent system representing the architecture of smart cities by balancing energy with optimal electricity
forecasting, integrating individual comfort, and extracting financial gains.

As shown in figure 21, these consumption signals All these decisions are taken at the IrCC level, and
are further processed and synchronized by load adjustment the signals are then passed on to the SCC level to make
using trading setups that include GTA of Ethereum, APE, different decisions based on the GTA of the SCC. Figure 25
Dot, and Sol. The HVAC agent takes the signals from GTA depicts the monthly bill reductions before they are forwarded
and IrCC to decide whether to operate within the minimum to SCC for further evaluation of buying and selling excess or
and maximum comfort ranges. In this case of lower RES deficit electricity energy.
integration, surplus power is less than in Case 1. As a result,
HVAC operates near the threshold rather than at more
personal comfort levels. Figure 22-23 explains how HVAC
makes decisions on points of GTA and power supply deficit.

FIGURE 25. Monthly billing (Case 2)

4.2 Complete GTA Transactions for SCC and IrCC


Trading’s:
Figure 26 shows the real-time data of total GTA
transactions for August, September, and October. Traders,
investors, and stakeholders can get their profits according to
their chosen trading setup and plan. Energy can be bought
and sold in the T or for T+1 hour based on RES generation
and GTA transactions. Sol(Solana) has the highest number
of transactions in the three-month time frame.

FIGURE 23. Energy Signals at LrCC with Trading setup 3 (Dot), Trading
setup 2 (Sol) and HVAC thermostats
FIGURE 26. Grid Transaction Agent (GTA) (Transactions in Real-Time)

FIGURE 24. Real Time Pricing (Case 2)


FIGURE 27. Grid Transaction Agent (GTA) (Total Transactions)

After considering how much energy is consumed,


generated, and stored, the pricing agent gets these signals, as
illustrated in Figure 24.
14

This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 License. For more information, see https://creativecommons.org/licenses/by-nc-nd/4
This article has been accepted for publication in IEEE Access. This is the author's version which has not been fully edited and
content may change prior to final publication. Citation information: DOI 10.1109/ACCESS.2024.3497752

M. M. Malik et al.: A full-fledged, multi-agent system representing the architecture of smart cities by balancing energy with optimal electricity
forecasting, integrating individual comfort, and extracting financial gains.

Figure 27 shows the total number of transactions they can invest in getting profits in the form of extra energy
done in 90 days from August to October 2022. Figure 28 units and the comfort they are aiming for. HVAC agents
shows the total profit percentage and asset value operate according to the proposed model based on ASHRAE
accumulated from applying these agents. Energy units can be standards, GTA, and surplus/deficit power signals. Two load
bought with these profits, and investors can enjoy these profiles and four cryptocurrency scenarios revealed the total
profits. Table 5 shows all the parameters and results achieved cost analysis, power utilization, cryptocurrency-based power
by running the simulations on all four trading setups. trading, load balancing, emission curtailment, and user
comfort. The involvement of cryptocurrencies has noticed an
increase in total assets of 116.264%, 78.18%, 71.63%, and
250.9%.

Acknowledgements
This work is indorsed by U.S.-Pakistan Center for Advanced
Studies in Energy, National University of Sciences and
Technology, Islamabad, Pakistan.

VI. REFERENCES

FIGURE 28. Total Profit Percentage and Real Asset Value


[1] S. Wang, X. Wang, S. Wang, and D. Wang, “Bi-
directional long short-term memory method based
TABLE 5
CRYPTOCURRENCIES BEHAVIOR AND GTA TRANSACTIONS on attention mechanism and rolling update for
short-term load forecasting,” Int. J. Electr. Power
Total
Price at Profit GTA’s Energy Syst., vol. 109, pp. 470-479, 2019.
Agen Gri Profit per
Coin
Name
(Date:
12/3/202
Limit
s
t
per
grid
d Transactio
Transactio
ns in 3
doi.org/10.1016/j.ijepes.2019.02.022.
2)
type
(%)
size n
months [2] A. Al Mamun, M. Sohel, N. Mohammad, M. S. H.
(Aug –
Oct) Sunny, D. R. Dipta, and E. Hossain, “A
Eth
300 $ comprehensive review of the load forecasting
- 0.94 47
(Ethereu
m)
1702 $
5000
GTA
% $
9.4 129 techniques using single and hybrid predictive
$
Ape
models,” IEEE Access, vol. 8, pp. 134911-134939,
1$ - 0.2
(ApeCoin 7.26 $
25$
GTA 1%
4$
10 116 2020. doi.org/10.1109/ACCESS.2020.3010702
)
Dot [3] D. Niu, Z. Ji, W. Li, X. Xu, and D. Liu, “Research
2$- 0.90 0.2
(PolkaDot
)
8.98 $
27 $
GTA
% 5$
9 101
and application of a hybrid model for mid-term
Sol
43.21 $
3$ -
GTA
1.20 0.6
12 263
power demand forecasting based on secondary
(Solana) 67$ % 4$
decomposition and interval optimization,” Energy,
vol. 234, p. 121145, 2021.
doi.org/10.1016/j.energy.2021.121145.
V. CONCLUSION
[4] S. N. Fallah, R. C. Deo, M. Shojafar, M. Conti, and
The historical energy consumption data for smart city S. Shamshirband, “Computational intelligence
was trained and tested in this study. Neural network methods, approaches for energy load forecasting in smart
including GNN and smart hybrid models, are utilized to energy management grids: state of the art, future
provide the best-predicting results for power consumption. It challenges, and research directions,” Energies, vol.
demonstrates that in terms of MAPE, MSE, and MAE 11, no. 3, p. 596, 2018. doi:10.3390/en11030596.
values, the proposed smart hybrid model with load forecast [5] N. Ayub et al., “Big data analytics for short and
outperforms alternative methods. This study builds a medium-term electricity load forecasting using an
practical model to operate among various tiers of AI techniques ensembler,” Energies, vol. 13, no.
community-based smart cities. MOPnP, MOPPnP, GTA, 19, p. 5193, 2020. doi:10.3390/en13195193.
and Knapsack are used to make an intelligent strategy in a [6] R. Lu, S. H. Hong, and M. Yu, “Demand response
multi-agent environment. It has been shown that a working for home energy management using reinforcement
model of several cryptocurrencies and their smart learning and artificial neural network,” IEEE Trans.
transactions can help people trade electricity more Smart Grid, vol. 10, no. 6, pp. 6629-6639, 2019.
efficiently. A mix of DD and DR signal models has been Doi: 10.1109/TSG.2019.2909266.
used to achieve the best results. GTA, HVAC (smart [7] R. Hemmati and H. Saboori, “Stochastic optimal
thermostat), and specialized codes for each controller (IrCC, battery storage sizing and scheduling in home
IaCC, and SCC) has been implemented for optimal outcomes energy management systems equipped with solar
based on the power, trading, cost, comfort, and profitability photovoltaic panels,” Energy Build., vol. 152, pp.
indices of stakeholders. Homes and industries are separated 290-300, 2017. doi:10.1016/j.enbuild.2017.07.043
based on how well they can afford their monthly bills, and

15

This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 License. For more information, see https://creativecommons.org/licenses/by-nc-nd/4
This article has been accepted for publication in IEEE Access. This is the author's version which has not been fully edited and
content may change prior to final publication. Citation information: DOI 10.1109/ACCESS.2024.3497752

M. M. Malik et al.: A full-fledged, multi-agent system representing the architecture of smart cities by balancing energy with optimal electricity
forecasting, integrating individual comfort, and extracting financial gains.

[8] M. Killian, M. Zauner, and M. Kozek, Systems,” e-Prime, p. 100006, Oct. 2021, doi:
“Comprehensive smart home energy management 10.1016/j.prime.2021.100006.
system using mixed-integer quadratic- [18] H. ben Abdeljawed and L. el Amraoui, “Prospects
programming,” Appl. Energy, vol. 222, pp. 662- for synergies between low-voltage DC microgrid
672, 2018. technology and peer-to-peer energy trading
doi.org/10.1016/j.apenergy.2018.03.179. markets,” Sustainable Production and
[9] H. Kim, H. Choi, H. Kang, J. An, S. Yeom, and T.
Consumption, vol. 28. Elsevier B.V., pp. 1286–
Hong, “A systematic review of the smart energy
1296, Oct. 01, 2021. doi:
conservation system: From smart homes to
10.1016/j.spc.2021.07.029.
sustainable smart cities,” Renewable and
[19] X. B. Jin et al., “Deep-learning forecasting method
Sustainable Energy Reviews, vol. 140. Elsevier Ltd,
for electric power load via attention-based encoder-
Apr. 01, 2021. doi: 10.1016/j.rser.2021.110755.
decoder with bayesian optimization,” Energies, vol.
[10] F. G. Papi, J. F. Hübner, and M. de Brito, “A
14, no. 6, p. 1596, 2021. doi.org:
Blockchain integration to support transactions of
10.3390/en14061596.
assets in multi-agent systems,” Eng Appl Artif
[20] Q. Yu and Z. Li, “Correlated load forecasting in
Intell, vol. 107, Jan. 2022, doi:
active distribution networks using Spatial-
10.1016/j.engappai.2021.104534.
Temporal Synchronous Graph Convolutional
[11] A. Kolahan, S. R. Maadi, Z. Teymouri, and C.
Networks,” IET Energy Syst. Integr., vol. 3, no. 3,
Schenone, “Blockchain-based solution for energy
pp. 355-366, 2021. doi: 10.1049/esi2.12028.
demand-side management of residential buildings,”
[21] L. Lu and B. Lyu, “Reducing energy consumption
Sustain Cities Soc, vol. 75, Dec. 2021, doi:
of Neural Architecture Search: An inference
10.1016/j.scs.2021.103316.
latency prediction framework,” Sustain. Cities Soc.,
[12] W. Xu, J. Li, M. Dehghani, and M.
vol. 67, p. 102747, 2021.
GhasemiGarpachi, “Blockchain-based secure
doi.org/10.1016/j.scs.2021.102747.
energy policy and management of renewable-based
[22] A. Al Mamun, M. Hoq, E. Hossain, and R.
smart microgrids,” Sustain Cities Soc, vol. 72, Sep.
Bayindir, “A hybrid deep learning model with
2021, doi: 10.1016/j.scs.2021.103010.
evolutionary algorithm for short-term load
[13] M. Raval, S. Bhardwaj, A. Aravelli, J. Dofe, and H.
forecasting,” in Proc. 8th Int. Conf. Renewable
Gohel, “Smart energy optimization for massive IoT
Energy Research and Applications (ICRERA), pp.
using artificial intelligence,” Internet of Things
886-891, Nov. 2019. doi:
(Netherlands), vol. 13, Mar. 2021, doi:
10.1109/ICRERA47325.2019.8996550
10.1016/j.iot.2020.100354.
[23] A. Ozcan, C. Catal, and A. Kasif, “Energy load
[14] U. Majeed, L. U. Khan, I. Yaqoob, S. M. A. Kazmi,
forecasting using a dual-stage attention-based
K. Salah, and C. S. Hong, “Blockchain for IoT-
recurrent neural network,” Sensors, vol. 21, no. 21,
based smart cities: Recent advances, requirements,
p. 7115, 2021. doi.org/10.3390/s21217115.
and future challenges,” Journal of Network and
[24] S. Kazmi, N. Javaid, M. J. Mughal, M. Akbar, S. H.
Computer Applications, vol. 181. Academic Press,
Ahmed, and N. Alrajeh, “Towards optimization of
May 01, 2021. doi: 10.1016/j.jnca.2021.103007.
metaheuristic algorithms for IoT enabled smart
[15] X. Luo, W. Shi, Y. Jiang, Y. Liu, and J. Xia,
homes targeting balanced demand and supply of
“Distributed peer-to-peer energy trading based on
energy,” IEEE Access, vol. 7, pp. 24267-24281,
game theory in a community microgrid considering
2017. doi: 10.1109/ACCESS.2017.2763624
ownership complexity of distributed energy
[25] K. Muralitharan, R. Sakthivel, and Y. Shi,
resources,” J Clean Prod, vol. 351, Jun. 2022, doi:
“Multiobjective optimization technique for demand
10.1016/j.jclepro.2022.131573.
side management with load balancing approach in
[16] H. J. Kim, M. K. Kim, and J. W. Lee, “A two-stage
smart grid,” Neurocomputing, vol. 177, pp. 110-
stochastic p-robust optimal energy trading
119, 2016. doi.org/10.1016/j.neucom.2015.11.015.
management in microgrid operation considering
[26] M. Tan, Y. Zhou, L. Wang, Y. Su, B. Duan, and R.
uncertainty with hybrid demand response,”
Wang, “Fair-efficient energy trading for microgrid
International Journal of Electrical Power and
cluster in an active distribution network,”
Energy Systems, vol. 124, Jan. 2021, doi:
Sustainable Energy, Grids and Networks, vol. 26,
10.1016/j.ijepes.2020.106422.
Jun. 2021, doi: 10.1016/j.segan.2021.100453.
[17] M. S. Javadi et al., “Conditional Value-at-Risk
[27] M. S. Aliero, K. N. Qureshi, M. F. Pasha, and G.
Model for Smart Home Energy Management
Jeon, “Smart Home Energy Management Systems

16

This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 License. For more information, see https://creativecommons.org/licenses/by-nc-nd/4
This article has been accepted for publication in IEEE Access. This is the author's version which has not been fully edited and
content may change prior to final publication. Citation information: DOI 10.1109/ACCESS.2024.3497752

M. M. Malik et al.: A full-fledged, multi-agent system representing the architecture of smart cities by balancing energy with optimal electricity
forecasting, integrating individual comfort, and extracting financial gains.

in Internet of Things networks for green cities [37] W. El-Baz, P. Tzscheutschler, and U. Wagner,
demands and services,” Environmental Technology “Integration of energy markets in microgrids: A
and Innovation, vol. 22. Elsevier B.V., May 01, double-sided auction with device-oriented bidding
2021. doi: 10.1016/j.eti.2021.101443. strategies,” Appl Energy, vol. 241, pp. 625–639,
[28] X. Qu, H. Hui, Y. Ding, and K. Luan, “Optimal May 2019, doi: 10.1016/j.apenergy.2019.02.049.
Control of Intelligent Electricity Consumption for [38] V. Vakiloroaya, B. Samali, A. Fakhar, and K.
Residential Customers Considering Demand Pishghadam, “A review of different strategies for
Response,” in Energy Procedia, 2018, vol. 145, pp. HVAC energy saving,” Energy Convers Manag,
510–515. doi: 10.1016/j.egypro.2018.04.074. vol. 77, pp. 738–754, 2014, doi:
[29] H. E. Keshta, A. A. Ali, E. M. Saied, and F. M. 10.1016/j.enconman.2013.10.023.
Bendary, “Real-time operation of multi-micro-grids [39] K. J. Lomas and R. Giridharan, “Thermal comfort
using a multi-agent system,” Energy, vol. 174, pp. standards, measured internal temperatures and
576–590, May 2019, doi: thermal resilience to climate change of free-running
10.1016/j.energy.2019.02.145. buildings: A case-study of hospital wards,” Build
[30] S. A. Mansouri, A. Ahmarinejad, E. Nematbakhsh, Environ, vol. 55, pp. 57–72, Sep. 2012, doi:
M. S. Javadi, A. R. Jordehi, and J. P. S. Catalão, 10.1016/j.buildenv.2011.12.006.
“Energy management in microgrids including smart [40] 40. ASHRAE, “Thermal environmental conditions
homes: A multi-objective approach,” Sustain Cities for human occupancy,” ANSI/ASHRAE Standard
Soc, vol. 69, Jun. 2021, doi: 55, pp. 1-5, 1992
10.1016/j.scs.2021.102852.
[31] M. S. Javadi et al., “Self-scheduling model for
Appendix A:
home energy management systems considering the
end-users discomfort index within price-based Algorithm for Level 1 / Consumer Layer:
demand response programs,” Sustain Cities Soc,
a. Home controller: Communicating home agents through PADE and their
vol. 68, May 2021, doi: 10.1016/j.scs.2021.102792. working
[32] V. F. Yu, T. H. A. Le, and J. N. D. Gupta, b. Kick start all agents
“Sustainable microgrid design with multiple c. Dummy message sending/receiving (response time = 0.1s)
d. Register devices w.r.t community type 1-n
demand areas and peer-to-peer energy trading
involving seasonal factors and uncertainties,” While n<N: // Total number of devices
Renewable and Sustainable Energy Reviews, vol. Initialization of agents:
Send the message
161, Jun. 2022, doi: 10.1016/j.rser.2022.112342. Receive the proposal message and information from agent n
[33] G. Vieira and J. Zhang, “Peer-to-peer energy n++
end
trading in a microgrid leveraged by smart
e. Total number of homes ( 1-h )
contracts,” Renewable and Sustainable Energy While h<H: // Total number of homes
Reviews, vol. 143, Jun. 2021, doi: 1. Send the message
2. Receive the proposal message and information from home h
10.1016/j.rser.2021.110900.
3. n++
[34] Y. C. Tsao and V. van Thanh, “Toward sustainable 4. end
microgrids with blockchain technology-based peer- time slots (t=1,24)
While t<=24:
to-peer energy trading mechanism: A fuzzy meta- 1. Send signals assigned hr
heuristic approach,” Renewable and Sustainable 2. Receive signals assigned hr
Energy Reviews, vol. 136, Feb. 2021, doi: f. Function Call (Controller): def Rich home, def middle home , def poor
home
10.1016/j.rser.2020.110452. Def rich home(): (PnP)
[35] Z. Wang, X. Yu, Y. Mu, H. Jia, Q. Jiang, and X. While Pgen > Pthreshold:
Plug in 1:
Wang, “Peer-to-Peer energy trading strategy for Inflexible loads
energy balance service provider (EBSP) Plug in 2:
considering market elasticity in community Best optimal HVAC performance (Ashire Standard)
Plug in 3:
microgrid,” Appl Energy, vol. 303, Dec. 2021, doi: Schedule Time Controllable Load (PPnP)
10.1016/j.apenergy.2021.117596. Priority Plug in (Device 1 (washing machine))
[36] S. Xu, Y. Zhao, Y. Li, and Y. Zhou, “An iterative Priority Plug in (Device 2 (iron))
Priority Plug in (Device 3 (dish washer))
uniform-price auction mechanism for peer-to-peer Else :
energy trading in a community microgrid,” Appl Plug in 1:
Inflexible loads
Energy, vol. 298, Sep. 2021, doi:
Plug in 2:
10.1016/j.apenergy.2021.117088. Lowest optimal HVAC performance (Ashire Standard)

17

This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 License. For more information, see https://creativecommons.org/licenses/by-nc-nd/4
This article has been accepted for publication in IEEE Access. This is the author's version which has not been fully edited and
content may change prior to final publication. Citation information: DOI 10.1109/ACCESS.2024.3497752

M. M. Malik et al.: A full-fledged, multi-agent system representing the architecture of smart cities by balancing energy with optimal electricity
forecasting, integrating individual comfort, and extracting financial gains.

Def middle home():


While Pgen > Pthreshold:
Plug in 1:
Inflexible loads
Plug in 2:
Best optimal AC performance (Ashire Standard)
Plug in 3:
Schedule Time Controllable Load (PPnP)
Priority Plug in (Device 1 (washing machine))
Priority Plug in (Device 2 (iron))
Priority Plug in (Device 3 (dish washer))
Else:
Plug in 1:
Inflexible loads
Plug in 2:
Lowest optimal AC performance (Ashire Standard)
Def Poor home():
If (Pgen>Pthreshold)
Plug in 1:
Inflexible loads
Plug in 2:
Schedule Time Controllable Load (PPnP)
Priority Plug in (Device 1 (washing machine))
Priority Plug in (Device 2 (iron))
Plug in 1:
Inflexible loads

Algorithm for Level 2 / Community Layer:

Local Community controller (L.C.C):


• Initialize duplex communication between H.C and L.C.C through
PADE.
• Kick start related agents.
• Dummy message sending/receiving (response time = 0.1s)
• Register devices w.r.t community type 1-n
While n<N: // Total number of devices
1. Send the message
2. Receive the proposal message and information
from agent n
3. n++
4. end
• Priority assigned 1,….,p(n)
While h<H: // total number of devices
5. Send the message
6. Assign priority to the agents
7. P++
8. end
• time slots (t=1,24)
While t<=24:

1. Send signals assigned hr


2. Receive signals assigned hr
• Function Call (Controller):
• Def Local_Community_Controller(): (PPnP)
While Pgen > Pthreshold:
Priority (1) //Psur +ve used for charging purposes
BESS(-VE)
Priority (2)
S.S.B(-VE)
Plug in 3
E.V(-VE)
Else : //Psur -ve
Priority (1) //Psur +ve used for charging purposes
BESS(+VE)
Priority (2)
S.S.B(+VE)
Plug in 3
E.V(+VE)
// Functions to be called
BESS().

18

This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 License. For more information, see https://creativecommons.org/licenses/by-nc-nd/4

You might also like