# Demand-Response Control in Smart Grids
## 4 Comparison between Centralized and Distributed Control for Demand Response
### Distributed Control for Demand Response  
Distributed control is a method of demand response that uses distributed systems (such as smart meters) to manage energy usage. This system allows customers or utilities to monitor and adjust energy usage on an individual basis, rather than relying on a centralized system. This allows customers or utilities more flexibility in managing their own energy consumption and provides incentives for customers who reduce their energy use during peak times. In distributed DR, the request for energy is not centrally collected, and consumers have direct access to grid state indicators. Using this data, users can respond based on the system's state, especially in crucial situations. At the round \(t\) (time) of information transmission between agents, let be \(\pi_{i,t}\) the amount of resource sought by the agent \(i\)[29; 30]. Let \(\Pi\), \(\sum\limits_{i=1}^{n}\pi_{i}^{\min}\leq\Pi\leq\sum\limits_{i=1}^{n}\pi_{i}^{ \max}\) be the entire quantity of resources that the aggregator provides. \(\underset{t\rightarrow+\infty}{\lim}\pi_{i,t}=\pi_{i}\), \(i=1,2,\ldots,n\) exist and satisfy  
\[\pi_{i}^{\min}\leq\pi_{i}\leq\pi_{i}^{\max},\forall i\text{ and }\sum\limits_{i=1}^{N}\pi_{i}=\Pi \tag{8}\]  
The goal is to create a distributed iterative algorithm in which each agent \(i\) modifies its resource request at step k based on (i) its current need and (ii) the present requests of nearby agents that communicate with \(i\) with the restriction to not exceed the limit. The graph depicting the data exchange is considered to be tightly connected in the algorithm described in this work, and each agent \(i\) calculates its resource request \(\pi_{i,t}\) as a function of some \(\mu_{i,t}=[\hat{\mu}_{i,t},\tilde{\mu}_{i,t}]\) that each agent \(i\) acquires recursively as a linear combination of its previous \(\mu_{i,t}\) and the previous \(\left\{\mu_{i,t}\mid j\in N_{i}\right\}\) of its neighbors; specifically,  
\[\mu_{i,t+1}=p_{ii,t}\mu_{i,t}+\sum\limits_{j\in N_{i}}p_{ij,t}\mu_{j,t} \tag{9}\]  
where the \(p_{ij,t}\) are a set of time-varying weights defined as following: \(\sum\limits_{j=1}^{n}p_{ij,t}=1\), \(\forall i\); where \(p_{ij,t}>0\) if \(j\in N_{i}\), and \(p_{ij,t}=0\) otherwise. In this study, we propose an approach for resolving the problem of distributed resource allocation. The aggregator (which is aware of the amount of resource \(\Pi\) that needs to be  
Figure 3: Comparison between the consumed and generated power as well as the minimum and the maximum power. cooperatively delivered by the agents) is supposed to be able to communicate with K \(\geq\) 1 agents, and first sends a command requiring \(\Pi\)/K units of resource to each of them. Then, if the agent \(i\) is a neighbor of the aggregator, \(\hat{\mu}_{i,0}\) is set to \(xi=\Pi/\)K, and \(xj=0\) otherwise. Additionally, each agent sets \(\widetilde{\mu}_{i,0}=\pi_{i}^{\max}-\pi_{i}^{\min}\). For the equation, the algorithm utilizes constant weights. Each agent \(i\) sets its weights to be \(p_{ii}=1/(1+D_{i}^{+})\) and \(p_{ij}=1/(1+D_{j}^{+})\) for all \(j\) that have agent \(i\) as a neighbor, i.e., all \(j\) such that \(i\in N_{j}\). Therefore, each agent's value is updated as needed (Algorithm 2). \[\mu_{i,t+1}=\frac{1}{1+D_{i}^{+}}\mu_{i,t}+\sum_{j\in N_{i}}\frac{1}{1+D_{j}^{ +}}\mu_{j,t} \tag{10}\]  
where \(D_{j}^{+}\) is the maximum number of agents to which \(j\) can send information (the out-degree of agent \(j\)). ```
1. At each round \(\tau\) of the algorithm:
2. Send a copy of local value \(\mu_{i,t}\) to all neighboring consumer agents \(j\) (\(j\
eq i\)). 3. Wait for the local values \(\mu_{j,t}\) of all neighboring consumer agents \(j\) (\(j\
eq i\)). 4. Update new values \(\mu_{i,t+1}\) using Equation (10). 5. Calculate new value of \(\pi_{i,t}\) from \(\mu_{i,t}\) via Equation (9).