Towards Sustainable Energy-Efficient Communities Based on a Scheduling Algorithm

The Internet of Things (IoT) and Demand Response (DR) combined have transformed the way Information and Communication Technologies (ICT) contribute to saving energy and reducing costs, while also giving consumers more control over their energy footprint. Unlike current price and incentive based DR strategies, we propose a DR model that promotes consumers reaching coordinated behaviour towards more sustainable (and green) communities. A cooperative DR system is designed not only to bolster energy efficiency management at both home and district levels, but also to integrate the renewable energy resource information into the community’s energy management. Initially conceived in a centralised way, a data collector called the “aggregator” will handle the operation scheduling requirements given the consumers’ time preferences and the available electricity supply from renewables. Evaluation on the algorithm implementation shows feasible computational cost (CC) in different scenarios of households, communities and consumer behaviour. Number of appliances and timeframe flexibility have the greatest impact on the reallocation cost. A discussion on the communication, security and hardware platforms is included prior to future pilot deployment.


Introduction
There exists a global aim to conceive novel sustainable services and energy infrastructures to balance supply and demand. Over the last decade, many sustainable development initiatives across the globe have been promoting regulatory campaigns, such as pricing or optional/mandatory thermal retrofit policies, looking at the engagement of cost-effective social behaviour and/or a social pro-environmental morality [1]. To this regard, the Internet of Things (IoT) and Demand Response (DR) combined have transformed the way Information and Communication Technologies (ICT) contribute to saving energy and reducing costs, while also giving consumers more control over their energy footprint [2,3]. Connected devices (e.g, household items, machines, vehicles or gadgets) can automatically influence each other in order to increase the overall potential for energy efficiency and the range of management systems' involvement.
DR programmes, designed to stimulate changes in consumers' electric usage patterns, thus appear to bolster not only energy efficiency, but also renewable energy resource management initiatives. Current DR strategies are based on providing end-users with individualised tailored advice about their particular habits with incentive payments for load reductions when needed to ensure reliability [4]. For instance, as control and communication technologies become more widely accessible, electricity prices and information are delivered more effectively to consumers. This allows consumers to identify and more easily target discretionary loads that can be curtailed or shifted. On one hand, we can find new challenges to the analysis of these loads and the extraction of consumer/community patterns that produce more automatic and user-friendly DR systems as well as driven by congestion management instead of being price-based. On the other hand, this automation should be enabled by on-site energy controls fed by near-real-time pricing information without significant customer effort or intervention. Furthermore, the real exploitation of renewable sources for energy supply presents multiple challenges not only to utilities, grid and system operators, but also to the consumer that knows very little about its availability or potential from microproduction [5] and energy harvesting processes [6,7]. For instance, according to the Eurostat survey (https://ec.europa.eu/eurostat) (Figure 1), only 19% of the final energy consumption in residential sector comes from renewable resources. Our proposal intends to bridge the aforementioned gap between utilities and consumers by leveraging consumer cooperation towards a joint daily schedule of their household appliances operation using supply generated from renewable energy sources. In this work, we assume the existence of an Utility entity (a set of energy providers or substations) generating, accumulating, storing and ultimately serving electricity to the consumers. This role, the Utility, is therefore in charge of allocating the available supply from the different energy sources at disposal of the community; it is not, however, dealing with the final destination of the supply (whether to power low-energy electronics or bigger appliances). As an application scenario, imagine a smart community of electricity consumers who, empowered by a better access to their consumption controls and appliance interconnection, are provided with sufficient incentives to coordinate and adjust their energy demands for a certain purpose. These consumption controls are coordinated by a Home Energy Management System, which enables energy management at homes. By doing this, consumers are able to visualise the energy data and make optimum use of energy by controlling their electrical appliances. They autonomously adapt their energy consumption by means of sharing nearly real-time electricity demand information. An aggregator device, capable of shifting the consumers' use of the resource, will be able to make the overall consumption pursue common goals such as being sustainable, ecofriendly or cheaper. On the other hand, utilities, allowed to perform real-time billing, profiling and fault detection, are also creating incentives for users consuming renewable sources (e.g., guaranteeing the lowest price if the load demand does not exceed a certain threshold). They produce, store, distribute and serve the supply to the consumers who will now benefit from additional information about the supply availability. It has to be observed that neither utilities nor consumers are considering microgenerated energy in the current model. Hence, it is responsibility of the aggregator the computation and rescheduling of the total daily load of the community to avoid overloading the utility supply from renewables. This scheduling represents an optimisation problem whose main factors are the 24 h-vector of the next day's supply from renewable sources and the duration and activation time preferences of every consumer's appliance.
In this work, we present a cooperative DR system designed to promote behavioural changes in small or large communities with common interests. The involved entities will reach binding agreements and coordinated behaviour through the aggregator, a device that collects 24-h vectors with the consumers' demands and the expected supply from renewables. It also centralises the supply allocation algorithm that optimises the distribution of the available green supply between the consumers taking into consideration their time preferences of appliance activation. Experimentation on the algorithm implementation is conducted using estimated values and benchmarks. We include the analysis of the power consumption in watts for most commonly used appliances taking average measures informed by manufacturers; for each appliance type, we show the efficiency label (according to EU normative), the estimated cost while in operation mode and standby mode as well as the average consumption in 24 h time. In addition, we evaluate the algorithm over different strategies of player order selection as well as over the application of four heuristics that optimise the objective search. Evaluation results throw feasible computational cost in all these different programming configurations as well as considering a series of scenarios for household and community settings, and consumer behaviours. Finally, from the empirical results we can discuss on the hardware and networking requirements for an efficient pilot deployment.
The paper is organised as follows. We discuss the related work in Section 2. Section 3 states the system model and design decisions. We describe the simulation of the implemented scheduling algorithm and estimate the performance cost in Section 4. Technical considerations in terms of communication, network protocols, security and hardware platforms are drawn in Section 5. Finally, Section 6 concludes and establishes future research directions.

