PowerGAMA: A new simplified modelling approach for analyses of large interconnected power systems, applied to a 2030 Western Mediterranean case study

This paper describes a modelling approach suitable for assessments of future scenarios for renewable energy integration in large and interconnected power systems, based on sequential optimal power flow computations that take into account variability in power consumption, in renewable power production, energy storage, and flexible demand. The approach and the implementation as an open source Python package called Power Grid And Market Analysis is described in some detail. Particular emphasis is put on the modelling of energy storage systems, and the use of storage values as a means to define storage utilisation strategies. A case study representing a 2030 scenario for the Western Mediterranean region is then analysed using this approach. The main aim of this study is to assess the benefit for the system of adding flexibility in terms of storage associated with concentrated solar power or flexible demand. But other results are also presented, such as the resulting energy mix, generation costs, price variati...


I. INTRODUCTION
A major shift towards renewable energy is expected in the next years and decades, and most countries have targets for renewable energy integration which imply big changes for the power system.One important change is that the renewable power plants will be built in locations where energy resources are good, away from load centres, altering power flow patterns and likely leading to grid congestions and a need for large grid reinforcement investments.Another change is the increased variability in power generation and therefore increased need for balancing through, e.g., energy storage systems, demand flexibility, or increased power exchange between the regions and countries.
Due to the large costs associated with electricity grid investments, long life times, and long planning and construction times, it is important to identify potential future grid bottlenecks and beneficial grid reinforcements at an early stage.It is also important for planning and decision making to understand at least on a high level how the interconnected system copes with the changes in the generation mix.These concerns and questions are being addressed from different angles by a multitude of transmission system operators, policy makers, and scientists, with a general aim to support the development of a stable and economic future power system.
][10][11] Often in this type of studies, the transmission grid is considered only at a highly aggregated level, and the constraints implied by the physical power flow equations are ignored.
PowerGAMA is a Python-based lightweight simulation tool for high level analyses of renewable energy integration in the large power systems.It is intended as an open source and easy to use tool for exploring future scenarios with large scale renewable energy integration, and created with simplicity and flexibility in mind.Although it may be tempting to add functionality or make it more advanced, there are some clear advantages of the simplified approaches.One is that more advanced modelling requires more input data which may be very hard to get, especially when considering future scenarios.Other is that the results are easier to interpret and analyse when based on a simple model.Of course, a simpler approach is easier to implement and maintain as a software package.
Various open source tools exist for the power system analyses, such as Matpower, 19 Power System Analysis Toolbox (PSAT), Minpower, and Python for Power System Analysis (PyPSA).An overview is maintained by the IEEE Task Force on Open Source Software for Power Systems.1][22] It was developed initially as part of the TradeWind project 23 and applied in several subsequent studies 24,25 to assess the large-scale wind integration in the European grid.PowerGAMA is based on PSST, but with significant modifications and written from scratch in Python.An important novelty of the new approach is the extension of the storage system method to include the short term storage systems such as those relevant for concentrated solar power (CSP) and to represent demand flexibility.Furthermore, it is built around a single and flexible generator model which enables a high degree of flexibility for the user.
The heart of the current approach is a linear optimisation of the generation dispatch, i.e., the power output from all generators in the power system for each time-step over a given period, typically a year.It takes into account the variable power available for solar, hydro, and wind power generators, and the variability of power consumption.It also takes into account the power flow equations that govern power flow in AC grids.Since some generators may have energy storage, the optimal solution in one time-step depends on the previous time-step, and the problem is therefore solved sequentially (see Figure 1).
The approach is based on a simple power market description, assuming a perfect market where generation dispatch is determined by the generator costs and power flow constraints.

II. POWER SYSTEM REPRESENTATION
This chapter describes how the power system is modelled, discussing in turn the transmission network, the electricity market, power generators, power consumption, and energy storage systems.
As noted above, the approach relies on a simplified description of the power grid and market, with an obvious drawback being the loss of accuracy.The typical uses of this approach are scenario investigations and identification of grid bottlenecks, renewable energy curtailment, load shedding, price variability, and generation mix.Thus, the main characteristics of the power system that should be well reproduced are as follows: (1) power flows in the grid, especially between the countries and (2) the generation mix within each country, with realistic daily and seasonal variations.Comparisons of simulation results against real data regarding power flow and annual generation mix have been performed for the case of Morocco in Ref. 26, and for a continental European model in a planned forthcoming publication.The match is good on an aggregated level, whilst large deviations can be found on a detailed level, such as for a single transmission corridor or in a single hour.

A. Transmission network
The transmission system is represented by a number of nodes and AC and DC branches that connect the nodes into a network.In practice, the transmission network may correspond to the highest voltage levels in the actual grid or it may be a reduced equivalent grid.
AC branches have a specified impedance and a maximum transmission capacity.In accordance with the linearised approach (see Section III), it is assumed that the imaginary part of the impedance is dominant such that only the branch reactance is included.These reactances govern the power flow in the grid, via the power flow equations, and are important to get a realistic picture of the actual capability for power exchange between the regions and countries.DC branches correspond to high voltage DC transmission lines or cables that are connected to the AC grid via the power electronic converters which enable full control of power flow.
Transmission capacities may be specified as infinite, which may be useful if data are unavailable, and especially when considering future scenarios based on up or down scaling of demand and generation capacities.In such cases, the uncertainties about the geographic distribution of the generation capacity and demand may not justify detailed considerations of the internal grid bottlenecks.One useful approach is to consider the unlimited transmission capacity internally within countries, while keeping transmission limits between countries. 20,27Assuming infinite transmission capacity is akin to assuming that necessary grid reinforcements have been implemented to remove grid congestion.It is worth noting that although the capacity is set to infinite, the power flow is not unconstrained, since it is still governed by the power flow equations, and may be restricted by the capacity limits elsewhere in the network.
It should be pointed out that transmission capacities typically reflect only cable thermal limits.Other constraints, such as cross-border transfer limitations based on the system's stability and reliability requirements are not directly taken into account.Unless corrected for, this implies that the approach over-estimates the possibilities for power exchange between the countries and regions.One way to account for such constraints is to reduce the transmission capacity of the selected connections, typically the cross-border connections, to what may be considered as "safe" values.In some cases, notably by ENTSO-e in Europe, such numbers are publicly available as the net transfer capacity (NTC) values.

