A Generalized Unit Commitment and Economic Dispatch Approach for Analysing the Polish Power System under High Renewable Penetration

: The achievement of carbon neutrality requires a deep transformation of the Polish power sector. This paper analyses the impact of increased electricity generation from wind and solar technologies envisaged in the newest version of the Energy Policy of Poland until 2040 on the operation of dispatchable generators in 2030. The analysis was carried out using the Model of Economic Dispatch and Unit commitment for System Analysis (MEDUSA) model, which solves a mixed integer problem related to unit commitment and economic dispatch in electrical power production. At ﬁrst, the model was validated based on the real operation data from 2018. Next, ﬁve scenarios were built to analyse the operation of the system in 2030. The overall result of the study is that the safest solution from the point of view of power system stability is to extend the decommissioning of coal units of 200 and 300 MW classes, to invest in renewable energy sources (RES) according to the energy policy, to build new gas power plants with the total capacity of ca. 4 GW, and to enforce Demand Side Management (DSM) programs for shifting the electrical load. The proposed framework for the optimization of power system planning helps to avoid wrong investment decisions that would have a negative impact on energy prices.


Introduction
As a country of abundant coal reserves, Poland used to belong to a group of several countries in the world where more than 80% of the electricity was generated from solid fuels. Whilst this has gradually been changed, approximately 77% of electricity in Poland is still produced from hard coal and lignite. The achievement of carbon neutrality by 2050, as recently agreed by the European Union Council [1], requires a deep transformation of the Polish power sector, mainly towards Renewable Energy Technologies (RET). In its official supporting documents, namely "Energy Policy of Poland until 2040" (EPP2040) [2,3] and "National Energy and Climate Plan" (NECP) [4], Poland declares that it will aim to decrease the share of coal in the electricity production mix to 56-60% by 2030 and maintain the declining trend in the years after. At the same time, the share of renewable energy sources (RES) in electricity production is planned to be increased to approximately 32% by 2030. This causes several challenges to the Polish power sector. A predominantly greater use of RES, such as wind and solar, for which power generation depends on weather conditions, will make the electricity supply

Motivation
In our study, we used the UCED model named Model of Economic Dispatch and Unit commitment for System Analysis (MEDUSA) to analyse the technical feasibility of power system operation in 2030 according to the energy scenario presented in EPP2040. This scenario was prepared with the use of the Capacity Expansion Planning (CEP) model [14]. Unfortunately, these types of models neglect the system dynamics and technical constraints, which may lead to misrepresentation of the true costs and performance of a particular generation mix and result in capacity mixes that are suboptimal or even infeasible [15]. Attempts have been made to integrate daily energy planning with long-term capacity expansion planning [16], but such integration presents computational challenges. Often, the time horizon in CEP is divided into the so-called modeling years (e.g., every five years). We therefore propose an approach where capacity expansion models, such as those described in [17,18], are launched first and subsequently, the UECD models are launched for selected years, using their results as the input. In this way, the technical feasibility of the scenarios can be verified. A flowchart illustrating the proposed framework for power system planning considering capacity expansion planning, as well as the unit commitment and economic dispatch, is depicted in Figure 1. Obviously, the presented flowchart is a generic one and additional work on integration is still necessary, e.g., harmonization of main datasets, assumptions, etc.
Energies 2020, 13,1952 3 of 19 operation in 2030 according to the energy scenario presented in EPP2040. This scenario was prepared with the use of the Capacity Expansion Planning (CEP) model [14]. Unfortunately, these types of models neglect the system dynamics and technical constraints, which may lead to misrepresentation of the true costs and performance of a particular generation mix and result in capacity mixes that are suboptimal or even infeasible [15]. Attempts have been made to integrate daily energy planning with long-term capacity expansion planning [16], but such integration presents computational challenges. Often, the time horizon in CEP is divided into the so-called modeling years (e.g., every five years). We therefore propose an approach where capacity expansion models, such as those described in [17,18], are launched first and subsequently, the UECD models are launched for selected years, using their results as the input. In this way, the technical feasibility of the scenarios can be verified. A flowchart illustrating the proposed framework for power system planning considering capacity expansion planning, as well as the unit commitment and economic dispatch, is depicted in Figure 1. Obviously, the presented flowchart is a generic one and additional work on integration is still necessary, e.g., harmonization of main datasets, assumptions, etc. This study contributes to the analysis of the robustness of long-term scenarios elaborated with the use of CEP models in order to avoid wrong investment decisions that would have a negative impact on energy prices. Infeasibility of the UECD model for the CEP results gives a clear signal that the proposed scenario cannot be carried out in reality. The case in which the UCED model is feasible for all the runs in a given year, but its results concerning power unit operation are very different to those of CEP, indicates that the solution of the latter is suboptimal.

