Emmanuel Rollinde
email: emmanuel.rollinde@cyu.fr

R M Ros

B Garcia

S Gullberg

J Moldon

Modeling astronomy education, the case of F-HOU tools : SalsaJ and Human Orrery

Keywords: methods: data analysis, solar system: general, astronomy education

This communication introduces two cases of the use of astronomy as a motivating context to interdisciplinary science education with emphasis on modeling activities. Firstly, a dedicated software, called SalsaJ, allows students to reproduce the same data analysis as made by astronomers.

The case of exoplanet detection will be used as an exemple. Secondly, bodies of learners are considered to model movements of planets with a Human Orrery (a Spatio-Temporal Map of the Solar System), connecting thus mathematics, physics, geography and arts.

INTRODUCTION

The association F-HOU is part of a worldwide project, Global Hands-On Universe [13],

that aims to promote a method of learning sciences through astronomy. We are a community of science teachers, astronomy researchers and science education researchers, whose main goal is to provide science and mathematics teachers from middle school to high school with interactive and collaborative tools (software, instruments, methodology, documents shared on the Internet). Based on an investigative pedagogy that emphasizes observation, the global objective is to develop students' curiosity, to maintain their taste for science and technology, and to lead them to argue and reason [START_REF] Rollinde | Futures of Education -GHOU 2020[END_REF]. This approach requires interaction between physical sciences and mathematics, and can also be easily integrated into multidisciplinary teaching (combining literature, philosophy, technology, language teaching and sports).

MODELING ACTIVITIES AND ASTRONOMY

Our pedagogical approach is based on the principle of modeling and the resulting link between mathematics and physical sciences [START_REF] Helding | Modeling Students' Mathematical Modeling Competencies[END_REF][START_REF] Hestenes | Proceedings of the 2006 GIREP conference: Modeling in physics and physics education[END_REF]. To address and reflect on a problem, an expert or student will use two registers as described in [11] and [10], see Fig. 1 (right): the empirical register which consists of objects, phenomena and actions on objects and phenomena; the theoretical register which corresponds to an abstraction applicable to any real object. As for students, the theoretical register corresponds to a set of statements that the student holds to be true and that allow him or her to make sense of the real. A model can then be considered as a link between these two registers. Modeling activities make students work from one register to another, or within one register. Modeling in the context of mathematics education makes a specific emphasis on horizontal and vertical mathematization [1,[START_REF] Yvain-Prébiski | Proceedings of the CIEAEM conference[END_REF]. The first is the transformation of the real model into a mathematical model, which requires to choose a set of physical parameters. The second is the obtaining of a mathematical result that can be later on translated into real results, or a description of the real situation.

FIG. 1. Two illustrations of modeling process. left: the modeling cycle presented in [1]. right: the theory of the two worlds presented in [10]. See main text for application to astronomy in education.

Astronomy provides teachers and students with real situations that are very specific.

First, the real situation in astronomy is a 'single case' situation, meaning that one cannot modify the observed celestial objects, or move around to see them from different point of view. In most cases (at least in the educational context), few objects will be observed to infer general laws. This was the case for Kepler and Newton who had to infer classical mechanics relations and laws from the observation of one single Solar System. This is less the case today with the era of big data even in astronomy. Second, real situation is observed through the light send or reflected by the objects. Hence, the situation given to the learner is already a model of the real situation provided by either an image or a spectrum. Making sense of this modeled situation is not straightforward and imposes the use of modeling cycle. Based on astronomy, and compared to 'everyday-situations' [START_REF] Yvain-Prébiski | Proceedings of the CIEAEM conference[END_REF] students' activities will enhance two aspects of modelisation: inferring the right model that should relate best to the real situation; choosing physical parameters that can be measured in the modeled situation (the image) and that can later on make sense of the real situation (after the two mathematizations).

MODELING ACTIVITIES WITH DATA ANALYSIS

To make data manipulation and measurement feasible in the class, a specific software, SalsaJ, has been developed in Java [2,6]. Its acronym stands for "Such A Lovely Software for Astronomy in Java". Downloaded free of charge from the project site, it works on all platforms and can be used in different European languages as well as in Arabic and Chinese.

The pedagogical sequence we present here is based on the detection of an exoplanet through its transit in front of its host star. The students have at their disposal a time series of images (Fig. 2, left) which accounts for their empirical register. The objective is to find clues revealing the presence of a planet in orbit around a star. A first modeled situation of a star and an exoplanet must be derived through the understanding that the light received by the observer (empirical register) is emitted by point stars (theoretical register). The learner must then use this model for predicting that the planet blocks part of the light when it is located between the observer and the star (theoretical register). Through this first cognitive task that connects two registers, the photometry emerges as a good candidate to use the model for making sense of the observed images and to make measures. Once the students proceed and make the measure using the tools provided by the software, they end up with a mathematical representation of the evolution of the luminosity of three different stars with time (Fig. 2, right) that may be compared to the prediction. The mathematical resolution consists in a statistical analysis of the significance of the departure from a constant luminosity for one of the series of data (or one of the star). The modeling cycle ends by connecting the amplitude of the observed decrease to the ratio of the surface of the star versus that of the planet. A "human Orrery" (Fig. 3) allows the learners to enact the planets' movement with correct relative speed. An Orrery is a mechanical or digital device designed to model the motion of the planets around the Sun and their changing positions in the sky. On a human Orrery, the orbits of planets and comets are drawn at a human scale allowing movements in the Solar System to be enacted by the learners [START_REF] Rollinde | [END_REF]7]. We give here one example of how this tool may be used to help students learn practice modelisation [START_REF] Rollinde | [END_REF]. All grade 10 students of a French high school were involved in two successive teachinglearning sessions. The learning material consisted of two versions of the Human Orrery.

One was an A4 model used individually on a table, with reference frames and trajectories drawn on a translucid paper; the other was a Human size version, with reference frames and celestial bodies enacted by students' bodies. Students enacted movements with their fingers and with their bodies respectively. Activities illustrated the movements of Earth, Mars, and Sun during 24 hours and one year, observed from different reference frames (terrestrial, geocentric or heliocentric). Students had to use the model for predicting trajectories in each referential frame. To do so, they enacted the trajectories, observed them, and discussed whether length and speed of the planets were different when observed in each referential frame. By doing so, they also proceeded through the modeling cycle, had to make predictions and test them. Hence, the model of the Human Orrery helps to make sense of what happens to a trajectory during a change of referential frame.

CONCLUSION

This communication intends to motivate and enhance the explicit reference and use of modeling activities in the field of astronomy education. The set up and evaluation of such activities requires to combine expertises from professional astronomers, didactics researchers (in mathematics and science) and teachers. In January 2021, a francophone conference [START_REF] Astroedu-Fr | [END_REF] has gathered 200 people coming from those three communities. We are confident that the international effort led by UAI on astronomy education will be fruitful in the set up of this community.

FIG. 2 .

 2 FIG. 2. Modeling activities on the detection of an exoplanet. The real problem is provided by a series of image of the same field taken at regular time interval (left). The model used is that of a star and an exoplanet orbiting around it. The mathematical prediction of the model is a graph showing the evolution with time of the luminosity of different stars in the field (right).

  FIG. 3. Modeling activities on the Solar System. Students enact the movements of planets and comets around the Sun on a 2D representation of the orbits, a so called Human Orrery. Left: Students enact and observe movements as seen from different referential frames. Right: Primary school children in front of the Human Orrery they have build in their courtyard.


Marcelo M Resende

Ana Sofia

V D Aranha

Rafael Kelman

Mário Pereira

Rafael Garaffa

Mário Pereira

Mario V F Pereira

Ana S V D Aranha

Mario V F Pereira

An Integrated Planning Framework for the Peruvian Energy Sector

Keywords: Energy Planning, Energy Modelling, Peru, SDDP, OPTGEN, OPTNET, TIMES, Computable General Equilibrium, Demand Forecast, Soft-Linking

établissements d'enseignement et de recherche français ou étrangers, des laboratoires publics ou privés.

Introduction

As the energy sector worldwide shifts towards renewable and innovative technologies, the need for computer algorithms capable of adapting to a complex and constantly changing reality arises. Sector coupling is becoming a buzzword in the field, as the links between the power sector, the fuel supply chain and demand side management intensify [START_REF] Mancarella | Mes (multi-energy systems): An overview of concepts and evaluation models[END_REF]. Energy models must evolve accordingly, treating energy industries (that is, production and transportation of oil, gas, electricity and other primary and secondary resources), demand segments (such as mobility, industrial processes and heat), the environment and the economy as integrated systems. Despite the need for this holistic view, the level of detail should not be compromised, since smaller time steps, higher geographical resolutions and longer horizons are critical to proper planning of modern energy systems [START_REF] Pfenninger | Energy systems modeling for twenty-first century energy challenges[END_REF].