Related Work
The starting point of our research can be found in the works by the authors of [8,9], where an adaptive model for DR is envisioned over the deployment of smart meter networks. Special focus is taken on the software design in order to facilitate the integration and scalability of the community system future development. An example of a DR aggregator model is designed in the work by the authors of [10] to facilitate renewable energy integration, where end consumers play a key role.
One of the major challenges in the energy efficiency context is the way to involve end-users in energy markets. This fact can be exemplified in the works by the authors of [11,12], where systems are designed to facilitate DR for residential prosumers. For instance, the work by the authors of [12] shows a system based on an aggregator of residential prosumers that participate in the day-ahead energy market to minimise operation costs by controlling appliances. The performance of an optimisation-based residential energy management scheme is presented in the work by the authors of [13]. This work applies a constrained swarm intelligence model to minimise the total cost of household electricity consumption. As it has been stated by the authors of [14], models based on DR, smart technologies and intelligent controllers can lead to a considerable energy consumption reduction.
The vast majority of the related work addresses energy-efficient solutions and optimisation algorithms from a single consumer/home viewpoint. The appliance scheduling optimisation solution in the work by the authors of [15] considers time ranges and consumer preferences along with different types of appliance consumption profiles. Their solution is based on the Mixed Integer Linear Programming (MILP) technique under "Gurobi" solver, which is addressed to minimise both the total energy cost and the peak load of all the home appliances used per day. This model is unscalable though. Similarly, household load scheduling is also approached in the work by the authors of [16] by the MILP optimisation model. The MILP model and a heuristic algorithm accounting for a typical household user are simulated taking into account overall costs, climatic comfort level and timeliness.
MILP is also the technique applied to load shifting by the authors of [17] to optimise the interaction between an aggregator and smart consumers' operation. The specific DR program incentives and the consumers' needs are the main parameters that a Smart Home (SH) controller considers to reshape the consumers' demand profile through shifting the operation of flexible loads. Focused on users' individual preferences, the work by the authors of [18] sets priorities and preferred time intervals for load scheduling, along with making efforts to optimise the consumption curves of household, commercial and industrial consumers.
A remarkable interaction between the utility and its consumers is modelled through a two-step centralised game in [19], where consumers reduce the peak-to-average power ratio by optimising their energy schedules. The utility supplier pulls consumers in a round-robin (RR) fashion and provides them with energy price parameter and current consumption summary vector. Each user, then, optimises its own schedule and reports it back to the supplier, which, in turn, updates its energy price parameters before pulling the next consumers. Also centralised but considering renewable energy technologies to improve energy efficiency and reduce costs through optimisation algorithms, approaches in the work by the authors of [20] focus on the context of microgrids and storage at residential and commercial building environments. In addition, heuristics based on genetics algorithms [21] and neural networks [22] work on the scheduling of the consumer consumption to save the peak formation. Their simulation results show that the proposed algorithms reduce the peak-to-average ratio and help users minimise their energy expenses without compromising comfort.
Applying a distributed and an autonomous Demand Side Management (DSM) within a neighbourhood, the consumers' schedulers in the work by the authors of [23] are assumed to be built inside smart meters and connected to the power grid and a local area network. In order to reduce the total energy cost, these schedulers interact automatically by running a distributed algorithm to find the optimal energy consumption schedule. Subscribers also receive incentives to use the schedulers via a novel pricing model derived from a game-theoretic analysis. The authors of [24] formulate a power allocation game, where multiple companies, leaders and their consumers are the followers to reach a unique pure-strategy Nash equilibrium via a distributed algorithm. Authors find that the multi-period scheme, compared with the single-period one, provide more incentives for energy consumers to participate in DR. For a comprehensive description of the many algorithms that can be used to solve the resource allocation problem, see the work by the authors of [25].
In summary, several optimisation Pareto-efficient approaches to the load and/or consumption adaptive scheduling have been the focus of much attention in demand side management, SHs, wireless sensor networks, broadband networks, and smart grids [26,27].