Materials and Methods
The analysis presented in this paper has been performed with the use of the Model of Economic Dispatch and Unit commitment for System Analysis (MEDUSA) developed at AGH University of Science and Technology in Poland. The MEDUSA code was written in the GAMS programming language [19]. As indicated by its name, it solves a mixed integer problem (MIP) related to the optimization of unit commitment (UC) and economic dispatch (ED) in electrical power production. The optimization is conducted with the use of the CPLEX solver [20]. The current version of the model assumes no transmission grid limits for the power flow (copper plate assumption). In this study, the model was used to optimize the operation of centrally dispatchable power generation units (hereafter called JWCD) operated by the Polish Power Grid Company (PSE) under different levels of intermittent RES penetration. The results of the model show how the forecasted load is going to be balanced, the operational status (online or offline), and the power output of the JWCD units. The year This study contributes to the analysis of the robustness of long-term scenarios elaborated with the use of CEP models in order to avoid wrong investment decisions that would have a negative impact on energy prices. Infeasibility of the UECD model for the CEP results gives a clear signal that the proposed scenario cannot be carried out in reality. The case in which the UCED model is feasible for all the runs in a given year, but its results concerning power unit operation are very different to those of CEP, indicates that the solution of the latter is suboptimal.

Materials and Methods
The analysis presented in this paper has been performed with the use of the Model of Economic Dispatch and Unit commitment for System Analysis (MEDUSA) developed at AGH University of Science and Technology in Poland. The MEDUSA code was written in the GAMS programming language [19]. As indicated by its name, it solves a mixed integer problem (MIP) related to the optimization of unit commitment (UC) and economic dispatch (ED) in electrical power production. The optimization is conducted with the use of the CPLEX solver [20]. The current version of the Energies 2020, 13,1952 4 of 18 model assumes no transmission grid limits for the power flow (copper plate assumption). In this study, the model was used to optimize the operation of centrally dispatchable power generation units (hereafter called JWCD) operated by the Polish Power Grid Company (PSE) under different levels of intermittent RES penetration. The results of the model show how the forecasted load is going to be balanced, the operational status (online or offline), and the power output of the JWCD units. The year 2018 has been selected for calibration and validation of the model.

Temporal Resolution and Modeling Time Horizon
MEDUSA optimizes the operation of power generation units using an hourly temporal resolution. Large amounts of data and numerous limitations describing real operational constraints, together with the high temporal resolution, significantly extend the time of solving. To overcome this problem and to keep computational efforts reasonable, a year is split into short timeslices consisting of two days (48 h), which are solved consecutively one after another ( Figure 2). After solving the model for the period P1, only the results for the first day and the first hour of the second day are saved, while the second day is resolved again in the optimization process of the second modeling period P2. In the work of [21], different interval lengths in a rolling horizon unit commitment model were studied, and it was concluded that the interval length is such models is not very significant and that the interval of two days is fairly sufficient.

Temporal Resolution and Modeling Time Horizon
MEDUSA optimizes the operation of power generation units using an hourly temporal resolution. Large amounts of data and numerous limitations describing real operational constraints, together with the high temporal resolution, significantly extend the time of solving. To overcome this problem and to keep computational efforts reasonable, a year is split into short timeslices consisting of two days (48 h), which are solved consecutively one after another ( Figure 2). After solving the model for the period P1, only the results for the first day and the first hour of the second day are saved, while the second day is resolved again in the optimization process of the second modeling period P2. In the work of [21], different interval lengths in a rolling horizon unit commitment model were studied, and it was concluded that the interval length is such models is not very significant and that the interval of two days is fairly sufficient.

Representation of the Power Generation Units in the Model
Dispatchable JWCD units included in the model mainly use hard coal and lignite, with a few natural gas-fired and hydro (including pumped-storage) power plants. The total installed electric capacity of these units in 2018 amounted to 26,760 MW. Non-dispatchable units (hereafter called nJWCD) are responsible for the so-called "determined" production of electricity. They include combined heat and power plants (fueled with hard coal, natural gas, biomass, or biogas) for which the operation is mainly driven by the heat demand, as well as the intermittent renewables, such as wind turbines and photovoltaics. According to the Polish regulations, RES-based electricity must be purchased by the grid operator. It is assumed that the hourly profile of power generation from nJWCD observed in 2018 is a reference one. The increase in RES capacity will obviously result in higher electricity generation; however, the hourly production profile will be the same (which implies a relative distribution of the annual value into timeslices, as in 2018). The generated electricity is entirely fed to the power grid and RES curtailment is only possible when the risk of system instability exists.