Integrated frameworks for energy planning have been extensively discussed in the literature on energy-economy interactions [START_REF] Lakshmanan | Integrated models for economic-energy-environmental impact analysis[END_REF]. The first Energy Modelling Forum (EMF) [START_REF] Forum | Energy and the economy[END_REF], in 1977, identified that understanding short-and long-run relationships between both fields was crucial for researchers and modelling teams, since the services provided by the energy sector are transversal to the economy 1 . From then on, two main approaches have been used to address integrated modeling of energy and economic systems: the hard-link approach, in which a single model covers all the aspects being studied; and the soft-link approach, in which different specialized models and tools are used, each one aiming to solve a specific problem, and are coherently integrated [START_REF] Riekkola | Challenges in Soft-Linking: The Case of EMEC and TIMES-Sweden[END_REF].

Hard-links require simplifications in order to be computationally tractable, given the great number of variables and equations. Although rich technological representation can be described in macroeconomic models, most approaches rely on a top-down view of the energy sector, focusing on market and economy-wide feedbacks and interactions. Typically, these models have exogenous variables for the energy sector, such as energy prices or production function parameters, facing some limitations to interpret investment needs and technological deployment for energy planning purposes [START_REF] Ghersi | Macroeconomic consistency issues in e3 modeling: the continued fable of the elephant and the rabbit[END_REF][START_REF] Bauer | Linking energy system and macroeconomic growth models[END_REF].

In contrast, soft-links allow a more detailed representation of the reality, particularly regarding technological representation at sectoral and regional levels. Because each model has a specific scope, soft-links require strong attention of the modeller on identifying what information to link and how to link it across the models in order to achieve coherent results [START_REF] Riekkola | Challenges in Soft-Linking: The Case of EMEC and TIMES-Sweden[END_REF]. The interaction between energy and the economy is often represented through partial exchange of information in an iterative process, that stops once convergence criteria for common parameters are reached across models. Soft-links are vastly applied in the literature when integrating economic models with energy models [START_REF] Riekkola | Challenges in Soft-Linking: The Case of EMEC and TIMES-Sweden[END_REF][START_REF] Andersen | Bridging the gap using energy services: Demonstrating a novel framework for soft linking top-down and bottom-up models[END_REF][START_REF] Böhringer | Integrated assessment of energy policies: Decomposing top-down and bottomup[END_REF].

A natural step is to extend the concept of soft-linking to the integration of more general models, instead on focusing only in energy-economy interactions. In this paper, we present a soft-link energy planning framework composed of: a demand forecast model, explained in section 2.1; a model made using IEA's TIMES system [START_REF] Loulou | Documentation for the TIMES model[END_REF], for least-cost optimization of supply and demand of petroleum, natural gas and other energy commodities (section 2.2); OPTGEN [START_REF] Psr | Optgen -model for generation expansion planning and regional interconnections[END_REF], SDDP [START_REF] Psr | Sddp stochastic hydrothermal dispatch with network restrictions[END_REF] and OPTNET [START_REF] Psr | Netplan model for transmission expansion planning[END_REF] models developed by PSR to optimize power sector's generation expansion, operation, and transmission expansion, respectively, discussed in section 2.3; and a Computable General Equilibrium (CGE) model for the economy (section 2.4). Our goal in this paper is to provide, in a transparent way, an overview of the soft-linking procedure used to build an energy planning framework, at national scale.

By using this soft-link approach, we were able to unify specialized software and methodologies that are widely used in research and commercial applications into a single framework, while preserving the complexity and flexibility of each model. When applying this framework to the Peruvian energy system, detailed power sector models allowed us to represent the 118 Peruvian power plants, 187 transmission lines, and over 200 network nodes, as well as individual projects for generation and transmission expansion. The problem formulation of TIMES included more than 50 thousand variables and 400 thousand constraints. Moreover, the demand forecast model provided 127 demand series that can be further broken down (sectorally or regionally) according to information availability and user requirements.

This energy planning framework was developed as part of a project for the Peruvian Ministry of Energy and Mines (MEM), funded by the Inter-American Development Bank (IDB). The project was carried out by the consortium formed by PSR and Mercados Energéticos, with strong collaboration from MEM team. Brazilian academic institutions COPPE/UFRJ and IBRE/FGV assisted in the design of the Peruvian TIMES model and the CGE model, respectively. The project also included the design and deployment of a national web-based energy information system available to relevant actors of the energy sector, to be managed by MEM. These tools were used in the elaboration of the 2040 National Energy Plan to address critical questions, such as the energy infrastructure evolution over the next years to ensure an economic and secure supply of oil, gas and electricity, investment requirements, and as a framework to evaluate the impact of different energy policies. Specific questions were also investigated, such as: are policies targeting an increase of renewable energy needed or will they happen anyway for economic reasons? And if they are implemented to anticipate the penetration of renewable energy that would happen anyway given the cost decrease of the technologies, what will be the corresponding cost? How much oil needs to be imported for supplying 1 Hogan and Manne [START_REF] Hogan | Energy-economy interactions: the fable of the elephant and the rabbit? working emf no. 1.3, energy modeling forum[END_REF] have metaphorically compared the interaction between energy and economy with the taste of a stew containing one elephant and one rabbit -it would still taste like an elephant stew -since the energy sector has a relatively small weight in most economies' GDP, a fable that is still part of the literature of model integration [START_REF] Ghersi | Macroeconomic consistency issues in e3 modeling: the continued fable of the elephant and the rabbit[END_REF].

local refineries, considering the domestic production? How will CO 2 emissions evolve in the next years? The main assumptions and results used are presented and discussed in section 3. Section 4 concludes with additional sensitivities that were done for the National Energy Plan.

2 Methodology: a soft-linked energy planning framework This section presents each constituent model / tool of the energy planning framework. We emphasize that each model may be run on a standalone basis. Even so, this section describes how the models were integrated to ensure consistency between their reults. Figure 1 shows the framework. Initially, econometric techniques are used to forecast demand for energy services -an input to supply side models. OPTGEN determines the optimal electric generation expansion, OPTNET then determines the necessary transmission network expansion to accommodate the new power plants and SDDP determines the least cost operation of the power system of a given supply x demand configuration. Then, the TIMES model optimizes the expansion and operation of the remaining energy sectors, aiming to satisfy the energy service demands in industrial, transportation, residential and commercial sectors, besides fuel consumption of thermal power plants (their dispatch decisions, already made by SDDP, are translated into fuel consumption in processes in TIMES). Finally, a CGE model of the Peruvian economy is used to update the energy demands inputted in TIMES, in an iterative process that models the impacts of the energy sector to the economy and vice versa.

Demand Forecast Model

Uncertainty about the future makes demand forecasting a key element in the development of energy planning strategies. In this context, energy demand projections should assist decision-making to ensure that the system expands and operates efficiently, according to market quality and reliability requirements.

The demand model developed for projection and analysis of Peru's energy consumption is divided into three main classes, with the objective of capturing key aspects of each consumer sector: buildings (residential, public, commercial and services sectors), productive activities (agriculture, mining, fishery and manufacturing) and transportation (aerial, naval, rail and road). Econometric models were used for the projection of energy consumption of the first two classes, in addition to a bottom-up approach for the transport sector.

Buildings and Productive Sectors

In econometric models, a mathematical model relating explanatory to dependent variables is built and parameters are estimated from historical data. The estimated model summarizes the dynamic patterns of the data, giving a statistical characterization of the links between the present and the past. In our demand forecast model, econometric techniques are used to forecast the long term energy demand by sector (residential, commercial, public, manufacturing, fishery, agricultural and mining), region (North, Center, South and East, as detailed in section 2.2) and type (fuel or energy service).

More precisely, for residential, commercial and public sectors, consumption is projected by fuel (coal, diesel, electricity, natural gas, gasoline, liquefied petroleum gas (LPG), firewood and jet fuel). For agriculture, manufacturing, mining and fishery, demand is projected for each energy service (driving force and process heat), in addition to the demand for electricity that is evaluated separately, for each sub sector.

Forecasting the demand of energy services, instead of directly forecasting fuel consumption, as we do for productive sectors, enables TIMES model to decide the optimum mix of fuels to meet that specific demand, as explained in section 2.2. Although this criterion has an economic logic, it has some limitations in the case of residential and commercial sectors: very high cost of the equipment that makes the replacement unfeasible due to the low financial capacity of the household or merchant, lack of information, personal customs, etc. Consequently, in this work, the energy efficiency analysis in the residential and commercial sector was not carried out on the basis of an economic decision-making model. Instead, demand forecasts by fuel were used, allowing the simulation of energy efficiency and fuel substitution policies based on realistic expectations for these sectors.