System Model
Our proposal embraces the use of renewable resources aiming three main actors: Consumer, Aggregator and Utility. Figure 2 illustrates the main roles and processes within the adopted cooperative DR framework.
The first actor, Consumer, provides the home energy usage to be managed and automatically controlled by Home Energy Management System (HEMS) that performs three main functions: (1) schedule demand, (2) appliance control and (3) information provider. It selects the daily scheduling preferences, managing a profile for collaboration in a DR system and viewing its account and consume information. The consumer can manage them from a portable device (i.e., an app installed on a mobile phone or tablet) that is connected to a communication network for preferences scheduling. A community will comprise a set of consumers sharing electricity supplier or substation. HEMS pulls scheduling information and generates processed data to the Aggregator. HEMS is also responsible for collecting information from the Aggregator and controlling a variety of home appliances.  In our proposal, Consumers adapt their energy consumption cooperatively on a centralised way, that is, sharing their demand schedule with a data collector, which facilitates the integration of energy consumption information into a common view. This integration is performed over the so-called Aggregator, the second actor, which implements an optimised resource allocation algorithm as a response to supply conditions, in particular, targeting renewable sources. The Aggregator is defined as the optimal system providing energy management services in order to efficiently manage demand in SH [28]. HEMS acts as a central node and receives the demand scheduled information from the Aggregator. Then it loads the power consumption preferences to each appliance and establishes communication for managing the appliances. The Aggregator allows the local distribution of the energy provided, according to the availability of renewable resources. This energy management system will be connected to the Utility, the third actor, which is a set of energy suppliers shared by customers. We presume utilities implement a distributed generation that allows to gather energy from mainly renewable sources addressed to give lower environmental impacts and improve supply security.

Consumer System Design
Let N denote an ordered set of Consumers that are willing to cooperate in the pursuit of global community targets (i.e., becoming greener) by sending their data to the Aggregator. Each consumer i ∈ N has a set of household appliances labeled as A i . Fixed energy load is identified by factors such as the consumers' habits, their behaviours and their use of appliances, as well as a variable load resulting from the use of such appliances and other equipments. Formulae and benchmarks can be used to estimate appliance and home electronic energy use in kilowatt hours (kWh) as well as household local records.
Bearing in mind a discrete time slot system, and without loss of generality, we assume that time granularity is one hour per day. Regarding the appliances, each Consumer is supposed to preallocate a certain amount of fixed demand and variable consumption planned for the next 24 h [29]. For each appliance, a ij ∈ A i , we assume both daily fixed and variable energy consumption scheduling vectors at each time slot t ∈ {0, . . . , 23} to control its non-shiftable and shiftable consumption respectively.
We define f D t i,a ij and vD t i,a ij by denoting the corresponding one-hour fixed and variable energy consumptions respectively. Variable energy demand is characterised by its flexibility, as the Consumer preference for an appliance starting in a specific period of time is taken into consideration. For each appliance, there is an execution window (i.e., a closed interval) that selects a minimal starting time, and a maximal ending time labelled by t i beg and t i end . t i sched is defined as the working time of appliance "i" and matches the range of operation start time t i sched ∈ [t i beg , t i end ]. L is defined as the duration of the planned operation of appliance a ij in the next day. Load needs to be switched on for a time between two predefined moments: In this line, load also needs to be switched off: In other words, Consumer i will set the following data for its appliance a ij ∈ A i (see Table 1).