Representation of the Power Generation Units in the Model
Dispatchable JWCD units included in the model mainly use hard coal and lignite, with a few natural gas-fired and hydro (including pumped-storage) power plants. The total installed electric capacity of these units in 2018 amounted to 26,760 MW. Non-dispatchable units (hereafter called nJWCD) are responsible for the so-called "determined" production of electricity. They include combined heat and power plants (fueled with hard coal, natural gas, biomass, or biogas) for which the operation is mainly driven by the heat demand, as well as the intermittent renewables, such as wind turbines and photovoltaics. According to the Polish regulations, RES-based electricity must be purchased by the grid operator. It is assumed that the hourly profile of power generation from nJWCD observed in 2018 is a reference one. The increase in RES capacity will obviously result in higher electricity generation; however, the hourly production profile will be the same (which implies a relative distribution of the Energies 2020, 13, 1952 5 of 18 annual value into timeslices, as in 2018). The generated electricity is entirely fed to the power grid and RES curtailment is only possible when the risk of system instability exists.

Mathematical Model Formulation
This part provides an outline of a specification of the mathematical programming problem. Only the main equations, including the objective function and associated constraints, are presented.
The model definition requires the use of the following sets: As mentioned before, MEDUSA minimizes the total costs of balancing the forecasted electrical load by making decisions on whether the dispatchable units i are in operation at time t and what their power output is, taking into account fixed power generation from non-dispatchable units.
The main decision variables include the following: The main parameters include the following: The objective function given by the expression (1) represents the total costs of balancing the forecasted load, including start-up, shut-down, and operation costs; costs of load shifting through the demand-side response; and the costs of load shedding.
Start-up and shut-down Demand-side response + t vLS t · pVOLL Load shedding (1)

Operation Costs
The total power output vP i,t of the unit committed to operation (i.e., for which vOn i,t = 1) is given by the following equation: Each JWCD unit is obliged to submit 10 bids for power generation (in an ascending price order, where the first bid reflects the operation with the minimum power). In each bid, the power output range and the price have to be indicated. The accepted power output corresponding to a given bid can be less than or equal to the one determined in the bid (3). The total power output depends on the number of accepted production bids.

Start-Up Costs
The start-up costs occur once a unit is starting, i.e., when vSt i,t = 1. They depend on the downtime (DT), i.e., the time a unit has been shut down before a start-up (number of hours, n). By default, a unit is set to be in a "Cold" state. The unit is considered to be in a "Hot" or "Warm" state if n is ≤10 h or ≤20 h, respectively. Obviously, the start-up costs are the lowest in the case where the unit is starting from the "Hot" state and the highest in the case where the unit is "Cold" (see Section 2.5). Equation (4) assures that only one state is chosen.

Demand-Side Response and Load Shedding
The possibility of modification of the load profile through Demand Side Management should be considered in UCED problems [22]. MEDUSA enables load shifting, making it possible to reduce the electricity consumption during peak hours. However, this reduced amount of electricity must be consumed during other hours t of the same day d. At the time when the power demand cannot be balanced by the supply side, even if available demand-side response (DSR) bids are fully exploited, a variable, vLS t representing load shedding will hold a value equal to the power gap. The multiplication of vLS t by the parameter pVOLL, which reflects the value of loss of load, gives the total costs of load shedding.