The demand model assumes a causal forecasting approach, which establishes a historical relationship between the dependent variable (energy demand) and relevant independent variables. The explanatory variables are chosen for each sector from a pre-specified set of candidates, based on their predictive power and statistical significance. In this study, this set included national GDP, sectoral GDP and population. A model was developed to decide for the variables as well as the structure of the econometric model to be adopted, that is, if it uses a linear regression model, a vector autoregressive model (VAR) [START_REF] Engle | Co-integration and error correction: Representation, estimation, and testing[END_REF] or a vector error correction model (VEC) [START_REF] Hatemi-J | Multivariate tests for autocorrelation in the stable and unstable var models[END_REF][START_REF] Asteriou | Applied Econometrics, ch. Vector Autoregressive (VAR) Models and Causality Tests[END_REF], according to several hypothesis tests and statistical significance.

Tests were performed to detect nonstationarity (Augmented Dickey Fuller test), heteroscedasticity effects (ARCH test), cointegration between variables (Johansen test), collinearity (correlation matrix analysis) and residual independence (Ljung-Box/Portmanteu test) [START_REF] Granger | Spurious regressions in econometrics[END_REF][START_REF] Stock | Introduction to Econometrics[END_REF]. Once nonstationarity, heteroscedasticity and correlated variables are discarded, the indication of cointegration leads to the use of a VEC model, as well as non cointegration indicates that linear regression or VAR models should be employed. The Akaike criterion (AIC) [START_REF] Stock | Introduction to Econometrics[END_REF] is used to choose between formulations, since it points out to the model with lower variance, penalizing by the number of explanatory variables. Finally, the residual analysis of the chosen model needs to ensure that the error components behave like white noise, in order to avoid spurious regressions and ensure coherent projections.

Transport Sector

A bottom-up model is used to capture the complexity of the transport system. At first, primary parameters are estimated through a regressive model for aerial, naval, road and rail transportation. Table 1 specifies, for each transport subcategory, the primary parameters and the final demand variable projected, that is used as an input for TIMES. Once the primary projections have been obtained, the final energy consumption for categories air and naval is calculated assuming it follows the same growth rate of its primary variable. On the other hand, the primary variables for categories road and rail are converted to passenger-kilometer (pkm) or tonne-kilometer (tkm), for passengers and cargo transportation respectively, using historical factors taken from the Peruvian useful energy balance [START_REF] De Minas E Energía | Balance nacional de energía útil 2013[END_REF]. Similar to the productive sectors, this forecasting methodology allows TIMES to decide the optimal mix of fuels to meet the demand for each transport type, based on an economic analysis. It is worth mentioning that consumption forecasts for road transportation subcategories are made for each mode (cars, motorcycles, buses, vans, trucks, etc.).

PERU-TIMES

The TIMES model (The Integrated MARKAL-EFOM System) was developed as part of the IEA-ETSAP Energy Technology Systems Analysis Program [START_REF] Loulou | Documentation for the TIMES model[END_REF]. The model has been extensively used in the literature for describing bottom-up representations of the energy systems at country [START_REF] Shi | Modelling buildings decarbonization with application of china times model[END_REF][START_REF] Selosse | Achieving negative emissions with beccs (bioenergy with carbon capture and storage) in the power sector: New insights from the tiam-fr (times integrated assessment model france) model[END_REF][START_REF] Simões | Cost of energy and environmental policy in portuguese co2 abatementscenario analysis to 2020[END_REF], regional [START_REF] Beltrán-Jiménez | Associated natural gas flare in the integrated market of the southern cone[END_REF][START_REF] Chávez-Rodríguez | The role of lng and unconventional gas in the future natural gas markets of argentina and chile[END_REF][START_REF] Simoes | The jrc-eu-times model[END_REF], and global levels [START_REF] Bouckaert | A prospective analysis of waste heat management at power plants and water conservation issues using a global times model[END_REF][START_REF] Gracceva | Exploring the uncertainty around potential shale gas development-a global energy system analysis based on tiam (times integrated assessment model)[END_REF][START_REF] Babonneau | Energy security: a robust optimization approach to design a robust european energy supply via tiam-world[END_REF]. The integration with CGE models has also been explored in the literature [START_REF] Krook-Riekkola | Challenges in top-down and bottom-up soft-linking: Lessons from linking a swedish energy system model with a cge model[END_REF][START_REF] Schäfer | Experiments with a hybrid cge-markal model[END_REF], ensuring economic consistency of the results of energy sector partial equilibrium models.

In TIMES, each technology is represented by a process, which is a "black box" with inputs and outputs, called commodities. The relationship between inputs and outputs is expressed by linear (in)equations. The energy system is built as a chain of processes. Each process produces commodities that will be consumed by other processes or, in the end, by a demand. For example, the gas chain includes its extraction, processing, transport, local distribution and final consumption.

Each of the processes has its own technical parameters, which were calibrated according to Peruvian energy balances and other available information. The entire technological structure of energy supply and demand is represented and complemented by a series of technical (capacities, efficiencies, etc.) and non-technical constraints (political decisions to cap greenhouse gas emissions or to promote electrification of transportation, for example). Taking the topology and system constraints as data, the model optimizes the energy system configuration to satisfy the energy demands provided by the econometric demand model, seeking for the lowest total cost solution (sum of operating and investment costs in the system), discounted at present value, during the analyzed time horizon.

The model allows for virtually any topology and any linear constraint, eventually including binary variables regarding process investment decisions. This makes it very flexible and adaptable to new regulations and technology innovations. The main results of the TIMES model are the following:

-Optimal capacity expansion for each technology; -Investment costs required in the deployment of energy infrastructure; -Energy flows (in and out) for each process; -Optimal operation cost of the energy system; -Imports and exports of each commodity; and -Emissions of greenhouse gases (GHG).

The following subsections focus on the modeling adopted in this study for the main sectors of the Peruvian energy system (PERU-TIMES model). Four Peruvian regions are explicitly represented in the model (Center, South, North and East 2 ). Transfers of given commodities between regions are also represented by trade processes in PERU-TIMES.

Oil Upstream and Downstream

In the upstream, three types of crude oil are considered in modelling, according to API gravity: light, medium and heavy. For each kind of oil, five extraction processes were built, each corresponding to a reserve level based on the SPE classification (proved developed, proved undeveloped, probable, possible and contingent resources) [START_REF]Guidelines for the Evaluation of Petroleum Reserves and Resources[END_REF].

Uncertainties on how oil and gas reserves evolve over time add complexity to the modelling. Multiple factors can influence the classification of reserves: prices, regulation, socio-environmental constraints, investment decisions, etc. The model does not represent such dynamics -i.e., through exploration of undiscovered resources or a growth mechanism based on contingent resources. The EUR (Estimated Ultimate Recovery) 3 is static and the base year classification of reserves is assumed to remain constant over time. In the solution space, the model opts first to use the cheaper reserves (proved developed reserves), before reaching other levels (proved undeveloped reserves, probable reserves, and so on) [START_REF] Chavez-Rodriguez | Analysis of past and future oil production in peru under a hubbert approach[END_REF].

In the downstream, light, medium and heavy oil are either exported or blended in the proportions allowed by refineries technology. Each of the six Peruvian refineries (Pampilla, Talara, Conchán, Iquitos, Pucallpa and El Milagro) is modelled as an individual process that uses crude oil in order to produce diesel, gasoline, fuel oil, jet fuel and LPG. Each oil product has a share in the total refinery output, that can be optimized by the model, within a specified range. As most diesel produced by local refineries does not meet sulfur content standards imposed by regulations in some departments, the model treats low sulfur and high sulfur diesel as different commodities.

2 List of Peruvian departments in each region: (i) Center: Lima -Callao, Junn, Pasco and Huánuco; (ii) South: Ica, Arequipa, Moquegua, Tacna, Huancavelica, Apurmac, Ayacucho, Cuzco, Puno and Madre de Dios; (iii) North: Tumbes, Piura, Lambayeque, La Libertad, Ancash, Cajamarca and Amazonas; (iv) East: Loreto, Ucayali and San Martín. 3 EUR is an estimate of the expected ultimate recovery of oil or gas from a producing well [START_REF] Cook | Calculation of estimated ultimate recovery for wells in continuous-type oil and gas accumulations of the uinta-piceance province[END_REF]. Oil products may also be imported or exported (domestically, between regions, or internationally). Moreover, processes representing diesel and gasoline blending with biofuels (biodiesel and ethanol, respectively) are considered in PERU-TIMES, as they are obligatory according to existing regulation. At last, other processes represent the distribution of these fuels to final consumers.

Natural Gas Upstream and Downstream

Upstream natural gas is also modelled using the SPE reserve classification (proved developed, proved undeveloped, probable, possible and contingent resources), as in the case of oil. For associated gas reserves, mainly located in the North region, gas production is proportional to oil extraction, according to a factor estimated from historical production.

