# Synthesis of Solar Production and Energy Demand Profiles Using Markov Chains for Microgrid Design

^{*}

## Abstract

**:**

## 1. Introduction

## 2. Methodology for Generating Synthetic Profiles from Historical Data

#### 2.1. Analysis and Classification of the Initial Dataset

#### 2.2. Data Reduction Using Clustering

#### 2.3. Data Reduction Using Clustering

_{c}(h) × n

_{c}(h + 1), where n

_{c}(h) and n

_{c}(h + 1), respectively, represent the number of clusters at hour h and at hour h + 1. This matrix contains the probabilities that an element of a cluster identified at hour h joins an element of a given cluster at time h + 1.

#### 2.4. Scenario Generation

- X(h) is randomly selected among all elements of the cluster C(h) with uniform probability.
- X(h) is selected among all elements of the cluster C(h) considering the closest distance to the previous state X(h−1).
- X(h) is the medoid of the cluster: this strategy results in systematically replacing the cluster C(h) with its corresponding medoid.

- Start from an initial cluster C(0) at random (i.e., a random row of the first transition matrix T
_{1}of the month considered). - Start from the first cluster C(0) that is the closest to the last of the previous day C(23).
- Build an additional transition matrix T
_{24}that characterizes the transition between consecutive days of the month in the initial dataset T_{24}= T(X(23)→X(0)).

_{2}, we draw a random number r between 0 and 1 (r = U(0, 1) with a uniform random probability distribution:

- -
- example 1: if r = 0.1 then the cluster C(h + 1) = C
_{2}is chosen as successor because r greater than p(C_{1}) = 0 but r lower than p(C_{1}) + p(C_{2}) = 2/3; - -
- example 2: if r = 0.8, while r is between p(C
_{1}) + p(C_{2}) and p(C_{1}) + p(C_{2}) + p(C_{3})), the cluster C(h + 1) = C_{3}is chosen as successor.

## 3. Evaluation on a Case Study

- -
- clustering is carried with the k-medoid algorithm considering a fixed value of k = 10;
- -
- states of each cluster are only represented by the medoids associated with random sequences of the cluster generated via the Markov process;
- -
- transition between days in a month are performed using a 24th transition matrix.

#### 3.1. Statistical Assessment over Large Representative Periods

#### 3.2. Short-Timescale Variability

#### 3.3. Quantitative Comparisons

## 4. Conclusions and Perspectives

## Author Contributions

## Funding

## Data Availability Statement

## Acknowledgments

## Conflicts of Interest

## References