Consumption (kWh)
Fixed consumption (kWh) Fixed consumption (kWh) when appliance a ij is in standby status • Consumption (kWh) when a ij is on • Duration (hours/minutes) of the planned operation of appliance a ij in the next day • Point in time (hour, e.g., 8am) of preferred start of appliance a ij activation • Point in time (hour, e.g., 12pm) of preferred end of appliance a ij operation A centralised home controller provides access to all the appliances and devices at home via wireless networks; it will receive and apply the 24-hour reallocated vector from the Aggregator to systematically activate/deactivate every appliance without human intervention.
Moreover, we have developed an energy consumption scheduling app based on the Adobe XD template [30], which provides the consumer with an interface to control, monitor, visualise and program the functioning of appliances. More specifically, it allows the configuration and setting of the aforementioned data for each appliance a ij . Figure 3 depicts a usage sequence to explain how the application works. The app allows users to check the resources used in the previous 24 h as well as to select the appliance in relation to the dwelling zones such as the kitchen or the bathroom, among others. At this stage, consumer will be able to indicate the time range and the duration of activation for each appliance. The last window summarises the introduced demand information. It also provides an estimated power cost in operation and standby for each appliance (according to benchmark analysis in Table 2). Consumers have to give consent by sending these data to the home controller. Finally, a vector is sent to the Aggregator with the data structure shown in Table 1. Data aggregation is defined as a centralised system with aggregation tasks that communicates with the Utility and the Consumers as shown in Figure 4. An algorithm is originally designed to optimise the allocation of the expected electricity supply from renewables among the community's Consumers related to their chosen preferences.

Aggregator System Design
As an example of a renewable source efficient use, the Utility provides essential information on reliable renewable source and fossil energy programmed for the next 24 h by replacing carbon-intensive energy. The energy supply generated from a set of renewable sources at a time slot t ∈ {0, . . . , 23} is denoted by RW t . f U t represents the energy supply at time t generated from a set of fossil sources. The Utility centralises the distribution of the energy, the notification to the Aggregator, and the billing process. The renewable supply vector RW is essential for the Aggregator in the optimisation of a fair allocation of such supply between the Consumers' fixed (non-shiftable) and variable (shiftable) energy demands.
The daily fixed demand for consumer i ∈ N is denoted by i,a ij as the aggregated load of non-shiftable local consumption of the appliances and frequent behaviours. The Aggregator can then easily compute the daily fixed demand for the whole community of consumers at a time t as On a daily basis, the Aggregator verifies that the total energy consumed by all appliances in the system fulfils the daily utility service provided by the Utility. It is critical that the community does not reach the worst case such as On the contrary, aggregation of the variable energy is more complex given the consumers' time preferences. The Aggregator will execute a fair-share rescheduling of the community's requested variable demand per hour vD t i aiming at ∀t ∈ {0, . . . , 23}, We will show refinements of the proposed scheduler algorithm looking at the max-min fairness, Pareto-efficiency, envy-freeness, and truthfulness while serving Consumers' preferences. Perhaps the simplest way to give each Consumer equal chance against all other is to recursively apply a "round-robin" strategy in the allocation of each Consumer's needs. Fair random assignment is one of the refinement methods to be compared. A global centralised optimisation problem is faced here, where only a "Nash bargaining solution" is possible such as Therefore, solutions to the optimisation problem should satisfy t i sched and L while avoiding overconsumption at RW t . The formulation is explained in Algorithm 1 (Demand Calculation Function, DCF ) and it will be shaped as its minimum, i.e., min . DF C(·) upon request of Algorithm 2. In DF C function, a search for the optimum time slot for every appliance activation takes place given its activation time, its preference interval and the available supply in kW from the renewable utility. In particular, taking into account A i , t i sched , t i beg and t i end variables, the optimisation will determine how appropriate an adjustment is by minimising the total overconsumption (in hours) of the community appliances against the available renewable supply at a certain time slot.
Finally, upon reaching the optimisation objective, the Aggregator will notify the community that an agreement has been reached and privately release the reallocated demand vector − → µ i ∀i ∈ N to each Consumer. if ihour doesn't belongs to interval [t i beg , t i end ] then 6: f D t i computation 7: end if 8: end for 9: for iappliance 1 to size of appliances configuration (A i ) do 10: for ihour time to the total number of hours do 20: if ihour belongs to interval [t i beg , t i end ] then 21: else 23: end if 25: end for 26: end for 27