In downstream, wet gas extracted from wells is separated in processing plants into its gaseous component (dry gas) and natural gas liquids (NGL). The Peruvian gas processing plants are Malvinas, Curimaná, Pariñas and the plant operated by Graña y Montero Petrolera S.A. In PERU-TIMES, each of these plants is represented as an individual process, with given capacity and production cost. Dry gas flows through gas pipelines to be delivered to final consumers. However, a share of the production is flared, vented or reinjected. The main Peruvian pipeline is TGP, which carries gas from Camisea gas fields in the Amazon Basin to the departments of Lima and Ica, in the Coast. One of the ramifications of TGP goes to Pampa Melchorita liquefaction plant, which produces liquified natural gas (LNG). Most of the LNG produced in Pampa Melchorita is exported, but a small part is transported by trucks for distribution to final consumers in the North and South regions. Natural gas distribution processes to end-use technologies are also represented in the PERU-TIMES model, such as the ones for oil products (Figure 4).

Natural gas liquids (NGL) share in total production is given exogenously to consider its expected decrease over time. NGL sells are a key component of the cash flow generated by gas wells in Peru. NGL are then transported to fractionation plants for production of final products, such as LPG, gasoline and diesel. There are three fractionation plants in Peru: Pisco, Yarinacocha and one operated by Graña y Montero Petrolera S.A. Usually, gasoline and diesel produced in Pisco fractionation plant do not satisfy local consumer specifications and so they are mostly exported abroad.

Other Commodities: Coal, Biomass and Biofuels

Coal is represented by three processes: imports, exports and domestic production. For domestic production, only proven reserves were considered, and extraction and investment costs were estimated. Most of ethanol and biodiesel used for blending with fossil fuels are imported, but domestic production processes were also modeled. A process representing uranium mining was created, but nuclear power plants do not exist in Peru and were not represented in the model. Production of firewood, charcoal (having wood as an input) and sugarcane for power generation and for domestic ethanol production are also represented by individual processes in PERU-TIMES.

End-use Technologies

In general, end-use technologies are represented by processes that convert an energy commodity (oil products, natural gas, coal, etc.) into an energy service (useful energy), such as heating, lighting, or cooling. The demands for energy services are inputs to PERU-TIMES, and are calculated by the econometric demand model (section 2.1) for buildings, productive sectors and transportation. The approach for buildings is straightforward, since the econometric demand model already calculates demand for energy services for each fuel, in petajoules (PJ), and TIMES does not have to decide which fuel to use to satisfy demand (Figure 2).

For productive sectors (manufacture, mining, agriculture and fishery), demands for energy services (heating and driving force) are inputted to the model. Different end-use technologies (processes) may be used for satisfying the same energy service demand, each one corresponding to a specific fuel and with certain efficiency and costs parameters. According to these parameters and subject to other constraints, PERU-TIMES chooses how much of each fuel should be used in order to minimize the objective function. Electricity consumption (either for heating, driving force or other uses) for each industry sector is treated independently by the demand econometric model, since this is also used for power system planning (section 2.3).

PERU-TIMES may also choose the mix of fuels in order to satisfy transport demands (Figure 2), such as in industry sector. However, these demands are given by the performance of freight transportation in tonne-kilometer (tkm) or the performance of passenger transportation in passenger-km (pkm), which, in turn, is divided into public and private transport. For this reason, each end-use process has, besides an efficiency parameter (in PJ/km), an average occupation factor (in passenger or tonne per vehicle), which allows for the conversion between fuel consumption and demands (in pkm or tkm). The average vehicle use (average annual mileage) is an additional parameter that allows for estimating the number of vehicles using each fuel. This kind of modelling is used for road and railway transport, but for navigation and air transport, final energy demands (in PJ) are inputted directly into the model.

All these end-use processes, as well as power generation processes (see section 2.3), have a factor that relates fuel consumption to GHG emissions. This factor is expressed in tonnes of GHG emitted by PJ of fuel burned, so PERU-TIMES automatically does the emissions accounting. Three greenhouse gases were considered: CO 2 , CH 4 and N 2 O.

Power Sector Models

In PERU-TIMES, there is one process for each of the eleven power generation technology considered: solar, wind, biofuels, geothermal, hydro, coal, diesel, fuel oil, open cycle natural gas and closed cycle natural gas. The model can be run in stand-alone mode, deciding how much electricity each technology will generate and how to expand the power sector. The main drivers the model will consider for these decisions are investment and operating costs. However, as fuel costs for hydro and renewable are virtually zero -power plants do not have to pay for water, sun or wind used for generation -PERU-TIMES will usually favor these technologies. In addition, PERU-TIMES does not consider hydrology and hydrology uncertainty (that is, the possibility to save water in wet periods to reduce electricity prices in dry ones), renewable annual and intraday seasonality and power grid constraintsalthough renewable technologies are cheaper, they usually require big investments in new transmission infrastructure, which can make specific projects unfeasible.

For this reason, tools specifically designed for power sector modelling were used, to improve representation of Peruvian power plants and electric grid. Three models were used: OPTGEN, for optimal electric generation expansion, OPTNET, for optimal transmission network expansion and SDDP, for power system operation optimization. These models are developed by PSR and applied in about 70 countries, from all continents4 , including Peru, where it is used by the System Economic Operation Committee (COES), market participants and the energy sector regulator (OSINERGMIN).

A software was made for transforming power sector models outputs into additional constraints for PERU-TIMES, so that power sector expansion and operation in TIMES is exogenously given by SDDP, OPTGEN and OPTNET decisions. As power sector models consider individual power plants, this software basically aggregates generation and capacity of all power plants belonging to each of the eleven mentioned processes, and write a file of generation constraints for use by TIMES. Operation and investment average costs are also transferred from power sector models to PERU-TIMES, assuring coherence between TIMES objective function and power sector models costs.

OPTGEN

Based on a list of candidate power plants, the model's objective is to elect those that satisfy the electric demand (estimated by the econometric demand model) and minimize the sum of operational and investment costs, taking into account inflow uncertainties [START_REF] Psr | Optgen -model for generation expansion planning and regional interconnections[END_REF][START_REF] Thomé | Decomposition approach for generation and transmission expansion planning with implicit multipliers evaluation[END_REF][START_REF] Campodnico | Expansion planning of generation and interconnections under uncertainty[END_REF]. For this, OPTGEN has an operating module that represents the main aspects of the system.

In addition to supplying consumer demand in future years (energy consumption and peak demand), OPTGEN offers additional options, such as the definition of a power reserve margin coverage restriction (so that total firm capacity in each year exceeds the peak demand of the same year by a certain margin) and renewable plants generation targets (e.g. 15% of overall demand must be satisfied by non-conventional renewable plants by 2030). For recent applications, see [START_REF] Perez | Determinación del plan óptimo de la expansión de la generación del sistema de la república dominicana[END_REF][START_REF] Morais | Aplicación de un modelo de expansión de la generación considerando el requerimiento de reserva probabilística dinámica en el sistema eléctrico mexicano[END_REF][START_REF] Perez | Determinación del plan óptimo de expansión de cada país y evaluación de interconexión energética regional contemplando alta penetración de fuentes renovables[END_REF].

SDDP

SDDP is a probalistic dispatch model with representation of the transmission network, that may be used in short-, medium-and long-term operational studies [START_REF] Psr | Sddp stochastic hydrothermal dispatch with network restrictions[END_REF]. The model calculates the minimum cost operational policy of a power system taking into account the operational details of hydro plants (water balance, limits on storage and turbined outflow, spillage, filtration, etc.), thermal plants (gas consumption restrictions, bi-fuel thermal plants, unit commitment, take-or-pay fuel contracts, etc.) and renewable plants (solar and wind seasonality, operation factors, etc.). SDDP also incorporates decision-making under hydrological uncertainty, by means of stochastic generated hydrological scenarios and multi-stage stochastic optimization techniques [START_REF] Pereira | Multi-stage stochastic optimization applied to energy planning[END_REF][START_REF] Pereira | Application of stochastic dual dp and extensions to hydrothermal scheduling[END_REF][START_REF] Pereira | Long-term hydro scheduling based on stochastic models[END_REF][START_REF] Tilmant | Hydrological risk assessment in the euphrates-tigris river basin: A stochastic dual dynamic programming approach[END_REF][START_REF] Flach | Long-term optimal allocation of hydro generation for a price-maker company in a competitive market: latest developments and a stochastic dual dynamic programming approach[END_REF]. In addition to the minimal cost operating policy, the model also calculates different economic indices such as the marginal cost of operation (per submarket and per bar) and others.

In the methodology used in this study and presented in Figure 1, SDDP is run twice. In the first execution, in preparation for the grid expansion planning (see section 2.3.3), SDDP receives as inputs the electricity demand and the generation expansion plan made by OPTGEN. Maximum limits for transmission lines and transformers of the electric grid are not considered in this run. Those circuits and transformers with flows above the maximum existing capacity automatically become candidates for transmission reinforcement. Therefore, before executing a study to plan the expansion of transmission capacities, a preliminary stage of preparing candidate circuits is performed, which includes the use of technical parameters and investment costs consistent with Peruvian market.

