ArticlePDF Available

Coalition based Game Theoretic Energy Management System of a Building as-service-over Fog_ With Source _Code

Authors:

Abstract and Figures

For the better management of energy, a coordination based energy management system as-a-service on fog is presented. An efficient system model is introduced to handle a social networking problem in order to maintain the balance between the produced and the required energy. This social network problem is formulated as a game theory based coalition method. With the increase in number of electricity consumers, the computational complexity of energy management system is becoming a threat for system efficiency in real-time environment. To deal with this dilemma, the service providers shift their computational and storage units on cloud and fog. The fog is an intermittent layer between the cloud and the end user which helps to make the system faster as compared to the cloud. In this scenario, a building with multiple apartments is considered. Where, each apartment is taken as a player and the surplus power as pay-off. The surplus energy will be distributed among the energy deficient apartments using Shapley value that unevenly distributes the power according to the demand. The experimental results show that 13 kW extra power is saved and distributed among energy deficient apartments during different times of a day.
Content may be subject to copyright.
1
Coalition based Game Theoretic Energy
Management System of a Building as-service-over
Fog
Adia Khalid1, Nadeem Javaid1,
1COMSATS University Islamabad, Islamabad, 44000, Pakistan
Correspondence: www.njavaid.com, nadeemjavaidqau@gmail.com
Abstract—For the better management of energy, a coordina-
tion based energy management system as-a-service on fog is
presented. An efficient system model is introduced to handle a
social networking problem in order to maintain the balance
between the produced and the required energy. This social
network problem is formulated as a game theory based coalition
method. With the increase in number of electricity consumers,
the computational complexity of energy management system is
becoming a threat for system efficiency in real-time environment.
To deal with this dilemma, the service providers shift their
computational and storage units on cloud and fog. The fog
is an intermittent layer between the cloud and the end user
which helps to make the system faster as compared to the
cloud. In this scenario, a building with multiple apartments is
considered. Where, each apartment is taken as a player and the
surplus power as pay-off. The surplus energy will be distributed
among the energy deficient apartments using Shapley value that
unevenly distributes the power according to the demand. The
experimental results show that 13 kW extra power is saved and
distributed among energy deficient apartments during different
times of a day.
KeywordsCloud platform, fog platform, social network, co-
ordination, coalition, game theory, energy management system,
demand side management and smart grid
I. INTRODUCTION
Electricity is an emergent need and requires an effective and
efficient management system. The generation, transportation,
distribution and marketing are the basic units of a power
system. Except marketing, the main focus of other levels is on
solving electricity problems. Consumers play a very important
role in the provision of additional services to enhance the sys-
tem flexibility, planning and operational scheduling according
to the demand in order to maintain a balance between the
demand and the supply [1].
The irregular electricity load demand of consumers leads to
energy scarcity problem at any time of the day. By the integra-
tion of a smart meter infrastructure within the traditional grid,
the electricity resources of users’ can be controlled by using
the demand side management mechanisms which have some
undesirable effects [2]. Interruption in the electricity usage
behavior of the end user can cause discomfort. Which can be
handled by introducing the demand response program where
different pricing schemes have been designed to provide
incentives for electricity consumers. According to demand
response infrastructure, users are motivated to change their
electricity consumption profile. This mechanism is helpful to
some extent; however, power demand during the low peak
hours (demand and prices are low) can increase [3].
The peaks during any hour can be avoided by keeping
balance between load and supply. In this context, authors in
[4] and [5] are looking for the electricity demand and the gen-
eration forecasting mechanisms. Many organizations [6]-[8] in
different countries are generating energy after forecasting the
load demand pattern of consumers. However, they ignore the
direct involvement of the consumers, which is further studied
by [9]-[19]. In these systems, the decisions are made after
coordinating with consumers. This coordination is established
either between consumer and grid [10], or between micro-grid
and consumers [11] and [12]. However, they did not consider
the real time change in users' demand where there is a chance
of electricity loss during the operational slots whenever a user
curtails his electric load demand. The electricity consumers
can also suffer from electricity scarcity problem as in real-
time scenario, the electricity users are bound to utilize energy
according to the generation. To deal with such situations, an
efficient energy control and management system is required
which works by establishing the coordination or coalition
among various users.
Moreover, the stochastic behavior of electricity consumers
and the demand response characteristics affect the smart grid
users [13] which can be handled by social network. In social
network, there exists a coordination and competition among
the members so that they can maximize their profits [14]. The
existing work in [13] and [15]-[16] applied a social network
to the smart grid where the main focus of the study is the
efficiency of energy, integration of home generators or the
adaptation of smart grid technology where an individual has
the right to join smart grid network or not. However, they
did not focus on the stochastic behavior of the user and
its consequences on the entire infrastructure. To study the
human behavior in the situation when choice of each person
influences the other, game theory is one of the well-known
mathematical studies. It is a very powerful conceptual tool
to investigate the social interaction among the players, such
as the game rules, information structure and the pay-offs
associated with a particular decision [17].
In order to deal with a number of customers, an efficient
2
TABLE I: Literature Survey
Technique Problem(s) Identified Objective(s) Proposed Solution(s) Achievement(s) Limitation(s)
Multiple-leader
multiple-follower
Stackelberg game
[9]
Electricity load balancing
problem between microgrid
and users results in increase
in cost
Maximize micro-grid
profit while minimizing
energy generation
Distributed home energy man-
agement system where users
have their own storage units
30% and 55% higher en-
ergy utilization and 15.39%
and 30.79% higher micro-grid
profit than existing system
Delay in power sup-
ply because of exces-
sive message exchange
between customer and
micro-gird
Single-leader
multiple-follower
Stackelberg game
[10]
Power load balance issue be-
tween demand and supply
Maximize utility profit
and minimize customers
electricity bill
Demand response model be-
tween a utility and its cus-
tomers
40 kWh reduction in PAR A bottleneck can in-
crease with increasing
number of users
Game theory based
approach [11]
Issues in energy routing in
micro-gird
Maximum utilization of
distributed resources in
order to minimize the
transmission cost
Energy transmission routing
protocol
Efficiently utilize the surplus
power
No proper pricing
medium is adapted to
calculate the cost
IPOPT or Bonmin
[12]
Power generating components
incremental in cost within a
power sharing system
A distributed coordina-
tion strategy between
micro-grids
Cost optimization 55.46% and 54.48% cost re-
duction with and without
penalty function
57.58% cost is increased
for another scenario
Probabilistic based
coordination
mathematical
solution [18]
Electricity load balancing is-
sue between demand and sup-
ply in the presence of uncer-
tainties
Minimize operation cost Coordination among the dis-
tributed energy resources on
micro-grid operation while
considering considered uncer-
tainties
Reduced operational cost All results are taken as
expected values
Coordinated
dynamic
programming
algorithm [19]
Information analysis and per-
formance issues related to the
centralized data
Economical control sys-
tem for efficient signals
sharing and lower com-
plexity
A decentralized control sig-
nals
The total cost decrease by
3.2% where average power
storage level is increased by
44.4%
3.2% decrease in cost
which is ignorable.
Markowitz theory
and ε-graph [28]
Due to stochastic production
of renewable resources, sell-
ing of surplus energy is risky
Minimize the energy
wastage
Coalition formation after pre-
dicting the demand and gen-
eration
Utilized less storage and
waste less energy
Random sampling is
done and no proper
mechanism to deal with
system complexity
Coalition game us-
ing Shapley value
[29]
Excessive or insufficient
power exchange with in
non-cooperative mode
Optimal cost including
various kinds of expen-
ditures
An economic transaction
scheme based on the
coalitional game theory
Expenditure reduction up to
34.7%
No proper pricing policy
of the MGs
Cooperative game
theory using
Shapley value [30]
Problem related to the joint
operation by micro-gird and
utility, also discussed cost al-
location and payment calcula-
tion related issues
Minimize daily genera-
tion cost
A joint operation system Reduction in generation upto
202,397 MWh at a cost of
$3,977,685 during summer
and 159,755 MWh at a cost
of $2,918,003 during winter is
observed
Complexity can increase
Dynamic non-
cooperative
repeated game with
Pareto-efficient [31]
The energy trading manage-
ment requires accurate power
information
Users' energy trading
strategies from photo-
voltaic power genera-
tion with minimal infor-
mation exchange
A novel energy trading sys-
tem for load management of
a grid-connected micro-grid
Participating users increases
by 10%, PAR reduced upto
13.5% below the baseline and
saves 10.5% of electricity
costs
Assume 100% accurate
predictions for which
achieved results are not
satisfactory
Game theory us-
ing Nash equilib-
rium [32]
Scarcity of power Meet the load demand
with little hydrogen
A cooperative based system to
meet the load demand
7% higher efficiency and
1.62% reduction in annual
cost
Overlooked the system
complexity
Nash equilibrium
[33]
Complex interactions between
the storage units and their
owners, and the various smart
grid elements
Maximize the energy
sell to the local market
Energy trading pricing ac-
cording to the actuation mech-
anism
130.2% average utility per
storage unit
Ignored the system com-
plexity
The energy
management-as-
a-service over fog
computing platform
[20]
The increasing complexity
within smart grid network
and data, due to the growing
number of devices
Minimizing the
implementation cost
and time-to-market
Fog computing based infras-
tructure
Simulations show the effec-
tiveness of proposed system
A proper mechanisms to
calculate the numerical
values is missing
Cloud computing
[21]
High costs in cloud-based
smart grid system
Cloud and network
resource optimization
framework
Cloud based smart grid model Experimental results show the
effectiveness of proposed sys-
tem
Bandwidth can increase
and also can create bot-
tleneck
computation is required. As stated in [20], the computation
complexity and data may increase due to an increasing num-
ber of devices connected to the utility's energy management
system. In this context, scalable platforms are required to run
smart grid applications [21]. In this regards, some power-
ful features of cloud computing such as: flexible resources
and services shared in network and omnipresent access are
desirable for various smart gird applications [22]. The pow-
erful computing resources of cloud computing reduced the
computational time of complex calculations. Further, cloud
computing is used to perform communication process between
power supply companies and substations [21], and between
end users and utilities. This time-to-time communication helps
utilities to sustain the power supply. However, quick response
and scalability have become the possible issues in cloud
computing which can be tackled using fog. Fog environment
(supports) a new breed of services and applications to the edge
of network by extending the paradigm of cloud computing
[23]. This enables the development and deployment of new
applications at the edge of computing. A growing interest
3
towards the fog is due to high response time, low latency,
location awareness, mobility, strong presence of streaming,
heterogeneity and many others which make fog an appropriate
platform to efficiently run the smart gird applications [23].
In this work, we design a social network based model to
incorporate the cooperation to maintain a balance between
the demand and the supply. To incorporate the cooperation,
a game theoretic model is adapted which requires complex
computation that can be solved using fog based platform. This
work is the extension of our previous presented work [24]
where a single scenario for coalition among home is presented
through a control system embedded in a utility. However,
in this work two scenarios are discussed: 1). apartments
coordinate through coalition among power' surplus apartments
and apartments that are deficient of power, 2). apartments
coordinate with and without coalition. Moreover, in this work,
a game theory based energy management system as-a-service-
over fog platform is introduced.
The rest of the paper is organized as follows: Section
II discusses the state of the art work related with different
coordination based systems. Based on the existing systems,
problem statement is described in Section III and the proposed
solution is presented in V. Simulation results are shown in
Section VI to portray the strength and effectiveness of the
proposed system and final conclusion is provided in Section
VII.
II. RELATE D WORK
The efficiency of energy management systems has always
been a challenge for researchers. To overcome this challenge,
researchers are looking for different mechanisms as given
in Table I. In this respect, different coordination and coali-
tion among micro-grids, smart homes, micro-grids and smart
grids, and distributed energy resources and storage systems,
etc., based frameworks and systems have been proposed for
efficient utilization of energy. The authors in [9] and [10]
established the coordination between utility and consumers
in order to reduce the cost on supply and demand side.
Marzband et al. in [25] proposed the framework in which
multiple home micro-grid collaborate with each other by
forming the coalition. In this framework by implementing
coalition, they are able to lower the market clearing price
about 15%. Coordination among distributed energy resources
and storage units is presented in [26]. Coordination among
plug-in electric vehicles and renewable energy resources is
proposed in [27]. The coordination-based energy management
systems [9]-[19] and [25]-[27] are more effective to deal with
sudden changes and efficient utilization of power. However, a
quick response can be achieved by integrating fog platform.
The effective implementation of an energy management
system requires a platform which provides interactivity and
interoperability among devices, flexibility of operations [20]
and fast response. In [9]-[11] and [29]-[32], it is mentioned
that the complexity of game theory based models can vary
with respect to time and space with the increasing number of
users. To avoid this situation, service providers are shifting
their services on cloud [34]. In this respect, [35] proposed
a cloud based information storage and computational system
for smart grid to reduce the cost of information management
system. In [36], authors have performed computation of
energy management on the cloud to balance the power load.
In the same time the data-centers used for computation try
to minimize their energy cost. This bi-level optimization
problem is reformulated as linear problem by [36]. Here
authors proposed a branch and bound algorithm for global
optimal solution. Wang et al. improved the system perfor-
mance by 12% in terms of the electric load pattern index
and reduced up to 46% energy cost of the data-centers.
Another cloud computing framework is proposed in [37],
where utilities and smart energy hubs interact through cloud
rather than using energy management system of utilities. Also,
this system allows an intelligent infrastructure to handle the
communication and storage of data. Further, the researchers
explore how cloud computing is effective in demand side
management among a group of smart energy hubs. To model
it among smart energy hubs, a Nash equilibrium based game
theoretic model is implemented. To increase the efficiency of
demand side management, [38] proposed an information and
communication technology based infrastructure to allocate
the cloud computing resources for demand side management.
For this purpose, the priority list algorithm is developed and
compared with the annealing algorithm.
The targeted objectives of the aforementioned cloud based
energy management systems [35]-[37] are: fast processing
and minimum response time, which are difficult to achieve
through cloud computing. However, these objectives can be
accomplished through fog computing [39]. In this respect,
[40] used fog computing as an intermittent layer between
Internet of energy layer and cloud layer for demand side
management. Fog helps in reducing the energy consumption
of data transmission from Internet of energy layer to cloud
layer. The proposed architecture is designed to schedule the
electric appliances by creating the priority queue. Another
fog based energy management platform is proposed by [20]
to minimize the implementation cost and time-to-market. In
this article, home energy management and micro-grid power
management systems have been implemented as-a-service on
fog computing. In order to study the efficient utilization
of energy resources, a fog computing framework based on
Intel Edison is proposed by [41]. The simulations performed
in [41], demonstrated that fog is efficient for smart grid
computations in terms of low power consumption, reduced
data storage space and an overlay analysis capability.
The authors in [9] and [10] established the coordination
between utility and consumers in order to reduce the cost on
supply and demand side. The work in [11]-[19] discussed the
micro-grid related problems. Except [10], no one discussed
the problem related to the balance and supply; however, [10]
proposed system is more utility friendly. Beside these, an
increasing number of buildings within a smart grid or micro-
grid creates the bottleneck. This reduced the efficiency in
terms of performance, storage requirement and response time
of energy management systems installed within the utilities.
To overcome these issues, the utilities are shifting their com-
putation on cloud which is facing the same related issues with
the increasing number of customers. These issues are tackled
4
by introducing the fog computing platform proposed by [40]-
[41]. However, the discussed articles analyze the performance
of proposed systems on previously defined problems.
III. PROB LE M STATEMENT
Energy demand's fulfillment in affective and efficient way
is one of the major objectives of energy management system.
The coherent working of energy management system requires
systematic power quality analysis and energy dispatching
control. The energy dispatching control unit is structured to
distribute and generate the energy according to the demand
in order to avoid the energy wastage during the periods
of low power demand. Somehow, power storage units are
used to store the surplus energy; however, power storage is
always an issue and cannot be stored. Therefore, it is better
to generate energy after forecasting the demand [4]. In this
regard, researchers in [5] and [42] proposed a load prediction
system. Collotta et al. in [5] stated that difference is noticed
between predicted and used energy. Many energy service
providers such as [6]-[8] in the different countries generate
energy after forecasting the power load pattern. However,
demand of energy is always stochastic and unpredictable,
which is the main cause of imbalance between power demand
and supply [42]. This results in wastage and scarcity of elec-
tricity. To handle such a situation, [29] proposed micro-girds
coordination-based system which distributes energy among
deficit homes after purchasing extra energy from another
micro-grid. However, there is a possibility that some apart-
ment(s) have purchased energy in bulk and they are unable
to utilize all energy within time duration. At the same time,
service provider is generating or purchasing more electricity
for which deficient apartments have to pay extra charges i.e.,
the price tariffs for those units will be high. This situation
can be handled through coordination among the apartments
by the energy management control unit (energy management
system). Where through coordination, surplus energy can be
distributed among apartments that are power deficient. This is
cost effective for the power deficients apartment(s) and also
reduces the burden of the utility in the mean time.
The aforesaid energy control unit also has many other fea-
tures. Its installation on individual bases becomes problematic
in terms of adaptability, scalability and cost. Furthermore, the
products have strict policy about the number of connected
devices to manage, control and process. Moreover, users are
bound to purchase the whole package even if they want to
use some of its services [20].
In order to deal with abovementioned issues, electricity
service providers are moving their energy management and
control unit towards the cloud computing. This makes the
system flexible, efficient and robust in terms of fast com-
munication [34] and run time decision making. The flexible
resources and services are the need of the day for various
smart gird applications [22]. Though, this infrastructure is
efficient and cost effective. However, the dramatic growth
of devices may increase the response time and latency, such
that it violates the time constraints [43]-[45]. To alleviate
aforementioned issues, fog computing-based infrastructure is
found more efficient [39]. Fog computing has high response
time because these systems are installed at the edge of a
network and also have location-awareness. Hence, to build a
centralized energy management system for coordination, fog
computing is more effective than cloud computing.
IV. SYSTEM MODEL AND PROBLEM DEFINITION
In this section, the fog based energy management system is
discussed, which focuses on an efficient coordination coalition
among apartments under dispatching control unit of smart
grid. A systematic view of proposed system model along with
the information flow and power exchange is shown in Fig.
1. The modeled architecture consists of a building with Ã
number of apartments, which is connected with a fog and
local micro-grid (i.e., generation units) of the building. The
fog embedded with an energy control unit which is used as
platform to manage the energy management issues. The power
service provider within the building ensures the electricity
transformation from micro-grid to the apartments. The service
provider sends the basic information like: electricity price and
energy generation limit towards fog. In the similar way, it
gets the information about the current load utilized by the
consumers and their demand for the next time span.
The communication medium between fog and building
could be Blue-tooth, Wireless, Ethernet, etc., depending upon
the requirements and communication medium specification.
Whereas, ZigBee a unique protocol should be used for main
network. ZigBee can handle about 65535 devices in a network
[20]. A Wi-Fi embedded smart meter acts as a communication
medium between apartments and proposed game theory based
energy management system installed in fog.
Generally, utilities collect the information about the energy
demand and plan for electricity generation for the next day. It
also keeps the balance between power demand and generation
either through directly controlling the user load, or through
extra generation. In order to keep the balance between energy
demand and generation an additional functionality is added in
the system where proposed system can deal with the alteration
in energy demand (i.e., sudden change in consumers' demand).
The control unit will collect the information from consumers
who require more energy and those who have surplus energy
available and takes the decision accordingly. A coordination
is enabled between the Nenergy slack apartments and
Menergy surplus apartments. On the other hand, coalition
among Nslack apartments will be established to distribute the
slack power unevenly according to the demand, so that service
providers would be able to maintain the balance between
power generation and demand to avoid energy wastage.
In order to enhance the power utilization by minimizing the
power losses, we modeled coordination problem as a social
network problem which is solved by using coalition based
game theory. It is defined as a three tuple model (,f˛,=)
[46], where ={1,2, ...., N } is a set of players (i.e, =
E.DefN), f˛ : 2→ < is a utility function mapped as a real
number corresponding to each coalition Swhere S⊆ ℵ that
defines the total pay-off achieved by each coalition. E.Def
is an energy deficient apartment and =is a vector which
represents the obtained pay-offs of each player.
5
Microgrid
Ba eryWind turbinePV panel
AcceptanceDonar
Surplus energy
De cient energy
Total generated
energy
Input
Coali on
App1...AppM App1….AppN
Store in
BSC
Extra
genera on
One to One rela on
Input
Surplus energy
De cient energy
Total generated
GT
S ll de cient
or surplus
Electricity
ow
Communica on
ow
Scenario 1
Scenario 2
Sll
surplus
S ll
de cient
GT
Fig. 1. Proposed system model of an energy management system as-a-service on fog platform.
In this paper, each E.Def jis taken as a player and it
looks for another energy deficient E.Def k(i.e., j∈ ℵ and
i6=k) to setup coalition to achieve maximum pay-off in
terms of extra electricity for itself and for other players. In
this coalition, there are two subsets: the donor or contributor
E.E Mand acceptor E.DefN. The total available pay-off is
the total surplus electricity (E.ST otal ) by the Mapartments
which is formally represented as:
E.ST otal =
M
X
i=1
E.S (i).(1)
In this scheme, we aim to minimize electricity wastage
(E.W ) by distributing E.ST otal among E.Def Naccording
to each individual's electricity demand and available pay-
off. In this way, the difference between total distributed
energy (E.DisT oatl ) among Napartments and E.ST otal can
be minimized. The objectives under consideration can be
mathematically written as:
min (E.W ),
s.t min ∆(E.ST otal , E.DisT otal),(2)
E.DisT oatl =
N
X
j=1
E.Dis(j).(3)
Where E.W is calculated as E .ST otal. As explained earlier,
the E.ST otal will be distributed among E.DefNaccording to
their demand (E.DN). The electricity deficient for Npower
slack apartments is formally represented as:
E.DT otal =
N
X
j=1
E.D(j).(4)
Where E.DT otal could be greater, less or equal to the
E.ST otal and formally represented as:
E.DT otal E.ST otal < E.DT otal .(5)
It is very important to mention that the proposed system
is cost effective for both the utility and for the consumers.
Service providers have to provide extra energy during the
situation when a sudden increase in power demand occurs for
which consumers have to pay extra bill. On the other hand,
there is a possibility of electricity wastage if some apartments
6
back-off the demand on run-time without knowing about the
surplus electricity, and resulting in extra power generated.
In order to distribute the surplus energy among the deficient
apartment(s), there are many possible scenarios. In this work
two scenarios are considered. In scenario 1, coalition based
coordination among power surplus apartment(s) and power
deficient apartment(s) is established. Where two groups are
formed: one group contains the apartments that are surplus in
energy and second group contains those apartments that are
deficient in energy. After coordination the whole surplus en-
ergy will be distributed among the power deficient apartments.
In this scenario, no extra energy will be generated neither it
will be saved. Whereas, in scenario 2, coordination among a
power surplus apartment and a power deficient apartment is
established without any coalition. Moreover, extra energy will
be saved and if required, extra energy will be generated. The
detail description of these two scenarios is given below:
a) Scenario 1: In the scenario 1, E.ST otal will be
unevenly distributed among all the E.Def using coalition
in the situation when E.DT otal > E.ST otal.
Here each E.Defjgets the pay-off according to the de-
mand, i.e., if E.Defapower demand is higher than E.Def b
then E.Defagets more power regardless of the situation (i.e.,
E.S (i)== E.Dj). This can be mathematically written as:
Case :E .DT otal > E.ST otal
E.Dis(a)< E.Dis(b),if E .Def a< E .Def b,
E.Dis(a)E.Dis(b),if E .Def aE .Def b(6)
where a, b Mand a6=b. Further, for this scenario control
unit will enable the coalition among energy slack apartments
after each tminutes in a day.
b) Scenario 2: In the scenario 2, for the condition when
E.DT otal > E.ST otal, first control unit will check the condi-
tion, if the surplus energy E.S(i)of an apartment is equal to
any E.D(j), the control unit will establish the coordination
between these two apartments regardless of the requirement of
other apartments. Still, if required it will enable the coalition
among the E.Def(l)(i.e., l 6=j)as given in Equation 6. This
can be formally written as: Case :E .DT otal > E.ST otal
E.Dis(j) = E.S(i)if E.Def(j) == E.S(i),
E.Dis(a)< E.Dis(b),if E .Def a< E .Def b,
E.Dis(a)E.Dis(b),if E .Def aE .Def b
(7)
where iN,jM,a, b Nand a6=b. Further, control
unit will allow the coordination among apartment before the
start in a day for this scenario.
V. COAL IT IO NAL GAME THEORY BASED PRO PO SE D
SOLUTION
On the basis of problem definition in Section IV the
coalition game theory is proposed to minimize E.W while
maintaining a balance between the demand and the supply.
For the coalition game (,f˛,=), pay-off of each participant
player jwill be calculated using Shapley value [47]. The
pay-off of each E.Def jis denoted as (=(f˛)j) and can be
calculated as [48]:
=(f˛)j=X
S⊆ℵ\{j}
|S|!(ℵ−|S| − 1)!
!(f˛(S∪ {j})f˛(S)).(8)
For energy management, each apartment jparticipating in
game is considered as a player and the total gain is taken as
the E.ST otal . The distribution of E.ST otal according to the
Equation 5 can be formally written as:
E.Dis(j) = E.D(j),if E .DT otal E.ST otal ,
=(f˛)j,if E .DT otal > E.ST otal .(9)
Where at the end of the case E.DT otal > E.ST otal, the
E.DisT otal will be less than E.DT otal and E.DisT otal =
PN
j=1 =(f˛)j.
A. Algorithm for Scenario 1
The designed Algorithm 1 will work according to the con-
ditions given in Equation 5, Equation 7 and the total generated
energy (E.GT otal ). For the condition E.DT otal E.ST otal,
the power will be provided according to the demand. How-
ever, the case where E.DT otal < E.ST otal requires an
efficient and real time implementable system which helps in
the fair distribution of E.ST otal among E .Def N. Fair in the
sense that if an apartment requires more power, it will be
provided with more energy comparatively.
Algorithm 1 Cooperation among the apartments using coali-
tion within a smart building for the distribution of surplus
energy.
Require: List of the generated electricity E.G(t)where
{∀ E.G(t), t = 1,2,3, ..., T },E.ST otal and List
of demanded energy E.Djwhere {∀ E.D(j),=
j1,2,3, ..., N }
1: for t1 to Tdo
2: if E.ST otal > 0 && E.DT otal > 0 then
3: if E.DT otal E.ST otal then
4: for j1 to Ndo
5: E.Dis(j)=E.D(j)
6: end for
7: end if
8: if E.DT otal > E.ST otal then
9: Calculate the =(f˛)Nusing Equation8
10: for j1 to Ndo
11: E.Dis(j)==(f˛)j
12: end for
13: end if
14: end if
15: end for
B. Algorithm for Scenario 2
For the 2nd scenario, the Algorithm 2 is developed, its
working conditions depend on the Equations 5 and 7, and
the total generated energy (E.GT otal ). For the condition
E.DT otal E.ST otal , the control unit will establish the
7
simple coordination among the apartments while finding one-
to-one relation between E.E (i)and E.Def(j). For one-one
relation, E.S (i)should be equal to E.D(j). This relation
is established by adapting the simple social network behavior
where a person coordinates with others according to his need.
However, if E.Def > 0then coalition among deficients is
established and the surplus energy will be distributed using
Equation 8.
Algorithm 2 Cooperation among the apartments with and
without coalition in a smart building for the distribution of
surplus energy.
Require: List of generated electricity E.G(t)where
{∀ E.G(t), t = 1,2,3, ..., T },E.ST otal and List
of demanded energy E.Djwhere {∀ E.D(j),=
j1,2,3, ..., N }
1: for t1 to Tdo
2: if E.ST otal && E.DT otal > 0 && E.Dis(j)==0
then
3: for j1 to Ndo
4: for i1 to Mdo
5: if thenE.D(i)=E.S(i)
6: E.Dis(j)=E.S(i)
7: end if
8: end for
9: end for
10: end if
11: if E.ST otal && E.DT otal > 0 && E.Dis(k)==0
then where k6=j
12: Calculate the =(f˛)Nusing Equation 8
13: for j1 to Ndo
14: E.Dis(j)==(f˛)j
15: end for
16: end if
17: end for
VI. RESULTS AND DISCUSSION
In this section, the simulation results for the above men-
tioned scenarios are discussed. For the experimental purpose,
a building consisting of ten apartments (i.e., Ã = 10) is con-
sidered. Further, we consider that all the energy management
computations are done on fog which enables the coordination
among the surplus and the slack deficient apartments. It also
sets up the coalition among the energy deficient apartments.
A. Performance evaluation Scenario 1
For scenario 1, the real-time data is collected from [6]
which contains the energy load pattern in a day for different
types of classes. This helps to collect the information about
the domestic unrestricted customers' average electricity load
profile consumed by a home. This data is collected after every
30 minutes, in this respect we have total 48 time slots as
shown in Fig. 2.
Initially, we consider the consumed energy as the generated
energy because the utility generates energy after forecasting
the demand. The consumers have stochastic nature and their
energy demand can change at any time during the day as
shown in Fig. 3. Some consumers may require extra energy
while some may want to reduce their load profile than the
previous days.
Fig. 2 illustrates the generated and the utilized power With
Out Coordination (WOC) and With Coordination (WC) for
ten apartments. It is clear from Fig. 2 that if apartments
do not cooperate with each other, the generated energy can
be wasted if any apartment curtail power demand. In the
same time, some apartments can suffer when they require
extra energy. As shown in Fig. 2, during the hour 1:30am
the difference between generated and used energy WC is 0.3
kW, and generated and WOC is 1 kW. Additionally, the extra
energy demanded by the apartments (deficit energy WOC),
surplus energy WOC, fulfilled demand (deficit energy WC)
and surplus energy WC during different time intervals are
shown in Fig. 4.
4 8 12 16 20 24 28 32 36 40 44 48
Time (min)
0
2
4
6
8
10
Electricity Load (kW)
Energy Generation
Utilized Energy WOC
Utilized Energy WC
Fig. 2. Power load profile patterns of genera-
tion, and energy utilization WOC and WC.
The overall effect on power utilization with coalition and
without coalition is illustrated in Fig. 5. The total generated
energy is 267.6 kW, if the coalition is not formed among
apartments then 21.55 kW power is wasted. In case when
coalition is established, 8.31 kW of electricity is wasted, as
shown in Fig. 2. Further, Fig. 6 depicts that apartments suffer
from WOC as during different time intervals, 13 kW extra
power is demanded than usual. However, WC apartments
slack by 2.48 kW which is ignorable.
From Fig. 2 -6 it is revealed that a huge amount of energy
can be wasted in the case when overall demand is less than
the generated power. Electricity consumers can also suffer
if the utility restricts them to utilize the energy within a
predefined limit and extra power is required by the consumer.
Furthermore, it can be seen that using coalition, our proposed
scheme effectively creates the balance between generation
while incorporating the extra demand in emergency.
B. Performance evaluation Scenario 2
In this section, we will discuss the experimental results to
validate the performance of scenario 2. For real time scenario,
8
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
Day
0
1000
2000
3000
4000
5000
6000
Load (kW)
Apartment 1
Apartment 2
Apartment 3
Apartment 4
Apartment 5
Apartment 6
Apartment 7
Apartment 8
Apartment 9
Apartment 10
Fig. 3. Electricity load profile of ten apartments of one month.
4 8 12 16 20 24 28 32 36 40 44 48
Time (min)
0
0.5
1
1.5
2
2.5
3
Electricity Load (kW)
Surplus Energy WOC
Surplus Energy WC
Deficit Energy WOC
Deficit Energy WC
Fig. 4. Extra demanded energy by the apart-
ment, and surplus energy WOC and WC.
the data is collected from [49] which contains the electricity
load pattern of 112 apartments. For simplicity, we collect per
day energy load pattern of ten apartments in a month. For
experiments, the available electricity usage will be considered
as the apartment demand for the next day.
The bar graph shown in Fig. 3 illustrates the energy profile
of ten apartments in a month. It can be seen from Fig. 3 that
the energy consumption profile of each apartment is different
from the other. The fluctuations in energy demand during a
month are shown in Fig. 7 and the values of these graphs are
Fig. 5. Total electricity generation, electricity
utilization WOC and WC during a day.
taken dynamically.
The purpose of the presented energy management system is
to minimize the energy wastage by creating the coordination
among the power surplus/slack apartments. All the apartments
will be connected with the energy management system located
on fog through smart meter where at the start of a day i.e.,
at 11:55 pm it will collect the information. The decision
making will be done according to the demand and the surplus
energy by using Algorithm 2. If required, extra energy can be
generated from the local micro-grid and the surplus energy
can be stored as given in Fig. 7. This stored surplus energy
9
Surplus Energy Deficit Energy
0
5
10
15
20
25
Electricity Load (kW)
WOC
WC
Fig. 6. Total surplus and deficit electricity dur-
ing a day.
4 8 12 16 20 24 28
Day
0
1
2
3
4
5
6
Electricity Load (kW)
104
Expected Demand
Energy Utilized
Surplus Energy
Extra Demand
Energy Saved
Extra Generation
Fig. 7. Change in energy demand and extra
generation by micro-grid one month data.
can be used during another day. Whereas, in scenario 1 extra
energy is not generated neither stored as a result even after
coalition energy is wasted.
After coalition among surplus apartments and their coor-
dination with group of energy deficient apartments, a clear
change in the energy profile can be seen in Fig. 8. A detailed
graphical representation of electricity deficient and surplus
apartments is given in Fig. 9. In this figure, the negative values
show the energy deficiency and positive values represent the
surplus energy. In this scenario, the deficient energy will
be the extra demanded energy which is reduced up-to a
minimum level after establishing the coordination coalition.
If the coordination is not established then the probability of
energy wastage will be higher as shown in Fig. 7.
From the real-time series data given in Fig. 2 and 3, it is
observed that the energy demand of each consumer is different
from the other. It can be envisioned that, the load profile of the
consumers is different each day. Furthermore, from the results
of scenario 1 and 2, it is analyzed that if energy utilization is
not monitored properly, a maximum level of energy can be
wasted. So a proper medium is required to monitor and take
quick decisions with minimum delay.
From the literature analysis, it is observed that the game
theory is one of the best known coordination techniques.
However, its complexity with respect to time and space can
be increased with the increase in the number of participants.
This phenomena can create the bottleneck on the network. In
order to avoid such situation and to keep the system efficient,
an energy management system is used as-a-service-over fog.
C. Fog computing performance evaluation
In oder to validate and study the complexity of an applica-
tion, its execution time, memory requirements and network
response time is calculated for scenario 2. The graphical
representation of the execution time and memory usage is
shown in Fig. 10 and Fig. 11. These figures illustrate that as
number of apartments participating in the coalition increases,
execution time of program as well as memory usage is
increased. The Fig. 10 shows the minimum execution time
2.40 sec for ten and 230.60 sec for 50 apartments. This further
requires more memory to execute the computation as shown
in Fig. 11, 524.24 MB memory is required for ten apartments
where it is increased upto 1303 MB for 50 apartments. This
discussion shows that a fast computational medium near the
network is the need of the day to avoid delay in energy supply.
The network response time is studied in Fig. 12, from this
figure it is clear that the response time is high with respect
to the data.
The graphical results in Figs. 10-12 depict that execution
time of an application and memory requirements are increased
with the increasing number of apartments. Therefore, a plat-
form is required that can reduce the service delay and should
have high response time which is possible by implementing
the user required application at the edge of network (fog).
Fog has the ability to reduce the service delay [50] and it has
fast response time.
VII. CONCLUSION AND FUTURE WORK
In this paper, we take a real-time scenario where the run-
time fluctuation in energy demand is observed and decisions
are taken accordingly. Furthermore, to make the system per-
formance more efficient, the energy management system as-a-
service over fog is considered. It is concluded from the experi-
mental results that as the number of participants increases, the
temporal as well as the spatial complexity of computation also
increases which in turn affects the performance of a system.
Any building with numerous apartments has fluctuating
electricity load pattern which degrades the performance of
a system. Although, many forecasting and coordination based
systems have been developed and deployed, however, these
systems are not working according to the situation where
surplus electricity load is shifted towards slacks. In this
work, we deal with this situation by establishing the coalition
10
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
Day
0
1000
2000
3000
4000
5000
6000
7000
8000
Load (kW)
Apartment 1
Apartment 2
Apartment 3
Apartment 4
Apartment 5
Apartment 6
Apartment 7
Apartment 8
Apartment 9
Apartment 10
Fig. 8. Electricity load profile in a month after coordination.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
Day
-3000
-2000
-1000
0
1000
2000
3000
4000
5000
6000
Load (kW)
Apartment 1
Apartment 2
Apartment 3
Apartment 4
Apartment 5
Apartment 6
Apartment 7
Apartment 8
Apartment 9
Apartment 10
Fig. 9. Deficient and surplus energy by each apartment during the month.
among the deficients using Shapley values. Simulation results
illustrate the effectiveness of the proposed system. Through
Shapley values, the surplus power is distributed among the
slack apartments and saved upto 13 kW electricity from
wastage in a day and 18000 kW from wastage in a month.
In this paper, the change in users’ electricity load profile is
taken dynamically. In the future, we will investigate machine
learning techniques to forecast the users’ power demand.
REFERENCES
[1] Carreiro, A. M., Jorge, H. M., & Antunes, C. H. "Energy management
systems aggregators: A literature survey". Renewable and Sustainable
11
10 20 30 40 50
Apartments
0
50
100
150
200
250
Execution Time (sec)
Fig. 10. The execution time
of application running on
fog.
10 20 30 40 50
Apartments
500
600
700
800
900
1000
1100
1200
1300
1400
Memory Utilization (MB)
Fig. 11. The memory re-
quired to run the application
on fog.
10 20 30 40 50
Apartments
0
Response Time (ms)
0.5
1
1.5
2
2.5
3
3.5
4
4.5
Fig. 12. The network re-
sponse time according to the
data.
Energy Reviews, 73, 1160-1172, 2017.
[2] Strbac, G. Demand side management:Benefits and challenges. Energy
Policy 2008, 36, 4419–4426.
[3] Barbato, A., & Capone, A. "Optimization models and methods for
demand-side management of residential users: A survey". Energies,
7(9), 5787-5824, 2014.
[4] Almeshaiei, E., & Soltan, H. "A methodology for electric power load
forecasting". Alexandria Engineering Journal, 50(2), 137-144, 2011.
[5] Collotta, M., & Pau, G. "An innovative approach for forecasting of
energy requirements to improve a smart home management system
based on BLE". IEEE Transactions on Green Communications and
Networking, 1(1), 112-120, 2017.
[6] http://www.meniscus.co.uk/analytics-expertise/energy_industry/energy-
load-profiles. Last visited: 20 November 2017.
[7] https://www.eia.gov. Last visited: 20 November 2017.
[8] http://www.ree.es. Last visited: 20 November 2017.
[9] Mondal, A., Misra, S., & Obaidat, M. S. "Distributed home energy
management system with storage in smart grid using game theory".
IEEE Systems Journal, 11(3), 1857-1866, 2017.
[10] Yu, M., & Hong, S. H. "Supply–demand balancing for power man-
agement in smart grid: A Stackelberg game approach". Applied Energy,
164, 702-710, 2016.
[11] Hong, J. S., & Kim, M. "Game-theory-based approach for energy
routing in a smart grid network". Journal of Computer Networks and
Communications, 2016, 2016.
[12] Lee, W. P., Choi, J. Y., & Won, D. J. "Coordination Strategy for
Optimal Scheduling of Multiple Microgrids Based on Hierarchical
System". Energies, 10(9), 1336, 2017.
[13] Cassidy, A. and Nehorai, A. "Modeling smart grid adoption via a
social network model". In 2014 IEEE Power & Energy Society General
Meeting| Conference & Exposition (PES), pp: 1-4, 2014.
[14] Jonnalagadda, A. and Kuppusamy, L. "A survey on game theoretic
models for community detection in social networks". Social Network
Analysis and Mining, 6(1), p.83, 2016.
[15] Ciuciu, I.G., Meersman, R. and Dillon, T. "Social network of smart-
metered homes and SMEs for grid-based renewable energy exchange".
In 6th IEEE International Conference on Digital Ecosystems and
Technologies (DEST), pp: 1-6, 2012.
[16] Skopik, F. and Wagner, C. "Novel energy saving opportunities in smart
grids using a secure social networking layer". In 36th IEEE Annual
Computer Software and Applications Conference (COMPSAC), pp:
557-566, 2012.
[17] Oh, J.C. and Mehrotra, K. "Game Theory and Social Networks". In
Encyclopedia of Social Network Analysis and Mining (pp. 589-599).
Springer New York, 2014.
[18] Alharbi, W., & Raahemifar, K. "Probabilistic coordination of microgrid
energy resources operation considering uncertainties". Electric Power
Systems Research, 128, 1-10, 2015.
[19] Wu, J., & Guan, X." Coordinated multi-microgrids optimal control al-
gorithm for smart distribution management system". IEEE Transactions
on Smart Grid, 4(4), 2174-2181, 2013.
[20] Al Faruque, M. A., & Vatanparvar, K. "Energy management-as-a-
service over Fog computing platform". IEEE internet of things journal,
3(2), 161-169, 2016.
[21] Wang, W.Y.C., Rashid, A. and Chuang, H.M. "Toward the trend of
cloud computing". Journal of Electronic Commerce Research, 12(4),
p.238, 2011.
[22] Yigit, M., Gungor, V.C. and Baktir, S. "Cloud computing for smart
grid applications". Computer Networks, 70, pp.312-329, 2014.
[23] Bonomi, F., Milito, R., Zhu, J. and Addepalli, S. "Fog computing and
its role in the internet of things". In Proceedings of the first edition
of the MCC workshop on Mobile cloud computing (pp. 13-16). ACM,
2012.
[24] Khalid, A., Javaid, N., Mateen, A., & Ilahi M. "Smart Homes Coalition
based on Game Theory". In 32nd IEEE International Conference on
Advanced Information Networking and Applications (AINA), pp: 846-
849, 2018.
[25] Marzband, M., Azarinejadian, F., Savaghebi, M., Pouresmaeil, E.,
Guerrero, J.M. and Lightbody, G. "Smart transactive energy framework
in grid-connected multiple home microgrids under independent and
coalition operations". Renewable energy, 126, 95-106, 2018.
[26] Worku, M.Y., Hassan, M.A. and Abido, M.A. "Real Time Energy
Management and Control of Renewable Energy based Microgrid in Grid
Connected and Island Modes". Energies, 12(2), 276, 2019.
[27] Nikoobakht, A., Aghaei, J., Khatami, R., Mahboubi-Moghaddam,
E. and Parvania, M. "Stochastic flexible transmission operation for
coordinated integration of plug-in electric vehicles and renewable energy
sources". Applied Energy, 238, 225-238, 2019.
[28] Gensollen, N., Gauthier, V., Becker, M., & Marot, M. "Stability and
Performance of Coalitions of Prosumers Through Diversification in the
Smart Grid". IEEE Transactions on Smart Grid, 2016.
[29] Ni, J., & Ai, Q. "Economic power transaction using coalitional game
strategy in micro-grids". IET Generation, Transmission & Distribution,
10(1), 10-18, 2016.
[30] Pilling, R., Chang, S. C., & Luh, P. B. "Shapley Value-Based Payment
12
Calculation for Energy Exchange between Micro-and Utility Grids".
Games, 8(4), 45, 2017.
[31] Mediwaththe, C. P., Stephens, E. R., Smith, D. B., & Mahanti, A. "A
dynamic game for electricity load management in neighborhood area
networks". IEEE Transactions on Smart Grid, 7(3), 1329-1336, 2016.
[32] Karavas, C. S., Arvanitis, K., & Papadakis, G. "A Game Theory
Approach to Multi-Agent Decentralized Energy Management of Au-
tonomous Polygeneration Microgrids". Energies, 10(11), 1756, 2017.
[33] Wang, Y., Saad, W., Han, Z., Poor, H. V., & Ba¸sar, T. "A game-
theoretic approach to energy trading in the smart grid". IEEE Transac-
tions on Smart Grid, 5(3), 1439-1450, 2014.
[34] Markovic, D. S., Zivkovic, D., Branovic, I., Popovic, R., & Cvetkovic,
D. "Smart power grid and cloud computing". Renewable and Sustainable
Energy Reviews, 24, 566-577, 2013.
[35] Fang, X., Yang, D., & Xue, G. "Evolving smart grid information man-
agement cloudward: A cloud optimization perspective". IEEE Transac-
tions on Smart Grid, 4(1), 111-119, 2013.
[36] Wang, H., Huang, J., Lin, X., & Mohsenian-Rad, H. "Exploring smart
grid and data center interactions for electric power load balancing".
ACM SIGMETRICS Performance Evaluation Review, 41(3), 89-94,
2014.
[37] Sheikhi, A., Rayati, M., Bahrami, S., Ranjbar, A. M., & Sattari, S.
"A cloud computing framework on demand side management game in
smart energy hubs". International Journal of Electrical Power & Energy
Systems, 64, 1007-1016, 2015.
[38] Cao, Z., Lin, J., Wan, C., Song, Y., Zhang, Y., & Wang, X. "Optimal
cloud computing resource allocation for demand side management in
smart grid". IEEE Transactions on Smart Grid, 8(4), 1943-1955, 20117.
[39] Thakare, M. Y. A., Deshmukh, M. P. P., Meshram, M. R. A., Hole,
M. K. R., Gulhane, M. R. A., & Deshmukh, M. N. A. "A Review: The
Internet of Things Using Fog Computing". 2017.
[40] Shahryari, K., & Anvari-Moghaddam, A. "Demand Side Management
Using the Internet of Energy based on Fog and Cloud Computing". In
2017 IEEE International Conference on Internet of Things (iThings) and
IEEE Green Computing and Communications (GreenCom) and IEEE
Cyber, Physical and Social Computing (CPSCom) and IEEE Smart Data
(SmartData), pp: 931-936, 2017.
[41] Barik, R. K., Gudey, S. K., Reddy, G. G., Pant, M., Dubey, H.,
Mankodiya, K., & Kumar, V. "FogGrid: Leveraging Fog Computing
for Enhanced Smart Grid Network". arXiv preprint arXiv:1712.09645,
2017.
[42] Alani, A. Y., & Osunmakinde, I. O. "Short-Term Multiple Forecasting
of Electric Energy Loads for Sustainable Demand Planning in Smart
Grids for Smart Homes". Sustainability, 9(11), 1972, 2017.
[43] Copie, A., Fortis, T. F., & Munteanu, V. I. "Benchmarking cloud
databases for the requirements of the internet of things". In IEEE 35th
International Conference on Information Technology Interfaces (ITI),
pp: 77-82, 2013.
[44] Xu, F., Liu, F., Jin, H., & Vasilakos, A. V. "Managing performance
overhead of virtual machines in cloud computing: A survey, state of
the art, and future directions". Proceedings of the IEEE, 102(1), 11-31,
2014.
[45] Wang, L., Zhang, F., Vasilakos, A. V., Hou, C., & Liu, Z. "Joint
virtual machine assignment and traffic engineering for green data center
networks". ACM SIGMETRICS performance evaluation review, 41(3),
107-112, 2014.
[46] Lai, H.Q., Chen, Y. & Liu, K.R. "Energy efficient cooperative com-
munications using coalition formation games". Computer Networks, 58,
pp.228-238, 2014.
[47] Shapley, L. S. "A value for n-person games". Contributions to the
Theory of Games, 2(28), 307-317, 1953.
[48] Ichiishi, T. "Game theory for economic analysis. Elsevier". 2014
[49] UMassTraceRepository, "http://traces.cs.umass.edu/index.php/Smart/Smart".
Last visited: 17 January 2018.
[50] Yousefpour, A., Ishigaki, G., & Jue, J. Fog computing: Towards
minimizing delay in the internet of things. In 2017 IEEE International
Conference on Edge Computing (EDGE), pp: 17-24, 2017.
View publication statsView publication stats
MATLAB Source Code for paper
Coalition based game theoretic energy management system of a building as-service-
over fog
Authors: Adia Khalid and Nadeem Javaid
For further queries you can contact on following email IDs: adia.khalid@gmail.com,
nadeemjavaidqau@gmail.com.
Note: The provided code contains one m file. Code has three portions: 1). Scenario 1:
Cooperation among the apartments using coalition within a smart building for the distribution
of surplus energy, 2). Scenario 2: Cooperation among the apartments with and without coalition
in a smart building for the distribution of surplus energy and 3). For studying impact of
increasing requests on a Fog (Execution time, Response time and Memory utilization).
DataSet: In this paper, we have used two data files: 1). Energy generation data (saved as:
Data.csv” and taken from http://www.meniscus.co.uk/analytics-
expertise/energy_industry/energyload-profiles
,) and 2). Electricity load data (saved as: Data_Appartments.csv” and taken from
http://traces.cs.umass.edu/index.php/Smart/Smart). These datasets in excel files are also
provided in Researchgate along with complete code.
https://www.researchgate.net/publication/342449338_M_File_DataSetzip
Link of the paper:
https://www.sciencedirect.com/science/article/abs/pii/S2210670718304402?via%3Dihub
Citation: Adia Khalid and Nadeem Javaid, "Coalition based Game Theoretic Energy
Management System of a Building as-service-over Fog", Sustainable Cities and Society,
Volume: 48, Article Number: 101509, Pages: 1-10, Published: July 2019, ISSN: 2210-6707.
DOI:https://doi.org/10.1016/j.scs.2019.101509.
% Keep .csv files and .m file in same folder. Code is written in MATLAB 2017b and tested and verified in MATLAB2019a
close all
clear
clc
%%
% This code is automatically generated by the matlab. Which may vary from
% version to version. The last time this is geneated using Matlab 2019a.
% This code is written and modified by Adia Khalid for publication "Adia Khalid and Nadeem Javaid, "Coalition based
Game Theoretic Energy Management System of a Building as-service-over Fog", Sustainable Cities and Society, Volume:
48, Article Number: 101509, Pages: 1-10, Published: July 2019, ISSN: 2210-6707.
DOI:https://doi.org/10.1016/j.scs.2019.101509."
% There are two scenarios in the paper. Both scenaios are given here in a
% single .m file. Moreover, the results for fog are taken after observing the
% cpu utilization and run-time of algorithm with respect to increasing demand by follwoing the procedure given in FogSim,
CloudSim and other cloud and fog simulators
%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%
%% Scenario 1 Wihout MG installation
%% Setup the Import Options
opts = delimitedTextImportOptions("NumVariables", 2);
% Specify range and delimiter
opts.DataLines = [2, Inf];
opts.Delimiter = ",";
% Specify column names and types
opts.VariableNames = ["Time", "Usage"];
opts.VariableTypes = ["double", "double"];
opts.ExtraColumnsRule = "ignore";
opts.EmptyLineRule = "read";
% Import the data
% This data is taken form http://www.meniscus.co.uk/analytics-expertise/energy_industry/energyload-profiles. Last visited:
20 November 2017.
% Graphical values were clearly taken and save in the excel sheet for
% experimental purpose
Data = readtable("Data.csv", opts);
%% Clear temporary variables
clearvars filename delimiter startRow formatSpec fileID ans;
dataArray=table2array(Data);
%% Convert the cell into array
Demand = (dataArray(:,2)); % Average Demand by the single home during a day regardless of house members
Demand = Demand';
N_Home = 10; % Number of homes You can change according to your demand
Generation = N_Home * Demand; % Here generation will be assumed as total demand by the 5 houses
%% There is always a chance of error in forcasting values
% Here we will consider the case that demand should be less than the
% generation. This generation and demand unit is MW
j=1;
User_Coalition = Generation;
User_Without_Coalition = Generation;
% for N_Home = 10:10
homes_ = N_Home/2;
for Slot=1:48 % Data is collected after every 30 mints so we have total 48 slots of 30 mints
R_Want_Int = randi([0 1], 1); % Check if any residence want to intruppt in case of more demand or have surplus energ
want to share
Load_Demand=0;
Total_Allocation=0;
Extra_Load=0;
if R_Want_Int >0
%% Parameters for the SH who want to curtail their electricity load
N_R_Int = randi([1 homes_], 1) % Here we will check how many homes are curtailing their load as an example
scenario we will considered maximum 5 residnce who can switched off their load
index = randperm(N_Home); % Randomize the number of houses
List_R_Int = index(1:N_R_Int);% Select the initial N_R_Int number of homes for
Load_Curtailed = (Demand(1,Slot)- 0.1).*rand(1, N_R_Int) + 0.1; % Load that is curtailed by the Selected SHs
Ndecimals = 2;
f = 10.^Ndecimals ;
Load_Curtailed = round(f*Load_Curtailed)/f;
Extra_Load = sum(Load_Curtailed); % Sum of extra load
%% Parameters for the SH who want extra electricity load
N_R_N_Extra = randi([1 N_R_Int], 1); % Number of SHs who required extra load
List_R_N_Extra = index(N_R_Int+1:N_R_Int+N_R_N_Extra); % List of SHs Who need extra load
Load_Demand = (Demand(1,Slot)- 0.1).*rand(1, N_R_N_Extra) + 0.1;
%% Call the game theory fucntion for the decision
%% Decision will be taken by game theory if the available load will be less than demanded load
Ndecimals = 2;
f = 10.^Ndecimals ;
Load_Demand = round(f*Load_Demand)/f;
User_Without_Coalition (Slot) = User_Without_Coalition (Slot) - Extra_Load;
User_Suffer_Without_Coalition = sum(Load_Demand); % This is what actually a used is demanding more than
his\her usual demand
if length(Load_Demand)==1 && Load_Demand <= Extra_Load
Allocated_Load = Load_Demand;
Home_Get_Load = List_R_N_Extra;
Total_Allocation = sum (Allocated_Load);
Marginal_Distribution = Allocated_Load;
Energy_wasted = Extra_Load - Load_Demand; % Energy wasted in case of surplus energy is geater than
demand
User_Suffer = 0; % As we have to find user who suffers in case of surplus energy is less than the demand.
User_Coalition (Slot) = User_Coalition (Slot) - Energy_wasted; % Here we will substract easted energy from the over
all energy
elseif length(Load_Demand)==1 && Load_Demand > Extra_Load
Allocated_Load = Extra_Load;
Home_Get_Load = List_R_N_Extra;
Total_Allocation = sum(Allocated_Load);
User_Suffer = Load_Demand - Extra_Load;
Marginal_Distribution = Allocated_Load;
Energy_wasted = 0;
User_Coalition (Slot) = User_Coalition (Slot) - User_Suffer;
end
tic
if length(Load_Demand)>1
if sum(Load_Demand) <= Extra_Load % if the load demand is greater than the extra load round off the values
Allocated_Load = Load_Demand;
Home_Get_Load = List_R_N_Extra;
Total_Allocation = sum(Allocated_Load);
Marginal_Distribution = Allocated_Load;
Energy_wasted = Extra_Load-Total_Allocation;
User_Coalition (Slot) = User_Coalition (Slot) - Energy_wasted;
User_Suffer = 0;
else
[Total_Allocation, Marginal_Distribution] = Game_Theory_Shapley(Load_Demand, Extra_Load);
User_Suffer = (sum(Load_Demand)-Total_Allocation);
Energy_wasted = 0;
User_Coalition (Slot) = User_Coalition (Slot) - User_Suffer;
end
end
toc
Record_Load(Slot,:)= [Extra_Load, sum(Load_Demand), Total_Allocation, Energy_wasted User_Suffer
User_Suffer_Without_Coalition ]; %Record of surplus load distribution
else
Record_Load(Slot,:)= [0, 0, 0, 0, 0, 0];
end
%% Saving values just to plot (Figure 3 in paper)
Extra_Load_Demand(Slot) = sum(Load_Demand);
Demand_Full_Fill(Slot) = Total_Allocation;
if sum(Load_Demand) > Extra_Load
Surplus_Energy(Slot) = 0;
Deficient_Energy(Slot) = sum(Load_Demand)-Extra_Load;
end
if sum(Load_Demand)< Extra_Load
Surplus_Energy(Slot) = Extra_Load-sum(Load_Demand);
Deficient_Energy(Slot) = 0;
end
if sum(Load_Demand) == Extra_Load
Surplus_Energy(Slot) = 0;
Deficient_Energy(Slot) = 0;
end
end
% end
Record_Load =[Generation' User_Without_Coalition' User_Coalition' Record_Load];
% Record_Data = table(Record_Load, 'VariableNames',
{'Generation','Utilization_with_Coalition','Utilization_without_Coalition', 'Extra_Load', 'Load_Demand',
'Total_Allocation','Electricity_Wasted', 'User_Suffer_with_Coor', 'User_Suffer_Without_Coalition'}) % To view and save
the data in tabular form
%% Graphical Results %%
%% each time you will run the code different values will be generated for the total surplus and total extra demanded
energy so each time you will get result with little vaiations
%% Figure 2: Plots for per hour Generation, usage with Coalition and without Coalition
figure
plot(1:48, Record_Load(:,1), 'Color',[0.6 0.7 0],'Marker','>','LineWidth',1.4);
hold on
plot(1:48, Record_Load(:,2), 'Color',[0 0.6 1],'Marker','s','LineWidth',1.4);
hold on
plot(1:48, Record_Load(:,3), 'Color',[0.75 0 0],'Marker','*','LineWidth',1.4);
xlabel('Time (min)');
ylabel('Electricity Load (kW)');
set(gca, 'XTick',4:4:48)
legend('Generation','WOC','WC');
legend('Location','NorthEast');
grid on
hold off
%% Figure 3: Plots for per hour Generation, usage with Coalition and without Coalition
figure
plot(1:48, Extra_Load_Demand, 'Color',[1 0.1 0],'Marker','+','LineWidth',1.4);
hold on
plot(1:48, Demand_Full_Fill, 'Color',[0, 0.75, 0.75],'Marker','o','LineWidth',1.4);
hold on
plot(1:48, Surplus_Energy, 'Color',[0.9, 0.3, 0.09],'Marker','p','LineWidth',1.4);
hold on
plot(1:48, Deficient_Energy, 'Color',[0.84, 0.3, 0.84],'Marker','^','LineWidth',1.4);
xlabel('Time (min)');
ylabel('Electricity Load (kW)');
set(gca, 'XTick',4:4:48)
legend('Extra demand','Demand full filled', 'Surplus energy', 'Deficit energy');
legend('Location','NorthEast');
grid on
hold off
%% Figure 4 Bar Graph for Total Generation and Energy usage with coalition and without coalition
figure
bar(1,sum(Record_Load(:,1)),0.3,'FaceColor',[0.6 0.7 0])
hold on
bar(2,sum(Record_Load(:,2)),0.3,'FaceColor',[0 0.6 1])
hold on
bar(3,sum(Record_Load(:,3)),0.3,'FaceColor',[0.75 0 0])
set(gca, 'XTick',1:1:3,'XTickLabel',{'Generation','WOC','WC'})
ylabel('Electricity Load (kW)');
grid on
hold off
%% Figue 5 Group bar graph for '' User suffer and Energy Wastage '' %%
Wastage = [sum(Record_Load(:,4)) sum(Record_Load(:,7))];
Suffer = [sum(Record_Load(:,9)) sum(Record_Load(:,8))];
Group = [Wastage; Suffer];
figure
bar_Grapg= bar(Group);
set(bar_Grapg(1),'FaceColor',[0 0.6 1]);
set(bar_Grapg(2),'FaceColor',[0.75 0 0]);
ylabel('Electricity Load (kW)');
set(gca, 'XTick',1:1:2,'XTickLabel',{'Surplus energy','Deficit energy'})
legend({'WOC','WC'},'Location','NorthEast')
grid on
hold off
%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%
%% Scenario 2
%% Coalition among Apartments under a utility with Microgid %%
% For this purpose we collect the data form
% http://traces.cs.umass.edu/index.php/Smart/Smart
% Last visited 15-01-2018
% This information is taken for a single day.
% Where target is energy management for the situation when user want to
% use the extra energy during the emergency
% objective is to create the half hour Load Profiles used in the
% UK electricity settlement process for the settlement of the UK non-half hourly market
%% ^^^^^^^^^^ About DATA ^^^^^^^^^^ %%
%% First we have to import the data from Data_Appartments.csv in the same folder %%
%% Import data from text file
%% Setup the Import Options
opts = delimitedTextImportOptions("NumVariables", 10);
% Specify range and delimiter
opts.DataLines = [1, Inf];
opts.Delimiter = ",";
% Specify column names and types
opts.VariableNames = ["VarName1", "VarName2", "VarName3", "VarName4", "VarName5", "VarName6", "VarName7",
"VarName8", "VarName9", "VarName10"];
opts.VariableTypes = ["double", "double", "double", "double", "double", "double", "double", "double", "double", "double"];
opts.ExtraColumnsRule = "ignore";
opts.EmptyLineRule = "read";
% Import the data
DataAppartments = readtable("Data_Appartments.csv", opts);
%% Allocate imported array to column variable names
% VarName1 = dataArray(1, :);
% VarName2 = dataArray{:, 2};
% VarName3 = dataArray{:, 3};
% VarName4 = dataArray{:, 4};
% VarName5 = dataArray{:, 5};
% VarName6 = dataArray{:, 6};
% VarName7 = dataArray{:, 7};
% VarName8 = dataArray{:, 8};
% VarName9 = dataArray{:, 9};
% VarName10 = dataArray{:, 10};
% Data = [VarName1 VarName2 VarName3 VarName4 VarName5 VarName6 VarName7 VarName8 VarName9
VarName10];
Data= table2array(DataAppartments);
%% Clear temporary variables
clearvars filename delimiter startRow formatSpec fileID ans;
%% Convert the cell into array
Demand = Data; % Average Demand by the single Apartment during a day regardless of house members
N_Apartment = 10; % Number of Apartments You can change according to your demand
Generation = Demand; % Here generation will be assumed as total demand by the 5 houses
%% There is always a chance of error in forcasting values
% Here we will consider the case that demand should be less than the
% generation. This generation and demand unit is MW
j=1;
User_Coalition = Generation;
User_Without_Coalition = Generation;
User_Energy1 = Generation;
Avg_LOAD= zeros(30,10);
for avg = 1:1
tic
for Slot=1:30 % Data is collected after every 30 mints so we have total 48 slots of 30 mints
% R_Want_Int = randi([0 1], 1); % Check if any residence want to intruppt
% if R_Want_Int >0
Surplus_Apartment = 0;
Deficient_Apartment = 0;
User_Energy = User_Energy1(Slot, :);
Load_Curtailed = [];
Load_Demand = [];
%% Parameters for the SH who want to curtail their electricity load
N_R_Int = randi([0 N_Apartment], 1); % Here we will check how many Apartments are curtailing their load as an
example scenario we will considered maximum 5 residnce who can switched off their load
index = randperm(N_Apartment); % Randomize the number of houses
if N_R_Int >0
List_R_Int = index(1:N_R_Int);% Select the initial N_R_Int number of Apartments for surplus user
for g=1:length(List_R_Int)
Load_Curtailed(g) = (User_Energy(List_R_Int(g))- 0.1).*rand(1) + 0.1; % Load that is curtailed by the Selected SHs
if Load_Curtailed(g) > User_Energy(List_R_Int(g))
Load_Curtailed(g) = (User_Energy(List_R_Int(g))- 0.1).*rand(1) + 0.1; % Load that is curtailed by the Selected SHs
end
end
Ndecimals = 2;
f = 10.^Ndecimals ;
Load_Curtailed = round(f*Load_Curtailed)/f;
Extra_Load = sum(Load_Curtailed); % Sum of extra load
Surplus_Apartment = length(Load_Curtailed);
Surplus_Energy = sum(Load_Curtailed);
else
Load_Curtailed = 0;
Extra_Load = 0; % Sum of extra load
Surplus_Apartment = 0;
Surplus_Energy = 0;
end
%% Parameters for the SH who want extra electricity load
L_Apartment = N_Apartment-N_R_Int;
if L_Apartment> 0
N_R_N_Extra = randi([1 L_Apartment], 1); % Number of SHs who required extra load
List_R_N_Extra = index(N_R_Int+1:N_R_Int+N_R_N_Extra); % List of SHs Who need extra load
Load_Demand = (mean(User_Energy)- 0.1).*rand(1, N_R_N_Extra) + 0.1;
%% Call the game theory fucntion for the decision
%% Decision will be taken by game theory if the available load will be less than demanded load
Ndecimals = 2;
f = 10.^Ndecimals ;
Load_Demand = round(f*Load_Demand)/f;
Deficient_Apartment = length(Load_Demand);
Deficient_Energy = sum(Load_Demand);
else
Load_Demand = 0;
Deficient_Apartment = 0;
Deficient_Energy = 0;
end
length(List_R_Int)
Deficient_Apartment+Surplus_Apartment
Energy_MG = [];
mg = 1;
%% If Deficient_Apartment => 1 and Surplus_Apartment = 0
if Deficient_Apartment > 0 && Surplus_Apartment == 0
Energy_MG(mg) = -Deficient_Energy; % Extra Energy taken from MG
for jj= 1: length(List_R_N_Extra)
User_Energy(List_R_N_Extra(jj)) = User_Energy(List_R_N_Extra(jj))+ Load_Demand(jj); %
end
mg = mg+1;
end
%% If Deficient_Apartment = 0 and Surplus_Apartment => 1
if Deficient_Apartment == 0 && Surplus_Apartment > 0
Energy_MG(mg) = Surplus_Energy ;
mg = mg+1;
for jj= 1: length(N_R_Int)
User_Energy(N_R_Int(jj)) = User_Energy(N_R_Int(jj))-Load_Curtailed(jj);
end
end
%% If Deficient_Apartment = 1 and Surplus_Apartment =1
if Deficient_Apartment == 1 && Surplus_Apartment == 1
%% If Deficient_Energy < Surplus_Energy
if Deficient_Energy < Surplus_Energy
Energy_MG(mg) = Surplus_Energy - Deficient_Energy;
mg = mg+1;
User_Energy(List_R_N_Extra) = User_Energy(List_R_N_Extra)+ Load_Demand;
User_Energy(N_R_Int) = User_Energy(N_R_Int)-Load_Curtailed;
end
%% If Deficient_Energy > Surplus_Energy
if Deficient_Energy > Surplus_Energy
Energy_MG(mg) = Surplus_Energy - Deficient_Energy;
mg = mg+1;
User_Energy(List_R_N_Extra) = User_Energy(List_R_N_Extra)+ Load_Demand;
User_Energy(N_R_Int) = User_Energy(N_R_Int)-Load_Curtailed;
end
%% If Deficient_Energy == Surplus_Energy
if Deficient_Energy == Surplus_Energy
User_Energy(List_R_N_Extra) = User_Energy(List_R_N_Extra)+ Load_Demand;
User_Energy(N_R_Int) = User_Energy(N_R_Int)-Load_Curtailed;
end
end
%% If Deficient_Apartment == Surplus_Apartment
if Deficient_Apartment > 1 && Surplus_Apartment > 1
if (Deficient_Apartment == Surplus_Apartment && Deficient_Apartment>0) || (Deficient_Apartment <
Surplus_Apartment && Deficient_Apartment>1) || (Deficient_Apartment > Surplus_Apartment && Surplus_Apartment>1)
[value, Index] = ismember (Load_Demand, Load_Curtailed);
if sum(value)>0
Load_Demand2 = zeros(1, length(Load_Demand));
Load_Demand1 =Load_Demand;
nc=1;
c =1;
Load_Curtailed1 = Load_Curtailed;
for x = 1: length(Load_Demand)
for y = 1: length(Load_Curtailed)
if Load_Demand(x) == Load_Curtailed1(y) && Load_Demand2(x)==0
Load_Demand2(x) = Load_Demand(x);
Indx_No_Coalition(nc)= x;
Index_No_Payoff(nc) =y;
Load_Curtailed1(y) = 0;
Load_Demand1(x) = 0;
nc= nc+1;
end
end
end
rr=1;
Load_Demand3 = [];
for r = 1: length(Load_Demand1)
if Load_Demand1(r)>0
Load_Demand3(rr)=Load_Demand1(r);
rr= rr+1;
end
end
rr=1;
for r = 1: length(Load_Curtailed1)
if Load_Curtailed1(r)>0
Load_Curtailed3(rr)=Load_Curtailed1(r);
rr= rr+1;
end
end
if Load_Demand3 >0
[Total_Allocation, Marginal_Distribution] = Game_Theory_Shapley_S2(Load_Demand3, Load_Curtailed3); %
Load_Curtailed3 is Extra_Load
end
else
[Total_Allocation, Marginal_Distribution] = Game_Theory_Shapley_S2(Load_Demand, Load_Curtailed); %
Load_Curtailed is Extra_Load
end
VALUE = User_Energy(List_R_N_Extra)+ Load_Demand;
VALUE2 = User_Energy(N_R_Int)-Load_Curtailed;
for jj= 1: length(N_R_Int)
User_Energy(N_R_Int(jj)) = User_Energy(N_R_Int(jj))-Load_Curtailed(jj);
User_Energy(jj) = VALUE2(jj);
end
for ii= 1: length(User_Energy(List_R_N_Extra))
User_Energy(ii) = VALUE(ii);
end
if Deficient_Energy ~= Surplus_Energy
Energy_MG(mg) = Total_Allocation - Deficient_Energy;
mg = mg+1;
end
%% If Deficient_Energy > Surplus_Energy
%% If Deficient_Energy == Surplus_Energy
end
end
EMG(Slot) = sum(Energy_MG);
LD(Slot) = sum(Load_Demand); %Extra Demand by the user
EL(Slot) = Extra_Load; %Surplus Energy
LOAD(Slot,: ) = User_Energy; %Energy Generated
end
toc
%% For Plot
Avg_EMG(avg,:) = EMG;
Avg_LD(avg,:) = LD;
Avg_EL(avg,:) = EL;
Avg_LOAD(:, :) = Avg_LOAD+LOAD;
%% For Bar graph
Energy_Wasted(avg) = sum (EL); %WOC
Deficient_Energy(avg) = sum (LD); %WOC
Extra_Energy_MG_G_WOC(avg) = sum (LD); %WOC
Extra_Energy_MG_G_WC(avg) = sum(EMG); %WC
end
%%
%% Before Coordination
%% Fig. 3. Electricity load profile of ten apartments of one month.
figure
bar_Grapg= bar(Data);
set(bar_Grapg(1),'FaceColor',[0.7 0.1 0.1]);
set(bar_Grapg(2),'FaceColor',[0.9 0.7 0.2]);
set(bar_Grapg(3),'FaceColor',[0.2 0.3 0.3]);
set(bar_Grapg(4),'FaceColor',[0.85 0.4 0.8]);
set(bar_Grapg(5),'FaceColor',[0.2 0.2 0.8]);
set(bar_Grapg(6),'FaceColor',[0 0.8 0.7]);
set(bar_Grapg(7),'FaceColor',[0.9 0.1 0.1]);
set(bar_Grapg(8),'FaceColor',[0.5 0.5 0.5]);
set(bar_Grapg(9),'FaceColor',[0.2 0.9 0.1]);
set(bar_Grapg(10),'FaceColor',[0.9 0.5 0.3]);
ylabel('Load (kW)');
set(gca, 'XTick',1:1:30, 'XTickLabel',{'1', '2', '3','4','5', '6', '7', '8', '9', '10','11', '12', '13','14','15', '16', '17', '18', '19', '20','21',
'22', '23','24','25', '26', '27', '28', '29', '30'})
xlabel('Day');
% 'XTickLabel',{'Day 1','Day 2','Day 3', 'Day 4', 'Day 5', 'Day 6' })
legend({'Apartment 1','Apartment 2','Apartment 3' ,'Apartment 4' ,'Apartment 5', 'Apartment 6','Apartment 7','Apartment 8',
'Apartment 9', 'Apartment 10'},'Location','NorthEast')
grid on
%% After Coordination
%% Fig. 8. Electricity load profile in a month after coordination
LOAD =(Avg_LOAD)./avg;
figure
bar_Grapg= bar(LOAD);
set(bar_Grapg(1),'FaceColor',[0.7 0.1 0.1]);
set(bar_Grapg(2),'FaceColor',[0.9 0.7 0.2]);
set(bar_Grapg(3),'FaceColor',[0.2 0.3 0.3]);
set(bar_Grapg(4),'FaceColor',[0.85 0.4 0.8]);
set(bar_Grapg(5),'FaceColor',[0.2 0.2 0.8]);
set(bar_Grapg(6),'FaceColor',[0 0.8 0.7]);
set(bar_Grapg(7),'FaceColor',[0.9 0.1 0.1]);
set(bar_Grapg(8),'FaceColor',[0.5 0.5 0.5]);
set(bar_Grapg(9),'FaceColor',[0.2 0.9 0.1]);
set(bar_Grapg(10),'FaceColor',[0.9 0.5 0.3]);
ylabel('Load (kW)');
set(gca, 'XTick',1:1:30, 'XTickLabel',{'1', '2', '3','4','5', '6', '7', '8', '9', '10','11', '12', '13','14','15', '16', '17', '18', '19', '20','21',
'22', '23','24','25', '26', '27', '28', '29', '30'})
xlabel('Day');
% 'XTickLabel',{'Day 1','Day 2','Day 3', 'Day 4', 'Day 5', 'Day 6' })
legend({'Apartment 1','Apartment 2','Apartment 3' ,'Apartment 4' ,'Apartment 5', 'Apartment 6','Apartment 7','Apartment 8',
'Apartment 9', 'Apartment 10'},'Location','NorthEast')
grid on
%% Fig. 9. Deficient and surplus energy by each apartment during the month.
figure
bar_Grapg= bar(LOAD-Data);
set(bar_Grapg(1),'FaceColor',[0.7 0.1 0.1]);
set(bar_Grapg(2),'FaceColor',[0.9 0.7 0.2]);
set(bar_Grapg(3),'FaceColor',[0.2 0.3 0.3]);
set(bar_Grapg(4),'FaceColor',[0.85 0.4 0.8]);
set(bar_Grapg(5),'FaceColor',[0.2 0.2 0.8]);
set(bar_Grapg(6),'FaceColor',[0 0.8 0.7]);
set(bar_Grapg(7),'FaceColor',[0.9 0.1 0.1]);
set(bar_Grapg(8),'FaceColor',[0.5 0.5 0.5]);
set(bar_Grapg(9),'FaceColor',[0.2 0.9 0.1]);
set(bar_Grapg(10),'FaceColor',[0.9 0.5 0.3]);
ylabel('Load (kW)');
set(gca, 'XTick',1:1:30, 'XTickLabel',{'1', '2', '3','4','5', '6', '7', '8', '9', '10','11', '12', '13','14','15', '16', '17', '18', '19', '20','21',
'22', '23','24','25', '26', '27', '28', '29', '30'})
xlabel('Day');
% 'XTickLabel',{'Day 1','Day 2','Day 3', 'Day 4', 'Day 5', 'Day 6' })
legend({'Apartment 1','Apartment 2','Apartment 3' ,'Apartment 4' ,'Apartment 5', 'Apartment 6','Apartment 7','Apartment 8',
'Apartment 9', 'Apartment 10'},'Location','NorthEast')
grid on
%% Bar Graphs
Energy_Wasted = (Energy_Wasted); %WOC
Deficient_Energy = (Deficient_Energy); %WOC
Extra_Energy_MG_G_WOC = (Extra_Energy_MG_G_WOC); %WOC
Extra_Energy_MG_G_WC = (Extra_Energy_MG_G_WC); %WC
%%%%%%%%%%%%%%%% Calculate the energy stored and genertaed by the MG
for i=1:length(EMG)
if EMG(i)> 0
Extra_Energy_Save(i) = EMG(i);
Extra_Energy_Genrated(i) = 0;
end
if EMG(i)< 0
Extra_Energy_Genrated(i) = -EMG(i);
Extra_Energy_Save(i) = 0;
end
if EMG(i) == 0
Extra_Energy_Save(i) =0;
Extra_Energy_Genrated(i) = 0;
end
end
%% Fig. 7. Change in energy demand and extra generation by micro-grid one month data.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%
figure
plot(1:30, sum(Demand'), 'Color', [0.8 0 0], 'Marker','d', 'LineWidth', 1.4)
hold on
plot(1:30, sum(LOAD'), 'Color', [0.5 0.5 0.5], 'Marker','pentagram', 'LineWidth', 1.4)
hold on
plot(1:30, EL, 'Color',[0 0.7 0],'Marker','*','LineWidth',1.4);
hold on
plot(1:30, LD, 'Color',[0 0.5 1],'Marker','s','LineWidth',1.4);
hold on
plot(1:30, Extra_Energy_Save, 'Color',[0.4 0.4 0],'Marker','>','LineWidth',1.4);
hold on
plot(1:30, Extra_Energy_Genrated, 'Color',[0.9 0.9 0],'Marker','<','LineWidth',1.4);
xlabel('Day');
ylabel('Electricity Load (kW)');
set(gca, 'XTick',4:4:48)
legend('Expected Demand','Utilized','Surplus' ,'Extra Demand', 'Save','Extra Generation');
legend('Location','NorthEast');
grid on
hold off
%% Some Extra Plots just for Discussions. You can use them
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
figure
DATA_DISPLAY = [sum(Demand'); sum(LOAD'); EL; LD; Extra_Energy_Save; Extra_Energy_Genrated];
bar_Grapg= bar(DATA_DISPLAY');
set(bar_Grapg(1),'FaceColor',[0.8 0 0]);
set(bar_Grapg(2),'FaceColor',[0.5 0.5 0.5]);
set(bar_Grapg(3),'FaceColor',[0 0.7 0]);
set(bar_Grapg(4),'FaceColor',[0 0.5 1]);
set(bar_Grapg(5),'FaceColor',[0.4 0.4 0]);
set(bar_Grapg(6),'FaceColor',[0.9 0.9 0]);
ylabel('Load (kW)');
set(gca, 'XTick',1:1:30, 'XTickLabel',{'1', '2', '3','4','5', '6', '7', '8', '9', '10','11', '12', '13','14','15', '16', '17', '18', '19', '20','21',
'22', '23','24','25', '26', '27', '28', '29', '30'})
xlabel('Day');
legend('Expected Demand','Utilized','Surplus' ,'Extra Demand', 'Save','Extra Generation');
legend('Location','NorthEast');
grid on
hold off
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
figure
bar(sum(LOAD')-sum(Data'));
ylabel('Load (kW)');
set(gca, 'XTick',1:1:30, 'XTickLabel',{'1', '2', '3','4','5', '6', '7', '8', '9', '10','11', '12', '13','14','15', '16', '17', '18', '19', '20','21',
'22', '23','24','25', '26', '27', '28', '29', '30'})
xlabel('Day');
% 'XTickLabel',{'Day 1','Day 2','Day 3', 'Day 4', 'Day 5', 'Day 6' })
% legend({'Apartment 1','Apartment 2','Apartment 3' ,'Apartment 4' ,'Apartment 5', 'Apartment 6','Apartment 7','Apartment
8', 'Apartment 9', 'Apartment 10'},'Location','NorthEast')
grid on
%% Part 3 Fog Results: here we have claulated the response time, execusion time and memory utilization of programe with
increasing number of requests. By running scenario for 10, 20, 30, 40 and 50 appartments by changing the number of
appartments for which you can double the number of appartments
%% use these line after for Slots=1:48
%%
% if N_Home == 10
%
% User_Energy = [User_Energy1(Slot, :)];
% end
% if N_Home == 20
%
% User_Energy = [User_Energy1(Slot, :) User_Energy1(Slot, :)];
% end
% if N_Home == 30
%
% User_Energy = [User_Energy1(Slot, :) User_Energy1(Slot, :) User_Energy1(Slot, :)];
% end
% if N_Home == 40
%
% User_Energy = [User_Energy1(Slot, :) User_Energy1(Slot, :) User_Energy1(Slot, :) User_Energy1(Slot, :)];
% end
% if N_Home == 50
%
% User_Energy = [User_Energy1(Slot, :) User_Energy1(Slot, :) User_Energy1(Slot, :) User_Energy1(Slot, :)
User_Energy1(Slot, :)];
% end
%% These values will vary from system to system. I have find this value using matlab 2017b, and System was CORE i3
%% Fig. 10. The execution time of application running on fog
Apartments = [10 20 30 40 50];
Execution_Time_S = [2.40 23.55 73.83 101.64 230.60];
Memory = [536828 540596 711456 895740 1334280]/1024; % we find these methods as given in CloudSim.
CloudSim assume the file size and accrdingly allocates the jobs and calcuate the response time. In our scenario, we
considered a fog system having fix memory size. So we study how much time a fog will take to solve the coalition problem.
Response = [0.1 0.1 2.1 2.1 4.1];
figure
plot( Apartments, Execution_Time_S, 'Color',[0.9 0.1 0],'Marker','+','LineWidth',1.4);
xlabel('Apartments');
ylabel('Execution Time (sec)');
set(gca, 'XTick', 10:10:50)
grid on
%% Fig. 11. The memory required to run the application on fog
figure
plot( Apartments, Memory, 'Color',[0.6 0.3 0.3],'Marker','*','LineWidth',1.4);
xlabel('Apartments');
ylabel('Memory Utilization (MB)');
set(gca, 'XTick', 10:10:50)
grid on
%% Fig. 12. The network response time according to the data
figure
plot( Apartments, Response, 'Color',[0.5 0.5 0.8],'Marker','o','LineWidth',1.4);
xlabel('Apartments');
ylabel('Response Time (ms)');
set(gca, 'XTick', 10:10:50)
grid on
%% This coalition code is taken from "https://www.mathworks.com/matlabcentral/fileexchange/35334-shapley-value-for-n-
player-cooperative-games" and must be cited for "Twan Burg (2020). Shapley Value for n-player Cooperative Games
(https://www.mathworks.com/matlabcentral/fileexchange/35334-shapley-value-for-n-player-cooperative-games), MATLAB
Central File Exchange. Retrieved June 17, 2020."
% Copyrights for this code is reserved for orinignal authors. In this code
% we have modified the pay-off values according to the our scenarios. Other
% claculations are same as given by original authors
% There are two differnet function for shappley va;lues because we are
% using two differnet pay off tables.
%% Shapely for scenario 1
function [Total_Allocation, Marginal_Distribution] = Game_Theory_Shapley(Load_Demand, Extra_Load)
A =Load_Demand; % each operational time of appliances are condidered as player
B =1:length(A); % Assign location to find the possible combination
Player.Location =[]; % players all possible combinations location
Player.Value =[]; % Players all possible combinations
Availabe_Load =Extra_Load; % Availabe power load
i=1;
while i<=length(A)
Player(i).Location = [combntns(B,i)]; % combntns will return the possible combination of set
if i>1 % seperate first combination as they are individual players they have seperate payOff
Player(i).Value = sum((A(Player(i).Location))'); % Add up the power load to calculate the payOff
else
Player(i).Value = (A(Player(i).Location));
end
i=i+1;
end
v=[Player.Value];
%% Payoff value assigned to the demand. Person who have high demand will be assign with high payoff
%% This Setup is as follows:
% a coalition of players cooperates, and obtains a certain overall gain from that cooperation.
% Since some players may contribute more to the coalition than others or may possess different
% bargaining power (for example threatening to destroy the whole surplus), what final distribution
% of generated surplus among the players should arise in any particular game? Or phrased differently:
% how important is each player to the overall cooperation, and what payoff can he or she reasonably expect?
% The Shapley value provides one possible answer to this question.
for i=1:length(v)
if v(i)== Availabe_Load
pay_off(i) = Availabe_Load;
elseif v(i) < Availabe_Load
pay_off(i) = v(i);
elseif v(i)> Availabe_Load % && abs(v(i)-Availabe_Load)<=0.09
pay_off(i) = Availabe_Load;
else
pay_off(i)=0;
end
end
% Condition if one player demand is very high than the surplus and other
% demand is less than surplus what system should do
% pay_off(i)=
n=length(A);
% v=[1 3 0 0 9 8 3 8 4 7 6 2 0 1 2 0 9 8 3 8 4 7 6 2 0 1 2 2 0 1 2];
% n=5;
if n>1
B =[matr(n) pay_off'];
else
B =[1 pay_off];
end
Shapleyvalue =zeros(1,n);
for i=1:n
G = sortrows(B,[n+1 -i]);
Shapleyvalue(i) = Shappie(G(:,n+2)');
end
%% Basically shapley will assign the load to each home according to pay-off
Distribution = Extra_Load/length(Shapleyvalue);
% Value=Shapleyvalue>0
% Distribution= Value*Distribution
Marginal_Distribution = Shapleyvalue ;% Distribution+Shapleyvalue;
Load_Demand;
Total_Allocation = sum(Marginal_Distribution);
Availabe_Load;
Load_D = sum(Load_Demand);
if Total_Allocation > Availabe_Load
display('Total_Allocation is greater than Availabe_Load');
elseif Total_Allocation > sum(Load_Demand)
display('Total_Allocation is greater than Load_Demand');
end
end
%% Shapley for scenario 2
function [Total_Allocation, Marginal_Distribution] = Game_Theory_Shapley_S2(Load_Demand, Extra_Load)
A =Load_Demand; % each operational time of appliances are condidered as player
B =1:length(A); % Assign location to find the possible combination
Player.Location =[]; % players all possible combinations location
Player.Value =[]; % Players all possible combinations
Availabe_Load =sum(Extra_Load); % Availabe power load
B_B =1:length(Availabe_Load);
i=1;
Pay_OFF.Location =[];
Pay_OFF.Value =[];
while i<=length(A)
Player(i).Location = [combntns(B,i)]; % combntns will return the possible combination of set
if i>1 % seperate first combination as they are individual players they have seperate payOff
Player(i).Value = sum((A(Player(i).Location))'); % Add up the power load to calculate the payOff
else
Player(i).Value = (A(Player(i).Location));
end
i=i+1;
end
v=[Player.Value];
%% Payoff value assigned to the demand. Person who have high demand will be assign with high payoff
%% This Setup is as follows:
% a coalition of players cooperates, and obtains a certain overall gain from that cooperation.
% Since some players may contribute more to the coalition than others or may possess different
% bargaining power (for example threatening to destroy the whole surplus), what final distribution
% of generated surplus among the players should arise in any particular game? Or phrased differently:
% how important is each player to the overall cooperation, and what payoff can he or she reasonably expect?
% The Shapley value provides one possible answer to this question.
for i=1:length(v)
if v(i)== Availabe_Load
pay_off(i) = Availabe_Load;
elseif v(i) < Availabe_Load
pay_off(i) = v(i);
elseif v(i)> Availabe_Load % && abs(v(i)-Availabe_Load)<=0.09
pay_off(i) = Availabe_Load;
else
pay_off(i)=0;
end
end
% Condition if one player demand is very high than the surplus and other
% demand is less than surplus what system should do
% pay_off(i)=
n=length(A);
% v=[1 3 0 0 9 8 3 8 4 7 6 2 0 1 2 0 9 8 3 8 4 7 6 2 0 1 2 2 0 1 2];
% n=5;
if n>1
B =[matr(n) pay_off'];
else
B =[1 pay_off];
end
Shapleyvalue =zeros(1,n);
for i=1:n
G = sortrows(B,[n+1 -i]);
Shapleyvalue(i) = Shappie(G(:,n+2)');
end
%% Basically shapley will assign the load to each home according to pay-off
Distribution = Extra_Load/length(Shapleyvalue);
% Value=Shapleyvalue>0
% Distribution= Value*Distribution
Marginal_Distribution = Shapleyvalue; % Distribution+Shapleyvalue;
Load_Demand;
Total_Allocation = sum(Marginal_Distribution);
Availabe_Load;
Load_D = sum(Load_Demand);
if Total_Allocation > Availabe_Load
display('Total_Allocation is greater than Availabe_Load')
elseif Total_Allocation > sum(Load_Demand)
display('Total_Allocation is greater than Load_Demand')
end
end
function matri=matr(n)
i=1; c=1;
if n==2 matri=[1 0; 0 1];
else
matri=zeros(2^n-1,n+1);
while i<n
for j=c:c+nchoosek(n-1,i-1)-1
matri(j,1)=1; %maakt de eerste kolom aan
end
c=c+nchoosek(n,i); i=i+1;
end
R=matr(n-1); t=2; k=1; r=1;
while k<n-1
matri(t:t+nchoosek(n-1,k)-1,2:n)=R(r:r+nchoosek(n-1,k)-1,1:n-1);
matri(t+nchoosek(n-1,k):t+2*nchoosek(n-1,k)-1,2:n)=R(r:r+nchoosek(n-1,k)-1,1:n-1);
t=t+2*nchoosek(n-1,k); r=r+nchoosek(n-1,k); k=k+1;
end
matri(2^n-2,2:n)=ones(1,n-1); matri(2^n-1,1:n)=ones(1,n); %de laatste 2 kolommen
end
g=1; c=1;
while g<=n
for j=c:c+nchoosek(n,g)-1 %bepaalt de groepsgrootte
matri(j,n+1)=g; end
c=c+nchoosek(n,g); g=g+1;
end
end
function Shapley=Shappie(v)
%Calculates the Shapley value for individual a
n=log2(length(v)+1);
M=zeros(1,2^n-2);
M(1,1)=v(1)*factorial(n-1);
c=2; i=1;
while i<n
for j=c:c+nchoosek(n-1,i)-1
M(1,j)=(v(j+nchoosek(n-1,i))-v(j))*((factorial(n-1))/(nchoosek(n-1,i)));
end
c=c+2*(nchoosek(n-1,i));
i=i+1;
end
Shapley=sum(M)/factorial(n);
end

Supplementary resource (1)

Data
June 2020
Adia Khalid · Nadeem Javaid
... Two problems naturally arise when relying on a third party. Firstly, intensive communication infrastructures are needed in the case of a central controller [5,[107][108][109][110][111]. Secondly, it is difficult to encourage a large number of participants in energy trading. ...
... We combined the above two equations, we now get θ s m(R s ) − γL s + γL s+1 ≤ θ s m(R s ) + (109) θ s+1 (m(R s+1 ) − m(R s )), ∀s = 1, 2, ..., S. ...
Research Proposal
Full-text available
The rapid deployment of Electric Vehicles (EVs) and usage of renewable energy in day-to-day activities of energy consumers have contributed toward the development of a greener smart community. However, load balancing problems, security threats, privacy leakages, and lack of incentive mechanisms remain unresolved in energy systems. Many approaches have been used in the literature to solve the aforementioned challenges. However, these approaches are not sufficient to obtain satisfactory results because of the resource and time-intensiveness of the primitive cryptographic executions on the network devices. In most cases, energy trading systems manage transactions using a centralized approach. This approach increases the risk of a single point of failure and overall system cost. In this study, a blockchain based Local Energy Market (LEM) model considering Home Energy Management (HEM) system and demurrage mechanism is proposed to tackle the issue of a single point of failure in the energy trading system. It allows both the prosumers and consumers to optimize their energy consumption and minimize electricity costs. This model also allows end-users to shift their load to off-peak hours and to use cheap energy from the LEM. On the other hand, users’ privacy leakages are still not solved in blockchain and can limit its usage in many applications. This research also proposes a blockchain based distributed matching and privacy-preservation model that uses a reputation system for both residential homes and EVs to preserve users’ privacy and efficiently allocate energy. A starvation free energy allocation policy is presented in the model. In addition, a charging forecasting scheme for EVs is introduced that allows users to plan and manage their intermittent EVs’ charging. Partial homomorphic encryption based on a reputation system is used to hide the EVs users’ whereabouts. Identity Based Encryption (ID Based encryption) technique is incorporated in the model to preserve the users’ information privacy in the blockchain. Another bottleneck in the energy trading systems is to perform efficient and privacy-preserving transactions. Therefore, an efficient and secure energy trading model leveraging contract theory, consortium blockchain, and a reputation system is proposed. Firstly, a secure energy trading mechanism based on consortium blockchain technology is developed. 1 Then, an efficient contract theory based incentive mechanism considering the information asymmetry scenario is introduced. Afterwards, a reputation system is integrated to improve transaction confirmation latency and block creation. Next, a shortest route and distance algorithm is implemented in order to reduce the traveling distance and energy consumption by the EVs during energy trading. Cheating attacks launched by both buyers and sellers are also issues, which are still not resolved. Thus, a mutual-verifiable fairness mechanism during energy trading based on timed commitment is presented. Proof-of-Energy Reputation Generation (PoERG) and Proof-of Energy Reputation Consumption (PoERC) consensus mechanisms are proposed to solve the high computational cost and huge monetary investment issues created by Proof-of- Work (PoW) and Proof-of-Stake (PoS) existing mechanisms. The mechanisms are developed based on reputation where energy trading transactions are audited, validated, and added into blocks of a blockchain. In order to protect the proposed model from impersonation attacks and minimize malicious validators, a two-stage peer-to-peer secure energy trading model based on blockchain is proposed. The proposed model has two layers: a mutual authentication process layer, and a secure and privacy-preserving energy trading layer. Afterwards, an incentivepunishment algorithm is introduced to motivate energy prosumers to contribute more energy in the proposed model. Next, a dynamic contract theory based supply-demand ratio pricing scheme is proposed. The purpose of the proposed pricing scheme is to solve the issues associated with the existing pricing scheme. Also, to preserve the privacy of the actual energy consumption behavior of the trading participants.
... For instance, smart-plugs, micro-controllers, affordable computing platforms (e.g., Arduino and Raspberry Pi), and multi-core embedded platforms (e.g., Jetson TX1/TX2, Jetson Nano, ODROID, etc.) are the most popular (Alsalemi et al., 2022;Thinh et al., 2021). Fog computing is the processing of data in the intermediate layer, which is placed between the edge and cloud layers (Khalid and Javaid, 2019). Cloud computing enables process occupancy data on the cloud level. ...
Article
Full-text available
The building internet of things (BIoT) is quite a promising concept for curtailing energy consumption, reducing costs, and promoting building transformation. Besides, integrating artificial intelligence (AI) into the BIoT is essential for data analysis and intelligent decision-making. Thus, data-driven approaches to infer occupancy patterns usage are gaining growing interest in BIoT applications. Typically, analyzing big occupancy data gathered by BIoT networks helps significantly identify the causes of wasted energy and recommend corrective actions. Within this context, building occupancy data aids in the improvement of the efficacy of energy management systems, allowing the reduction of energy consumption while maintaining occupant comfort. Occupancy data might be collected using a variety of devices. Among those devices are optical/thermal cameras, smart meters, environmental sensors such as carbon dioxide (CO2), and passive infrared (PIR). Even though the latter methods are less precise, they have generated considerable attention owing to their inexpensive cost and low invasive nature. This article provides an in-depth survey of the strategies used to analyze sensor data and determine occupancy. The article’s primary emphasis is on reviewing deep learning (DL), and transfer learning (TL) approaches for occupancy detection. This work investigates occupancy detection methods to develop an efficient system for processing sensor data while providing accurate occupancy information. Moreover, the paper conducted a comparative study of the readily available algorithms for occupancy detection to determine the optimal method in regards to training time and testing accuracy. The main concerns affecting the current occupancy detection system in terms of privacy and precision were thoroughly discussed. For occupancy detection, several directions were provided to avoid or reduce privacy problems by employing forthcoming technologies such as edge devices, Federated learning, and Blockchain-based IoT.
... Distributed generators (DGs) and energy storage systems (ESSs) are DER units. Renewable energy sources (RES), such as solar (PV) and wind power, are commonly used in DG units [2][3][4]. ...
Article
Full-text available
Advances in technology and population growth are two factors responsible for increasing electricity consumption, which directly increases the production of electrical energy. Additionally, due to environmental, technical and economic constraints, it is challenging to meet demand at certain hours, such as peak hours. Therefore, it is necessary to manage network consumption to modify the peak load and tackle power system constraints. One way to achieve this goal is to use a demand response program. The home energy management system (HEMS), based on advanced internet of things (IoT) technology, has attracted the special attention of engineers in the smart grid (SG) field and has the tasks of demand-side management (DSM) and helping to control equality between demand and electricity supply. The main performance of the HEMS is based on the optimal scheduling of home appliances because it manages power consumption by automatically controlling loads and transferring them from peak hours to off-peak hours. This paper presents a multi-objective version of a newly introduced metaheuristic called the bald eagle search optimization algorithm (BESOA) to discover the optimal scheduling of home appliances. Furthermore, the HEMS architecture is programmed based on MATLAB and ThingSpeak modules. The HEMS uses the BESOA algorithm to find the optimal schedule pattern to reduce daily electricity costs, reduce the PAR, and increase user comfort. The results show the suggested system’s ability to obtain optimal home energy management, decreasing the energy cost, microgrid emission cost, and PAR (peak to average ratio).
... A DER unit is either a distributed generator (DG) unit or an energy storage system (ESS). DG units are usually renewable-energy-sources (RES), that is, solar (PV) and wind power sources [4][5][6]. ...
Article
Full-text available
The steady increase in the energy demand and the growing carbon footprint has forced electricity‐based utilities to shift from their use of non‐renewable energy sources to renewable energy sources. Furthermore, there has been an increase in the integration of renewable energy sources in the electric grid. Hence, one needs to manage the energy consumption needs of the consumers, more effectively. Consumers can connect all the devices and houses to the internet by using Internet of Things (IoT) technology. In this study, the researchers have developed and proposed a novel 2‐stage hybrid method that schedules the power consumption of the houses possessing a distributed energy generation and storage system. Stage 1 modeled the non‐identical Home Energy Management Systems (HEMSs) that can contain the DGS like WT and PV. The HEMS organise the controllable appliances after taking into consideration the user preferences, electricity prices and the amount of energy produced /stored. The set of optimal consumption schedules for every HEMS was estimated using a BPSO and BSA. On the other hand, Stage 2 includes a Multi‐Agent‐System (MAS) based on the IoT. The system comprises two portions: software and hardware. The hardware comprises the Base Station Unit (BSU) and many Terminal Units (TUs).
... • P2. Fog computing architecture: data pre-processing and NILM modules are implemented in the middle layer located between the edge and cloud layers [164]. It refers to the continuous power data collection at the edge layer, which then transmits the data to a gateway acting as a fog platform [165]. ...
Article
Full-text available
Smart nonintrusive load monitoring (NILM) represents a cost‐efficient technology for observing power usage in buildings. It tackles several challenges in transitioning into a more effective, sustainable, and digital energy efficiency environment. This paper presents a comprehensive review of recent trends in the NILM field, in which we propose a multiperspective classification of existing smart NILM techniques. More attention is devoted to describing the contributions of deep learning, feature extraction, computing platforms, and application scenarios for NILM development. Accordingly, NILM technical aspects are first investigated, including data collection devices and public data sets. Next, event‐based and non‐event‐based NILM algorithms are overviewed. Furthermore, potential limitations of existing solutions are identified, highlighting their technical challenges, especially those related to security and privacy preservation, data scarcity, results reproduction, and implementation and business difficulties. Lastly, future directions are explored to overcome the identified limitations.
... In a recent review study by Groppi et al. (2021), it was found that using sector coupling and DSM solutions in smart energy islands, lead to reduction of surplus electricity consumption and improvement of the grid ability to host variable renewable energy sources. There are different approaches for management and coordination of energy resources in smart buildings such as game theory (Khalid & Javaid, 2019), heuristics (Dao et al., 2019), genetic algorithms (Sharifi & Maghouli, 2019), stochastic predictive models (Salehpour et al., 2021;Zhang et al., 2018) and optimization techniques Yahia & Pradhan, 2020). Further details about the development and optimization algorithm of DSM can be found in a recent review by Sharda et al. (2021). ...
Article
Full-text available
Smart homes, connected through a network, can optimize the energy consumption and general load shape of their area. In this work, a blockchain-based smart solution is presented for demand-side management of residential buildings in a neighborhood to improve Peaks to Average Ratios (PAR) of power load, reduce energy consumption, and increase the thermal comfort of occupants by modeling heating, illumination, and appliance systems. For real-time power and temperature monitoring of the neighborhood, a transient numerical physical model has been developed. The simulator has been validated with data measured from a building in Northern Italy. Then, a neighborhood with 2,000 households has been modeled for different occupancy patterns, initial values, and boundary conditions. Two different control scenarios, namely basic and smart, have been considered. In the basic scenario, everything is managed by occupants except the boiler, which is controlled by the indoor temperature of the home. Instead, in the smart scenario, a blockchain-based network has been introduced for buildings to exchange a parameter called the Probability of the Next Hour (PNH). Ethereum Solidity has been deployed for smart contract development in the blockchain. The results show that using blockchain-connected smart controllers aimed at demand-side management can improve PAR, comfort level, and energy efficiency of buildings, which can bring about CO2 reduction on an urban and even global scale.
... Two problems naturally arise when relying on a third party. Firstly, intensive communication infrastructures are needed in the case of a central controller [9,138,139,140,141,142]. Secondly, it is difficult to encourage a large number of participants in energy trading. ...
Thesis
Full-text available
The rapid deployment of Electric Vehicles (EVs) and usage of renewable energy in day-to-day activities of energy consumers have contributed toward the development of a greener smart community. However, load balancing problems, security threats, privacy leakages, and lack of incentive mechanisms remain unresolved in energy systems. Many approaches have been used in the literature to solve the aforementioned challenges. However, these approaches are not sufficient to obtain satisfactory results because of the resource and time-intensiveness of the primitive cryptographic executions on the network devices. In most cases, energy trading systems manage transactions using a centralized approach. This approach increases the risk of a single point of failure and overall system cost. In this study, a blockchain based Local Energy Market (LEM) model considering Home Energy Management (HEM) system and demurrage mechanism is proposed to tackle the issue of a single point of failure in the energy trading system. It allows both the prosumers and consumers to optimize their energy consumption and minimize electricity costs. This model also allows end-users to shift their load to off-peak hours and to use cheap energy from the LEM. On the other hand, users’ privacy leakages are still not solved in blockchain and can limit its usage in many applications. This research also proposes a blockchain based distributed matching and privacy-preservation model that uses a reputation system for both residential homes and EVs to preserve users’ privacy and efficiently allocate energy. A starvation free energy allocation policy is presented in the model. In addition, a charging forecasting scheme for EVs is introduced that allows users to plan and manage their intermittent EVs’ charging. Partial homomorphic encryption based on a reputation system is used to hide the EVs users’ whereabouts. Identity Based Encryption (ID Based encryption) technique is incorporated in the model to preserve the users’ information privacy in the blockchain. Another bottleneck in the energy trading systems is to perform efficient and privacy-preserving transactions. Therefore, an efficient and secure energy trading model leveraging contract theory, consortium blockchain, and a reputation system is proposed. Firstly, a secure energy trading mechanism based on consortium blockchain is developed. Then, an efficient contract theory based incentive mechanism considering the information asymmetry scenario is introduced. Afterwards, a reputation system is integrated to improve x transaction confirmation latency and block creation. Next, a shortest route and distance algorithm is implemented in order to reduce the traveling distance and energy consumption by the EVs during energy trading. Cheating attacks launched by both buyers and sellers are also issues, which are still not resolved. Thus, a mutual-verifiable fairness mechanism during energy trading based on timed commitment is presented. Proof-of-Energy Reputation Generation (PoERG) and Proof-of Energy Reputation Consumption (PoERC) consensus mechanisms are proposed to solve the high computational cost and huge monetary investment issues created by Proof-of-Work (PoW) and Proof-of-Stake (PoS) existing mechanisms. The mechanisms are developed based on reputation where energy trading transactions are audited, validated, and added into blocks of a blockchain. In order to protect the proposed model from impersonation attacks and minimize malicious validators, a two-stage peer-to-peer secure energy trading model based on blockchain is proposed. The proposed model has two layers: a mutual authentication process layer, and a secure and privacy-preserving energy trading layer. Afterwards, an incentive-punishment algorithm is introduced to motivate energy prosumers to contribute more energy in the proposed model. Next, a dynamic contract theory based supply-demand ratio pricing scheme is proposed. The purpose of the proposed pricing scheme is to solve the issues associated with the existing pricing scheme. Also, to preserve the privacy of the actual energy consumption behavior of the trading participants. Furthermore, storage overhead and delay in communication are challenges that need urgent attention, especially in resource constrained devices for sustainable and efficient transactions. Therefore, a consortium blockchain based vehicular system is proposed in this work for secure communication and optimized data storage in Internet of Vehicles (IoV) network. To secure the proposed system from active and passive attacks, an encryption technique and an authentication mechanism are proposed based on public key encryption scheme and hashing algorithm, i.e., Advanced Encryption Standard-256 and Rivest Shamir Adleman (AES-256+RSA), and Keccak-256. It also protects the model from double spending attack. Moreover, a cache memory technique is introduced to reduce service delay and high resource consumption. In the cache memory, the information of frequently used services is stored, which results in the reduction of service delivery delay. Simulation results show that all of the proposed models perform significantly better as compared to the existing schemes.
Thesis
Full-text available
This thesis examines the use of blockchain technology with the Electric Vehicles (EVs) to tackle different issues related to the existing systems like privacy, security, lack of trust, etc., and to promote transparency, data immutability and tamper proof nature. Moreover, in this study, a new and improved charging strategy, termed as Mobile vehicle-to-Vehicle (M2V) charging strategy, is used to charge the EVs. It is further compared with conventional Vehicle-to-Vehicle (V2V) and Grid-to-Vehicle (G2V) charging strategies to prove its efficacy. In the proposed work, the charging of vehicles is done in a Peer-to-Peer (P2P) manner to remove the intermediary parties and deal with the issues related to them. Moreover, to store the data related to traffic, roads and weather conditions, a Transport System Information Unit (TSIU) is used, which helps in reducing road congestion and minimizing road side accidents. In TSIU, InterPlanetary File System (IPFS) is utilized to store the data in a secured manner. Furthermore, mathematical formulation of the total charging cost, the shortest distance between EVs and charging entities, and the time taken to traverse the shortest distance and to charge the vehicles is done using real time data of EVs. The phenomena of range anxiety and coordination at the crossroads are also dealt with in the study. Moving ahead, edge service providers are introduced to ensure efficient service provisioning. These nodes ensure smooth communication with EVs for successful service provisioning. A caching system is also introduced at the edge nodes to store frequently used services. The power flow and the related energy losses for G2V, V2V and M2V charging strategies are also discussed in this work. In addition, an incentive provisioning mechanism is proposed on the basis of timely delivery of credible messages, which further promotes users’ participation. Furthermore, a hybrid blockchain based vehicular announcement scheme is proposed through which secure and reliable announcement dissemination is realized. In addition, IOTA Tangle is used, which ensures decentralization of the system. The real identities of the vehicles are hidden using the pseudo identities generated through an Elliptic Curve Cryptography (ECC) based pseudonym update mechanism. Moreover, the lightweight trustworthiness verification of vehicles is performed using a Cuckoo Filter (CF). It also prevents revealing the reputation values given to the vehicles upon information dissemination. To reduce the delays caused due to inefficient digital signature verification, transactions are verified in the form of batches. Furthermore, a blockchain based revocation transparency enabled data-oriented trust model is proposed. Password Authenticated Key Exchange by Juggling (J-PAKE) scheme is used in the proposed model to enable mutual authentication. To prevent collusion attacks, message credibility check is performed using Real-time Message Content Validation (RMCV) scheme. Furthermore, K-anonymity algorithm is used to anonymize the reputation data and prevent privacy leakage by restricting the identification of the predictable patterns present in the reputation data. To enable revocation transparency, a Proof of Revocation (PoR) is designed for the revoked vehicles. The vehicle records are stored in IPFS. To enhance the chances of correct information dissemination, incentives are provided to the vehicles using a reputation based incentive mechanism. To check the robustness of the proposed model, attacker models are designed and tested against different attacks including selfish mining attack, double spending attack, etc. To prove the efficiency of the proposed work, extensive simulations are performed. The simulation results prove that the proposed study achieves high success in making EVs energy efficient, secure and robust. Furthermore, the security analysis of the smart contracts used in the proposed work is performed using Oyente, which exhibits the secure nature of the proposed work.
Article
The demand response (DR) strategy enables household users to actively optimize and dispatch the household energy management system (HEMS), which may significantly reduce the cost of user energy consumptions. However, the uncertainty of home users behaviors, the diversity of electrical equipment types, as well as the complexity of the working status of various devices have brought severe challenges to the home energy management system. This article proposes a new forecasting based optimization method to deliver the real-time scheduling considering the future environment trend. A recent proposed dueling based deep reinforcement learning approach is adopted to optimally dispatch the HEMS. In addition, due to the delay of heating, ventilation, and air Conditioning (HVAC) indoor and outdoor temperature data non-Gaussian, a new generalized corr-entropy assisted long short-term memory (GC-LSTM) neural network is proposed where the generalized correntropy (GC) loss function is adopted to predict the outdoor temperature. The proposed method is verified in a featured HEMS benchmark problem and the experimental results show that the user costs are effectively reduced while the user satisfaction is maintained utilizing the proposed method.
Article
Power mismatching between the generated and consumed power is caused by the stochastic and unpredictable demand energy, resulting in increasing the electricity bill and the load energy waste. A consensus algorithm-based coalition game theory for optimal demand management scheme is proposed for multi-agent smart microgrids (SMGs). The consensus algorithm depends on the information and data transfer among the neighbors in the multi-agents SMGs. The consensus algorithm for the demand management system has been proposed to improve the coalition game theory. The allocation of the surplus energy on the deficient customers is based on Shapley value, which enables the unequal distribution of power according to the demand. The computational and storage units are shifted to the Fog layer to deal with the multi-agents SMGs' extensive data and information. The proposed method's main objectives are minimizing the energy cost, energy waste in the presence of packet losses, and power mismatching. A hypothetical SMG system has been simulated and modeled using the MATLAB environment program to prove the proposed method's effectiveness. Three scenarios are performed, including without a demand management system, coalition game theory only, and consensus algorithm-based coalition game theory. A comparison between the obtained results has been performed. Sensitivity analysis based on the increasing of iterations and the number of homes is performed to prove the effectiveness of the proposed method. Also, a comparison between the optimization outcomes obtained results is implemented using genetic algorithm (GA), particle swarm optimization (PSO), ant colony optimization (ACO), and artificial bee colony (ABC) optimization techniques. The results prove the applicability and feasibility of the proposed method for the demand management system in SMG. The proposed method achieves an improvement of 8.056%, 6.629%, and 98.888% for the incremental cost, the total electricity bill, and load energy waste concerning their values without applying the energy management system, respectively.
Article
Full-text available
An efficient power management control for microgrids with energy storage is presented in this paper. The proposed control scheme increases the reliability and resiliency of the microgrid based on three distributed energy resources (DERs), namely Photovoltaic (PV), battery, and diesel generator with local active loads. Coordination among the DERs with energy storage is essential for microgrid management. The system model and the control strategy were developed in Real Time Digital Simulator (RTDS). Decoupled d-q current control strategy is proposed and implemented for voltage source converters (VSCs) used to interface the PV and battery sources to the AC grid. A dc-dc buck converter with a maximum power point tracking function is implemented to maximize the intermittent energy generation from the PV array. A controller is proposed and employed for both grid connected and island modes of operation. In grid connected mode, the system frequency and voltage are regulated by the grid. During a fault in island mode, the diesel generator controls the system frequency and voltage in isochronous mode. Results based on the real time digital simulator are provided to verify the superiority and effectiveness of the proposed control scheme.
Article
Full-text available
Energy consumption in the form of fuel or electricity is ubiquitous globally. Among energy types, electricity is crucial to human life in terms of cooking, warming and cooling of shelters, powering of electronic devices as well as commercial and industrial operations. Users of electronic devices sometimes consume fluctuating amounts of electricity generated from smart-grid infrastructure owned by the government or private investors. However, frequent imbalance is noticed between the demand and supply of electricity, hence effective planning is required to facilitate its distribution among consumers. Such effective planning is stimulated by the need to predict future consumption within a short period. Although several interesting classical techniques have been used for such predictions, they still require improvement for the purpose of reducing significant predictive errors when used for short-term load forecasting. This research develops a near-zero cooperative probabilistic scenario analysis and decision tree (PSA-DT) model to address the lacuna of enormous predictive error faced by the state-of-the-art models. The PSA-DT is based on a probabilistic technique in view of the uncertain nature of electricity consumption, complemented by a DT to reinforce the collaboration of the two techniques. Based on detailed experimental analytics on residential, commercial and industrial data loads, the PSA-DT model outperforms the state-of-the-art models in terms of accuracy to a near-zero error rate. This implies that its deployment for electricity demand planning will be of great benefit to various smart-grid operators and homes.
Article
Full-text available
In recent years, microgrids have developed as important parts of power systems and have provided affordable, reliable, and sustainable supplies of electricity. Each microgrid is managed as a single controllable entity with respect to the existing power system but demands for joint operation and sharing the benefits between a microgrid and its hosting utility. This paper is focused on the joint operation of a microgrid and its hosting utility, which cooperatively minimize daily generation costs through energy exchange, and presents a payment calculation scheme for power transactions based on a fair allocation of reduced generation costs. To fairly compensate for energy exchange between the micro- and utility grids, we adopt the cooperative game theoretic solution concept of Shapley value. We design a case study for a fictitious interconnection model between the Mueller microgrid in Austin, Texas and the utility grid in Taiwan. Our case study shows that when compared to standalone generations, both the micro- and utility grids are better off when they collaborate in power exchange regardless of their individual contributions to the power exchange coalition.
Article
In this paper, the large-scale integration of plug-in electric vehicles (PEVs) with Vehicle-to-Grid (V2G) technology is taken as a promising way to promote the integration of renewable energy sources (RESs). But, it is a challenging task for the independent system operator (ISO) to manage the power flows in its system, especially in the large-scale integration of PEVs and RESs into the transmission system. The coordination between PEV, as distributed storage devices, and variable RESs create variable power flows and loop flows and quests for utilization of controllable devices to manage these flows. The On-load tap changing (OLTC) transformers and phase shifting transformers (PSTs) are two flexible transmission technologies that can be solved this challenge through controlling the power flows. In this paper, a novel model is developed for optimal operation of flexible transmission technologies for coordinated integration of PEVs and RESs in power transmission networks. The proposed model has been implemented on the six-bus and the IEEE 118-bus test systems. The simulation results imply that: (i) The V2G technology of PEV battery can ease the impact of variability of RES on power system operations and reduce operation cost and wind power spillage; (ii) substantial economic savings can be achieved through utilization of both OLTC transformer and PSTs beyond the independent capabilities of each technology.
Article
This paper presents a smart Transactive energy (TE) framework in which home microgrids (H-MGs) can collaborate with each other in a multiple H-MG system by forming coalitions for gaining competitiveness in the market. Profit allocation due to coalition between H-MGs is an important issue for ensuring the optimal use of installed resources in the whole multiple H-MG system. In addition, considering demand fluctuations, energy production based on renewable resources in the multiple H-MG can be accomplished by demand-side management strategies that try to establish mechanisms to allow for a flatter demand curve. In this regard, demand shifting potential can be tapped through shifting certain amounts of energy demand from some time periods to others with lower expected demand, typically to match price values and to ensure that existing generation will be economically sufficient. It is also possible to obtain the maximum profit with the coalition formation. In essence the impact of the consumption shifting in the multiple H-MG schedule can be considered while conducting both individual and coalition operations. A comprehensive simulation study is carried out to reveal the effectiveness of the proposed method in lowering the market clearing price (MCP) for about 15% of the time intervals, increasing H-MG responsive load consumption by a factor of 30%, and promoting local generation by a factor of three. The numerical results also show the capability of the proposed algorithm to encourage market participation and improve profit for all participants.
Article
Energy management systems are essential and indispensable for the secure and optimal operation of autonomous polygeneration microgrids which include distributed energy technologies and multiple electrical loads. In this paper, a multi-agent decentralized energy management system was designed. In particular, the devices of the microgrid under study were controlled as interactive agents. The energy management problem was formulated here through the application of game theory, in order to model the set of strategies between two players/agents, as a non-cooperative power control game or a cooperative one, according to the level of the energy produced by the renewable energy sources and the energy stored in the battery bank, for the purpose of accomplishing optimal energy management and control of the microgrid operation. The Nash equilibrium was used to compromise the possible diverging goals of the agents by maximizing their preferences. The proposed energy management system was then compared with a multi-agent decentralized energy management system where all the agents were assumed to be cooperative and employed agent coordination through Fuzzy Cognitive Maps. The results obtained from this comparison, demonstrate that the application of game theory based control, in autonomous polygeneration microgrids, can ensure operational and financial benefits over known energy management approaches incorporating distributed intelligence.
Article
Research on the operation of the multiple microgrid (MMG) has been increasing as the power system is operated through the microgrid. Some of the studies related to MMG have introduced various operation strategies by introducing concepts such as power sharing and power trading for power exchange between microgrids. In this paper, a strategy for obtaining optimal scheduling of MMG systems with power sharing through coordination among microgrids that have no cost function of generation units is proposed. There are microgrid-energy management systems (MG-EMSs) in the lower level that determine individual schedules for each microgrid in a hierarchical system. In the upper level, the microgrid of microgrids center (MoMC) implements the coordination among microgrids. In order to achieve the optimal operation of the entire system, MoMC calculates the amount of power sharing based on a predetermined limit value and allocates the command for coordination to each MG-EMS. MG-EMS changes the individual schedule based on the command. These processes are repeatedly performed, and when the change of the total cost becomes smaller than a specified size, the process is terminated and the schedule is determined. The advantages of the proposed algorithm are as follows. (1) It is a power sharing strategy of multiple microgrids considering multiple feeder structures as well as a single feeder structure for minimizing the operation cost of the entire system; (2) it is a power sharing strategy between microgrids that can be applied in a microgrid where only units that do not have a cost function exist; (3) since it is the optimization of the distributed form, the computation time decreases sharply compared with the one performed at the central center. The verification of the proposed algorithm was performed through MATLAB.