B. Electricity market
The market is considered perfect such that the generators with the lowest marginal costs are always favoured.The total cost of generation is assumed to be the sum of marginal cost times the power output for all generators.That is, power is assumed traded for each time step such that the overall cost of generation is always minimised.Since the approach is based on linear optimisation per time-step, the cost of generation must be a linear function and the marginal costs for each generator must be independent of the power output.Load shedding is given a penalty by being served by dummy generators with a high marginal cost.
An important simplification that is implicitly made by this market representation is that there is a single market and only one trading horizon, and all power is traded time-step by time-step.There are no forecast errors for power production, relevant for wind and solar, and no balancing market.The ramp limits and start-up costs are not included.In order to include these factors in a meaningful way, it would be necessary to optimise over multiple time-steps.
In sum, these simplifications mean that the flexibility of the power system is over-estimated, and therefore, an optimistic view of the ability to integrate renewable energy is given.Although it can be argued that the current trends of the improved power forecasting for wind and solar, and shorter trading horizons make some of the above limitations less important when considering future scenarios, it is clear that the market representation is very coarse.A possible extension of the market description that would address some of the limitations would be to include reserve procurement and a balancing market. 22,28n important output of the cost optimisation, for each time-step and node, is the nodal price, which is equal to the added system cost of marginally increasing the power consumption at the given node.

C. Power generation
Power generators are described by the same universal model, illustrated in Figure 2(a).Different types of power plants are simply distinguished by their different parameters, as indicated in Table I.
In general, the energy resource may be converted by a primary energy converter, such as a wind turbine, into a more readily exploitable energy form referred to as the power inflow P inflow .It is assumed here that the power inflow (the average value and time profile) is given as input, and so, the resource and primary energy converter parts included in Figure 2(a) are not directly relevant.The power inflow is the usable energy that can be exported to the grid by the generator.This is a useful notion when the energy resource is not a storable fuel, but naturally variable resources such as wind, sun, and rain, that are only instantaneously available.For the wind power, the inflow depends on the wind speed and the characteristics of the wind turbines.Similarly, for the solar power, the inflow depends on solar radiation and the characteristics of the Photovoltaic (PV) or Concentrated Solar Power (CSP) units.For the hydro power, the inflow depends on precipitation, temperature, topography, and soil conditions.
Energy losses in conversion and generation are not explicitly considered, but can be accounted for indirectly: For the renewable energy sources, losses should be incorporated in the power inflow, such that the power inflow is the available energy minus losses in all stages of the conversion.For the fuel-based generation, losses should be included in the marginal costs akin to a tax.This, however, assumes a fixed efficiency, whereas in reality, the efficiency may vary considerably with the power output.The power available for the generator, P avail , is determined by the power inflow P inflow and the amount of stored energy E, and is given by where Dt is the time-step interval.
The generator output P gen is limited both by the available power and by the generator capacity P max , as well as the minimum production P min .Regarding the upper limit, there is a difference depending on the generator type.From the definition of power capacity for the PV panels, which is based on a "standard sun," it may occur in very good conditions that the power output is higher than the nominal capacity.In this case, the output power should not be constrained by the nominal capacity, but only by the available power.In fact, this is true for all generators with no storage.In general, therefore, the upper limit on the generator output is given as No storage : P limit ¼ P avail ¼ P inflow ; (2) Non-zero storage : P limit ¼ min½P avail ; P max : The generation dispatch is based on a cost minimisation, so the most important factor for determining whether a given generator is used at a given time is its cost of generation.How this cost is interpreted and specified depends on the generator type, as discussed in the following.
For the fuel based generators, such as coal, gas, oil, nuclear, and biomass, the cost of generation is set equal to the fuel price, including relevant taxes.The inflow and storage parameters can be specified in two alternative ways.Alternative One is to set the inflow to zero and the storage to infinity with an initial value also to infinity.Then, there is always fuel available in the storage and the output is restricted only by the generator's capacity.Alternative Two is to set the inflow equal to the available capacity and the storage to zero.This allows the available capacity to vary throughout the year, which may be relevant at least for nuclear power and perhaps biomass.
The wind and solar PV power are similar to each other.The inflow represents the available electrical power in the wind or solar radiation.Storage typically zero implies that power not used is lost.The cost of generation is very low, such that unless restricted by the grid constraints, the available power will always be exported to the grid.Solar CSP and run-of-river hydro power without any storage is also modelled in this way.
The generators with energy storage are more complex.The cost of generation then cannot simply reflect the fuel price, but must be set such as to ensure a sensible utilisation of the storage.This is done by means of storage values, as discussed in Section II E 1. Storage is particularly relevant for hydro with the water reservoir and CSP with the thermal storage, but may also be a PV system with a large battery bank.
If there is an energy storage, there may also be a pump or a battery charger.These are included in the cost minimisation with a negative sign and a cost given by the storage value minus a certain offset.Pumping will thus occur if the cost of supply is below this threshold.This is described more in Section II E 2.