Proposed Algorithm: A Fair Division Game
The Aggregator can apply different approaches to optimisation search within the aggregated load vector vD. It contains all consumer appliances' scheduling that could be shifted within their preferred activation time frame. This scheduling problem at the Aggregator can be seen as a division game given a set of players (either the consumers in N or all its appliances ) and a set of assets (the supply from renewables in RW). In our algorithm we have opted for a turn-based sequential game played by Appliance instead of Consumer for optimisation purposes.
The scheduling problem has to produce a fair division of RW, i.e., a set of rules that, when properly used by the players, guarantees at the end of the game each player will have received a fair share of the assets. In our view, a fair share means that consumers' preferences on the appliance activation are considered by the Aggregator with equity and privacy. As in turn-based sequential games, defining the order under which players start within a turn could be approached in terms of (A) Round-Robin (RR) start: the first player selection policy is RR; (B) random RR; (C) ranking: the first player being the same every time; and (D) randomness: the first player is randomly selected (likewise the sequence order), as follows.
(A) The RR principle, known from other fields such as network scheduling and processor queuing, is based on a process/game/technique, where each task/person/device takes an equal share of something in turn. The RR scheduling can allocate the available electricity from renewables both simple and fairly among the Consumers/ Appliances, because (1) the consumers' number is known and fixed and (2) the reallocation process is centralised by the Aggregator which, starting on its own, will satisfy the demand of the Consumers/Appliances in a periodically repeated order. We include pseudocode of our algorithm's main function in the round robin strategy, being the rest pseudocodes similar with exception of the player turn selection on Algorithm 2-line 3. RR results in max-min fairness if the Consumers/Appliances' demands are equally sized; otherwise, fair queuing that establishes a fair share size would be desirable. (B) A random RR scheduling: A similar process as in A), though the election of first Consumer is random. (C) A picking-sequence has several merits as a fair division protocol [31]. Assuming that each agent has a (private) ranking over the set of objects, the allocator must find a policy (i.e., a sequence of agents that maximises the expected value of some social welfare function). Moreover, picking sequences are a natural way of allocating (indivisible) items to agents in a decentralised manner: at each stage, a designated agent chooses an item among those that remain available. The goal of the method is to identify the fairest sequence. (D) A random process could, or could not, introduce efficiency (no other "random" assignment dominates) in the aforementioned methods while keeping them Pareto-efficient, envy-free and giving good approximation to the social welfare. Efficiency in terms of computational time is also at stake.

System Validation
In this section, we measure the Computational Cost (CC) of the implemented scheduling algorithm evaluating the suitability of a number of four heuristics applied to the optimisation search and on a series of different case scenarios of consumer communities. In particular, the evaluation of the heuristics and their behaviour on our algorithm under the same input parameters will assist in the selection of the hardware platform for an efficient deployment.