Once the expansion of the transmission network has been carried out, SDDP is used for the second time in order to verify the quality of the final operation considering the elected network additions, with circuit flows being monitored so that they do not reach the maximum capacity. This final run produces as results scenarios of power generation, marginal costs of electricity, operating costs, circuit flows, fuel consumption in the thermal power plants, GHG emissions, and others.

OPTNET

OptNet is a computational tool that determines the least-cost expansion for the transmission network to ensure supply of the expected demand throughout the study horizon, with detailed modeling of Kirchhoffs laws [START_REF] Psr | Netplan model for transmission expansion planning[END_REF].The model chooses the best reinforcements among a list of transmission lines and transformers to minimize the sum of investment costs and network reliability worth, measured by interruption costs due to contingencies. Interruption costs are evaluated taking into account all scenarios coming from SDDP, instead of only one dispatch scenario. That is, each hydrological scenario considered by SDDP gives rise to a dispatch solution, which serve as inputs to OptNet. In this study, 44 hydrological scenarios were considered, and so, in each year, investments were made to minimize expected costs over 2640 power flows (12 months times 5 load blocks times 44 scenarios). In this way, a more robust expansion plan and a better trade-off between investment costs and the supply reliability are obtained [START_REF] Oliveira | Value-based transmission expansion planning of hydrothermal systems under uncertainty[END_REF]. Moreover, a disjunctive formulation of the transmission expansion problem is adopted, avoiding non-linear power flow equations [START_REF] Bahiense | A mixed integer disjunctive model for transmission network expansion[END_REF].

The candidate transmission lines and transformers list is prepared by the user. As mentioned above, in this study the candidates considered were circuits parallel to the ones that had their flow limits surpassed during the first SDDP execution. Some of the lines considered in the official Peruvian Transmission Plan [START_REF] Coes | Plan de transmisión 2017 -2026[END_REF] were also considered as candidates (see section 3).

Computable General Equilibrium Model

Demands provided by the econometric model are based on exogenous GDP forecasts. However, energy prices have an effect on economic growth and national income. The energy sector evolution may significantly impact GDP and therefore the energy sector's own demand. We developed a model of the Peruvian economy in which macroeconomic variables are determined by the condition of general equilibrium: assuming that each economic agent maximizes its welfare (the utility function, in the case of consumers, and profits, in the case of firms), demand and supply for each product are equalized. The model consider 12 kind of firms in the economy, each one responsible for producing one aggregate good. Four of them are responsible for the production of energy products: solid, liquid and gas fuels, plus electricity. Model parameters were calibrated using the Peruvian Social Account Matrix (SAM) of 2007 [START_REF] Inei | Perú cuentas nacionales 2007: Año base 2007[END_REF]. Since this SAM has 54 sectors, some aggregation operations were needed to transform it into a 12-sector SAM that could be used to estimate CGE's production and utility functions.

TIMES-CGE integration aims to assure that prices and quantities provided in TIMES solution are consistent with general equilibrium conditions for the overall economy. Different methods were proposed in the literature for integrating CGE and energy supply models [START_REF] Riekkola | Challenges in Soft-Linking: The Case of EMEC and TIMES-Sweden[END_REF][START_REF] Manne | Markal-macro: A linked model for energy-economy analysis[END_REF][START_REF] Messner | Messagemacro: linking an energy supply model with a macroeconomic module and solving it iteratively[END_REF]. In this project, after solving TIMES according to demands defined by the econometric demand model, prices and quantities of different commodities are aggregated into the four energy sectors considered in CGE (solids, liquids, gas and electricity). Then, an optimization problem is solved, changing specific parameters in the production functions of the four CGE energy sectors so that the distance between CGE and TIMES solutions (regarding prices and quantities of the four energy aggregates) is minimized.

The solution to this problem provides new GDP and sectoral GDP projections, besides new demands for energy aggregates, which must be disaggregated into the various energy service demands in order to feedback the TIMES model. For example, one of the outputs of CGE is the aggregate demand for liquid fuels. However, TIMES considers diesel, gasoline, jet fuel, fuel oil and other liquid fuels individually. To disaggregate liquid, solid, gas and electricity demands coming from the CGE, the econometric demand model is executed again, using the new GDP and sectoral GDP as explanatory variables in the regressions. This provides a new set of disaggegated enery service demands5 that are used to run TIMES once more. The interactive process continues until convergence between the CGE solution and TIMES solution is reached, within a specified tolerance for the difference between CGE and TIMES prices and quantities of the four energy aggregates6 .

Models and Tools Integration

The models and tools of the energy planning framework have different basic structures. The models process information in different levels of aggregation and have different scopes, spatial and temporal resolutions. Table 2 presents the core differences among the models. As an example, the sectoral (dis)aggregation in the CGE model comprises energy and non-energy sectors that are not the same as those represented in the PERU-TIMES model. The same applies for the representation of the supply technologies: while the CGE model has generic production functions, PERU-TIMES relies on "processes", that can be used to represent technologies with any level of detail desired (for instance, refineries are represented individually, while individual power plants are aggregated by technology).

The differences among the models pose a difficulty for the modeler during the soft-linking procedure. [START_REF] Riekkola | Challenges in Soft-Linking: The Case of EMEC and TIMES-Sweden[END_REF] presents a script for successful integration between models. The first step is to identify connection points (what to link), by carefully analyzing the models' basic differences and similarities (overlaps and common exogenous variables). The soft-linking procedure also requires a second major step: identifying how to connect the common points in order to create an information flow among the models (how to link). Naturally, a third and final step in this procedure is to check the consistency and the robustness of the outputs produced.

Table 3 describes a summary of the soft-linking procedure adopted for the energy planning framework. In the first column, the arrows indicate the direction of the information flow (a double arrow ↔ indicates information flow both ways). The overlaps and the common exogenous variables of the set of models were identified. Then, the connection points were defined and the information flow was set up to start producing the outcomes of the energy planning framework.

Peruvian National Energy Plan: an application of the soft-linking procedure

The energy planning framework described in section 2 was used for the preparation of a first draft of the 2040 National Energy Plan. The assumptions used in the study resulted from a long interaction bvetween the consortium and MEM staff. This collaboration allowed knowledge to be transferred to the MEM's team, which was essential since they are expected to operate and maintain the system in the future. During development, various players in the energy sector were heard, either by presential or remote meetings, in order to gather information and reach some degree of consensus on the major concerns regarding the evolution of the sector.

SDDP

Optimization of the power sector operation

Table 2 Basic / core differences between models

Demand scenarios

Three demand scenarios were built, according to different assumptions for national and sectoral GDP growth rates (which are later updated by the TIMES-CGE integration). Projections of socioeconomic variables made by APOYO consultancy [START_REF] Consultoría | Servicio de consultoría para elaborar las proyecciones de variables socio económicas y de la demanda de energía para el periodo 2016-2026[END_REF] were used from 2018 to 2026. In the absence of projections for sectoral GDP growth for the remaining period, scenarios provided by the Ministry of Energy and Mines (MEM) were used for 2027-2040. Figure 5 shows different scenarios of aggregated national energy consumption, in petajoules (PJ). Once the forecasts of aggregate total energy consumption by sector have been defined, detailed projections by region and fuel (or use) are achieved through a matrix of percentage participation factors. Regardless of the sector, the distribution of consumption by region is defined based on the regional consumption distribution of the Useful Energy Balance 2013 [START_REF] De Minas E Energía | Balance nacional de energía útil 2013[END_REF]. Nevertheless, the assumptions used for the partition between fuels and uses depend on the sector. According to the methodology exposed in 2.1, for the industrial and transport sectors, in which energy services demands are projected (electricity, process heat, driving force, passenger-kilometer etc.), the share of each use comes from the Useful Energy Balance 2013 [START_REF] De Minas E Energía | Balance nacional de energía útil 2013[END_REF], whereas TIMES will be responsible for deciding the optimal fuel mix. On the other hand, for residential, commercial and public sectors, in which the projection by energy commodity (firewood, electricity, LPG, etc.) is made by the demand model, exogenous policies, such as energy efficiency and fuel substitution were created.

In the residential sector, for instance, the exogenous policy included substitution of coal and firewood by gas and/or LPG, according to the availability of natural gas to residential consumers in each region. In the base growth scenario, the share of gas in the total consumption of the sector increases from 1% in 2013 to 10% in 2040. Consistently, the shares of firewood and coal decrease in the same proportion. For the commercial sector, the replacement of LPG by natural gas for the Central, Northern and Southern regions is considered. In this case, natural gas growth is more moderate: from 1% to 3% at the end of the horizon. In both sectors, for each region, shares were adjusted according to gas distribution companies' forecasts. Different matrices of participation were created for the high and low growth scenarios for the simulation of a greater or less firewood substitution.