- King, A.J. Modeling with Stochastic Programming; Springer Series in Operations Research and Financial Engineering; Springer: New York, NY, USA, 2012. [Google Scholar]
- Hu, J.; Shan, Y.; Guerrero, J.M.; Ioinovici, A.; Chan, K.W.; Rodriguez, J. Model predictive control of microgrids—An overview. Renew. Sustain. Energy Rev.
**2021**, 136, 110422. [Google Scholar] [CrossRef] - Hong, T.; Pinson, P.; Wang, Y.; Weron, R.; Yang, D.; Zareipour, H. Energy Forecasting: A Review and Outlook. IEEE Open Access J. Power Energy
**2020**, 7, 376–388. [Google Scholar] [CrossRef] - Mavromatidis, G.; Orehounig, K.; Carmeliet, J. A review of uncertainty characterisation approaches for the optimal design of distributed energy systems. Renew. Sustain. Energy Rev.
**2018**, 88, 258–277. [Google Scholar] [CrossRef] - Koltsaklis, N.E.; Dagoumas, A.S. State-of-the-art generation expansion planning: A review. Appl. Energy
**2018**, 230, 563–589. [Google Scholar] [CrossRef] - Gandoman, F.H.; Abdel Aleem, S.H.E.; Omar, N.; Ahmadi, A.; Alenezi, F.Q. Short-term solar power forecasting considering cloud coverage and ambient temperature variation effects. Renew. Energy
**2018**, 123, 793–805. [Google Scholar] [CrossRef] - Radet, H.; Sareni, B.; Roboam, X. On the interaction between the design and operation under uncertainties of a simple distributed energy system. Int. J. Comput. Math. Electr. Electron. Eng.
**2022**, 41, 2084–2095. [Google Scholar] [CrossRef] - Köhler, S.; Rongstock, R.; Hein, M.; Eicker, U. Similarity measures and comparison methods for residential electricity load profiles. Energy Build.
**2022**, 271, 112327. [Google Scholar] [CrossRef] - Pfenninger, S.; Staffell, I. Long-term patterns of European PV output using 30 years of validated hourly reanalysis and satellite data. Energy
**2016**, 114, 1251–1265. [Google Scholar] [CrossRef] - Debnath, K.B.; Mourshed, M. Forecasting methods in energy planning models. Renew. Sustain. Energy Rev.
**2018**, 88, 297–325. [Google Scholar] [CrossRef] - Patidar, S.; Jenkins, D.P.; Simpson, S.A. Stochastic modelling techniques for generating synthetic energy demand profiles. Int. J. Energy Stat.
**2016**, 4, 1650014. [Google Scholar] [CrossRef] - Chen, Y.; Wang, Y.; Kirschen, D.; Zhang, B. Model-Free Renewable Scenario Generation Using Generative Adversarial Networks. IEEE Trans. Power Syst.
**2018**, 33, 3265–3275. [Google Scholar] [CrossRef] - Ghalehkhondabi, I.; Ardjmand, E.; Weckman, G.R.; Young, W.A. An overview of energy demand forecasting methods published in 2005–2015. Energy Syst.
**2017**, 8, 411–447. [Google Scholar] [CrossRef] - Anvari, M.; Proedrou, E.; Schäfer, B.; Beck, C.; Kantz, H.; Timme, M. Data-driven load profiles and the dynamics of residential electricity consumption. Nat. Commun.
**2022**, 134, 4593. [Google Scholar] [CrossRef] [PubMed] - Salazar Duque, E.M.; Vergara, P.P.; Nguyen, P.H.; van der Molen, A.; Slootweg, J.G. Conditional Multivariate Elliptical Copulas to Model Residential Load Profiles from Smart Meter Data. IEEE Trans Smart Grids
**2021**, 12, 4280–4293. [Google Scholar] [CrossRef] - Crawley, D.B.; Pedersen, C.O.; Lawrie, L.K.; Winkelmann, F.C. EnergyPlus: Energy Simulation Program. ASHRAE J.
**2000**, 42, 49–56. [Google Scholar] - Berthou, T.; Stabat, P.; Salvazet, R.; Marchio, D. Development and validation of a gray box model to predict thermal behavior of occupied office buildings. Energy Build.
**2014**, 74, 91–100. [Google Scholar] [CrossRef] - Lombardi, F.; Balderrama, S.; Quoilin, S.; Colombo, E. Generating high-resolution multi-energy load profiles for remote areas with an open-source stochastic model. Energy
**2019**, 177, 433–444. [Google Scholar] [CrossRef] - Fonseca, J.A.; Schlueter, J. Integrated model for characterization of spatiotemporal building energy consumption patterns in neighborhoods and city districts. Appl. Energy
**2015**, 142, 247–265. [Google Scholar] [CrossRef] - Agarwal, C.C. Data Mining and Knowledge Discovery Series; Springer: Berlin/Heidelberg, Germany, 2015. [Google Scholar]
- Bouveyron, C.; Celeux, G.; Murphy, T.B.; Raftery, A.E. Model-Based Clustering and Classification for Data Science: With Applications in R; Cambridge University Press: Cambridge, UK, 2019. [Google Scholar]
- Xu, R.; Wunsch, D. Survey of clustering algorithms. IEEE Trans. Neural Netw.
**2005**, 16, 645–678. [Google Scholar] [CrossRef] - MacQueen, J. Some methods for classification and analysis of multivariate observations. In Proceedings of the 5th Berkeley Symposium on Mathematical Statististics and Probability; University of California Press: Berkeley, CA, USA, 1967; pp. 281–297. [Google Scholar]
- Schubert, E.; Rousseeuw, P.J. Faster k-Medoids Clustering: Improving the PAM, CLARA, and CLARANS Algorithms. In Proceedings of the Similarity Search and Applications: 12th International Conference, SISAP 2019, Newark, NJ, USA, 2–4 October 2019; Proceedings 12. Springer International Publishing: Berlin/Heidelberg, Germany, 2019; pp. 171–187. [Google Scholar]
- Ibe, O. Markov Processes for Stochastic Modeling, 2nd ed.; Elsevier Insights: Amsterdam, The Netherlands, 2013. [Google Scholar]
- Chang, W.A. Literature Review of Wind Forecasting Methods. J. Power Energy Eng.
**2014**, 2, 161–168. [Google Scholar] [CrossRef] - Zhang, Y.; Qin, C.; Srivastava, A.K.; Jin, C.; Sharma, R.K. Data-driven day-ahead PV estimation using autoencoder-LSTM and persistence model. IEEE Trans. Ind. Appl.
**2020**, 56, 7185–7192. [Google Scholar] [CrossRef] - Ratnam, E.L.; Weller, S.R.; Kellett, C.M.; Murray, A.T. Residential load and rooftop PV generation: An Australian distribution network dataset. Int. J. Sustain. Energy
**2017**, 36, 787–806. [Google Scholar] [CrossRef] - Poulin, A.; Dostie, M.; Fournier, M.; Sansregret, S. Load duration curve: A tool for technico-economic analysis of energy solutions. Energy Build.
**2008**, 40, 29–35. [Google Scholar] [CrossRef] - Rousseeuw, P.J. Silhouettes: A graphical aid to the interpretation and validation of cluster analysis. J. Comput. Math.
**1987**, 20, 53–65. [Google Scholar] [CrossRef] - Sheng, W.; Swift, S.; Zhang, L.; Liu, X. A weighted sum validity function for clustering with a hybrid niching genetic algorithm. IEEE Trans. Syst. Man Cybern. Part B Cybern.
**2005**, 35, 1156–1167. [Google Scholar] [CrossRef] [PubMed]