D. Power consumption
Power consumption is modelled as loads connected to different nodes with a given average power demand and a certain profile which describes the time dependent variation, i.e., how the power consumption varies from time step to time step.Any number of demand profiles can be specified and any number of loads can be connected to each node.The load model is illustrated in Figure 2(b).
Power demand that cannot be supplied is handled by adding high cost generators at all nodes.This ensures that the optimisation always has a solution.The high cost further ensures that these are used only when strictly necessary.Output from these "generators" is interpreted as load shedding.
Flexible load is represented in a similar way to flexible generation, i.e., by means of a storage and storage value curves and with the absolute values tuned such as to give a reasonable utilisation of the flexibility (see Section II E 3).

E. Energy storage
Energy storage is important for the power system flexibility and for maintaining balance between the power production and consumption.When included in a cost optimisation, the cost associated with generators with storage cannot be the fuel price, which is close to zero for hydro and solar, since that would mean that the storage would immediately be emptied.Rather, the cost should reflect the value of the stored energy, which is comparable to the cost of alternative generation.This points towards the use of the storage values as a method to obtain reasonable utilisation of a storage system.In general, the storage values provide the threshold prices for when a storage generator should produce power.They are a well established concept for scheduling of hydro power production with a seasonal storage capacity. 29,30his paper extends the previous use of the storage values to the short-term storage systems for CSP generation and flexible load.

Storage values
For generators with storage, the marginal cost is given by the storage values, which may depend on the filling level and time.The storage values reflect the value of adding energy to the storage.This means that a storage generator will produce if the cost of alternative generation is higher than the storage value at any given time, or in other terms, if the nodal price is higher than the storage value v, given as vðf; tÞ where t is time, f is the filling level, v 0 is the base value of the storage, vfilling is the relative value dependent on the filling level of the storage, and vtime is the relative value dependent on time.The storage value curves v are given as input.
If the storage is nearly full, the storage value should be low, since adding to the storage may lead to energy spillage.If the storage is nearly empty, the storage value should be high.For predictable seasonal or daily inflow patterns, the storage value would typically be low just before a peak in the inflow and high before a dip.A schematic illustration of how the storage values may vary with the filling level and time is given in Figure 3 for the solar concentrated power with small storage (hours) and for hydro power with a large reservoir for the seasonal storage.

Pumping
The implementation of pumping is illustrated in Figure 4(a).If the price is high, the generator will produce power, reducing the storage filling level.If the price is below the storage value, the generator will be idle, allowing the storage to fill up (due to inflow).If the price is also lower than the pumping threshold, given as the storage value minus a certain dead-band value, the pump will add energy to the storage, increasing the filling level.The dead-band ensures that the generator-pumping system does not continuously alternate between generating and pumping, and indirectly takes into account the losses associated with pumping.The energy in the storage E is updated between each time step according to the differential equation where E max is the maximum capacity of the storage, P gen is the generator output, P pump is the pump power demand, and 0 < g pump < 1 is the pumping efficiency.Discretised, this equation is written as

Flexible load
The modelling of flexible demand is analogous to generators with storage (see Figure 2(b)).The idea is to add a storage E flex between the grid and the customer.The power extracted from this storage is constant and equal to the average load P flex,avg , whereas the power taken from the grid P flex and put into the storage is determined by the optimisation.The energy in the storage is thus computed according to where Dt is the time-step interval.
As with the generator storage, this load storage has a storage value v flex ðf flex Þ ¼ v flex 0 vðf flex Þ associated with it that depends on the filling level f flex which is the relative value of energy in the storage compared to the storage capacity E max flex If f flex > 0.5 then the load is "over-served," and the low storage values will discourage further serving the load.If f flex < 0.5, then it is "under-served," and the high storage values encourage serving the load.The storage value curves for flexible demand are specified in the same manner as for the generator storage, and the logically determining whether the load is being served, i.e., the value of P flex is also the same.This is illustrated in Figure 4(b) with a typical storage curve.If the storage value is higher than the associated nodal price, then the load is served, giving an increase in the filling level and a lower storage value in the next time-step.On the contrary: If the storage value is lower, then the load is not served while the storage is depleted according to the average load, giving a higher storage value in the next time-step.