Technical Parameters
In this study, the focus is placed on the flexibility of coal-fired units, which still dominate the power generation structure in Poland. These include pulverized and circulating fluidized bed hard coal-and lignite-fired boilers. With increasing RES penetration, these JWCD units must become more flexible. Flexibility in the operation of a generating unit is referred to as the ability to operate in a stable and safe manner in contingency situations (unexpected outages of generating units, failures of the transmission lines, etc.). Key elements shaping the flexibility are quick start-up and shutdown; a broad range of boiler loads and power outputs; and a high rate of change in the power output, i.e., high ramping rates. Each of the JWCD units in MEDUSA when in operation is allowed to have a power range between Pmin and Pmax (MW). Ramp-up and -down constraints (MW/h) limit the changes in the power output during two consecutive hours. Start-up and shut-down conditions are indicated, i.e., the initial power output (MW) at time t in which the unit is started and the power level that needs to be reached before the unit can be shut down. Finally, in order to consider the limitations of the materials, e.g., thermal stress, the minimum number of hours that the unit needs to operate once started or left offline once it has been shut down is determined. In this study, the values of these parameters have been reviewed for each JWCD unit based on the operation data from 2018 published by the PSE operator [23]. Table 1 provides some main statistics of this review. The JWCD generating units were split into different classes based on their fuel type and electric capacity. The range of downtime periods considered was the same as described in Paragraph 2.2. The main outcome of the review is that once being started, units operated for longer periods. The same applies to staying offline after the units were shut down. The minimum downtime after which the units were back in operation was equal to 4 h. In 77% of cases, units operated for more than 20 h after being brought into operation. The total number of start-ups reached 2186, with the highest number of 1375 in the "HC 200" class. This capacity class (for both hard coal and lignite) also had the largest number of downtimes. In the majority of cases, units started from the "Cold" state. One can also see that the smaller the electric capacity of the units, the more hours they stay offline on average. This can be explained by the lower efficiency and higher operation costs observed with a decrease of the unit sizes. The only exemption is the class "HC > 500", for which the average downtime per unit was higher than 5100 h. In fact, two of the three units belonging to this class were under modernization and practically did not operate in 2018.

Economic Parameters
Each of the JWCD is obliged to submit 10 generation bids for the balancing market. Bids must be increasing in price in the consecutive bands. The bidding offers are confidential. Therefore, a simplified approach was made in this study, in which the average variable costs were calculated for each generator, taking into account the national data on the fuel prices, gross electric efficiencies, CO 2 emissions, and prices of CO 2 emission allowances. The price of the bid for a power band in the middle between Pmin and Pmax was equal to the calculated variable costs. In the next step, the third-degree polynomial was fitted accordingly for each unit, assuming that the price offer in the first and last power band was 5% lower and 7% higher, respectively. The obtained values of the polynomial function in the center of each band gave the final price offers. Another important economic parameter is the start-up cost, which depends on the electric capacity of the thermal unit, as well as on the amount of time that a unit has been offline before a start-up. Start-up costs are often approximated by a constant value to minimize the computational requirement needed to solve MIP models. In this study, start-up costs were approximated by three-step approximation ( Figure 3). The starting point for approximation was the function proposed by [24] describing the time-dependent start-up cost characteristics for a thermal plant with nominal power Pmax i , as shown in Equation (5): where StCst is the start-up cost of the i-th generating unit taking into account the number of hours n that the unit has been offline and a, b, and c are the coefficients calibrated for the 200 MW coal-fired unit and kept constant in calculations of start-up costs of other units. Next, the start-up cost functions were derived for each JWCD unit based on their nominal power and finally approximated by three steps for the time intervals described in Section 2.2 ( Figure 3).

Validation of the Model for 2018 Data
In order to validate the model, its results were compared against the real operation data reported by [23]. The real operation data included the power output of each JWCD unit for each hour of 2018. Table 2 shows the value of Pearson's Correlation Coefficient for data aggregated in different time periods and months. In general, the correlation varies from 0.73 (observed in the period between 1:00-2:00 in January) up to almost 0.92, with a mean equal to 0.857. Therefore, the obtained results indicate a high positive correlation between the modeled and observed data. In general, a higher correlation is observed in the period from June to September and in hours starting from 7:00 till 21:00. were derived for each JWCD unit based on their nominal power and finally approximated by three steps for the time intervals described in Section 2.2 ( Figure 3).

Validation of the Model for 2018 Data
In order to validate the model, its results were compared against the real operation data reported by [23]. The real operation data included the power output of each JWCD unit for each hour of 2018. Table 2 shows the value of Pearson's Correlation Coefficient for data aggregated in different time periods and months. In general, the correlation varies from 0.73 (observed in the period between 1:00-2:00 in January) up to almost 0.92, with a mean equal to 0.857. Therefore, the obtained results indicate a high positive correlation between the modeled and observed data. In general, a higher correlation is observed in the period from June to September and in hours starting from 7:00 till 21:00.
The highest correlation in the entire 2018 year is observed in June in the period between 13:00 to 14:00. Figure 4 shows a scatter plot which compares the power output of the units committed to work in that period. Although the general performance of the model is positive, there are still some differences between the observed and modeled results. A lower correlation is observed in night hours where the power demand of the system is lower and consequently, only a limited number of units is in operation.  I  II  III  IV  V  VI  VII VIII  IX  X  XI I  II  III  IV  V  VI  VII  VIII  IX  X  XI  The highest correlation in the entire 2018 year is observed in June in the period between 13:00 to 14:00. Figure 4 shows a scatter plot which compares the power output of the units committed to work in that period. Although the general performance of the model is positive, there are still some differences between the observed and modeled results. A lower correlation is observed in night hours where the power demand of the system is lower and consequently, only a limited number of units is in operation.

