# Risk-Based Virtual Power Plant Implementation Strategy for Smart Energy Communities
## 3 Risk-Based VPP Implementation Strategy
### Risk-Based VPP Implementation Strategy
#### 3.2.1 Optimization-Based VPP Implementation Strategy  
In this study, the energy balance constraint is relaxed as risk function  
\[F(\mathbf{c},\hat{\mathbf{d}},\hat{\mathbf{g}}^{i})=\frac{1}{T}\sqrt{\left( \hat{\mathbf{d}}-\sum\limits_{i\in\mathcal{I}}\lambda_{i}\hat{\mathbf{g}}^{i} \right)^{2}}, \tag{5}\]  
where \(\hat{\mathbf{d}}\) and \(\hat{\mathbf{g}}^{i}\) are the expected demand and generation of resource \(i\) in the form of column vectors \(\hat{\mathbf{d}}=\left\{\hat{d}_{1},\dots,\hat{d}_{t},\dots,\hat{d}_{T}\right\}^ {T}\) and \(\hat{\mathbf{g}}^{i}=\left\{\hat{g}_{1}\,^{i},\dots,\hat{g}_{t}^{i},\dots, \hat{g}_{T}\,^{i}\right\}^{T}\). The expectation values can be measured using the historic data for demand and generation. \(\lambda_{i}\) is the capacity factor according to the second constraint in problem **P0**. The generation supplied from resource \(i\) is proportional to the capacity purchased by the VPP. Therefore, the second constraint in problem **P0** is modified as the capacity factor related to the maximum capacity of resource \(i\), \(\lambda_{i}=c_{i}/c_{i}^{\max}\).  
The risk function of the energy balance can be rewritten as a vector form:  
\[\begin{array}{ll}F(\mathbf{c},\hat{\mathbf{d}},\hat{\mathbf{g}}^{i})&=\frac {1}{T}\sqrt{\left(\hat{\mathbf{d}}^{T}\hat{\mathbf{d}}-\sum\limits_{i\in \mathcal{I}}\lambda_{i}^{2}\ \hat{\mathbf{g}}^{iT}\hat{\mathbf{g}}^{i}-2\sum\limits_{i\in \mathcal{I}}\lambda_{i}\hat{\mathbf{d}}\ \hat{\mathbf{g}}^{i}+2\sum\limits_{i\in \mathcal{I}}\sum\limits_{j\in\mathcal{J}}\lambda_{i}\lambda_{j}\ \hat{\mathbf{g}}^{iT}\ \hat{\mathbf{g}}^{j} \right)},\\ &=\frac{1}{T}\sqrt{\hat{\mathbf{d}}^{T}\hat{\mathbf{d}}+\sum\limits_{i\in \mathcal{I}}\lambda_{i}(-\lambda_{i}\ \hat{\mathbf{g}}^{iT}\ \hat{\mathbf{g}}^{i}-2\hat{\mathbf{d}}\ \hat{\mathbf{g}}^{i}+2\sum\limits_{j\in \mathcal{J}}\lambda_{j}\ \hat{\mathbf{g}}^{iT}\ \hat{\mathbf{g}}^{j})}.\end{array} \tag{6}\]  
In the risk function, the first term, \(\hat{\mathbf{d}}^{T}\hat{\mathbf{d}}\), is only related to the demand of the SEC. Therefore, the risk function of resource \(i\) when implementing a VPP can be defined as follows:  
\[f_{i}(\mathbf{c},\hat{\mathbf{d}},\hat{\mathbf{g}}^{i})=2\sum\limits_{j\in \mathcal{J}}\lambda_{j}\hat{\mathbf{g}}^{iT}\hat{\mathbf{g}}^{j}-\lambda_{i} \ \hat{\mathbf{g}}^{iT}\hat{\mathbf{g}}^{i}-2\hat{\mathbf{d}}\hat{\mathbf{g}}^{i}. \tag{7}\]  
The risk function of resource \(i\) in (7) consists of two parts: (1) the temporal correlation between the expected generation of resource \(i\) and the expected generation of other resources expressed as the first and second terms of \(\sum_{i\in\mathcal{J}}\hat{\mathbf{g}}^{iT}\hat{\mathbf{g}}^{j}-\hat{\mathbf{g }}^{iT}\hat{\mathbf{g}}^{i}\) and (2) the temporal correlation between the expected generation of resource \(i\) and the expected demand as the third term of \(\hat{\mathbf{d}}\hat{\mathbf{g}}^{i}\). This provides the following guide for VPP implementation to reduce the energy balance risk:  
1. The generated resources in the VPP should have low temporal correlation with each other;
2. The generation of resources in the VPP should have a high temporal correlation with the served participant's demand. Using the risk function, problem **P0** is relaxed as an unconstrained problem: \[\textbf{P1}:\ \min\limits_{\mathbf{c}}\widetilde{O}(\mathbf{c},\hat{\mathbf{d}},\hat{\mathbf{g}}^{i})=O(\mathbf{c})+\gamma F(\mathbf{c},\hat{\mathbf{d}}, \hat{\mathbf{g}}^{i}),\] (8) where \(\gamma\) is the relaxation multiplier, which imposes the priority of the risk. Problem **P1** is quadratic and differentiable. Therefore, it can be optimally solved using linear programming [30].