III. LINEAR OPTIMISATION PROBLEM
As described in Section II B, the problem to be solved is a time step by time step optimal power flow.Energy storage links the time-steps; the optimisation in one time-step is dependent on the result of the previous one, and the overall problem therefore needs to be solved sequentially, as indicated in Figure 1, with the storage levels being updated between each time step.A key point with the storage value method is that storage utilisation is not part of this optimisation, which means that the simulation can be quite fast: The case study in Section V with 843 nodes and 673 generators simulated for a year with hourly resolution takes about half an hour using an open source solver and a normal laptop computer.
A linear objective function is used in order to ensure fast optimisation that converges with the practical benefit that it also requires fewer input parameters.The set of variables to be determined by the optimisation are where g 2 G is the set of generators; p 2 P is the set of pumps; f 2 F is the set of flexible loads; and n 2 N is the set of nodes.j 2 B is the set of AC and DC branches.The objective of the optimisation is expressed in terms of an objective function, which in our case is where c g is the cost of generator g, c pump p is the cost of pump p, c flex f is the cost of flexible load p, and c shed is the fixed cost of load shedding.As discussed in Section II E, these cost parameters are determined by the fuel price for generators without storage and by storage values in the other cases.The negative sign in front of pumping and flexible load denotes that increasing their value reduces the objective function.However, the energy balance constraint (see below) implies that the power for pumping or flexible load must be compensated by generating elsewhere.The benefit therefore depends on the cost of that alternative generation.
The variables (9) are not free, but constrained through upper and lower bounds, and through equations expressing relationships between them.Referring to these constraints as C m , the optimisation problem is formulated in the standard Linear Programming (LP) form This must be solved time step by time step, where the time steps are coupled due to the presence of storage.The various constraints are now described in more detail.
The first set of constraints state that the power flow on branches is constrained by their capacity limits where j refers to AC and DC branches with limited capacity.
The second set of constraints state that the power generation at generators is limited by lower and upper bounds, most notably the generation capacity and available power as described in Section II C C 2 : P min g P gen g P limit g ; where g refers to all generators.The third set of constraints state that the pumping is limited by the pump capacity where p refers to all pumps.The fourth set of constraints state that the flexible load is limited by the maximum demand where f refers to all flexible loads.The fifth set of constraints express the condition of power balance at each node, which requires that net power injection at a node equals the net AC power flow out of the node.Net power injection is given as generated power minus demand, pumping and load shed plus power inflow via DC connections, which are controllable and free variables in the optimisation.The flow in the AC grid, however, is determined by grid impedances by means of non-linear power flow equations.In order to formulate the problem as a linear optimisation problem, an approximate version of these equations is applied.To arrive at the linearised equations, often referred to as the DC power flow equations, the following assumptions are made: (1) phase angle differences are small; (2) voltage deviations are small; (3) branch resistance is small compared to reactance; and (4) shunt reactances are small, so self-admittances can be ignored.With these assumptions, the AC power flow equations reduce to the linear equations, where H is a vector of voltage angles, B 0 is the conductance matrix, and P node is a vector of net power injections into all nodes.The conductance matrix B 0 is the imaginary part of the bus admittance matrix, which are the same with the approximations given above.The P node vector elements are given as where P gen j is the generator output, G k is the set of generators at node k, P pump j is the pump demand, P k is the set of pumps at node k, P shed k is the amount of load shedding at node k, P dc j is the inflow on DC branches (positive or negative), D k is the set of DC branches connected to node k, P cons j is the consumer demand (fixed and flexible), and C k is the set of loads at node k.The sixth set of constraints express the relationship between power flow on branches and nodal voltage angle differences.In the linear approximation, power flow P ac on AC branches is related to nodal voltage angles as expressed by the equation, where D is a diagonal matrix with elements given by the branch reactance D mm ¼ À 1 x m , and A is the node-branch incidence matrix describing the network topology.
The seventh constraint specifies a reference node with zero voltage angle for each synchronous area, Since these are arbitrary and do not influence the results, the references are chosen to be the first node within each synchronous area.

IV. INTRA-DAY STORAGE UTILISATION
This section explores further the representation of storage systems and expands upon the description in Section II E. The discussion is illustrated with a simple 9-bus example.

A. Storage strategies
The storage value curves determine the storage utilisation strategy, with different shapes of the curves representing different strategies.And several strategies may be considered: One is to provide as constant output as possible; another is to optimise the revenue of the power plant, selling power when the price is high; and another is to provide balance power and avoiding price jumps and load shedding.The appropriate choice of storage value curve helps mimic such strategies.
The simplest approach is to use constant curves, where the storage value is independent both of time and filling level.Then the nodal price alone is the determining factor.This may work quite well if the base value v 0 of the storage (see Eq. ( 4)) is well tuned, being similar to the average nodal price.But it is a crude approach and may lead to a storage that is often empty or often full, meaning that the benefits of the storage are not realised.A better choice is to use the storage values that decrease with the filling level.If the storage has a critical function in avoiding price spikes, e.g., due to load shedding, the value at low filling should be sufficiently high such that the storage is never emptied completely.This is the case, e.g., for a hydro dominated system such as Norway.At the other end, the storage value should go to zero as the filling level goes to 100%, in order to avoid spilling energy.Two examples of storage value curves are shown in Figure 5.
Time dependence of the storage values may be applied in order to make power output better follow the demand, with high storage values when energy should be saved and with low values when the energy should be released from the storage.Since the demand patterns are usually predictable, the storage value time profile curves may be defined such that they correlate with demand, probably with a shift in time.An example of such a curve is shown in Figure 6.However, if the share of renewable energy in the system is high, this is not straightforward, since what matters is not the load itself, but the residual load once uncontrollable generation, such as wind and PV, is subtracted.And the residual load pattern is not as easy to predict.This point illustrates the main advantage of the storage value approach.Instead of determining upfront how the storage should be utilised, it allows a dynamic utilisation driven by price signals.Even with no explicit time dependence in the storage value curves, the storage utilisation will tend to follow the residual demand, because high residual demand means high price.

B. 9-bus example
To illustrate the PowerGAMA tool and the general approach, the remainder of this section addresses short-term storage utilisation, using the well-known 9-bus power flow model as a starting point.The model has been modified to suit the current discussion.In the base case, it consists of 9 nodes, 4 generators of different types and fuel prices as specified in Table II, 3 loads as specified in Table III, and 9 AC connections with data specified in Table IV.The CSP generator has a variable power inflow following a daily solar radiation pattern.The loads vary according to the same demand profile, as shown in Figure 6.
Several 48 h simulations have been run, with time-steps of 1 h.The results with the comments are presented below.
Case A: The base case has no storage and therefore limited flexibility.Figure 7 shows the grid layout, with colour codes indicating average energy balance in each node, i.e., production minus consumption, and the average utilisation of branch capacity.Buses 1, 2, and 3 are generation buses, while buses 7 and 9 are load buses.Bus 5 with the CSP generator has an average generation surplus close to zero. Figure 8  production is curtailed in the middle of the day, and also that there is load shedding during the evening demand peak.