Hour Annual
These differences can be explained by the discrepancies in the values of the production bids, which, in our case, were determined based on the operation cost data and were kept static during all hours in the year. One should also note that the power grid constraints were not considered in the model. As discussed in Section 2.3, in 2018, units operated with specific characteristics, i.e., longer operation after start-up and a longer period of staying offline after shut-down. The settings of MEDUSA made more flexible operations possible.

Case Study
In order to provide some insights on the questions asked in the introductory part of the paper, five simulations were run with the use of MESUSA for years between 2018 and 2030. The next decade will have crucial importance, particularly for the existing JWCD units, which will either be closed after 2025 or operate a few years longer to provide the back-up power for the system. Therefore, the special focus of this simulation was placed on the future role of the existing coal-fired units and new These differences can be explained by the discrepancies in the values of the production bids, which, in our case, were determined based on the operation cost data and were kept static during all hours in the year. One should also note that the power grid constraints were not considered in the model. As discussed in Section 2.3, in 2018, units operated with specific characteristics, i.e., longer operation after start-up and a longer period of staying offline after shut-down. The settings of MEDUSA made more flexible operations possible.

Case Study
In order to provide some insights on the questions asked in the introductory part of the paper, five simulations were run with the use of MESUSA for years between 2018 and 2030. The next decade will have crucial importance, particularly for the existing JWCD units, which will either be closed after 2025 or operate a few years longer to provide the back-up power for the system. Therefore, the special focus of this simulation was placed on the future role of the existing coal-fired units and new intermittent RES technologies, i.e., PV and wind on-and off-shore. The main assumptions of each simulation are described below.

Installed Electric Capacities of Existing JWCD Units
According to the EPP2040, there will be no more investments in coal-fired plants, except for those currently under construction. The same applies to lignite power plants (building a new lignite mine in the vicinity of the city of Złoczew close to the existing Bełchatów power plant is considered approved in EPP2040). About 4 GW of new gas-fired plants will be built and the existing hard coal combined heat and power plants (CHPs) will be replaced by gas-fired ones. Table 3 shows the path of decommissioning for the main thermal types of generation units used in this work. The value of electric capacities installed in lignite-and natural gas-fired units in 2030 is very similar to that in EPP2040. However, to test the impact of the deep decommissioning of hard coal-fired plants as a consequence of their possible exclusion from the capacity market, a more significant decrease in the capacities of these units was assumed. In our baseline decommissioning plan, the total electric capacity of hard coal units in 2030 is ca. 2 GW lower than in EPP2040. The most significant reduction in the period 2018-2030 (6.8 GW) is for the class "HC 200". An increase in the electric capacity in the hard coal class named "Other" is due to the recent commissioning of a few large-scale projects. The lignite installed capacity decreases by about 1 GW in this period.

Installed Electric Capacities of RES Technologies
The goal of EPP2040 is to achieve 23% of RES in the final energy consumption in Poland by 2030. This is to be achieved through the construction of new power plants using RES at the rate shown in Table 4. As mentioned before, our study is mainly focused on the new intermittent RES; however, for the sake of clarity, other RES are also presented in the table. Onshore wind turbines will not exceed the total installed capacity of 10 GW due to legal restrictions [25], which is in line with the study of [26]. The dynamic development of offshore wind turbines begins in 2025 (this technology is perceived by the government as very prospective and receives strong support [27]). Dynamic development PV units are foreseen. The total electric capacity installed reaches more than 7 GW in 2030.

