Weighted Fair Queuing as a Scheduling Algorithm for Deferrable Loads in Smart Grids
Weighted Fair Queuing (WFQ) is implemented for the problem of load scheduling in demand side management. Power demand, wait time and group-to-group fairness are the basis for three variants of the algorithm’s implementation. The results are compared to a Greedy strategy with regard to the residual of renewable power supply and the suggested measures of fairness. WFQ proves comparable to Greedy in terms of the primary objective and in addition is capable of equally distributing resources and distress caused by deferral.
KeywordsDemand side management Optimization Weighted fair queuing
Renewable energies are a resource that strain the grid through intermittent availability and difficulty in prediction. Demand side management addresses the issue by reversing the paradigm of grid operation and controlling power consumers instead of only power generators.
Within demand side management there is a need for robust algorithms that face the unpredictability aspect of renewable energies, which makes real-time algorithms with no forecast information favorable.
Finding solutions that improve the residual power problem is only the first step. Said problem is the question of how unused renewable supply should be handled. Using the Greedy algorithm significant improvements can be accomplished. However, the results indicate that distress would be unevenly spread in the consumer population. If distress is distributed unevenly, compensation would also be distributed unevenly, which means that the market is not design towards fairness.
This paper introduces Weighted Fair Queuing (WFQ) as a scheduling algorithm for deferrable loads in smart grids. Three variant implementations are presented that feature different concepts of fairness: serving more and simultaneously smaller loads, fairly distributing wait times, and treating any number of groups equally.
2 Materials and Methods
The experimental environment is designed in AnyLogic and uses an interface to control power consuming processes, as presented in . The interface is suitable for any process that is capable of prolonging periods of its activity or inactivity as can be seen in Fig. 1. This requires no intimate knowledge of the process: when an algorithmic decision is made to alter the behavior of an individual load, the request is passed on to the agent representing the load. In accordance with its internal conditions it then accepts or rejects. This is to replicate the sovereignty of loads, as in actuality algorithms are informed of the current states and consider them accordingly.
Every process is divided into 4 states: activity and inactivity, and for each of those one deferrable and one non-deferrable. Processes can alter their power demand from step to step or follow a mathematical function–anything that describes the real behavior. The model captures distinct periods in which switching can be deferred. The deferral and operation times are a matter of survey in the companies (interviews, data sheets and surveillance). The total load shape is based on real loads that are replicated with the simulation. Figures 2 and 3 are two examples of the power demand and the repeated activation of loads.
The analyzed algorithms make no use of forecasting of any kind; they operate based on information of the “now”. The power supply is processed data-point-by-data-point, left to right.
The model population consists of approximately 300 individual loads. These encompass beverage production, metal working, glass finishing, plastics production, textile treatment, sewage treatment, electric vehicles and compressors for both pressure applications and freezing. The switching behavior of a load for the purposes of the simulation is detailed. The realistic accuracy was verified by a test implementation in . The composition of the population, i.e. the proportions of types of loads are elected to reflect a midsized city by approximation, based on statistics found in [3, 4] and . The overall peak power demand across the whole population is 25 MW, with single members requiring power between 1 and 350 kW. The average population power demand is 5.8 kW (cf. Fig. 7). State changes are deferrable by 15% to 50% and depend on the current and future state (arrows in Fig. 1) of the individual load. At any given time an average of approximately 20% of loads is deferrable.
2.3 Objective Function
Considering the negative impact of renewable energies, optimizing the load population toward a renewable energy supply profile seems adequate. As the volatility of the renewables is the straining property, immediate consumption by the deferrable loads would lead to the minimization of the residual power function and thereby stabilization. Residual power (R) is the amount of power leftover from renewable supply after subtracting the demand. A sample from historic supply data is picked, that consists of wind and solar energy over 24 h with a resolution of one data point per 3 s. This deviates from the resolution of simulated demand, which is continuous. Figure 4 shows the sample. At this resolution the objective function incorporates no useful gradient information.
This scenario seems manageable concerning not only algorithms, but is also realistic with regard to resource allocation. The latter meaning that purely renewable supply seems unrealistic and would probably feature a safety factor to account for fluctuations in demand. At the same time, however, in an economic sense a rough balance between supply and demand is sensible, because of investment and operative costs. At the least, equal supply and demand appears to be a good initial metric.
This condenses the result of one 24 h simulation into one manageable value.
The Greedy strategy (Algorithm 1) is a heuristic search algorithm. It is incomplete, but fast and very simple. As  shows it generally yields good results, though it is not capable of systematically finding global optima. I chose this algorithm as a starting point for its popularity, non-specificity and low computational requirements. I have previously outlined the use of the Greedy algorithm in  and . The algorithm sorts the available candidates according to size and attempts to activate as many as possible, as can be seen in Algorithm 1.
Algorithm 1: Greedy
2.4.2 Weighted Fair Queuing
Weighted Fair Queuing (WFQ) is a sophisticated algorithm designed by Demers et al. (cf. ), building on the work of Nagle . WFQ manages congestion in gateway queuing of datagram networks. The problem occurs when participants in a network attempt to send data packets, but some entities always send larger packets than others. WFQ replaces the pragmatic FIFO (first in, first out) paradigm by categorically distinguishing datagram sources by packet size and permanently assigning them to queues with predetermined weights. Weight, packet size and a queues history determine which packet gets serviced next.
Identifiable parallels to the scheduling of deferrable loads lead to the application of WFQ in a novel way. The deferrable loads also feature a well-defined requirement for resources which is their power demand in Watts. This parameter is equatable to the packet size, as is the network bandwidth to the usable residual power. The significant reason that makes a more sophisticated algorithm desirable is the unfair dissemination of resource with the Greedy strategy. By sorting according to size, Greedy categorically prefers large loads, which disadvantages smaller loads.
Within every queue, all elements are queued on a FIFO basis. The element of the queue i to be scheduled next is Fi. All previously successfully activated elements are added with the summation term Fn. At every point in time the algorithm selects the queue with the lowest SFi value. The significant difference in comparison to the original WFQ implementation is the explicit check (Algorithm 2, ln. 10) whether the current residual power is sufficient for the regarded load. In the network realm decreasing bandwidth will not cause a packet to be rejected service–it will, however, take increasing amounts of times to submit. This “flow” property is not given in the case of deferrable loads, therefore “choking” cannot be applied, and switching decisions are discrete.
Algorithm 2: Weighted fair queuing
In datagram networks fairness is the property of allotting a certain resource to any participant according to a predefined key. Such a key maybe simple and assign equal fractions to everyone. In the case of WFQ, however the distribution scheme accounts for a priori observations in terms of the typical resource requirements of each participant. With WFQ bandwidth cannot be manipulated which means that the amount of sheer data transmitted will at best remain the same (though more packets cause more gaps). In fact the objective is to service a greater number of participants.
Fairness of Wattage
This exact thought is transferred to demand side management applied to a load’s wattage. In contrast to the original network application participants do not forfeit after multiple trials in vain. It is implausible to assume that a load be denied access altogether. Loads forcing themselves to power on is unfavorable, but in line with the conventional grid operation paradigm of supplementation in such a case. As the key influenceable property is the length of part of the “on” and “off” episodes of each load, disproportionately large loads compensate with their “on” time. This means that larger loads are operated for shorter periods of time by the algorithm. The objective of employing this queuing scheme is to serve more participants in the same time interval. Here fairness is targeting decongestion.
Fairness of Distress
“Wait time” is a second, additional fairness measure worthy of investigation. Wattage is a strictly objective parameter. If we consider the period that a process can wait to be served, this requires very intimate knowledge of the process to determine the validity or honesty of time parameters as declared by a machine operator. A company might easily misrepresent this information. For the simulation experiment at hand the processes were personally surveyed and documented during live observations. Especially as there was no motivation presented to falsify data, the time parameters can considered to be sufficiently accurate.
In this regard fairness would disregard the wattage of a load and consider the time it has been waiting to get served. Fairness in this sense is the equal distribution of waiting-distress among the entirety of the load population.
As for a third measure of fairness the load population is subdivided into regions of equal size, representative of quarters or districts. In this configuration each queue represents one region, and regions compete for the available resources. This option is designed to grant each group the same right to resources. Any attribute can be used to queue in this manner. This generic queuing scheme targets an equal distribution of deferral times and power to independent groups, but not within the groups. As the virtual finish time paradigm is still applied, smaller loads are preferred.
Weights and Queues
There is no definitive answer on how weights should be chosen. Existing procedures such as that outlined in  are not applicable because the prevailing problem of node congestion in networks is not a relevant phenomenon. Therefore a mode of selecting weights should rely on the available parameters. Each of the fairness measures suggested above requires its own weighing scheme.
2.4.3 Weight by Power (WFQ-Power)
Averages of power in queues and corresponding weights (WFQ-Power)
μ of power in queue
For example: At 250 kW load # 1 is a member of the queue weighted at 0.09, i.e. the group of highest wattages. Compared to bottom quintile member load # 2 of 20 kW and its weight of 1. Load # 1 has a virtual finish time 138 times higher. The mismatch in wattage reflects proportionately in the weights.
2.4.4 Weight by Wait Time (WFQ-Time)
Loads for WFQ-Time are dynamically assigned to queues by the percentage of wait time expended from their maximum so far. In order to augment urgency, queue weights are doubled from queue to queue
Expended wait time
2.4.5 By Region (WFQ-Geo)
In the case of grouping by region equal weights are assigned to all queues. As the fictitious regions comprise equal portions of every category of the overall population, and given the equal weights, this queuing scheme acts comparable to a round-robin. This is true for all types of WFQ with equal weights (cf. ).
3 Model Limitations
The proposed model requires highly automated processes. The underlying work plans are machine accessible so that the ensuing steps and their duration can be projected. Semi-automation or increased human interaction would hinder this procedure.
Even though they were not encountered during survey, processes that can continuously adapt the level of their power input can only be replicated as a series of discrete steps. On the contrary this model is a response to the lack of continuously adaptable processes. Yet this is a limitation.
In addition the size of the consumer population cannot be arbitrarily increased. To this end an arbitration mechanism appears feasible. Multiple optimization algorithms would work on a fraction of a larger problem which in turn is consolidated by optimization layers higher up in the hierarchy. This approach could also help to reduce the amount of datagrams that are sent between the loads and the optimizer.
Natural run: All loads operate without any algorithmic interference. This is a reference trial.
WFQ: Wait time
Results are compared regarding the fulfillment of the primary optimization objective from equation (3)–the minimization of residual power deviations. The three queuing schemes of the WFQ variants have different secondary objectives. The algorithm in experiment 3, with weights defined by power demand, aims to serve more participants, especially smaller ones. Experiment 4 entails queuing by wait time, which is designed to equally distribute the wait time percentages over the entire population. Queuing by region, experiment 5, is designed to allocate the same resources to arbitrarily defined subsets of the population.
In order to judge the fulfillment of these secondary objectives additional parameters must be analyzed. Cycles counts all activations which is the sum of every individual power-on that was granted–in the datagram sense this is analogous to serviced packages. The standardized average wait time is indicative of how long every activation was deferred in percent of the maximum. Deferral length is the sum of all deferrals as time. The variance of this value is representative of how evenly deferrals are distributed among the population.
While Greedy performs best in terms of residual, it causes a high variance in deferral lengths (inequal waiting). WFQ-Power and WFQ-Time accomplish their secondary objectives of equal distress distribution (variance) and increasing the serviced loads (cycles) at the cost of energy optimization (residual)
Avg. standardized wait [%]
Avg. deferral length [h]
Variance of deferral length
Cycles (switch on & off)
The Greedy algorithm performs best by reducing the residual by 54.8%. WFQ-Time improves the deferral distribution by a factor of 2.08, while maintaining a very similar deferral length.
This table shows the distribution of wait times of all queues of the WFQ-Geo algorithm. The objective here is to treat all queues equally, which hinders global optimization objectives. Fairness reflects in the similarity of waiting times
Avg. standardized wait [%]
Avg. deferral length [h]
Variance of deferral length
Figure 6 summarizes the advantages of WFQ: it is an improvement on the Greedy algorithm which is fast and versatile. At the cost of slightly worse results with regard to the optimization of the power residual, WFQ algorithms distribute distress more equally, and serve more loads all else being equal.
As to be expected the natural run that features no algorithm or adaptation to the objective function causes a high residual. The Greedy algorithm delivers the greatest improvement in terms of residual. At the same time this algorithm unevenly distributes the wait time distress across the population which is expressed in the variance of the average deferral time. WFQ-Time significantly narrows the variance of deferral, following its secondary objective. The WFQ-Power variant is capable of placing more individual activations which can be seen in its cycle count. Keeping in mind that the objective function cannot be fully attained, as indicated in Sect. 2.3, the algorithm still reduces the gap in serviced packages by approximately 60% in comparison to Greedy.
The results from the algorithm WFQ-Geo in experiment 5 are inferior in general as it causes longer wait times and the variance thereof indicates that wait times are heterogeneously distributed within queues. The objective of equal queue treatment is achieved at the cost of worse results all in all.
Distress distribution is a desirable trait in demand side management that is not trivially deducible. Wait time is a parameter that cannot be easily subverted, if for example the maximum deferral time is repaid as an incentive. Weighted Fair Queuing is capable of delivering comparable result to a Greedy strategy in the primary objective of residual power improvement. In addition it can be adapted to pursue additional objectives. I presented three possible measures of fairness: equality between multiple queues or regions (WFQ-Geo), the even distribution of wait times (WFQ-Time), and serving more participants (WFQ-Power)–the latter being most similar to the original algorithm. This shows that WFQ can be used to introduce fairness to the selection of deferrable loads.
5.3 Methodological Contribution & Policy Advice
Despite its complexity Weighted Fair Queuing is a staple of network congestion management. It is highly functioning and ubiquitous because of its performance and its ability to accomplish fairness. The application to energy distribution problems is novel. At the same time it introduces the problem of fairness into the matter, which was disregarded because of the focus on residual power optimization, monetary compensation or welfare gain.
The optimization problem presented and solved in this paper is significant in its size regarding multiple dimensions. Firstly the time resolution exceeds the commonly quoted 15 min intervals that stem from the tertiary grid balancing realm. Grid stabilization however can only be achieved when the shrinking number of spinning masses can be replaced. The realization that compensatory measure must move below the 30-seconds-threshold is at the core of this research. Secondly, the population is substantial with 300 members and 25 MW peak. Each load is replicated as an agent with internal processes, variables and decision making. Furthermore their states are not estimated or stochastically approximated–decision making and transmission is acute, meaning that statuses are inquired, evaluated, decided on and requests dispatched. Thirdly, no simplifying assumptions are applied to the target function (power supply) such as smoothing. The complexity of the problem is embraced to the extent that the resolution of the objective function (supply) is the restricting factor. The argument is in favor of preparedness, as methodologically the question answered here is that demand side management features the necessary scalability and agility.
The suggested algorithms are implementations of centralized algorithms. As the technology is still at an early stage centralization is acceptable. Especially as the methodological exploration of this topic–which this research is part of–is still ongoing. For future applications, however, this is not advisable, as a single entity will possess all information on all clients (loads). The controlling entity would be vulnerable to attacks . The presented model, is acting on a request basis which means that a load can reject any suggestion to change its state. Designing intrinsically safe systems increases complexity, but is quintessential policy advice.
5.4 Practical Implications
For companies owning deferrable loads the practical implications are low, especially if processes are highly automated. The test implementation presented in  required no manual interaction. While loads were in interference the optimization paused and resumed automatically. The more a deferrable load is interwoven into the process of a company, the more difficulty can arise from automated unexpected deferrals. Deferrable loads are an effort that aim to improve the usage of renewable loads. Some resulting distress is to be expected. Although not insinuated here, market design should compensate for this.
The suggested interface is at the core of the research presented, as it allows for the load to negotiate deferral and reject it. From a load’s perspective WFQ-Time is the most favorable, as it guarantees that no load is overburdened with deferral. The Greedy algorithm is unfavorable, as some loads are asked to defer significantly more often than others (unfairness).
5.5 Algorithm Comparison
There is a multitude of optimization algorithms that can be used. The advantage of the above presented algorithms is their simplicity. They can be categorized as local search algorithms, which means that they use a type of heuristic, like SFi in Eq. (5). As there are no simplifying assumptions, and every load is designed to be addressed with a direct request, the problem presents itself to be massive and without useful gradient information, which excludes classic optimization algorithms.
A suitable alternative would for example be “Simulated Annealing” (cf. ). It is an algorithm that begins by amply exploring the solution space with random solutions. A solution in this case is an allowable sequence of activation and pause for all loads. The algorithm continues by rejecting or accepting results, based on the metaheuristic property (“temperature”). In principle this algorithm converges on the global optimum solution, which local search algorithms are not systematically capable of. The significant disadvantage is considerably higher run time. A preliminary test implementation shows that, after 14 h Simulated Annealing delivers results, which are comparable to the Greedy strategy which takes approximately 15 min on the same desktop computer (2.5 GHz Intel Core i7 with 16 GB 1600 MHz DDR3 memory).
6 Related Work
Gellings laid out the fundamentals of demand side management in .
Most related work is based on  where an optimal deferrable load control problem is defined. The focus is placed on market parameters which is why price bounds are employed.  focuses on the problem laid out in this publication. To solve this problem a decentralized algorithm is employed, which communicates the power residual to all participants. This is in contrast to centralized solution efforts, but capable of scheduling multiple instances of the same load.  utilizes a similar approach but only for singular placement of loads in 24 h.
 uses a stochastic model which defers one activation of each load and no reactivation. The underlying idea is very strongly connected to the paradigm of grid operation. This means that the time scales of balancing power in the European grid are adopted and all activity takes places in time steps of 15 min, and deferral times are at least 4 h. The significant difference is the lack of understanding and anticipating load behavior. The publication focuses on the simulation of wind power only and the cost of demand side management.
 has a similar approach in that only one activation instance of every participant is considered. The multitude of loads is approached as a combinatorial problem. Here the smallest time step is one hour. In neither of these loads can extend their operative time.