Case B:
The second case has 6 h storage capacity of the CSP generator.The storage value dependence on filling level is as curve "csp" in Figure 5, while there is no dependence on time.FIG. 6.Time dependence of demand with morning and evening peaks, and the CSP storage value curve for shifting generation towards the evening.The base storage value is set to 9. The resulting generation mix in this case is shown in Figure 9.
The CSP generator output has now been shifted such that there is no curtailment and also no load shedding.More details for the CSP generator are shown in Figure 10, with inflow and output shown on the left side axis and storage filling level shown on the right side axis.The storage filling level varies between close to zero and close to one, indicating that the storage capacity is fully utilised.The figure also shows how the output is shifted relative to the inflow.Case B2: An alteration of the second case was defined as identical to Case B, except with the time-dependent storage values, see curve "csp" in Figure 6, and with no dependence on filling level.
Case B3: Another alternation of the second case was defined as identical to Case B, except with constant storage values, both in time and with filling level.
Case C: The third case has a reduced storage capacity of 1 h with an increased base storage value of 19 in order to ensure more restrictive use of the storage, and 10% demand flexibility.This flexible load has a flexibility of 10 h.The load when on is 5 times the average value; in other words, it is on about every fifth hour on average.The energy mix in this case is shown in Figure 11.Instead of shifting CSP generation, it is now the load that is shifted.Details of the demand at one of the three loads are shown in Figure 12.
The results of these simulations are summarised in Table V.The columns show the total cost of generation, load shedding, and spilled CSP power.Naturally, the cases with no spilled solar CSP power give lower total costs as CSP has no fuel cost.Load shedding costs are not included in the cost of generation presented here, but they do of course represent a cost for society.From these results, it is clear that flexibility in terms of generator storage or flexible demand is important in this system.Several alternatives are successful in avoiding load shedding, whereas avoiding spillage of solar power is more difficult.

V. CASE STUDY: WESTERN MEDITERRANEAN REGION
This final section is devoted to the analysis of a 2030 case study of large scale renewable energy integration in the Western Mediterranean region, with emphasis on Morocco.A 2014 version of the case has been presented previously, 26 including a comparison of simulation results with the actual data.That study provided the confidence in the approach and is the starting point for the definition of the 2030 scenario.A. Case description The system included in the study consists of countries around the western Mediterranean: Portugal, Spain, France, Switzerland, Italy, Tunisia, Algeria, and Morocco.

Grid
The European part of the grid is based on a subset of an existing reduced grid model for Europe. 31Tunisia and Algeria have been represented in a very simplified way with only a few nodes in each country.For Morocco, a reduced grid model was derived based on the power flow and bus voltage angle similarity as described in Refs.32-34.
Missing large generators have been added to the model and placed at the nearest node.This was done for wind and solar generators in Europe and all generators in Tunisia and Algeria.Information about those generators, regarding capacity, type, and location, was found mainly from Enipedia 35 and various lists on Wikipedia.New generation capacity in the future scenario is by nature difficult to place, but has been accounted for as follows.For offshore wind, new generators have been added for planned large offshore wind farms in France, Spain, Portugal, and Italy.In Morocco, new solar CSP, solar PV, and wind generators have been added on a few nodes corresponding to likely areas for future developments.For other cases, new capacity has been added by scaling up capacities of existing generators in the model.As a final step, generator capacities were scaled up or down to get the correct numbers per country and per generator type.
High-voltage direct current (HVDC) links have been added between Algeria and Spain, Tunisia and Italy, and France and Italy. 15Reinforcements in the AC links between countries has been done for all European countries according to the 3rd stage grid model for a 2030 FIG.12. Power demand and "storage" at load with certain amount of demand flexibility.scenario from the TradeWind project. 36The interconnections for Morocco, Algeria, and Tunisia were modelled according to the information from the Paving the Way for the Mediterranean Solar Plan project. 14he various grid model parts have been merged together to give a model covering the Western Mediterranean region with 843 nodes, 1274 branches, 673 generators, and 561 loads.

Consumption
2030 power demand for EU countries has been taken from the EC Trends to 2050 Reference Scenario 2013. 37The projection for Switzerland has been taken from the OffshoreGrid project, 38 and projections for Morocco, Algeria, and Tunisia have been taken from the BETTER project. 13Compared to the present consumption (2012), there is a 22% increase amongst the European countries considered and a 244% increase amongst the north African countries.The very large increase in North Africa is explained by rapidly increasing the population and assumed increase in per capita gross domestic product similar to the historical values from 2000 to 2010.Similar demand increases have been projected by the German Aerospace Center (DLR). 15,39Hourly consumption profiles are based on the profiles from the TradeWind project 20 for the European countries.For the northern African countries, the profile for Morocco 40 has been used also for Algeria and Tunisia, but adjusted according to the time zone shifts.No flexible demand has been included in the base case.An overview of the assumed annual demand per country is given in Table VI.

Generation
2030 generation capacities for EU countries were taken from the EC Trends to 2050 Reference Scenario 2013. 37For North African countries, renewable generation capacities are based on the Pan-Arab Renewable Energy Strategy 2030 41 for Algeria and Tunisia.For Morocco, 2030 values were estimated by doubling the targets for 2020.Hydro generation capacity has been kept as today for Algeria and Tunisia, and equal to the 2020 target for Morocco.Fossil fuel generation in 2030 has been set equal to the present values, except gas, which has been scaled up to give a reasonable ratio of 2.5 between total generation capacity and average demand.Fuel prices are based on the OffshoreGrid project 38 and assumed equal in all countries.The costs for hydro, wind, and solar have been set to 0.5.An overview of assumed generator capacities and marginal costs per country is given in Table VI.