Data and main assumptions

The power sector database was adapted from the one used in the study for reserve margin verification prepared by COES [START_REF] Coes | Estudios de verificación del margen de reserva firme objetivo del sistema[END_REF]. All technical parameters for existing and planned transmission lines, transformers and power plants connected to the National Electric Interconnected System (SEIN) are part of this original database. For power generation expansion planning up to 2040, a diversified set of candidate plants was added to that base, including hydroelectric, natural gas, diesel, solar, wind, geothermal and biomass plants 7 . Renewable technologies investment costs were assumed to reduce in the future according to [START_REF]Annual technology baseline (atb)[END_REF]. An additional supply reliability constraint was included in OPTGEN, by which firm capacity in each year should exceed peak demand by the margin established in COES' reserve margin verification study [START_REF] Coes | Estudios de verificación del margen de reserva firme objetivo del sistema[END_REF]. Although the evaluation period of that study ends in 2022, we assumed that this minimum reserve criterion is maintained throughout the horizon.

As OPTNET candidates, circuits and transformers parallel to existing ones were considered, with the same capacity, reactance and resistance. Transmission lines already considered in the official transmission plan of the country [START_REF] Coes | Plan de transmisión 2017 -2026[END_REF] up to 2026 were maintained in the database, while lines to be built after this year were added as additional candidates. Investment costs were estimated based on reference values contained in that plan and discussed with MEM staff, following market references. The construction of a 1000 MW transmission line connecting Peru to Ecuador, expected to start operation by mid 2023, was also considered. The Ecuadorian power system was not modeled, as only its transactions with Peru were of interest. For this matter, a dummy power plant, that produces only when Peruvian marginal cost is greater than Ecuador's one, and a flexible demand, that consumes only when Peruvian marginal cost is lower than in Ecuador, were used to represent exports to and imports from Peru, respectively. Marginal costs for Ecuador were estimated assuming a strong hydroelectric expansion in that country.

Economical and technical parameters for PERU-TIMES processes (presented in section 2.2) were taken from many sources, ranging from information sent directly by MEM's staff, to public information from the web [START_REF]Estadísticas sector hidrocarburos[END_REF][START_REF] Osinergmin | Osinergmin: Estadísticas[END_REF][START_REF] Proinversion | Proinversin[END_REF]. For example, oil and gas reserves data were taken from [START_REF] De Minas E Energía | Libro anual de recursos de hidrocarburos al 31 de diciembre del 2016[END_REF], while existing capacities and efficiencies for end-use technologies came from [START_REF] De Minas E Energía | Balance nacional de energía útil 2013[END_REF]. When national data was not available, international references were assumed, such as for CO 2 , CH 4 and N 2 O emission factors for power generation and end-use technologies [START_REF] Ipcc | 2006 -IPCC guidelines for national greenhouse gas inventories[END_REF] and for vehicles maintenance costs [START_REF] Etsap | Energy technology systems analysis program -energy demand technologies data[END_REF]. This allowed for a detailed representation of the Peruvian energy system, with data that can be changed over time, as more information becomes available.

The main projects considered for PERU-TIMES are described in Table 5 in the Appendix. For some of these projects, the investment decision was already taken by competent authorities and so we classify them as "Decided". Others are candidates for PERU-TIMES, that may choose if and when to invest. For refining, the only project considered was the modernisation of the Talara refinery (that is expected to be completed in 2021), as no other project is expected to be developed in the study horizon. Another important assumption was the adoption of an exogenous scenario for domestic oil production until 2040, provided by MEM's team.

Natural gas, oil and oil products import and export prices were taken from the "High Resource and Technology" scenario from EIA's Energy Outlook [START_REF] Eia | Annual energy outlook 2019 with projections to 2050[END_REF], which is similar to the reference scenario of World Bank's forecast [START_REF]Commodities price forecasts[END_REF]. Prices were internalized according to freight and other transportation costs (without taxes). Fuel costs for power generation were assumed to follow these international trends.

Results and Discussion

The energy planning system provides general trends, as well as several specific results. OPTGEN and OPTNET executions provide the power sector generation and transmission plans. SDDP uses these plans to determine the optimal stochastic dispatch of each power plant, considering water inflow uncertainties. It also provides electricity marginal costs. For every single process, TIMES finds its input and output flows along with investment and operation costs. This section summarizes the main results of the energy plan draft elaborated for MEM using the tools and assumptions shown in previous sections. Final results are shown, subsequent to the convergence of the iterative process between CGE and PERU-TIMES.

Figure 6 shows the average generation per technology (in GWh/year) for the baseline scenario up to the year 2040. Variable renewable sources lead the electrical expansion, driven by the reduction of their investment costs. Solar photovoltaic generation has the biggest growth, going from 2% of total demand in 2018 to 14% in 2040, with significant growth after 2025; wind generation expands from 3% to 7%. Including hydroelectric generation, the share of "clean" energy in Peru reaches 60% of demand in 2040. Hydraulic generation (small hydropower plants included) participation decreases from 63% in 2017 to 40% in 2040. Thermal generation goes from 34% in 2017 to a maximum of 44% in 2024-26 and then returns to 34% in 2040 (23% from closed cycle natural gas plants, 10% from open cycle gas plants and 1% from coal). This confirms the role of natural gas as a complementary source to renewable and hydroelectric plants. It should be noted that natural gas in Peru is provided solely by domestic production, so external dependence does not increase as a result of demand growth. Generation from oil products is almost zero during the whole period, given their higher fuel costs. These plants, however, play an important role to satisfy the reserve margin constraint imposed to the system.

After the construction of the transmission line connecting Peru and Ecuador, net imports of electricity from that country reach 2% of Peruvian demand during 2024-2029, and 5-6% during 2030-2040. This is because hydroelectric expansion in Ecuador results in marginal electricity costs in that country lower than in Peru.

The main natural gas production site in Peru, the Camisea project, has approximately 18.7 TCF of 3P natural gas reserves8 [START_REF] De Minas E Energía | Libro anual de recursos de hidrocarburos al 31 de diciembre del 2016[END_REF]. Its availability and competitiveness (alongside with existing subsidies for gas power plants) allow its demand to grow in all sectors: residential, commercial, industrial, transportation and power generation. This growth is limited, however, by existing infrastructure: the main processing plant, Malvinas, has been operating near maximum capacity for the past six years [START_REF] Osinergmin | Osinergmin: Estadísticas[END_REF]. Although CNPC Gas Processing Plant is planned to enter operation in 2023, TIMES indicates the need of further investments in processing capacity in 2035 in the baseline scenario. This investment is anticipated to 2022 in the high demand scenario. As gas production and demand increase, the model also expands gas transportation capacity beyond already decided investments -such as the SIT GAS project, planned to enter operation in 2025 (see Appendix).

Natural gas infrastructure constraints limit the growth to a relatively modest rate of 2.1% per year in the baseline scenario (Figure 7). This is also explained by the displacement of gas power plants expansion by renewable sources, mainly from 2026 onwards. Natural gas exports decline in most scenarios, since the model prioritizes domestic supply. The higher the domestic demand growth, the greater the drop in gas exports (Figure 7). Current natural gas reserves are enough to ensure a reliable supply until 2040. However, this study did not evaluate the possibility of new oil and gas fields discoveries, which can contribute to the decision of whether reserves should be monetized in the short term, or rather, kept for future exploitation. As seen in Figure 8, major changes in Peruvian oil sector are not expected, and the country remains a net importer of crude oil. This is related to the adoption of an exogenous scenario for oil production, as previously mentioned, and to the limitation of refining capacity in the country (new refinery candidates were not considered, except for the expansion of Talara refinery in 2021). Exploitation in the North region declines as reserves are at an advanced level of its useful life. On the contrary, extraction of heavy crude oil in the East increases, due to the reopening of the North Peruvian oil pipeline (Figure 8). The Talara refinery expansion (to be completed in 2021) increases national demand for crude oil, mostly met by imports. Since this refinery stops operations in 2020 to complete its modernization, imports fall dramatically during this year (Figure 8). This project is expected to improve the quality of the diesel produced, to comply with the new Peruvian sulfur content specifications. As a result, it also reduces diesel imports and, consequently, foreign dependence, in the short term (Figure 9). Residual oil domestic consumption has a strong growth (average of 7.3% per year), especially in the maritime transport sector. This growth allows absorbing surpluses produced by local refineries, which are currently exported, as shown in Figure 9. The decline in oil products exports in 2020, that may be seen in this graphic, is due to the outage of the Talara refinery for modernization.

In the demand side, a slight decrease in LPG consumption is observed in the Central region. The reason is that this region is where the substitution between natural gas and LPG can be carried out in greater extension (in other regions, LPG remains a major fuel because the arrival of natural gas is not economically viable, in addition to firewood replacement for LPG). Considering that LPG is an imported fuel and that natural gas is cheap and largely available in the Central region, the proposed substitution policy seems appropriate. Moreover, electric vehicles begin to enter the market by 2029, after reaching cost parity with respect to internal combustion vehicles.