Forecast of Electricity Production
Future electricity production in the Polish power system was taken from EPP2040. The forecasted electricity production is shown in Table 5. According to this forecast, electricity production will amount to ca. 201 TWh in 2030. In our case study, we assumed that this amount of electricity will be generated with the use of domestic power plants and that the net electricity imports will be equal to zero. Data for 2018 are based on statistics [29], and data for 2020 are based on EPP2040 projection.
Additionally, we assumed that the hourly load profile in 2030 would have the same shape as in 2018 and it was just scaled-up according to the forecasted growth in annual electricity production. Figure 5 shows the pattern of power demand in 2030 in an hourly temporal resolution. Data for 2018 are based on statistics [29], and data for 2020 are based on EPP2040 projection.
Additionally, we assumed that the hourly load profile in 2030 would have the same shape as in 2018 and it was just scaled-up according to the forecasted growth in annual electricity production. Figure 5 shows the pattern of power demand in 2030 in an hourly temporal resolution.

Simulation Settings
Five scenarios named S1-S5 were built (Table 6). They were mainly differentiated by the level of electric capacity installed in dispatchable JWCD and RET, as well as by the level of the electricity demand. The two main options were 2018 and 2030, which refers to the situation in the respective years, as described in the previous sections. In the S1 scenario, the availability of some units was decreased, in line with the values reported by the Polish TSO (i.e., the maximum power output in some hours was reduced accordingly) [30]. This was not the case in the S2 scenario or in other scenarios, where no constraints on unit availability were imposed. The S4 scenario assumed that the dynamic development of the domestic natural gas market observed in the last decade will continue [31]. In this scenario, six new natural gas-fired 630 MW units were added on top of the ones described

Simulation Settings
Five scenarios named S1-S5 were built (Table 6). They were mainly differentiated by the level of electric capacity installed in dispatchable JWCD and RET, as well as by the level of the electricity demand. The two main options were 2018 and 2030, which refers to the situation in the respective years, as described in the previous sections. In the S1 scenario, the availability of some units was decreased, in line with the values reported by the Polish TSO (i.e., the maximum power output in some hours was reduced accordingly) [30]. This was not the case in the S2 scenario or in other scenarios, where no constraints on unit availability were imposed. The S4 scenario assumed that the dynamic development of the domestic natural gas market observed in the last decade will continue [31]. In this scenario, six new natural gas-fired 630 MW units were added on top of the ones described in Table 3. Finally, the S5 scenario had the closest assumptions to the ones described in EPP2040. Besides investments in natural gas, it also assumed that in 2030, there would be 2 GW more electric capacity available in the class HC "Other". The DSM option considered in our study is load shifting, which means that the demand decreased during some hours (at most 2 GW) and must be added to other hours during the day. Table 6. Specification of simulation runs including reference years for the main input parameters. S1  2018  2018  2018  0  No  S2  2018  2030  2030  0  No  S3  2030  2030  2030  0  No  S4  2030  2030  2030  6  No  S5 2030 + 2 GW HC 2030 2030 6 2 GW

No of New Gas Units DSM
All the simulations were run on the Windows 10 workstation with four Intel Core i7-8550U CPUs and 32 GB RAM. The branch-and-bound CPLEX algorithm with the relative gap (OPTCR) set as 1% was used to solve the MIP problem. The solving time for one scenario was approx. 90 m.