Power inflow
A set of normalised power inflow profiles per country were used to capture the variability of wind, solar, and hydro powers.For wind and solar, these were generated based on the wind speeds and solar radiation data from the Reanalysis dataset; 42 whereas for hydro, they were approximated using the TradeWind inflow pattern "3" 20 with maximum values in the spring.Capacity factors, i.e., the ratio between average production and rated capacity, have been estimated as follows.For hydro power, they have been derived from capacity and annual production estimates in European countries, 27,37 and set to 0.3 in other countries.For solar, they have been set to 22% for European countries, and 26% for North African countries.For onshore wind, they have been set to 25% and for offshore wind to 40% in all countries.An overview of the assumed capacity factors is given in Table VI.

Storage
Assumptions for 2030 hydro storage capacities have been taken from the TradeWind 20 for the European countries.No hydro storage has been included in the North African countries.Storage for other generators have not been included in the base case, but analysed in Section V C. Storage capacities are summarised in Table VI.Pumped storage has not been considered in this study.
In order to fine tune the model, generator capacities and loads have been scaled up or down to match the total values per country.

B. Results
The extent of the model with the results from the base case simulations showing annual average nodal prices is illustrated in Figure 13.The nodal prices reflect the marginal costs and do not account for generator or grid investment costs.Such costs will be put on top of the operational costs as some form of tax.For example, France has low nodal prices because nuclear fuel is relatively cheap.However, building nuclear power plants is very expensive, so, although nodal prices in France are lower than in Spain, it does not necessarily mean that power is cheaper for the end customers.Large gradients in nodal prices indicate grid bottlenecks.This is evident, for example, in south and south-east Morocco, where cheap renewable energy is not transported to load centres because of the limited capacity on transmission lines, see Figure 14.The figure also shows average branch utilisation, i.e., the average power flow relative to the transmission capacity.As expected, there is a clear correlation between high price gradients and high line utilisation.These are indicators that the grid transmission capacity is insufficient, and that grid reinforcements should be considered.In order to say whether such reinforcements are economically sensible, it would be necessary to perform the cost-benefit analysis also taking into account the grid investment costs over a certain lifetime.
Because the power flow is determined by grid impedances, a limitation in power flow on one connection in a meshed grid may also limit flow on other connections.The ability to capture such effects is a major advantage of a flow-based market model such as applied in PowerGAMA.
Figure 15 shows the area price variations during the entire year.For Morocco, the price does not vary much since gas power is almost always the price-setting generation type.Slightly higher prices in the morning and evening correspond to peak load, where more expensive generation is also needed.For the other countries, the combination of demand, wind, and solar gives a more interesting picture.Lower prices in mid-day and in the summer correspond to solar power, while more random-looking price drops correspond to high wind situations.
Grid bottlenecks may lead to renewable energy being curtailed and therefore spilled.With high penetration levels, spilling of renewable energy may also happen if the renewable generation capacity is higher that the minimum load.In this case study, however, the spillage of renewable energy can be explained by insufficient grid capacities.Figure 16 shows an overview of spilled energy in the 2030 scenario simulation.It is clear from these results that there are serious problems in this 2030 scenario.Spilled renewable energy represents a waste and lost opportunity, and should be very small in a well-designed power system.As mentioned above, the reason in the present case is the grid bottleneck.To some extent, this may be explained by poor placement of new renewable generation capacity, but mostly it is due to the fact that we have not added sufficient grid reinforcements that should occur before 2030.Only new HVDC connections have been included in this base case.For the internal grid in the European countries this is not critical, as internal connections are modelled with  infinite capacity, but for cross-border connections, as well as all connections in Morocco, this is important.As mentioned above, combined with an investment cost analysis, the present case study may be extended with a cost-benefit analysis in order to identify suitable grid upgrades, beyond what is already planned by transmission system operators.This will be addressed in a future study for the case of Morocco.The focus of the present study is instead on the modelling of flexibility, and how storage and flexible demand may improve the situation.
Figure 17 shows the relative energy mix in the annual electricity production per country for the base case simulation.The renewable share is about 26% for Morocco, close to 28% for Tunisia, and 23% for Algeria.This is short of policy targets of 40% for Algeria and 30% for Tunisia. 41The reason for the mismatch is probably that these three countries have been modelled with a larger increase in demand than what has been assumed in the renewable energy policy targets.

