## 4 Lower-Level Dynamic Response Priority-Based Response Instruction Allocation in VPP
### Dynamic Response Priority Sequence Construction for DERs  
The evaluation index of DERs priority sequence includes time margin. 1. Normalized improved time margin \(t_{\text{la}}\)  
The absolute time margin reflects the relationship between the maximum sustainable regulation time and a specific regulation duration \(T\). The regulation duration \(T\) is defined as the time period during which the DER device is required to always participate in response without exiting. Additionally, the normalized improved time margin is the negative exponential function of absolute margin. When participating in EFC, EVs will discharge to the grid and TCLs will shut down. For EV, the improved time margin can be expressed as  
\[t_{\text{la,EV}}=\exp(-\text{min}(\frac{(S_{\text{exp}}^{\text{min}}-s(t_{0})) E_{\text{r}}}{T\eta_{\text{c}}P_{\text{c}}^{\text{max}}},10)) \tag{20}\]  
where \(s(t_{0})\) is the SOC of the battery at time \(t_{0}\). \(S_{\text{exp}}^{\text{min}}\) is the minimum SOC at the departure time set by the user. \(E_{\text{r}}\) is the battery rated capacity. \(\eta_{\text{c}}\) is the charging efficiency. \(P_{\text{c}}^{\text{max}}\) is the maximum charging power. For ON/OFF-type TCLs (including fixed-frequency AC, fixed frequency RF, and resistance heating-type WH), the improved time margin can be expressed as  
\[t_{\text{la,TCL}}=\exp(-\text{min}(\frac{\text{min}(t_{\text{on}}^{\text{re}},t_{\text{off}}^{\text{max}})-T}{T},10)h_{\text{la,TCL}}) \tag{21}\]  
\[t_{\text{on}}^{\text{re}}=RC\,\text{ln}(\frac{\eta_{\text{AC}}P_{\text{AC}}R+ \theta_{\text{in}}(t_{0})-\theta_{\text{a}}}{\eta_{\text{AC}}P_{\text{AC}}R+ \theta_{\text{set}}(t_{0})-\delta/2-\theta_{\text{a}}}) \tag{22}\]  
\[t_{\text{off}}^{\text{max}}=RC\,\text{ln}(\frac{\theta_{\text{a}}-\theta_{ \text{in}}(t_{0})}{\theta_{\text{a}}-\theta_{\text{max}}}) \tag{23}\]  
where \(\theta_{\text{in}}(t_{0})\) and \(\theta_{\text{a}}\) are the indoor and ambient temperatures at time \(t_{0}\), respectively. \(\theta_{\text{set}}\), \(\delta\), and \(\theta_{\text{max}}\) are the indoor temperature setpoint, the temperature dead zone, and the maximum allowable temperature set by the user, respectively. \(P_{\text{AC}}\), \(R\), \(C\), and \(\eta_{\text{AC}}\) are the rated electric power, equivalent thermal resistance, equivalent heat capacity, and energy efficiency ratio of the TCL device, respectively. \(h_{\text{la,TCL}}\) is the amplification factor of the remaining duration of TCLs, and \(h_{\text{la,TCL}}\) is a constant greater than 1. For different \(h_{\text{la,TCL}}\), the improved time margin curves are shown in Figure 8.  
It can be seen from Figure 8 that for EVs with a large maximum sustainable regulation time, the margin curve is flat, and more of the normalized EV time margin falls in the lower part of the vertical axis. For TCLs, the larger \(h\)\({}_{\text{la,TCL}}\) will make more time margins of TCL devices distributed in the lower part of the vertical axis instead of all being concentrated in the upper part of the vertical axis, improving the probability that TCL can participate in EFC. Normalized state margin \(s_{\text{la}}\)  
The state margin reflects the relationship between the current state and the limit state set by the user (such as the minimum expected SOC of EV and the maximum indoor temperature of TCLs). The state margin can be expressed as follows,  
\[s_{\text{la,EV}}=1-\frac{s(t_{0}+T)-S_{\text{min}}}{S_{\text{exp}}^{\text{min }}-S_{\text{min}}} \tag{24}\]  
\[s_{\text{la,TCL}}=1-\frac{\theta_{\text{max}}+\delta/2-\theta(t_{0}+T)}{\theta _{\text{max}}-\theta_{\text{set}}(t_{0})+\delta} \tag{25}\]  
Considering that the response time of DER for EFC is generally tens of seconds, and it is usually less than 5 min, to simplify the analysis, the current state is used instead of the state after time \(T\); that is, \(s(t_{0}+T)\) and \(\theta(t_{0}+T)\) will become \(s(t_{0})\) and \(\theta(t_{0})\), respectively.