Results
The performance of the JWCD units for different scenarios is presented in Table 7. The general observation that the electricity generation from hard coal-fired units in 2030 stays at a similar level in all the scenarios (but S4), as in 2018, and is equal to approx. 60 TWh, can be made. The reason for this is that the decrease in electricity generation in existing "HC 200" and "HC 300" classes is offset in S3-S5 scenarios by generation in larger units belonging to the class "HC Other". The capacity share of this class increases from ca. 16% in 2018 to almost 30% in 2030. In the case of the lignite plants, the installed electric capacity and overall electricity production only slightly drops between 2018 and 2030. S4 is the most favorable scenario for natural gas units, both in terms of the installed capacity and Energies 2020, 13,1952 13 of 18 electricity generation. In this scenario, electricity production in natural gas-fired units rises from ca. 2.6 TWh in 2018 to 17 TWh.  Figure 6 depicts the electricity generation profile of different technologies in the first week of July in 2018 and 2030. One can see a significant increase in electricity produced by RET. This has an influence on the coal-fired units, whose operation becomes much more chunked in comparison to the situation in 2018. The increase and decrease in electricity generation, respectively, in the class of hard coal units "HC Other" and "HC 200", is also clearly visible. Natural gas units mainly operate in electricity peak demand periods. A gap (marked by the white area) between the electrical load and cumulative electricity generation is filled with output electricity from hydro pumped-storage plants. On the contrary, when the load line is below the cumulative production, the storage is being charged. Table 8 shows the values of selected indicators. These include the following: (i) Loss of Load (LoL), revealing, in our case, the number of hours per year in which the supply does not meet the demand; (ii) Energy Not Served (ENS), i.e., the amount of electricity demand that is not met by generation in a given year; (iii) the Renewable Energy Penetration Index (REPI), which is the average annual share of demand covered by wind and solar generation; (iv) Renewable energy generation Curtailment (RC), expressed as the sum of hours per year in which RES-based generation was reduced to avoid negative residual load; (v) Renewable Curtailed Energy (RCE) in GWh in a year; and finally, (vi) the number of JWCD start-ups. One can see that in the case of the S2 scenario, contrary to S3, there is no hour with a loss of load. A gap (marked by the white area) between the electrical load and cumulative electricity generation is filled with output electricity from hydro pumped-storage plants. On the contrary, when the load line is below the cumulative production, the storage is being charged. Table 8 shows the values of selected indicators. These include the following: (i) Loss of Load (LoL), revealing, in our case, the number of hours per year in which the supply does not meet the demand; (ii) Energy Not Served (ENS), i.e., the amount of electricity demand that is not met by generation in a given year; (iii) the Renewable Energy Penetration Index (REPI), which is the average annual share of demand covered by wind and solar generation; (iv) Renewable energy generation Curtailment (RC), expressed as the sum of hours per year in which RES-based generation was reduced to avoid negative residual load; (v) Renewable Curtailed Energy (RCE) in GWh in a year; and finally, (vi) the number of JWCD start-ups. One can see that in the case of the S2 scenario, contrary to S3, there is no hour with a loss of load. Both scenarios referred to 2030, but S2 assumed that the same units that existed in 2018 would be in full operation in 2030. On the other hand, the S3 scenario assumed deep decommissioning of the "HC 200" generators class. As a consequence, in this case, there are 383 h with a loss of load. If the S2 scenario was run with a limited availability, as in S1, then the generation capacity would not have been sufficient to avoid power shortages (there are 218 h with lost load in such a case). This also shows that the existing units that would be mainly left for providing the back-up capacity need to maintain a high availability. The risk of loss of load with deep decommissioning can be avoided by adding new generating capacities, as in the S4 scenario, in which a total of 3780 MW of natural gas units was added. Finally, the S5 scenario has the highest electric capacity installed in controllable units in 2030. Consequently, the capacity factors in all the generator classes are the lowest of all the scenarios. Considering solar and wind technologies, the REPI index amounts to 19.8% in 2030. From all RET, the highest production in 2030, equal to ca. 20 TWh, comes from the onshore wind. This is followed by offshore wind and photovoltaics, which generate 13.2 and 6.4 TWh, respectively.
The evaluation of the economic performance of generation units was made using a simplified approach with two income streams, i.e., from electricity and capacity markets. In the case of the electricity market, the revenue of the JWCD unit i in the hour t was calculated by multiplying its electricity output by the electricity price.
Electricity prices were set based on the merit order approach using expression (6): In the case of the units for which operation costs were above the established electricity price (meaning that, e.g., they were forced to operate with the minimum power and could not be shut-down as they were needed to balance the electrical load in the following hours), the income was set to be equal to their operation costs.
The incomes from the capacity market were calculated for all JWCD units and for all scenarios based on the results of auctions for 2021, in which the average revenue was equal to ca. 240 kPLN/MW/year [32]. It should be noted, however, that a majority of the existing coal units will only be able to use the support from the capacity market until 2025 due to the "winter package" regulation [13]. This regulation stipulates that only generation units with a CO 2 emission standard lower than 550 g/kWh can obtain such support (meaning that classical coal-fired units, which have much higher emissions, will be excluded). Table 9 summarizes the calculated cost components and revenues from electricity and capacity markets.