4 Sensitivity Analyses: simulating policies and shocks on the base case In addition to the three demand scenarios above, four sensitivities were executed to simulate different policies and shocks on the base case.

1. High international prices for hydrocarbons: simulates the impact of an increase in import and export prices of natural gas, crude oil and their products. Prices for this sensitivity were taken from EIA's "Reference" scenario, instead of the lower prices from "High Resource and Technology" scenario considered in the remaining scenarios; 2. Hydroelectric capacity target: which requires that hydroelectric plants (small hydro not included) comprise at least 30% of overall installed capacity, throughout the horizon. Notice that hydropower generation (GWh) is more than 30% in the baseline scenario, as mentioned in section 3.3, but capacity comprises only 22% of total installed capacity; 3. Impact of climate change on inflows: simulation of the effects of climate change on hydrology and, consequently, on power sector generation. For each drainage basin, inflows were modified in SDDP according to predictions made by CEPAL [START_REF] Bid | Informe: La economía del cambio climático en el perú[END_REF], impacting on water availability for hydropower plants 9 . Besides the change in inflows, we do not consider other effects that climate change could have on the energy sector, such as increasing demand for cooling, as temperature rises, and possible impacts on GDP due to mitigation and adaptation costs; 4. Electric vehicles (EVs) promotion policy: instead of optimizing the number of electric vehicles entering in operation in each year, that number is an input to the model, which is given by the Nationally Appropriate Mitigation Actions (NAMA) study [START_REF] Hinicio | Diseño detallado de la nama de transporte limpio, su respectivo sistema de monitoreo, reporte y verificación (MRV), capacitaciones para su validación, funcionamiento y preparación de documentación para registrar la nama ante minam y unfccc[END_REF]. This scenario increases and anticipates EVs penetration, in relation to the base case. For instance, while the model invests on private EVs only in 2029 for the baseline scenario, this promotion policy considers 2 thousand electric vehicles in operation already in 2024, increasing to 365 thousand in 2040 (in comparison to 202 thousand for the base case).

All sensitivities use the same demand from the base scenario. Table 4 shows, for each sensitivity, the objective function (that is, total costs, including OPEX and CAPEX, discounted to present value), total CO 2 equivalent emissions over the horizon 2017-2040, and consumption of oil products (diesel, gasoline, fueloil, turbo and LPG), natural gas, electricity, biomass and coal in 2040. The three demand scenarios (base, low and high) are also shown for comparison. There is little difference between the objective functions of the seven cases. The biggest difference occurs for the low demand scenario, with an objective function 6.7% lower than the baseline. High international hydrocarbon prices led to stronger substitution of oil products by natural gas in transportation and industrial sectors. In turn, this anticipated investment in gas processing capacity to 2022 (in the baseline scenario it is predicted to 2035) and reduced LNG exports in 2040 by 26%, when compared to the baseline scenario. There is also an increase in the use of EVs, which explains the small growth of electricity consumption in this scenario: 1 PJ more than the baseline.

As previously mentioned, in the baseline scenario, hydraulic generation accounts for 37% of the power mix in 2040. At first, this suggests that hydropower is not competitive with respect to nonconventional renewable technologies. However, the "hydro" sensitivity analysis reveals that forcing the investment in hydroelectric plants leads to an overall cost similar to the cost of the baseline scenario 10 . Therefore, we conclude that hydroelectric plants have similar competitiveness to a mix of non-conventional renewable with natural gas plants, which allows more flexibility for decision-making. A concern that may arise regarding the construction of new hydroelectric capacity is the negative impacts climate change may have on hydrological flows. However, the sensitivity to climate change did not result in significant modifications to the annual total hydro generation with respect to the baseline scenario. The greatest difference occurs in 2020, when hydro generation is only 0.9% smaller than in the base case.

Promotion of EVs according to NAMA involves a relatively small cost, increasing the objective function by less than 0.05% (around 80 million dollars). Electric vehicles displace mainly GNV vehicles, which explains the decrease in natural gas consumption in this scenario. The decrease in gasoline consumption is smaller: only 2 PJ in 2040.

While most scenarios simulate the response of the energy system to exogenous situations in which the decision maker has minimal interference (high, medium and low demand, high prices, climate change), EVs and hydropower promotion policies depend largely on political decisions for climate change mitigation. These could cut CO 2 cumulative emissions by 6 million and 23 million tonnes, respectively, up to 2040. Considering only the power sector emissions (Figure 10), the promotion of hydropower leads to emissions similar to the low demand scenario in the long run.

Conclusions and lessons learned

Herein we presented the energy planning framework developed for MEM. Three main guidelines were pursued for designing it: economic efficiency, flexibility and consistency. Economic efficiency means that infrastructure investment and operation must seek the minimum total cost. That is why we opted for optimization models such as TIMES, OPTGEN, SDDP, OPTNET and CGE, instead of simulation models such as LEAP [START_REF] Leap | Leap model[END_REF].

Moreover, since the system is designed to be continuously improved by MEM's team, the models should have the flexibility to include increasing level of detail, and to adapt to technology development, new environmental policies and political decisions. The scenarios and sensitivities analysed in this paper illustrate the capability of the models to adjust to new data, such as GDP growth, commodities prices and hydrological inflows, and also to public policies such as hydropower targets, electric vehicles promotion, and energy efficiency programs -e.g firewood substitution in household consumption. Renewable power generation and GHG emission targets, regional limitations on diesel sulfur content, technology efficiency improvement and virtually any constraint may be represented in the models. The econometric demand model allows for further breakdown of demands, for example, dividing the freight road transport into various truck segments, or even making spatial breakdown to consider demands of individual departments or major cities.

As a core aspect of the framework, inputs and outputs of each model are consistent with each other. This was made by soft-linking all the models in a single framework, in which power transmission investments (made by OPTNET) take into account the generation expansion plan (made by OPTGEN) and power plants fuel consumption (determined by SDDP) is used by TIMES in evaluating biomass, coal, oil and natural gas infrastructure needs. Consistency between the energy and the remaining sectors of the Peruvian economy was also sought, by using a general equilibrium model for updating the demands inputted to TIMES. Results confirm the robustness of the soft-linking procedure and adequacy of the connection points chosen.

Finally, the greatest contribution of this project was to build capacity along Peruvian institutions, mainly MEM, in order to analyse and contribute to the development of the energy sector. In this sense, the draft of the 2040 National Energy Plan presented here was the first study made using the planning framework developed for MEM. It provides important insights for assisting decision-making, such as the primacy of non-conventional renewable sources for power generation, especially solar photovoltaic technology. One of the main conclusions is the need of expanding and modernizing the Peruvian energy infrastructure, for ensuring safe and continuous supply. Specific projects may be highlighted: the modernization of the North Peruvian Pipeline and of Talara Refinery, and the expansion of natural gas processing and transport capacity.

7 Appendix: PERU-TIMES projects Table 7 presents the main projects considered in PERU-TIMES according to their type. Decided projects are the ones for which the investment decision was already taken by responsible institutions, entering operation in a specific year that is inputted to the model. For Candidate projects, the model chooses whether and when to invest. Moreover, only continuous investment variables were considered, meaning that PERU-TIMES can also choose how much capacity enters operation in each year for Candidate projects.

Project

Type Description

Talara Refinery Modernization Decided

Construction of new processing units and facilities that will increase Talara refinery capacity, providing diesel with low sulfur content and the processing of heavier crudes, such as those produced in the Eastern oil fields of the country. Talara must stop operations in 2020 for completing modernization works.

CNPC Gas

Expansion of Pisco Gas Fractionation Plant Candidate

A cost of 2 MMUS$ per added PJ-year of capacity was adopted. This investment option is available for PERU-TIMES from 2022 onwards.

Sistema Integrado de Transporte de Gas Zona Sur del País (SIT GAS)

Decided

This is an important pipeline project to ensure natural gas supply to power generation plants, industrial projects and others consumers in the South region. Although uncertain, we consider its start-up in 2025, with an estimated investment amount of 4400 MMUS$ for a transport capacity of 473 MMSCFD.

Expansion of TGP pipeline Candidate

TGP is the main gas pipeline in Peru. Future expansions of this pipeline are considered, at a cost per MMSCFD of added capacity similar to that of historical TGP expansions.

Expansion of NGL pipeline Candidate

Capacity expansions for the pipeline that transports NGL produced in Malvinas for Pisco Fractionation Plant at a cost of 3. This project includes the automation of valves, replacement of engines, among other investments in the existing pipeline, which would total 564 MMUS$ and reduce fixed O&M costs in 15% and variable costs in 30%.

Industrial end-use technologies Candidate