C. Value of flexibility
Six additional cases have been specified to investigate the value of energy storage in the system, four with modifications in Morocco (1a, 1b, 2, 3) and two with modifications in Spain (4, 5).Case 0 is the base case as described above.Case 1a is the same as 0, but with a 6 h energy storage added to all solar csp generators in Morocco, with the storage values that depend on the filling level (see "csp" in Figure 5), but not on time.Case 1b is the same as 1a, but with 12 h storage.Case 2 is the same as 0, but with 5% of demand having 24 h flexibility for all loads in Morocco, with the storage value dependent on the filling level (see "flex demand" in Figure 5), but not on time.Case 3 is the same as 1a plus 2, i.e., both energy storage and demand flexibility.Case 4 is the same as 1, but with a 6 h energy storage added to all solar csp generators in Spain instead of Morocco.Case 5 is the same as 2, but with 5% of demand having 24 h flexibility for all loads in Spain instead of Morocco, and with the storage values that are independent of the filling level, but depends on time.The last two cases were included in order to allow a comparison between flexibility added in Morocco and in Spain.These two countries are suitable representatives of the different countries included in the case study, see Figure 17.
The results from these simulations are summarised in Table VII.In principle, comparisons between different simulations have to take into account the net changes in storage filling from start to end in the simulation.To do this, the value of net energy added to the storage may be estimated by multiplying storage filling change with the storage base value, see Section II E 1.This is shown as the variable DS in Table VII.In our case, this storage change value is small compared to the differences in total cost of generation C, and may therefore be ignored.
It is clear from these results that both generation flexibility in terms of energy storage and demand flexibility in Morocco are beneficial for the system, giving reduced system operational costs.The benefit is most pronounced for the CSP energy storage: Adding 6 h storage to the CSP generators decreases the generation cost by 101 million Euro per year, or in terms of specific generation cost for Morocco, an almost 3% reduction from 50.20 to 48.71 e/MWh.As expected, the benefit of doubling the storage is somewhat less, but still significant 61 million Euro per year.The added demand flexibility gives a modest 17 million Euro cost reduction, or 0.6% reduction in specific cost for Morocco.The storage value curves and flexible demand parameters have not been optimised so it is likely that this number could be increased significantly by a better choice of parameters.
The reduction in the costs of generation is to some extent reflected in the average area prices in Morocco.Area prices are computed as average nodal prices, weighted according to the relative power demand within an area.However, for area prices flexible demand has a bigger effect: The reduction is only 0.2% with 6 h CSP storage, but 1.1% with flexible demand.Two effects probably contribute to this.First, storage reduces the need for expensive generation, which lowers both cost and price at the high price end.Second, storage enables cheap generators to save energy until prices are higher, which tends to increase the prices and the low price end.The price difference is elaborated in Figure 18 which shows cumulative histograms for the area prices for the base case as well as cases 1a and 2. The y-axis gives the fraction of the time that the area price exceeds the corresponding x-axis value.The reduced area price means that the curve is shifted to the left.As is evident from the figure, area price reduction is most pronounced for case 2 (flexible demand), reflecting the fact that the average area price is also lower in this case.However, case 2 does not reduce the occurrence of the very highest prices.In this regard, case 1 (CSP storage) is more efficient.The result of case 2 with flexible demand in Morocco is illustrated in Figure 19, indicating how the averaged daily load profile is affected.Somewhat surprisingly, the overall profile is not really changed at all.This is another illustration of the relatively modest benefit of the demand flexibility, which again may be understood in terms of the small daily price variations in Morocco (see Figure 15).
In general, storage on solar CSP plants supports the system in two ways, as demonstrated in Figure 20 for Morocco.First, it reduces the problem evident from Figures 14 and 16 of solar CSP curtailment due to the grid bottlenecks by allowing solar energy to be transmitted when there is available transmission capacity.Thus, the overall CSP power output is increased.Second, it shifts energy output to better match the high demand in the evening.This is the same effect as observed in Figure 9 for the 9 bus example.
An example from Morocco showing more detail for a CSP plant with storage is presented in Figures 21 and 22.The shift of the output towards the evening is evident.In the middle of the day, the nodal price drops to zero, reflecting a surplus of renewable generation in the region.CSP energy is added to the storage until it is full, at which point the generator starts exporting power to the grid.As the storage filling level decreases, the storage value increases until it is higher than the price of gas at 70 e/MWh.The fact that the storage filling level only varies between 0.4 and 1 indicates that it is not utilised fully, and that the storage utilisation strategy encoded in the storage value curve is not optimal.In the present approach, storage value curves are given as input, and no attempt has been made to optimise these.The result above indicates that a better utilisation would be achieved if the storage value did not reach such a high value in the evening: A lower value would lead to an emptying of the storage, and more energy could then be absorbed during daytime.
The cases (4,5) with the flexibility added to Spain show less of a change for the entire system.Case 4, which is similar to 1a, but with 6 h storage added to the CSP plants in Spain instead of in Morocco, has a generation cost reduction that is much smaller, only 39 Me compared to 101 Me for the case with the storage added in Morocco (see Table VII).This is despite the fact that the added storage in case 4 is five times higher than in case 1a: 60 GWh (and generator capacity 10 GW) versus 12 GWh (and generator capacity 2 GW).So why does more storage in Spain give less benefit than less storage in Morocco?This is not as strange as it may seem, since the main reason for the cost reduction in the Morocco case is that it allows the use of otherwise spilled solar energy.As there is hardly any spillage of solar power in Spain, see Figure 16, the benefit of the storage should be expected to be minimal.The average CSP production profile in Spain in case 4 with the storage and in the base case without the storage is shown in Figure 23, which should be compared with Figure 20.
An important aspect of the model that further explains the big difference in the results between the added storage in Spain and in Morocco is the fact that Spain has been modelled with infinite capacity on internal branches.This amounts to assuming that enough grid reinforcements have been applied such that there are no internal grid bottlenecks.In such a case, the benefit of storage arises from the fact that it can reduce the need to run the most expensive generator types.An extract of the results showing generation mix in Spain during four days when this happens is shown in Figure 24.On the second day, some of the CSP power is stored for the evening, helping to avoid the need to start up expensive gas generators.On the fourth day, the situation is quite different, and the storage plays no significant role: The large amount of wind power keeps the price low and therefore the storage is already full before sunrise.The same figure also illustrates how Spain changes from importing energy the first two days to exporting energy the last two days.
Case 5 is similar to 2, with flexible demand added in Spain instead of in Morocco.In this case, however, storage values have been set to be independent of the filling level, but vary with time: The storage values are 50% less than average in the morning, and 50% higher than average in the evening.This has been done in order to shift demand from the evening to the morning (see Figure 4(b)) illustrating another type of storage utilisation strategy.Simulation results in Figure 25 show how this gives a flattening of the average demand profile, with load shifted from the evening peak to the morning, as desired.There is a spike in flexible demand in the early morning because of sharp change in storage value at this point.A smoother activation of flexible demand could be achieved by assigning somewhat different storage value curves to the different loads, with somewhat different on-off periods.The flattening of the demand profile may have advantages in itself, e.g., related to system stability issues.However, no economic benefit is apparent from the present simulations.This is clear from Table VII, where the total cost of generation actually increases in this case.This may partly be understood on the basis of how prices correlate with demand and renewable generation, see Table VIII.Correlation coefficients between area price time-series and other values for the base case are presented in Table VIII.Naturally, the strongest correlation is between the prices and residual load, i.e., load minus wind and solar production.Otherwise, the table indicates the main drivers for price variations in the different countries.In France, Italy, and Morocco, the demand is the most important; whereas in Spain and Portugal, wind is the most important, and in Algeria, solar power dominates.In the case of Spain, there is only a low (0.32) correlation between price and demand, whilst there is a high anticorrelation between price and wind power (0.66).This indicates that it would be more beneficial to shift demand to follow the wind rather than to even out daily variations.The area price variation in Spain for cases 0, 4, and 5 are illustrated as cumulative histograms in Figure 26.In these cases, there are only very small differences in the price distributions, much less than seen in the Morocco cases in Figure 18.This is in alignment with the previously described results demonstrating the minor impacts of adding this type of flexibility in Spain in the present case study model.