Discussion
The measures assumed in the S2 scenario aimed at the extension of the decommissioning period for coal-fired units of classes "HC 200" and "HC 300" until 2030 are not sufficient to avoid the risk of power shortages in 2030. The results show, however, that such an extension, which is technically possible, would contribute to maintaining the necessary back-up capacities for contingency situations and to increasing the security of the electricity supply. These units would have to maintain a high availability, which is only possible when having adequate revenues for necessary modernizations and maintenance. Without the incomes from the capacity market, JWCD units generate a negative net income. The results of the S3 scenario showed that the deep decommissioning of hard coal-fired units significantly increases the risk of system instability (there are 383 h with load lost). Therefore, a more rational option is the one proposed in EPP2040 and the S5 scenario, where the total installed capacity of the hard coal-fired units in 2030 is ca. 2 GW higher than in the S3 scenario.
Balancing of the increased electricity demand in 2030 would not be possible without increasing the electric capacities in renewable energy technologies. Our study showed that the RES capacities adopted in EPP2040 for 2030 should be considered as feasible from a system balancing point of view.
Energies 2020, 13, 1952 16 of 18 The dynamic development of RET results in a significant supply of electricity with a variable availability. A good match can be observed between the electricity demand and generation in photovoltaics in the temporal profile. In fact, PV-based production flattens the residual load in the middle of the day and in the afternoon (e.g., Figure 6). The planned PV capacities are too low to change the profile of the residual load curve into a "duck" shape, causing steep ramping in the evening. Although the electric capacity of wind onshore in 2030 is 2.5 times greater than that offshore, electricity generation is only 1.5 times greater. This is because the capacity factor of wind turbines located offshore is grater and the production profile is more stable due to more constant wind. Finally, on the supply side, investments in new natural gas-fired units are necessary. The results obtained in this study for the S4 scenario indicate that at least ca. 4 GW of electric capacity should be built by 2030 on the top of ca. 2 GW existing in 2020. This number is in line with the one provided in EPP2040. The S4 scenario also indicates the change in the nature of the operation of hard coal units of classes "HC 200" and "HC 300" from the electricity supply to capacity provision, which is characterized by shorter operating times and lower annual electricity production. The study has shown that the introduction of DSM programs can have a very positive impact on reducing the number of hours with lost load.
The overall result of the study is that the safest solution from the point of view of power system stability is to extend the decommissioning process of coal units of classes "HC 200" and "HC 300" (this requires the financial mechanism on the top of electricity-only market to generate net income), to invest in renewable energy sources according to EPP2040, to build new gas power plants with the total capacity of ca. 4 GW, and to enforce DSM programs for shifting the electrical load. This result is consistent with the development plan presented in the Polish Energy Policy.

Conclusions
This paper describes the Model of Economic Dispatch and Unit commitment for System Analysis (MEDUSA). MEDUSA optimizes the operation of controllable power generation units under real technical constraints using an hourly temporal resolution. The objective function, which is minimized by the model, consists of the unit operation, start-up and shut-down costs, and the costs of Demand Side Management and load shedding. The applicability of the model was illustrated for the Polish power system. MEDUSA was intended to verify the results of capacity expansion planning with respect to the response of the power system to intermittent RES supplies. At first, in order to validate the model, its results were compared against the real operation data for 2018. A high positive correlation between the modeled and observed data was observed. Next, five scenarios were built to analyse the operation of the system in 2030 with the focus on coal-fired units and their role in 2030-when a significant supply of electricity from renewable energy sources is foreseen.
In general, balancing of the increased electricity demand in 2030 would not be possible without increasing electric capacities in renewable energy technologies. The nature of the operation of hard coal units of classes of 200 and 300 MW will be changed from electricity supply to capacity provision. The decrease in the electricity production in these units will be offset by generation in larger hard coal units recently commissioned or under construction. In the case of lignite plants, the installed electric capacity and overall electricity production will only slightly drop between 2018 and 2030. The total electric capacity in natural gas units will increase to ca. 6 GW in 2030 from the current value of 1.1 GW. The study has shown that the introduction of DSM programs can have a very positive impact on reducing the number of hours with lost load. The results of the scenarios were compared with the development plan presented for 2030 in the Polish Energy Policy. The main conclusion that can be drawn is that this development plan can be considered reasonable and consistent with the results obtained in our work.
One of the limitations of this study is that the future load profile was achieved through a simple scaling process based on the 2018 data. In our future work, possible changes in the load profile will be considered (the peak demand in 2030 could move from winter to the summertime due to the wider use of air conditioning). In relation to this, more attention will be given to the role of Demand Side Management and energy storage. The environmental aspects will also be addressed, including emissions of greenhouse gases and air pollutants. The model will be run for various historical meteorological data and with a higher temporal resolution. Finally, the electricity prices in this study were calculated using a simplified approach. We plan to improve the price calculation algorithm to better reflect scarcity situations and resulting price escalations. In the longer term, the impact of electricity exchange on the European market will be analysed.

Conflicts of Interest:
The authors declare no conflict of interest.