As mentioned in section 2.2.4, generic processes for converting specific fuels into energy services (heating, driving force and electricity) for four industry sectors (manufacture, mining and metallurgy, farming and fishery) were considered. While existing capacities of these processes were calibrated according to national energy balances, the model has the possibility of expanding them based on three major parameters: efficiency (calibrated also according to energy balances), investment and O&M costs (extracted from [START_REF] Schaeffer | Opções de mitigação de gases de efeito estufa (GEE) em setores-chaves no Brasil informe técnico para GEF (Global Environmental Facility) modelagem setorial de opções de baixo carbono para o setor de óleo e gás natural[END_REF]).

Transport end-use technologies Candidate

Efficiencies (fuel consumption by kilometer) and vehicle use were taken from national energy balances, while average mileage, from data from Brazilian Ministry of Environment, as data for Peru was missing. Investment and O&M costs were based on data from IEA-ETSAP [START_REF] Etsap | Energy technology systems analysis program -energy demand technologies data[END_REF], NAMA [START_REF] Hinicio | Diseño detallado de la nama de transporte limpio, su respectivo sistema de monitoreo, reporte y verificación (MRV), capacitaciones para su validación, funcionamiento y preparación de documentación para registrar la nama ante minam y unfccc[END_REF] and Peruvian car dealers. For electric vehicles, we assumed an investment cost decrease of 2% per year for cars and 3% per year for buses, as in [START_REF] Hinicio | Diseño detallado de la nama de transporte limpio, su respectivo sistema de monitoreo, reporte y verificación (MRV), capacitaciones para su validación, funcionamiento y preparación de documentación para registrar la nama ante minam y unfccc[END_REF]. EVs were not considered for the Eastern region, as the Amazon region imposes a series of obstacles for their adoption.

Table 5 Main decided and candidate processes considered in PERU-TIMES.

Fig. 1

 1 Fig. 1 Energy planning framework developed for the Peruvian Ministry of Energy and Mines (MEM).

Fig. 2

 2 Fig. 2 Econometric and bottom-up models for demand projection.

Fig. 3

 3 Fig. 3 Crude oil upstream and downstrem representation in PERU-TIMES. Processes for blending diesel and gasoline with biofuels are not shown.

Fig. 4

 4 Fig. 4 Natural gas upstream and downstrem representation in PERU-TIMES. NGL transport from Camisea to Pisco fractionation plant is also a separate process in PERU-TIMES (not shown here).

Fig. 5

 5 Fig. 5 National demand forecast scenarios, in PJ.

Fig. 6

 6 Fig. 6 Electric Generation by source, for baseline scenario, in GWh. "Other" includes biomass, coal and oil products.

Fig. 7

 7 Fig. 7 Natural gas production and LNG exports, in PJ.

Fig. 8

 8 Fig.8Crude oil domestic production and imports, in PJ, by type (heavy, medium and light) and region. Results are the same for every scenario, since domestic production is exogenous and demand is determined by refining capacity.

Fig. 9

 9 Fig. 9 Diesel and other oil products net imports, in PJ, for the baseline scenario. Negative values indicate net exports. The green line shows import costs, after discounting export revenues.

Fig. 10

 10 Fig. 10 Peruvian power sector GHG emissions (comprises CO 2 , CH 4 and N 2 O gases), in metric tonnes of equivalent CO 2 by MWh of electricity generated. The expansion of natural gas power plants increases GHG emissions. However, this effect is compensated in the long-run by thermal plants displacement by renewable generation.

Table 1

 1 Projected variables by transport category.

	Category	Subcategory	Primary Variable	Final Demand Model Output Variable
	Naval	cargo	Transported cargo	Energy consumption (PJ)
	Aerial	all	Number of airplanes	Energy consumption (PJ)
		public passengers transportation	Vehicle sales	Passenger-kilometer (pkm)
	Road	private passengers transportation cargo	Vehicle sales Vehicle sales	Passenger-kilometer (pkm) Tonne-kilometer (tkm)
		passengers	Number of passengers transported by railway company	Passenger-kilometer (pkm)
	Rail	cargo	Metric tons transported by railway company	Tonne-kilometer (tkm)

Table 3

 3 Connection points and information flow among the models.

	Models (from → to)	Overlaps	Common exogenous variables	Connection points (what to link)	Information flow (how to link)
	Demand Forecast Model → PERU-TIMES	Both models may be used energy service exist) to forecast fuel demands (PERU-TIMES may do this when different options to meet a given	End-use technology parameters (e.g. efficiencies)	Energy demands	The demand forecast model provides demands already in the required by PERU-TIMES
	Demand Forecast Model → PSR Tools	-	-	Electricity demand	Electricity demand projected by the demand forecast model is disaggregated by load block and grid node
		Both models may be used
	PSR Tools → Peru-TIMES	to optimize electricity generation mix and investment decisions, but PSR tools are more	Electricity demand	Electricity generation and capacity mix	Constraints on generation and investment decisions in PERU-TIMES, according to the decisions of PSR tools
		detailed
	PERU-TIMES ↔ CGE	Both models simulate fuel prices and production	Historical data of energy flows (used to calibrate both models)	Energy production (and thus demand) and prices	For each year, energy sector's productivities in CGE are changed for giving the closest solution to TIMES
	CGE →				GDP and sectoral GDP
	Demand Forecast	Both models simulate energy demands	Population growth	GDP and sectoral GDP	endogenously determined by CGE are inputted to the
	Model				demand forecast model
	PSR Tools (OPTGEN/SDDP/OPTNET)
	OPTGEN → SDDP	Both models have operational decisions, but SDDP is a more detailed model and designed planning specifically for operation	Electricity demand and transformers and parameters for power plants, transmission lines	Generation expansion plan	SDDP defines the optimal dispatch, considering OPTGEN's expansion plan
					OPTNET decides the best
	SDDP ↔ OPTNET	Both models run power flow analysis, but SDDP does not consider candidate circuits and OPTNET does not optimize dispatch	Electricity demand and parameters for power plants, transmission lines and transformers	Dispatch scenarios and circuits candidates	circuits to invest to ensure reliability in all dispatch scenarios from a previous execution of SDDP. SDDP is run once more considering OPTNET's
					expansion plan

  Processing Plant Decided Starts operation in 2023 and will be able to process 360 MMSCFD of wet gas produced in a new field in Camisea. Gas Fractionation Plant in La Convención Province Decided Processing capacity is estimated in 3.2 MBPD of NGL. Operations are expected to begin in 2024. Expansion of Malvinas Gas Processing Plant Candidate A cost of 1.55 MMUS$ per added PJa was adopted. This investment option is available for PERU-TIMES from 2022 onwards.

For more information go to https://www.psr-inc.com/

After solving the demand forecast model for the second time, with explanatory variables updated, results do not necessarily coincide with the demands of the four energy aggregates resulting from CGE, since methodologies differ. To ensure consistency between all models, another optimization model is employed to find new demands which differ as little as possible of the demand model's forecasts and at the same time are close enough to CGE quantities.

For the study presented in section 3.3, a 10% tolerance was used.

We considered only hydroelectric projects in an advanced stage of studies, environmental certifications and concessions. Renewable projects location and capacity were based on previous renewable auctions in the country. For thermal plants, generic projects were considered, according to reference international technical-economic parameters[START_REF]Gas Turbine World[END_REF].

According to SPE classification of reserves, 3P corresponds to the sum of proved, probable and possible reserves.

PSR softwares include a time series tool used to predict inflow series for all relevant rivers. In the climate change scenario, these series were multiplied by factors that represent how much of the inflows in each drainage basin would increase or decrease in this sensitivity, according to[START_REF] Bid | Informe: La economía del cambio climático en el perú[END_REF].

Indeed, the objective function in the "hydro" scenario is 0.1% smaller than the baseline scenario. As hydroelectric plants replace natural gas in this case, this fuel may be exported, providing additional revenues for Peru.

Acknowledgements

The authors gratefully acknowledge the contributions of Ana Carolina Deveza, Sérgio Granville, Tiago Andrade, Silvio Binato, Guilherme Machado, Lucas Okamura, Marcelo Cruz, Reynaldo da Matta and André Granville, from PSR; Enrique Patiño, Manuel Tinoco, Felipe Manuel Bastarrica Anselmi and Alejandro Parodi from Mercados Energéticos Consultores; André Lucena, Alexandre Szklo, Mauro Chavez-Rodriguez, Fernanda Guedes, Camilla Oliveira and Bruno Cunha, from COPPE/UFRJ; Livio Ribeiro and Vinícius Botelho, from IBRE/FGV; and MEM-DGEE's team, including Manuel Heredia, José Luis Caro, Luis Isla and Giannina Milagros on the development of this work. Rafael Garaffa would like to express his gratitude to the Conselho Nacional de Desenvolvimento Cientifico e Tecnológico (National Scientific and Technological Development Council -CNPQ) for the financial support.