# Incentive Price-Based Demand Response in Active Distribution Grids
## 3 Mathematical Modeling and Simulation Setup
### Linear Model of the LV Grid  
A linear model of the LV grid based on [13] is derived below to express the node voltages as a linear function of node active and reactive powers. The branch currents \(\tilde{\mathbf{I}}_{b}\coloneqq[\tilde{I}_{b1},\cdots,\tilde{I}_{bN}]\) can be computed from the bus currents \(\tilde{\mathbf{I}}\) as below  
\[\tilde{\mathbf{I}}_{b}=\mathbf{M}_{r}\tilde{\mathbf{I}} \tag{1}\]  
where the binary matrix \(\mathbf{M}_{r}\) is the reduced version of the bus injection to branch current matrix with the column pertaining to the slack bus current removed [29]. As per [PERSON]'s law, the branch voltage drops can be computed from the bus current injections as \(\bar{\mathbf{v}}_{b}=(\mathbf{R}_{db}+\mathbf{j}\mathbf{X}_{db})\tilde{ \mathbf{I}}_{b}\). Then each node voltage phasor can be written as the difference between the slack node voltage \(v_{0}\) and the voltage drop on the line between the corresponding node and the slack node. In vector format, it is written as follows.  
\[\bar{\mathbf{v}}=\mathbf{v}_{s}-\mathbf{M}_{r}^{\mathrm{T}}\bar{\mathbf{v}}_{b} \tag{2}\]  
where the vector \(\mathbf{v}_{s}\coloneqq[v_{0},\cdots,v_{0}]^{\mathrm{T}}\) of size \(N\). From (1), the following expression can be written.  
\[\mathbf{v}_{s}=\bar{\mathbf{v}}+\mathbf{M}_{r}^{\mathrm{T}}(\mathbf{R}_{db}+ \mathbf{j}\mathbf{X}_{db})\tilde{\mathbf{I}}_{b} \tag{3}\]  
Let us assume that voltage magnitudes of the \(N\) buses are either measured or estimated at each sample time, denoted as \(\mathbf{v}_{m}=[v_{m1},\cdots,v_{mN}]^{\mathrm{T}}\) and collected in the diagonal matrix \(\mathbf{V}_{dm}=\mathrm{diag}(\mathbf{v}_{m})\). Then the approximate expression for branch currents from (1) can be written in terms of the bus active and reactive powers as below.  
\[\tilde{\mathbf{I}}_{b}=\mathbf{M}_{r}\mathbf{V}_{dm}^{-1}(\mathbf{p}+ \mathbf{j}\mathbf{q})^{*} \tag{4}\]  
where the bus current injections are calculated using the approximation \(\tilde{\mathbf{i}}=\mathbf{V}_{dm}^{-1}(\mathbf{p}+\mathbf{j}\mathbf{q})^{*}\).  
The real part of the node voltages from (3) can be expressed as below.  
\[\mathrm{Re}(\bar{\mathbf{v}}-\bar{\mathbf{v}}_{s})=-\mathbf{M}_{r}^{ \mathrm{T}}\mathbf{R}_{db}\mathrm{Re}(\tilde{\mathbf{I}}_{b})+\mathbf{M}_{r} ^{\mathrm{T}}\mathbf{X}_{db}\mathrm{Im}(\tilde{\mathbf{I}}_{b}) \tag{5}\]  
Using (4), the above expression can be written in terms of bus active and reactive powers as below.  
\[\mathrm{Re}(\bar{\mathbf{v}}-\bar{\mathbf{v}}_{s})=-\mathbf{M}_{r}^{ \mathrm{T}}\mathbf{R}_{db}\mathbf{M}_{r}\mathbf{V}_{dm}^{-1}\mathbf{p}- \mathbf{M}_{r}^{\mathrm{T}}\mathbf{X}_{db}\mathbf{M}_{r}\mathbf{V}_{dm}^{-1} \mathbf{q} \tag{6}\]  
In LV grids, the voltage phase-angles are small, hence the imaginary part of the node voltages from (3) can be neglected [28]. The errors introduced by this approximation are very much negligible (the maximum error will be less than 0.4%). Based on this assumption, (6) can be written as  
\[\mathbf{v}=-\mathbf{M}_{r}^{\mathrm{T}}\mathbf{R}_{db}\mathbf{M}_{r}\mathbf{ V}_{dm}^{-1}\mathbf{p}-\mathbf{M}_{r}^{\mathrm{T}}\mathbf{X}_{db}\mathbf{M}_{r} \mathbf{V}_{dm}^{-1}\mathbf{q}+\mathbf{v}_{s} \tag{7}\]  
Let us define the constants \(\mathbf{B}_{vp}=-\mathbf{M}_{r}^{\mathrm{T}}\mathbf{R}_{db}\mathbf{M}_{r} \mathbf{V}_{dm}^{-1}\), \(\mathbf{B}_{vq}=-\mathbf{M}_{r}^{\mathrm{T}}\mathbf{X}_{db}\mathbf{M}_{r} \mathbf{V}_{dm}^{-1}\) and then (7) becomes  
\[\mathbf{v}=\mathbf{B}_{vp}\mathbf{p}+\mathbf{B}_{vq}\mathbf{q}+\mathbf{v}_{s} \tag{8}\]  
The above expression for bus voltage magnitudes is linear with respect to the bus active and reactive powers. The matrices \(\mathbf{B}_{vp}\) and \(\mathbf{B}_{vq}\) are updated at each sample time based on the latest voltage measurements/estimates.  
In [13], it is shown that the above formulation for estimating the node voltages is more accurate than the state-of-the-art methods such as LinDistFlow [30].