A new Markov-chain-related statistical approach for modelling synthetic wind power time series

The integration of rising shares of volatile wind power in the generation mix is a major challenge for the future energy system. To address the uncertainties involved in wind power generation, models analysing and simulating the stochastic nature of this energy source are becoming increasingly important. One statistical approach that has been frequently used in the literature is the Markov chain approach. Recently, the method was identified as being of limited use for generating wind time series with time steps shorter than 15–40 min as it is not capable of reproducing the autocorrelation characteristics accurately. This paper presents a new Markov-chain-related statistical approach that is capable of solving this problem by introducing a variable second lag. Furthermore, additional features are presented that allow for the further adjustment of the generated synthetic time series. The influences of the model parameter settings are examined by meaningful parameter variations. The suitability of the approach is demonstrated by an application analysis with the example of the wind feed-in in Germany. It shows that—in contrast to conventional Markov chain approaches—the generated synthetic time series do not systematically underestimate the required storage capacity to balance wind power fluctuation.


Introduction
The integration of rising shares of fluctuating renewables, such as wind and photovoltaic, is a major challenge for the future energy system (Turner 1999, Marris 2008. In particular, high propotions of wind in the generation mix lead to growing uncertainties in the system since the actual feed-in of wind power can change drastically within a very short period of time. It is therefore increasingly important to address these uncertainties in energy system models. One approach for undertaking this task is the stochastic modelling of the feed-in from wind converters. This paper presents a new Markov-chain-related approach which is suitable for generating synthetic time series for wind power feed-in that have statistical characteristics comparable to those of real ex post time series. The synthetic time series can be used to analyse a multitude of different situations and scenarios for the feed-in from wind power-which may also include situations that have not yet occurred in historical data. This is, for example, useful to examine the robustness of an electricity system derived by energy system models such as that described in (Pesch et al 2014). Synthetic time series can also be used as input for further approaches to address uncertainty in energy system models, e.g. scenario trees or Monte-Carlo simulations (Negra et al 2008).
We focus on intermediate time scales and analyse time series with a sampling time of 15 min. This time scale is particularly important for the operation of the European electricity system as it is the shortest trading period on the European electricity market (EPEX Spot SE 2014). Extremely fast fluctuations also exist on time scales as short as seconds due to the turbulent character of wind energy. These effects are not the subject of this paper but are discussed in detail in (Milan et al 2013).

OPEN ACCESS RECEIVED
In contrast to other publications, our purpose is not to model the wind speed or wind power feed-in related to single wind turbines or wind parks. Instead, we consider the overall feed-in of all installed onshore wind turbines in a whole market region. For the application analysis, the model was trained with original ex post data of the wind power feed-in in Germany.
The paper is organized as follows: section 2 first gives an overview of different possible approaches for the modelling of wind time series. Afterwards, the basic principles of Markov chains are explained. For a deeper understanding of the characteristics of wind time series, their deterministic and stochastic components are discussed in the following. A basic approach for removing deterministic components is presented, which aims at obtaining a stationary time series that can be used for Markov chain models. Exisiting Markov chain approaches are then analysed with regard to their suitability for reproducing the stochastic characteristics of wind time series. Special attention is paid to why conventional Markov chains are not able to reflect these characteristics sufficiently.
In section 3, the procedure for modelling the new Markov-chain-related approach is explained. Of particular interest is the description of the main difference in our approach compared to conventional secondorder Markov chains. Furthermore, two new features are introduced: a healing mechanism to avoid dead ends and a running average filter to adjust the short-term characteristics of the time series.
In section 4, the effects on the synthetic time series of varying the different parameters of the presented approach are shown. Subsequently, a suitable variant for wind power feed-in time series for Germany is presented. The quality of the approach is determined by comparing the original and the synthetic time series in terms of statistical characteristics such as autocorrelation, probability distribution and the distribution of increments on different time scales. Finally, an application analysis shows that-in contrast to conventional Markov chains-the generated synthetic time series do not systematically underestimate the required storage capacity to balance wind power fluctuation.
The main conclusions drawn from the analysis are finally summarized in section 5.

Approaches for the modelling of wind speed and wind power time series
This section gives an overview of the different approaches for modelling wind speed and wind power time series. Section 2.1 presents the general classification into persistence models, physical models and statistical models. As the approach pursued in this paper is based on a Markov chain, the basic principles of these chains are explained in section 2.2. An understanding of the stochastic properties of the original wind time series is necessary to develop a model which generates realistic wind power time series. For that reason, section 2.3 analyses a given wind power time series in terms of deterministic and stochastic components and characteristic trends and fluctuations. Furthermore, a basic approach for removing deterministic components of the time series is presented. Section 2.4 gives an overview of existing Markov chain approaches for modelling wind speed and wind power time series, showing that these approaches have difficulty in reproducing the stochastic behaviour of wind correctly.

Overview of the different methods
The rising share of volatile wind power in the present generation mix has led to increased interest in methods for the modelling and especially the forecasting of wind. As a result, a variety of different approaches has been developed and applied to wind time series. Overviews of the different approaches with the focus on forecasting techniques can be found in Lei et al (2009), Soman et al (2010, Wang et al (2011), Foley et al (2012. The suitability of a method is closely linked to the purpose of the model. This especially accounts for the desired time horizon in the case of forecasting wind. Although time scale classifications are rather vague in this context and the boundaries between the respective classes often overlap, a distinction can be made between very short-term (seconds to 30 min), short-term (30 min to 6 h), medium-term (6 h to 1 d) and long-term (1 d to 1 week or more) forecasting techniques (Soman et al 2010). In the case of generating synthetic time series, the method should account for the proper description of both short-term and long-term characteristics.
Besides some new techniques and combinations of model types (hybrid structures), most of the common methods can be assigned to one of the following classes (Soman et al 2010): • Persistence models-also called naive predictors-assume that the current state is maintained. This method is obviously only suitable for very short-term forecasts and may serve as a benchmark for other forecast methods.
• Physical methods such as numerical weather predictors are based on meteorological data and a detailed description of the atmospheric physics. These methods are especially employed for the long-term forecasting of wind.
• Statistical methods only need the historical data of a process to estimate the future development. The different methods cover a wide range from short-term to long-term forecasting. The Markov chain approach can be assigned to this category.

Basics of the Markov chain approach
A Markov chain models a stochastic process, in which a state changes between discrete time steps. In a Markov chain approach, it is assumed that the probability of a certain state depends on one or more past states. It is a probabilistic forecasting method, as it does not just estimate a point forecast but also provides estimates of the probability distribution associated with it (Carpinone et al 2010). The method only requires empirical ex post data so that a restrictive assumption on the shape of a wind power probability distribution is not necessary (Carpinone et al 2010). This approach is applicable for time series with any probability distribution. A necessary requirement for the ex post time series is weak stationarity. This means that the probability of making a transition from one given state to another is time-independent (Castro Sayas and Allan 1996). For the application of the Markov chain, the amplitude range must be broken down into a defined number of discrete states. The number of equidistant amplitude intervals n for the state variables … s s s { , , , } n 1 2 is a calibration parameter of the Markov chain (Carpinone et al 2010, Carapellucci andGiordano 2013).
Another important parameter is the order of the Markov chain. It gives the number of past states that influence the probability of the present state (Shamshad et al 2005). In a first-order Markov chain, the present state only depends on the previous state.
Let X(t) be a stochastic process with the discrete state space S = {1, 2,.., n} and the discrete time steps t. The transition probability from a state i to a state j is defined as: These transition probabilities form the elements of the transition matrix P. For n states, the first-order transition matrix is an × n n matrix, The problem with Markov chains of higher order is the increasing complexity, as a K-order Markov chain needs a + n K 1 transition matrix (Brokish and Kirtley 2009). The advantage of higher-order Markov chains is better forecasting performance, as they reduce the prediction error (Carpinone et al 2010). Therefore, a compromise between prediction accuracy and computing time (and particularly memory requirements) needs to be found.
The basic concept of the modelling approach presented in this paper is related to a second-order Markov chain. A conventional second-order Markov chain uses the two previous states j (first lag) and k (second lag) to forecast the present state i: The resulting × × n n ntransition matrix P is shown below:  The transition probabilities satisfy the following properties: The current state of the process is represented by the corresponding row of the matrix, while each column corresponds to one of the n possible states at the next time step (Carpinone et al 2010).

Deterministic and stochastic characteristics of wind power time series
In order to evaluate the suitability of existing Markov chain approaches for reproducing the stochastic nature of wind, it is necessary to analyse the stochastic characteristics of wind time series. For this purpose, the seasonal and daily periodicities of wind power time series are discussed in section 2.3.1. In section 2.3.2, we present an approach for removing these periodicities with the objective of obtaining a stationary time series. After testing the resulting time series for stationarity in section 2.3.3, its characteristic trends and fluctuations are analysed in section 2.3.4. Furthermore, the time series is characterized by daily as well as annual periodicities. Generally, wind speed and consequently also wind power is higher in winter than in summer. The daily periodicities differ during the year, resulting in wind power peaks in the afternoon during winter and peaks in the evening during summer.

Conditioning of the original wind power time series
The positive trend and also the seasonal periodicities represent deterministic components of the time series. These deterministic components must be removed to be able to analyse the stochastic component of the wind power time series. Since periodicities and trends cause instationarity of the data, this deseasonalization step is also necessary for the application of a Markov chain.
In order to eliminate the trend, the feed-in time series was divided by the respective actual installed capacity (Fraunhofer IWES 2014) to derive the specific feed-in per installed capacity kW installed (figure 2). The next step in obtaining a deseasonalized time series is to identify and eliminate those parts of the time series caused by periodicities. For this purpose, a basic approach was chosen based on arithmetic means allocated to a certain month and a certain time. First, the average over all specific feed-in values was determined. Second, the mean value was identified for each quarter-hour in a month that was subsequently divided by the overall average value. In this way, a seasonality factor was created, which-due to seasonal or daily fluctuationsis higher than 1 in high feed-in times and lower than 1 in low feed-in times. In this way, × = 12 96 1152 different factors for the twelve months and 96 quarter-hours each day were obtained. Consequently, this approach implies that every day of a month has the same properties. This simplification is especially necessary to obtain a sufficient number of values for average determination. The seasonality factors in figure 1 reflect the above-mentioned seasonal and daily periodicities. The values of the specific feed-in time series are divided by the corresponding factor to obtain a time series that only contains the non-deterministic residuals .

Stationarity of the conditioned wind power time series
The extent to which the conditioned time series fulfils the requirement of weak stationarity is examined by conducting a stationarity test. For this purpose, the moving average and the moving standard deviation of the original time series are compared to those of the deseasonalized time series (figure 3). The window size of the moving average filter was set to the length of a whole year ( ×  =  4 8760 35040 values). It can be observed that both the moving average and the moving standard deviation of the original time series are much more timedependent than those of the conditioned time series. In particular, the strong positive trend at the end of the time series can be eliminated by data conditioning.
Nevertheless, the obtained deseasonalized time series does not completely fulfil the requirement of weak stationarity since the moving average curves are not entirely levelled. This is due to the limitation of the available data basis and the occurrence of strong and weak wind years. Therefore, we refer to the definition of wide-sense stationarity as in Thomann and Barfield (1988). Castro Sayas and Allan (1996) point out that a wind time series can be treated as wide-sense stationary as long as there is no trend in the data. Peiyuan et al (2009) and Jones and Lorenz (1986) also assume wide-sense stationarity of their considered wind time series which they use for a Markov chain model. Since the moving average and the moving standard deviation of the conditioned time series show no trend, we assume that the criteria for wide-sense stationarity are fulfilled and that we can use the time series for a Markov-chain-related approach. Seasonality factor plotted against month and time of day. While high wind speeds were observed during summer afternoons and winter nights, the wind speed was lower during summer mornings/evenings and winter middays. Generally, the wind speed was higher in winter than in summer.  To analyse this assumption, a time series based on the incremental changes between two adjacent time steps was constructed. Subsequently, this time series of increments was delayed by τ time steps so that the correlation coefficients between the original time series of increments and the delayed time series of increments can be calculated. These correlation coefficients are given in figure 4 as a function of the time lag τ.
The figure shows that the correlation coefficients of the shifted time series are high at low time lags and decline with an increasing time lag. Nevertheless, the correlation coefficients of the further shifted time series of increments still have significant correlation coefficients. In the case of the feed-in time series introduced, the time series of increments shifted by up to τ = 12 (equivalent to three hours) have correlation coefficients above 0.1. Further shifted time series of increments show a correlation coefficient below 0.1. It therefore can be assumed that they no longer have any significant influence on the present increment.
The results show that trends can be identified in the time series that are maintained for several quarterhours. We interpret this effect as upcoming weather fronts and typical cycles of weather regions. This finding serves as the first evidence that on this time scale it is not sufficient to merely consider the one or two previous values for anticipating trends correctly. However, the wind power time series of other countries most likely have different characteristic time scales due to different geological conditions and different weather conditions.

Existing Markov chain models for wind speed and wind power time series
Markov chain models have been frequently used for the generation of synthetic wind speed and wind power time series (Carpinone et al 2010). The early approaches mostly differed in the order of the Markov chain, the transition matrix sizes, and the number and length of time steps. Jones and Lorenz (1986), Sahin and Sen (2001) Extended Markov chain approaches have been pursued by Castro Sayas and Allan (1996) and Negra et al (2008) using a birth-and-death Markov chain. Papaefthymiou and Klockl (2008) and Tong et al (2012) proposed a Markov chain Monte-Carlo method for the generation of synthetic wind power time series. Peiyuan et al (2009) developed a Bayesian Markov model to generate wind power data using Bayesian inference to model the uncertainty of the transition matrix.
A review of existing Markov chain models shows that better results are obtained using a second-order Markov chain rather than a first-order Markov chain. The analysis also reveals the superiority of models that directly generate wind power time series compared to models that estimate wind power by generating wind speed time series. The reason is that the multitude of parameters which influence the feed-in of a wind turbine, such as the terrain characteristics, cannot be neglected. It is advantageous that these effects are already included in the historical wind power feed-in time series.
The existing approaches have in common that the autocorrelation properties and the different time scales of wind time series are not given sufficient consideration. Brokish and Kirtley (2009) observed that 'autocorrelation plots of wind speeds generated by Markov chains are often inaccurate'. They also show that time series generated by Markov chains underestimate the required storage capacity to balance the wind power fluctuations, as the short time step behaviour cannot be modelled properly. They therefore suggest that Markov chains should not be used for time steps shorter than 15-40 min.
The reason for this underestimation of required storage capacity is the lack of modelling of the trend character, which results in time series that alternate too frequently between rising and falling. As discussed in section 2.3.4, a trend in wind power time series can last for a certain time. Consequently, the probability that wind power rises from one state to the next can be higher when there was previously a positive trend, e.g. during the last three hours. Since only the previous state influences the next state in first-order Markov chains, the previous trend cannot be considered. This is the reason why second-order Markov chains already produce better results. Nevertheless, on time scales shorter than 15-40 min it is still not sufficient to take merely the two previous time steps into account.

Modelling of the new Markov-chain-related approach
In this chapter, the procedure for modelling the new Markov-chain-related approach will be explained. The two main steps, determination of the transition matrix (section 3.1) and generation of the synthetic time series (section 3.2), are outlined. Furthermore, two new features are introduced: the healing mechanism to avoid dead ends and the running average filter to smooth the time series.

Determination of the transition matrix
To ensure wide-sense stationarity of the input time series, deterministic trends and seasonalities need to be removed. Therefore, the positive trend caused by a growing installed capacity and also the daily and seasonal periodicities were removed as explained in section 2.3.2.
The approach pursued in this paper is related to a second-order Markov chain. As shown in section 2.3.4, it would be preferable to consider approximately the last 12 time steps in the case of the wind time series introduced since significant correlations are given. A higher order Markov chain does not bring further benefits because the influence on the present state of the values more than 12 time steps ago can be neglected. However, a Markov chain with such a high order is hard to model, because of the high order transition matrix and the resulting high memory requirements.
Consequently, we also only consider two previous values that influence the present value to keep the memory requirements at an acceptable level. The difference to conventional second-order Markov chains is a variable second lag, which is normally set at the state before the first lag. In this way, a more distant second state can be used to determine the present state. Consequently, the trend behaviour of the wind power time series can be reproduced without overloading the computing capacities.
As with conventional Markov chains, the values of the conditioned specific wind power feed-in time series need to be discretized and assigned to the corresponding state. As explained in section 2.2, the transition matrix is determined by counting the number of state transitions to state i under the condition that state j and state k took place at the corresponding points in time.
State j belongs to the first lag and is therefore always set to the state before the present state i. In contrast to conventional second-order Markov chains, state k is set to a variable previous step L and is not fixed to the state two steps before state i: To derive the transition probability matrix, the specific number of state transitions needs to be divided by the sum of all state transitions to state i for all different combinations of i, j and k.

Generation of synthetic time series
The Markov chain approach requires initial values for the synthetic time series. In our approach, the second lag L determines the number of values that need to be set as a seed for the synthetic time series. The first values of the deseasonalized input time series can, for example, be used for the start of the synthetic time series.
The rest of the time series is generated step by step based on the values given so far, the cumulative transition probability matrix and a random generator. The generated random number is equally distributed between 0 and 1. Based on the given states j and k, state i is chosen by increasing i until the corresponding cumulative transition probability is greater than the random number. A random sample obeying the given distribution is thus generated in a straightforward manner.
If too many states and/or a too distant second lag is chosen, it is possible that certain (conditional) state transitions never occurred in the historical data. In this case, the transition probability would be equal to 0, which violates the condition given in equation (7). In the process of generating synthetic time series, this situation would lead to a dead end since no further state transition is possible. For this reason, we developed a healing mechanism for unknown state transitions to allow for a higher number of states. We allow the model to choose the transition probabilities of a 'nearby' situation that occurred in the historical data. Therefore, the looked-up state for the second lag is replaced by the next state directed toward the state of the first lag as long as the transition probability is no longer equal to 0. If this procedure is not successful, the current state i is chosen based on the previous time step plus a random function that allows it to jump into the adjacent state. In this case, the transition probability is equally distributed amongst the current and the adjacent states. This methodology successfully avoids dead ends in the generation of synthetic time series. In any case, it should be ensured that these interventions are only applied extremely rarely since this practice falsifies the results slightly. In the following examinations, these interventions never occurred more than 400 times during a simulation of 166,464 time steps and only in settings with many states ( > n 50) and a distant second lag ( > L 5). The next step is to transform the amplitude discrete values to amplitude continuous values. To avoid the same value always accounting for a certain state, an equal distribution function generates a random value within the interval boundaries of the corresponding state.
This practice can lead to a flickering in the time series, which is rather unusual for wind power time series. Therefore, we subsequently apply a running average filter on the amplitude continuous time series to smooth the time series again (Oppenheim and Schafer 1989). This allows for a more precise adjustment of the generated time series. The window size of the running average filter can be seen as another parameter of the model.
Finally, the seasonalities are restamped onto the generated time series. This is achieved by multiplying the synthetic time series by the seasonality factors. However, some of the generated specific feed-in values can have a value above 1. This problem occurs if an already high value has been multiplied by a seasonality factor above 1. For this reason, only the time series without seasonalities are compared and evaluated in the following.

Analysis of the synthetic time series
In this chapter, the suitability of the new Markov-chain-related approach is examined by comparing the original and synthetic time series in terms of statistical characteristics. By means of a parameter variation, the influences of the model parameters 'number of states', 'time lag' and 'window size of the running average filter' on the properties of the synthetic time series are examined in section 4.1. In section 4.2, the process of deriving good model parameters and an exemplary case with well-fitted parameters are presented. Finally, the model is applied in a hypothetical application in section 4.3. The analysis shows that the presented approach is suitable for correctly dimensioning the required storage capacity of an energy system supplied solely by wind power.

Effects of varying the parameters of the new Markov-chain-related approach
To analyse the influence of the different parameters on the results, two parameters were fixed and one parameter was varied for each case. Table 1 gives an overview of the parameter settings, which only serve as examples. The conclusions drawn are valid for all other cases as well.

Effects of varying the number of states
For the analysis of the effect of varying the number of states, the second lag L was fixed as 2 and no running average filter was applied. This setting represents a conventional second-order Markov chain.
The chosen number of states has a major influence on the resulting time series. As described in section 3.2, the number of states is limited due to the limited input data. However, if too few states are applied, the resulting time series almost takes the form of a step function with deviations in every state due to the random function. Accordingly, the random function that chooses a random value within the state interval still has a major effect on the time series. With the increasing number of states, the amplitude range of each state decreases and therefore also the effect of the random function. This effect can be explained based on the distribution of the incremental variations τ − t , which is given for two different time scales (τ = 1 and τ = 10) and different numbers of states ( = = = n n n 25, 50, 100 and n = 200) in figure 5. For 25 states, for example, the distribution of the incremental variations between adjacent states (τ = 1) is much too flat and heavy-tailed compared to the distribution of the original ex post time series. In this way, small changes in the synthetic time series occur too rarely and larger changes much too often. With an increasing number of states, the distribution function of the incremental variations becomes peaked and closer to the distribution of the original time series. In any case, with the given second lag (L = 2) and without any filtering, 200 states are still not sufficient to reproduce the distribution function of increments of the ex post time series. This dependency is also valid for incremental variations with a longer time lag, for example τ = 10, whereas the deviation from the incremental distribution of the original time series decreases.
The probability distribution that reflects the probability of occurrence of each state is given for all cases in figure 6. The synthetic time series are compared to the original time series that has been discretized into the corresponding number of states in each case. Of special importance is the observation that the general feature of conventional Markov chains of reproducing the probability distribution is maintained by the new approach. This accounts for any number of states. However, the level of detail and the accuracy increase with the number of states. As expected, the distribution of wind power feed-in has the shape of a Weibull distribution (Justus et al 1976).
A very important characteristic of a time series is the autocorrelation behaviour. The autocorrelation function (ACF) of the synthetic time series should ideally be similar to the ACF of the original ex post time series.  In general, with an increasing time lag the autocorrelations decrease in all cases (figure 7). If a sufficient number of states is applied ( > n 50), no more effects on the autocorrelation properties as a function of the number of states can be identified. All synthetic time series show autocorrelations that are too high compared to the ex post time series. This is especially attributed to the choice of the second lag (L = 2), which is used in conventional second-order Markov chains. For this reason, the influence of varying the second lag will be discussed in the following section.

Effects of varying the second lag
The possibility of varying the second lag is the major feature of the approach presented in this paper. For the analysis of the effect of varying the second lag, no running filter was applied and the number of states was, as an example, fixed at 100. However, the presented dependencies apply for any number of states.
The possibility of influencing the shaping of trends and fluctuations is shown based on the ACFs in figure 8. It can be observed that a more distant second lag leads to decreasing autocorrelations. The effect leads to less uniformity and therefore more fluctuation in the shape of the resulting time series. The decreasing uniformity is also caused by longer-lasting trends that can be reflected much better with a more distant second lag than L = 2. The length of typical trends therefore depends on the distance of the second lag.
In the case of the given time series for Germany, time series with L = 10 to L = 12 fit the original time series best. This observation indicates that the characteristic dynamics of the overall wind feed-in in Germany can be better determined based on the feed-in a quarter-hour and three hours ago (L = 12) rather than, for example, a quarter-hour and only half an hour ago (L = 2).
The choice of the second lag is therefore very useful to adjust the autocorrelation properties of the synthetic time series. A well-fitted second lag automatically leads to a good shaping of trends and fluctuations in the synthetic time series.
4.1.3. Effects of varying the window size of the running average filter In order to analyse the effect of varying the window size M of the running average filter, the number of states was, as an example, fixed at 100 and the second lag at L = 10. The effects on the shapes of the synthetic time series are illustrated in figure 9.
The synthetic time series without any filtering shows the typical flickering induced by the random function that distributes the values within the state interval. The running average filter smooths this flickering. The  broader the window size of the filter, the stronger is the effect on the time series. A qualitative comparison with the ex post time series indicates that a filter length of approximately 4-5 time steps produces the best results. However, a filter with too broad a filter length such as 10 time steps smooths the time series too much.
The effect of filtering the synthetic time series can also be explained very well on the basis of the distribution of the incremental variations τ − t , which is given for the time scales τ = 1 and τ = 10 in figure 10. Increasing the filter length leads to a peaked distribution of the increments between two adjacent states. This means that the very short-term fluctuations of the synthetic time series can be adjusted very well by varying the length of the running average filter. According to the qualitative observation of the time series, a filter length of approximately 4-5 fits the distribution of the original ex post time series best. The long-term characteristics of the shape of the generated time series are not affected by the filtering. The distributions of the incremental variations with a time lag τ = 10 (figure 10, right) are hardly affected at all.

Comparision of original and synthetic time series for a well-fitted case
In this section, an exemplary case with a parameter setting is presented that is well-suited for the wind power feed-in in Germany. Besides this combination of parameters, there are a multitude of other parameter settings that generate suitable results.
The basic procedure for identifying appropriate parameters is as follows: first, the number of states n has to be determined, which-restricted by the size of the data basis -should be large enough for the probability mass function to reach a sufficient level of accuracy. Second, the distance of the second lag L needs to be chosen such that the autocorrelation properties fit those of the original time series. Finally, the short-term fluctuations can be adjusted by the running average filter. Therefore, the filter length M needs to be chosen such that the distribution of increments of the synthetic time series fits that of the original time series.
The parameters in this exemplary case were chosen according to table 2. The shapes of the original and synthetic time series are compared in figure 11. It can be seen that it is hard to draw a distinction between the characteristics of the original and synthetically generated time series. The synthetic time series shows the same typical fluctuations and also longer-lasting trends with comparable gradients of the ramps.  The comparability also applies to the ACF and the probability mass function of the states (figure 12). Once again, the advantageous feature of conventional Makov chains of reproducing the probability mass function is maintained by the new approach.
Of special importance for the dynamical characteristics are the distributions of the incremental variations τ − t . The distributions are given in figure 13, distinguished by the different time scales τ = 1, τ = 5, τ = 10, τ = 20 and τ = 96.
In the left plot in figure 13, special emphasis is put on the central peaks, whereas the tails of the distributions are cut off. For a better visualization of the tails, a semi-logarithmic scale is applied in the right plot in figure 13. Although slight variations occur, the incremental characteristics of the synthetic time series match those of the original time series very well for the different time scales.
The statistical parameters are given in table 3. Since the generation of the synthetic time series is a stochastic process, slight variations occur for every simulation. For this simulation, a minor deviation can be observed for the maximum value of the time series. This is due to the extreme rareness of the appearance of such high values as observed in the original ex post time series (according to the probability distribution given in figure 12). In total, the statistical parameters of the synthetic time series are comparable of those of the original time series. Brokish and Kirtley (2009) argue in their paper 'Pitfalls of modelling wind power using Markov chains' that synthetic wind power time series generated by a Markov chain underestimate the necessary storage capacity to balance the wind power fluctuations.

Application for storage dimensioning
They modelled a hypothetical situation in which an isolated energy system with a constant load is only supplied by wind power. Therefore, storage is necessary to meet constant demand by fluctuating wind power.   Brokish and Kirtley (2009) estimated the required storage size using real and synthetic data, generated with a first-order Markov chain. The generated time series always underestimated the necessary storage capacity, as the first-order Markov chain cannot reproduce the stochastic properties of wind correctly. We want to show that the wind power time series generated with the proposed Markov-chain-related approach will not lead to a systematic underestimation of the necessary storage capacity. As in the previous section, the basis of the analysis are the time series without seasonal component. We estimated the required storage size in a similar way to Brokish and Kirtley (2009). The load is assumed to be constant and is set to the value of the average wind power generation. Surplus energy is always stored and unfulfilled demand is always supplied by storage. In this way, the necessary storage capacity can be derived by subtracting the minimum storage level from the maximum storage level. This storage dimensioning was conducted for the original time series as well as for ten generated time series. The synthetic storage sizes were then divided by the real storage size, so that a storage fraction is defined, whereby a value of one means a perfect estimate.
The storage fraction for the ten generated time series is shown in figure 14. As the values fluctuate around one, there is no systematic underestimation of the required storage capacity. Therefore this example shows that the proposed Markov-chain-related approach is suitable for reproducing the stochastic behaviour of wind power time series.   Figure 14. Storage fraction for ten randomly generated time series. As the values fluctuate around one, there is no systematic underestimation of required storage capacity.

Conclusion
The rising share of wind power feed-in leads to growing uncertainties in the electricity system. The stochastic modelling of wind is one approach to address these uncertainties in energy system models. Amongst different statistical methods, the Markov chain approach is one technique that has been frequently used in the literature for the forecasting of wind and the generation of synthetic time series. Recently, it has been shown that conventional Markov chains are of limited use for generating wind time series with time steps shorter than 15-40 min. The reason is that more than the previous one or two time steps have significant correlations with the next time step on this time scale. Neither the level of fluctuation nor characteristic trends in the time series can thus be shaped correctly. This leads, for example, to a systematic underestimation of the size of storage used for balancing wind power simulated by conventional Markov chains.
Therefore we developed a new Markov-chain-related model. The major difference to existing Markov chain approaches is the introduction of a variable second lag, which is normally fixed at the state previous to the first lag. We also included a healing mechanism that avoids dead ends in the generation of the time series and that increases the robustness of the model. Additionally, a running average filter was introduced into Markov chain modelling that allows for the better adjustment of the very short-term characteristics of the generated time series.
The focus was placed on the generation of long-term synthetic time series with a sampling time of 15 min. The data basis covered the overall feed-in of a whole country with the example of Germany. Since weak stationarity of the input data is necessary for Markov chains, we presented a basic approach to deseasonalize the ex post time series based on arithmetic means allocated to a certain month and a certain time. After showing that the conditioned time series fulfils the criteria for wide-sense stationarity, we applied the data for the new model.
In the analysis of the generated synthetic time series, we first conducted a parameter variation to analyse the influence of the parameter settings on the properties of the synthetic time series.
The variation in the number of states to discretize the amplitude of the time series showed that a rising number of states increases the level of detail and accuracy of the probability distribution. Furthermore, the distribution of incremental variations becomes more peaked and closer to the distribution of the original wind power time series. Too few states lead to an inappropriate shape of the synthetic time series, whereas the number of states is limited due to the limited training data.
The variation of the second lag revealed that a more distant second lag leads to decreasing autocorrelations, which is very useful for the adjustment of the dynamics in the synthetic time series.
The introduction of a smoothing running average filter turned out to be a very useful method for the further adjustment of the synthetic time series. The increase of the filter length leads to a peaked distribution of the incremental variations between adjacent states. It is therefore a practical way to modify the very short-term characteristics of the synthetic time series without affecting the long-term characteristics.
Afterwards, a case with well-fitted parameters for the wind feed-in in Germany was presented as an example. The analysis revealed that the generated synthetic time series have statistical characteristics comparable to those of original ex post time series. It turned out that the second lag L = 2 of conventional Markov chains is not the optimal choice for wind power feed-in on a 15 min basis in Germany. The dynamics, such as the steepness of ramps and the level of fluctuation in the time series, were much better reproduced with a second lag of e.g. L = 12. The basis of comparision was the shapes of the time series, the autocorrelation functions, the probability mass functions, the distributions of the increments for different time scales as well as statistical parameters such as the variance.
Finally, we used the model in a hypothetical application for storage dimensioning. Therefore, an isolated system with constant load was supplied solely by wind power. On the basis of the original and the synthetic time series, the required storage capacity to balance fluctuating wind power with constant demand was simulated. It was shown that-in contrast to conventional Markov chain approaches-the generated synthetic time series do not systematically underestimate the required storage capacity. The new approach is therefore suitable for generating synthetic time series for application in energy system models or in other methods addressing uncertainty such as Monte-Carlo simulations.