Optimisation Algorithms Used
We adopt heuristic techniques to perform a partial random search of optimal solutions to our objective, i.e., either when the reallocation demand is met or when the number of predefined iterations is reached. We have identified and implemented the following four optimisation methods to guide the search of a workable solution, i.e., the nearest local minimum standard strategy in our Algorithm 1 as follows.
(i) Simulated Annealing (SA) [32] finds a local minimum solution for our Algorithm 1 (DCF ) starting at an initial operation time t i sched . As explained in Algorithm 3, SA starts generating trial point based on current estimates and evaluates the function by accepting a new value generated after T parameter is set. The solution must consider the [t i beg , t i end ] time constraints. t i sched can randomly generate and filter by L. In case of better D, the original one D , t i sched could be accepted as better solution if D is worst than D. After the internal counter reaches its threshold, T is cooled down and re-select the best solution again with the reset counter.  T reduction and update t i sched at each reduction 20: end while (ii) Genetic algorithm (GA) [33] is identified as a method mainly used to solve optimisation problems based on a natural selection process similar to biological evolution. GA finds an optimal operative time from our Algorithm 1 (DCF ) for the A i variables. As explained in Algorithm 4, GA can find a solution beginning with random population of points. GA repeatedly modifies a population of individual solutions. At each step, GA produces a next generation population based on a randomly selection of individuals from the current population. After that, the population turns into an optimal solution. The evaluation number is increased when the method finishes by calculating one generation P. Each generation is a feasible solution for the appliance scheduling (t i sched per appliance). In the evaluation stage, the best solution t i sched , which has the lowest demand, is inserted to the best solution set. Mutation and crossover operators are selected to generate the next evaluation from the current generation. The mutation operator randomly shifts the scheduled start times of some appliances in order to generate newly solutions that may have a better result in demand efficiency. They are screened with the constraints to filter out the infeasible ones. The crossover driver swaps scheduled t i sched under feasible solutions. if betters in D then 6: Update the current solution to the best neighbour in D; ∆=∆ 0 7: else 8: Search step reduction ∆=∆ 0 /2 9: end if 10: end while (iv) Particle Swarm Optimisation (PSO) [35] is a stochastic search method and simulates the social behaviour of particles used to find parameters that minimise a given objective. The optimisation determines the minimum value and the best location evaluating our Algorithm 1 (DCF ) through iterations.
Algorithm 6 illustrates this search procedure, which is initialised with the generation of particles assigning initial velocities and positions. The operative appliances time is defined as a set of lower and upper bounds [ .., v ij ) are the current position and velocity, respectively. Each individual adjusts its position according to a linear combination of its inertia ω, the best location of individual particle − → p = (p i1 , ..., p ij ) and the best location of particle swarm − → g = (g i1 , ..., g ij ). The confidence degree is determined by the random operators φ p and φ g in the range [0,1] together with the confidence coefficients c p and c g . They are responsible for moving in the direction of the best position of a particle and the global best position. The new displacements are no more than one way of trying to imitate other individuals. It then iteratively updates the solution positions (the new location is the old one plus the velocity, modified to keep particles within [ − → t beg , − → t end ], velocities and neighbours). The solution, above A i , tries to find the optimal ones. After several iterations, particles converge to the best solution.
− → t end ] 2: Set each particle best known position to its initial position − → p ← − → x 3: Initialise each particle velocity to random values − → 5: while Termination condition not reached do 6: for Each particle i do 7: if i > 1 then 8: Choose two random numbers φ p ,φ g 9: Update the position of the particle − → x ← − → x + − → v 12: Bound population 15: update the particle's best known position − → p ← − → x 16: end if 17: if f ( − → x ) < f ( − → g ) then 18: update the particle's best known position − → g ← − → x 19: end if 20: end for 21: − → g holds the best found position in search space 22: end while