VI. CONCLUSIONS
The paper has described and demonstrated a modelling approach for assessments of future scenarios for renewable energy integration in large and interconnected power systems, based on the sequential optimal power flow computations that take into account the variability in power consumption, in renewable power availability, energy storage and flexible demand.The approach as well as the implementation as the PowerGAMA Python package was described in detail.The representation of generators with energy storage and flexible demand using a common model based on the storage values is a novel idea that was applied with promising results.Different storage value curves may be applied to mimic different storage utilisation strategies.
A case study representing a 2030 scenario for the Western Mediterranean region was defined by merging data and projections from multiple sources.This case was then analysed and discussed, with an emphasis on the potential benefits of storage and flexibility in Morocco and Spain.The analysis illustrated significant differences between the different countries in terms of energy mix, renewable energy curtailment levels, and price level and price variations.
Morocco is modelled with the internal grid constraints that limit the power output from renewable power plants.As expected, there is a clear benefit of adding flexibility both in terms of CSP storage and on the demand side.The benefit of storage arises primarily from the ability to distribute the power flow from solar power plants over a longer time period, thus obtaining a better utilisation of the limiting transmission corridors.This results in an increased overall output of the CSP plants, or in other words, reduced curtailment.For Spain, the CSP storage was also found to reduce the overall cost of generation, despite ignoring the internal grid constraints.In this case, the benefit is due to the time shift of the CSP output, allowing expensive generators to be replaced by cheaper generators.The amount of grid bottlenecks strongly influences the benefit of storage and demand flexibility, as is evident by comparing the Morocco (1a) and Spain (4) cases.
The very high utilisation on several internal branches in Morocco suggests that grid reinforcements should be considered.Further work should consider a cost-benefit analysis taking into account both the possibility of grid upgrades and inclusion of energy storage.
The results also demonstrate some significant shortfalls of the presented 2030 scenario.One is the need for grid reinforcements that should be considered and included in a more realistic scenario.Another point is the high demand increase in North Africa which means that the renewable share of the energy mix remains at a modest level, despite largely increased generation capacities.
The most significant result of this paper is the description and demonstration in a relevant case study of a new simplified modelling approach implemented as the open-source PowerGAMA package.This approach and tool are suitable for the analyses of large-scale renewable energy integration in large power systems.

FIG. 3 .
FIG.3.Illustration of typical storage values with dependence on filling level (left) and time variation for solar power with small storage (middle) and hydro with large storage (right).

FIG. 7 . 9
FIG. 7. 9 Bus example.Results from 48 h simulation showing the average energy balance in each node and utilisation level of branches.

FIG. 9 .
FIG. 9. Generation mix with flexibility in terms of CSP

FIG. 15 .
FIG. 15.Area prices in EUR/MWh showing variations within a day (vertical) and from day to day over a year (horizontal direction).

FIG. 24 .
FIG.24.Generation mix in Spain during four days with high wind penetration (case 4).

TABLE I .
Generator parameters: Inflow, storage capacity, and marginal cost for different types of generators.
shows the generation mix.It is evident that the CSP FIG. 5. Storage value curves for CSP and flexible demand, showing dependence on the storage filling level.

TABLE II .
9Bus case generator data.

TABLE V .
9 Bus case results.

TABLE VI .
2030 Case parameters.Generator costs are given in (e/MWh).

TABLE VII .
Case study results, showing system costs of generation C (Me), cost compared to base case DC (Me), storage value change DS (Me), and specific cost of generation c (e/MWh) and average area price p (e/MWh) in Morocco and Spain.
FIG. 18. Cumulative histograms for hour-by-hour area prices in Morocco.FIG.19.Change in demand curve with flexible demand in Morocco (case 2).
FIG. 20.Average daily CSP power output in Morocco in case without storage (case 0) and with storage (case 1a).Average daily demand profile is shown for reference.FIG. 21.Solar CPS plant in south-east Morocco.Example showing how storage is utilised during operation over two days.Left axis is power (MW) and right axis is relative filling level (case 1a).
FIG. 22. Solar CPS plant in south-east Morocco.Example showing storage value and nodal price (e/MWh) on associated node during operation over two days (case 1a).FIG.23.Average daily CSP power output in Spain in case without storage (case 0) and with storage (case 4).Average daily demand profile is shown for reference.

TABLE VIII .
Correlation coefficients between hour-by-hour area prices and other values in the base case.Cumulative histograms for hour-by-hour area prices in Spain.055501-26 H. G. Svendsen and O. C. Spro J. Renewable Sustainable Energy 8, 055501 (2016)