Formulated as a constraint problem regarding the availability of the demand side,  manages a day-ahead scenario by interacting with energy markets. By the introduction of welfare they move away from monetary quantification. They outline the difference in time scale between markets (larger steps) and the load behavior (smaller steps).
heuristic, not physical time
- 1.T. Haslak, SACI 2016 – 11th IEEE International Symposium on Applied Computational Intelligence and Informatics, Proceedings, 2016, pp. 381–384. https://doi.org/10.1109/SACI.2016.7507406
- 2.C. Brabec, M. Neswal, R. German, Final Project Report: Smart Grid Solar. Tech. rep. (2019)Google Scholar
- 3.A. Kollmann, C. Amann, C. Elbe, V. Heinisch, Lastverschiebung in Haushalten, Industrie, Gewerbe und kommunaler Infrastruktur Potenzialanalyse fuer Smart Grids. Tech. Rep. 2 (2013)Google Scholar
- 4.M. Buddeke, C. Krüger, F. Merten, Modellbeschreibung: Einsatzmodell für Flexibilitätsoptionen im europäischen Stromsystem Projektbericht. Tech. rep. (2016)Google Scholar
- 5.L. von Bremen, M. Buddeke, D. Heinemann, A. Kies, D. Kleinhans, C. Krüger, F. Merten, M. Preute, S. Samadi, T. Vogt, W. Lukas, Ergebnisse und Empfehlungen des BMBF-Forschungsprojektes Regenerative Stromversorgung & Speicherbedarf in 2050. Tech. Rep. September (2016)Google Scholar
- 6.T. Weise, Global Optimization Algorithms – Theory and Application (2008). https://doi.org/10.1109/HIS.2007.11
- 7.A. Demers, S. Keshav, S. Shenker, Analysis and simulation of a fair queueing algorithm (1989). https://doi.org/10.1145/75247.75248. http://portal.acm.org/citation.cfm?doid=75247.75248 CrossRefGoogle Scholar
- 9.E. Magaña, D. Morató, P. Varaiya, in 10th International Conference on Telecommunications, ICT 2003, vol. 2, 2003, pp. 917–922. https://doi.org/10.1109/ICTEL.2003.1191562
- 18.M. Klobasa, Dynamische Simulation eines Lastmanagements und Integration von Windenergie in ein Elektrizitätsnetz. Ph.D. thesis (2007). https://doi.org/10.3929/ethz-a-005484330
- 19.T.P.I. Ahamed, S.D. Maqbool, E.a. Al-Ammar, N. Malik, 2011 2nd IEEE PES International Conference and Exhibition on Innovative Smart Grid Technologies, 2011, pp. 1–4. https://doi.org/10.1109/ISGTEurope.2011.6162637
- 20.L. Jiang, S. Low, 2011 49th Annual Allerton Conference on Communication, Control, and Computing, Allerton, 2011, pp. 1334–1341. https://doi.org/10.1109/Allerton.2011.6120322
Open Access This chapter is licensed under the terms of the Creative Commons Attribution 4.0 International License (http://creativecommons.org/licenses/by/4.0/), which permits use, sharing, adaptation, distribution and reproduction in any medium or format, as long as you give appropriate credit to the original author(s) and the source, provide a link to the Creative Commons license and indicate if changes were made.
The images or other third party material in this chapter are included in the chapter's Creative Commons license, unless indicated otherwise in a credit line to the material. If material is not included in the chapter's Creative Commons license and your intended use is not permitted by statutory regulation or exceeds the permitted use, you will need to obtain permission directly from the copyright holder.