Performance Analysis
Simulation runs on a computer with the following specifications: CPU: 2.3 GHz Intel Core i5; Memory: 8 GB 2133 MHz LPDDR3 and MATLAB R2018b [36]. We evaluate the computational cost of the proposed Algorithm 1 on a series of experiments that represent a variety of possible scenarios of community sizes, consumption patterns or consumer behaviour as depicted in Table 3. Experimentation will help us to identify the most influential factor/s in the computation of the community scheduling.
We have conducted an analysis on the most common appliances' real consumption estimation from manufacturers and data sources from the authors of [37], the U.S. Department of Energy (http: //www.energy.gov/), the National Grid report (http://www.nationalgrid.com), the authors of [38] and the reports (https://standby.lbl.gov/docs) as well as the manufacturer data to set the scenarios. Our benchmark is depicted in Table 2. Scenarios were envisioned from the design of a residential building as in Figure 5. In particular, we have generated eight scenarios as illustrated in Table 4 and conducted hundreds of experiments for the different factor values to obtain results on a boxplot shape. On the one hand, we can denote as altruistic or flexible a consumer whose time preferences range is big (e.g., from 0h to 23 h); such types of communities are represented by Cases 1, 3, 5 and 7. On the other hand, Cases 2, 4, 6 and 8 illustrate communities on a more selfish setting. Duration is set equally in both situations.   We will compare our method's performance with the four different heuristics mentioned in Section 4.1, i.e., SA, PSO, GA and PS, and evaluate the efficiency of the different strategies presented in Section 3.3 on the search for the optimisation objective. Figures 6-9 depict the scheduling cost for the different case scenarios of consumers using strategy C picking-sequence. These scenarios represent extreme conditions either considering high number of appliances and/or an uneven distribution of them, and also the flexibility of the consumers' time preferences. Communities with selfish settings or fixed consumption display the best results over all different optimisation procedures (cases 2, 4, 6 and 8). The CC is higher when consumers have an uneven number of appliances. This effect can be observed in Figure 7 and in comparison with Figure 6. The same occurs in scenarios with high variable demand (see Figure 9 and Figure 8). In addition, a high variable demand (Figures 8 and 9) penalises the CC when compared with low settings (Figures 6 and 7). We find the worst case situation on altruistic communities with high variable demand when applying strategy C under SA optimisation. As Figure 9 (red colour) shows, it takes 30 minutes. Both PSO and GA work with sets of solutions that interact between themselves. Both perform better due to the number of solutions managed at the same time. We can also conclude that strategy C under all possible scenarios can be solved within the next 24 h, being PSO the most computationally efficient for scheduling (28sec).
Additional simulation measures the performance of communities of 20 appliances per consumer in Case 1. Figure 10 (left) compares all the algorithms and shows that PSO achieves a global optimum solution quickly. GA obtains similar outcomes. Applying SA, Figure 10 (right) shows that the cost needed for the scheduling increases linearly with the number of appliances. So far, experiments have been mainly focused on strategy C. Figure 11 depicts the optimised cost obtained after applying all strategies, and taking into account the different factors (see Table 4). These factors are differentiated by branches and data are expressed as a percentage of the required CC.  Strategy C performs badly, with higher CC in all circumstances. This is mainly because the Aggregator needs more resources when it has to optimise all consumers and their appliances all together. The simulation performed with consumers by adding their preferences randomly (strategy D) shows similar cost when compared to strategy C. By contrast, the Aggregator under strategy A optimises consumers preferences consecutively in an individual way. A new variant of RR is to perform this strategy when the first consumer starts randomly (strategy B). Both strategies act equally, though dispersed. Strategy A appears as the most appropriate strategy on our system. Further conclusions can be extracted globally for all the strategies. The CC is higher in four possible situations: when users set a very flexible demand need, when the community is large, when the number of appliances is also large and when a high demand is needed (Figure 11, last branches). A better performance is achieved under strategy B when consumers demand low variable load, in a selfish and small community ( Figure 11, first branch). The distribution of appliances also impacts the CC, being higher in large communities with uneven number of appliances per neighbour. The highest CC, which exceeds the half an hour of computation, is obtained in strategy C scenario under a high demand flexibility for an optimisation of 30 neighbours with different appliances distribution per dwelling ( Figure 11, last branch).
Finally, Figure 12 compares the CC considering two different RW vector structure provided from the available sources at the Utility: uniform RW vector and the 50% standard deviation of RW values. For the eight different cases, and using strategy B and SA, testing is performed for communities of 5-30 consumers. In terms of the chosen strategy, both situations display similar behaviours.