**Figure 1.**Description of the scenario generation method based on Markov chains: from historical data (0); days are divided into representative week and weekend days for each month (1); for each hour, a given number of states is selected using a clustering algorithm (2); then the transition matrices based on the probabilities of going from one state to another between two consecutive hours are computed (3); finally, synthetic scenarios are generated through giving an initial state, a timestamp and the length of the horizon (4).

**Figure 2.**Representative periods classification to account for the different time scales’ variability. Data are classified at the level of the day for each month and for all available years, distinguishing weekdays from weekends.

**Figure 3.**Illustration of the transition matrix calculation for a simple example with three clusters at hour h and h + 1.

**Figure 4.**Overview of the 3-year time series from the 39th Ausgrid customer (in gray) followed by a 1-year scenario generated with the Markov model (in color). This conclusion is also verified at a lower time scale as depicted in Figure 5 and Figure 6. Indeed, the latter shows the comparison between the real historical data and the Markov model for both the weekdays and weekend days of each month.

**Figure 5.**Comparison between the Markov model (in blue) and the real historical data (in red) for each weekday of each month. Mean values are depicted with a solid and dashed line for the model and the real data, respectively. All the values are given in the background of each figure for both cases.

**Figure 6.**Comparison between the Markov model (in blue) and the real historical data (in red) for each weekend day of each month. Mean values are depicted with a solid and dashed line for the model and the real data, respectively. All the values are given in the background of each figure for both cases. As observed in the Figures, it appears that the Markov model correctly reproduces both the shapes and the main statistical features of the historical dataset for each of the representative days (e.g., the model mean values match those of the historical dataset). Furthermore, the seasonal issues are accurately addressed via the model as it follows the monthly variations of the real data. This latter observation is reinforced through comparing the power level amplitudes, in addition to the sunrise and sunset times of the different months. Note that for this case study, there are no major differences between the weekday and weekend day energy demand patterns. This latter observation might not be true with other residential customers.

**Figure 7.**Short-timescale variability over one week for 10 randomly chosen scenarios in July. The mean values are depicted in red.

**Figure 8.**Autocorrelation of the three variables and load/production duration curves for both the synthetic scenarios (in blue) and the 3-year historical dataset (in red). To conclude this section, all these visual and statistical indicators emphasize the relevance of the Markov’s synthesis process with respect to the input data (i.e., the historical data). It should be noted that, while the generated profiles are really variable on a short (daily) timescale (see Figure 7), the key statistical characteristics (e.g., mean and peak value) are recovered over the long term (annual) (see Figure 8).

Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content. |

© 2023 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (https://creativecommons.org/licenses/by/4.0/).

## Share and Cite

**MDPI and ACS Style**

Radet, H.; Sareni, B.; Roboam, X.
Synthesis of Solar Production and Energy Demand Profiles Using Markov Chains for Microgrid Design. *Energies* **2023**, *16*, 7871.
https://doi.org/10.3390/en16237871

**AMA Style**

Radet H, Sareni B, Roboam X.
Synthesis of Solar Production and Energy Demand Profiles Using Markov Chains for Microgrid Design. *Energies*. 2023; 16(23):7871.
https://doi.org/10.3390/en16237871

**Chicago/Turabian Style**

Radet, Hugo, Bruno Sareni, and Xavier Roboam.
2023. "Synthesis of Solar Production and Energy Demand Profiles Using Markov Chains for Microgrid Design" *Energies* 16, no. 23: 7871.
https://doi.org/10.3390/en16237871