Technical Considerations: Communication, Security and Hardware
Discussion on the development of a pilot testbed for our system over the existent smart home technologies, their security properties and more feasible communication protocols are included in this section. Extensive work on networking infrastructures has been proposed for smart metering data transmission [14,39]. Some approaches focus on fiber-optics for a high-speed data exchange transmission [40], whose deployment cost would only worth when high data transmission rates are required. Power Line Carrier (PLC) is generally applied to computer networks, wired smart meters among other purposes such as remote monitoring and direct control applications offered by utility companies to consumers [41,42]. Note that regulation should be taken into account to allow the use PLC technologies in outdoor deployments as discussed in the work by the authors of [43].
Infrastructures in a Home Area Network (HAN) comprise the communication technologies for deploying HEMS integrating the household appliances. Communication protocols for data transmission between appliances can be provided with a variety of unwired techniques [28] such as (1) ZigBee, which offers an adequate range communication with low data rate and power consumption; (2) Z-Wave, which has been used for short range communication due to the low latency communication of small data packets in scalable environments; (3) 6LoWPAN, which can be applied to building automation designs [44] and to home automation architectures [45]; (4) Bluetooth, which is widely used to exchange data over short distances in low energy usage and fast data exchange [46]; and (5) GSM networks and WLAN, which provide low latency robust communications [47].
Neighbourhood Area Network (NAN) connects customers' HEMS on a two-way communication infrastructure responsible for transmitting their demands and time preferences to the Aggregator, as well as the traditional control messages and power grid sensing data. Wireless cellular is widely used in this type of scenarios as described in the work by the authors of [14].
A Wide Area Network (WAN) establishes communication between the Aggregator and the Utility substations. Distance to cover is in a radius of a thousand meters comprising of two interconnected networks [48]. Protocols LoRaWan and 5G demonstrate high speed, bandwidth and responsiveness while operating on various licensed and unlicensed frequency bands. Moreover, LPWAN (LoRa) will fulfil most of the IoT challenges and applications. By contrast, the introduction of 5G into the IoT world is still slow and other technologies sound more promising at present time. Table 5 summarises the main features of the discussed technologies and includes recommendations on more appropriate application areas.
In terms of security and privacy, HEMS involve the deployment of physical controls, cyber-security countermeasures as well as privacy leakage prevention [49]. In addition, a gateway architecture for high system availability is proposed in the work by the authors of [50]. Anonymous authentication applying zero-knowledge proof of knowledge could be the solution to provide anonymous authentication between consumers and Aggregator. The latter needs to guarantee compliance with the General Data Protection Regulation (GDPR). Furthermore, a methodology to assess the security risks within the HAN domain should be developed as in the work by the authors of [51]. Further details can be found in the work by the authors of [52], where the authors explain the different IoT security threats scenarios (e.g., personal information leak) and provide an evaluation method within a situational smart home framework. Table 6 identifies the most promising hardware platforms to build our HEMS emphasising low-cost, compatibility, scalability, easy programming and lightweight properties [48,53]. Raspberry Pi 3 [54] is a single-board computer with integrated Bluetooth and WiFi module and enough resources to control the smart appliances and send/receive our system messages. The emergence of cheap microcontrollers like the Arduino has enabled the implementation of low-cost HEMSs mainly devoted to obtain the consumption data as to generate demand/load profiles [55]. For example, the work by the authors of [56] designs and implements a remotely controlled, energy-efficient and highly scalable HEMS using Zigbee in Arduino Mega board as a central controller. In [57] it is discussed and evaluated the performance of BeagleBone blue for HEMS developments, an open-source hardware platform with similar principles of Raspberry Pi. Similarly, the proposal by the authors of [58] develops a remote monitoring system using "Libelium Waspmot", a modular device that allows the integration of different sensors and radio transceivers. Additionally, deep learning implementations on Field Programmable Gate Array (FPGA) performs fast due to the exploration of parallel computing [59]. Particularly in the work by the authors of [60], Zedboard implementation (Zynq-ARM Cortex-A9 processor) allows the control of unpredictable loads in a deterministic demand management model. In the work by the authors of [61], the algorithm is modelled in Verilog language on a FPGA allowing dynamic reconfiguration of the HAN. A HEMS prototype is developed on a Cubietruck board (Linux based cortex A7 processor) using a WiFi module [62]. It transmits real-time sensing data using TCP/IP communication protocols.  In terms of our DR system, and from preliminary design decisions, our prototype will consist of a Raspberry testbed as the main processor of the HEMS, as it offers good computing performance at a very low price. Its interoperability will provide the performance of alternatives protocols such as ZigBee, WiFi or Z-wave. In the proposed architecture, the WiFi wireless communication between the Aggregator, HEMS and appliances can transfer the data at around a hundredth millisecond, a suitable speed for our current application. The proposed centralised DR system (Aggregator) will also operate in an open-source HW platform.

Conclusions
Globally, smart communities are envisioned more efficient as residents gain autonomy and self-organisation for reducing and shifting any resource consumption. Strategies for energy demand response applied to smart residential communities can lead to improved scenarios of energy efficiency. Consumers have the opportunity to reduce their electricity cost and/or peak-to-average ratio through scheduling their power consumption. In this article, we have described a DR model that integrates the electricity supply available from renewable energy sources into the scheduling process, which is centralised via the community Aggregator. We have showed details of community scheduling algorithm implementation and evaluated it in terms of its computational cost. Empirical comparison of our algorithm design on different implementation strategies for player turn selection and optimisation heuristics as well as on a series of case scenarios of community's consumption patterns showed feasible results in all cases (less than 1 minute to compute the rescheduled community vector). Simulations are conducted with data from our own benchmark of appliance power cost. We have also illustrated development decisions of a mobile app for consumers introducing their demands and time preferences. Finally, we included the discussion of the preliminary decisions on the hardware requirements and communication protocols for a pilot deployment. Immediate future work includes the pilot deployment comprising the algorithm/Aggregator running on the most suitable HW platform as well as the home controllers that autonomously activate/deactivate the smart appliances. We also plan to refine the scheduling algorithm as to consider the usage or purpose of the consumption along with the device type. Furthermore, Utilities and Aggregators in possession of the real-time data from microgeneration and other energy harvesting generators would enhance the conceptual demand response model. Finally, a study of the community patterns will be conducted through game theory and evolutionary computation methods.

Abbreviations
The following abbreviations are used in this manuscript.