WHAT-IF: an open-source decision support tool for water infrastructure investment planning within the water–energy–food–climate nexus

Water infrastructure investment planning must consider the interdependencies within the water–energy– food nexus. Moreover, uncertain future climate, evolving socio-economic context, and stakeholders with conflicting interests, lead to a highly complex decision problem. Therefore, there is a need for decision support tools to objectively determine the value of investments, considering the impacts on different groups of actors, and the risks linked to uncertainties. We present a new open-source hydro-economic optimization model, incorporating in a holistic framework, representations of the water, agriculture, and power systems. The model represents the joint development of nexusrelated infrastructure and policies and evaluates their economic impact, as well as the risks linked to uncertainties in future climate and socio-economic development. We apply the methodology in the Zambezi River basin, a major African basin shared by eight countries, in which multiple investment opportunities exist, including new hydropower plants, new or resized reservoirs, development of irrigation agriculture, and investments into the power grid. We show that it is crucial to consider the links between the different systems when evaluating the impacts of climate change and socio-economic development, which will ultimately influence investment decisions. We find that climate change could induce economic losses of up to USD 2.3 billion per year in the current system. We show that the value of the hydropower development plan is sensitive to future fuel prices, carbon pricing policies, the capital cost of solar technologies, and climate change. Similarly, we show that the value of the irrigation development plan is sensitive to the evolution of crop yields, world market crop prices, and climate change. Finally, we evaluate the opportunity costs of restoring the natural floods in the Zambezi Delta; we find limited economic trade-offs under the current climate, but major trade-offs with irrigation and hydropower generation under the driest climate change scenario.


Introduction
Having established Integrated Water Resources Management Plans, many countries and river basins around the world are now planning to formulate water infrastructure development plans. These plans will help countries and regions realize the potential of their water resourcesincluding agriculture, energy generation, and tourismwhile preserving the environment. 30 Infrastructure investments will contribute to multiple Sustainable Development Goals (United Nations, 2015), such as : End Poverty (1), Zero Hunger (2), Clean and affordable energy for all (6), Clean and available water for all (7), Sustainable economic growth (8), and Climate Action (13). However, formulating these investment plans is a complex process involving competing objectives, upstream-downstream trade-offs, interactions between investments, multiple stakeholders and uncertainty related to socio-economic changes and future climate. In particular, it requires evaluating the interactions in the 5 Water-Energy-Food (WEF) nexus.
The WEF nexus is an expanding topic in the literature. Albrecht et al. (2018) provide a systematic review of nexus approaches; Bazilian et al. (2011), McCarl et al. (2017 and Miralles-Wilhelm (2016) consider modelling and research challenges and Khan et al. (2017) focus on the water and energy sectors. Nexus studies cover resource use efficiency, institutional analysis, decisionmaking, and policy integration, using a broad range of methods such as integrated models, input-output analysis, Life Cycle 10 Assessment and stakeholder engagement. In general, they aim to identify trade-offs between the different sectors and to support the development of cross-sectorial solutions, which produce additional benefits in comparison to single resource assessments (Albrecht et al., 2018). There are two strategies to model the interdependencies in the nexus: one is to couple well-established single system models where the output of the one feeds the input of the other in a one-way or iterative process (e.g. Howells et al. (2013) and Kraucunas et al. (2015)); another is the holistic approach which internally represents all interactions within a 15 single model (e.g. Kahil et al. (2018) and Khan et al. (2018)). The advantage of coupling models is that it simplifies communication among stakeholders in different areas that can use their respective tools and enables a more detailed representation of single systems, while the holistic approach better represents interrelations and is more effective in an optimization framework. A challenge in both cases is to represent the diversity of the scales (spatial, temporal and political) where interactions occur (McCarl et al., 2017). While there is no approach that can fit all purposes, few models consider a 20 spatial and temporal scale that can represent the interactions of water infrastructure with the WEF nexus.
Hydroeconomic optimization models (HOM) have developed into potential decision support tools for basin-scale water resources management over the past decade (see reviews by Bauer-Gottwein et al. (2017) and Harou et al. (2009)). They have been used to analyse water infrastructure investments, reservoir release scheduling and transboundary resources sharing problems. (e.g. Dogan et al. (2018), Draper et al. (2003), Goor et al. (2010), and ). Models 25 include a representation of the regional-scale flow network; water availability, water uses and willingness-to-pay. By associating an economic impact to each decision, the complex multi-objective management problem becomes a simpler singleobjective problem. Traditionally, agricultural and energy water users are represented with an exogenous demand and willingness-to-pay for water (Bauer-Gottwein et al., 2017). Therefore, classic hydroeconomic models are able to analyse tradeoffs and synergies between water users, but are not as effective in terms of representing dynamic interactions between 30 infrastructure, policies, and commodity markets. For example, increased production of a commodity may lead to a lower market price of the commodity and thus to a lower willingness-to-pay for water. On the other hand, nexus models, particularly energy centred models (e.g. OSeMOSYS  and TIAM-FR (Dubreuil et al., 2013)) tend to ignore the spatial and temporal scale of water availability and therefore may overlook water scarcity problems (Khan et al., 2017).
Over the past 20 years, an increasing amount of legal and policy frameworks for transboundary water management have been implemented in internationally shared water courses (Qwist-Hoffmannn and McIntyre, 2016). River basin organisations are intended to facilitate the application of such mechanisms. In the Southern African Development Community (SADC), a state willing to implement a project, needs to notify potentially affected riparian states, including a description of the projects and its potential impacts (SADC, 2000). Furthermore, most international financial institutions (e.g. AfDB, World Bank) require 5 "No-objection" from riparian states to fund projects. Therefore, there is a need for decision support tools to objectively determine the impacts of WEF related projects on transboundary watersheds.
In this study, we developed a new open-source decision support tool for water infrastructure investment planning: WHAT-IF, Water, Hydropower, Agriculture Tool for Investment and Financing. The novelty of the tool is that it combines a hydroeconomic optimization framework, with a nexus representation of the agriculture and food systems. The tool can represent 10 political boundaries, the joint development of WEF infrastructure and policies, and uncertainty in future climate and sociotechnical changes. It aims to provide quantitative answers to the following prototypical questions: -What is the economic impact of a given project or set of projects? Which is the best alternative among different investment plans?
-What are the synergies or trade-offs between investments and/or policies in different sectors? (e. g. what are the trade-offs 15 between hydropower, irrigation development plans and ecosystem preservation) -What are the risks linked to uncertainty in future climate and socio-economic changes? Which investments and policies will be more robust to a range of future conditions?
This article is structured as follow: firstly, Sect. 2 presents the general modelling framework and details the representations of the water, energy, and food systems and the economic optimization. Secondly, we illustrate an application of the model on the 20 Zambezi river basin, where water resources of the eight riparian countries play a central role in the regional economy and are critical to sustainable economic growth and poverty reduction. Section 3 shows the input dataset for the study case, as well as the investment opportunities such as new hydropower plants, new or resized reservoirs, development of irrigation agriculture, and investments into the power grid. We show in Sect. 4 how the model answers the previous questions to assist decisionmaking. Finally, we discuss the limitations and improvement opportunities of the modelling approach in Sect. 5. 25 2 Methodology of the decision support tool Figure 1 provides an overview of the decision support tool methodology, with the representation of the WEF subsystems and their main components. Subsystem representations are based on the concepts used in models such as WEAP (Yates et al., 2005) for the hydrology and water management, OSeMOSYS  for energy systems and IMPACT (Robinson et al., 2015) for agriculture. Subsystems are presented as blocks only for explanation purposes; the model internally 30 represents the interrelations in the nexus. The core component is the economic optimization framework, using a single objective function taking into account the different production costs, transaction costs and supply benefits of the different WEF commodities. In welfare economic terms, the objective function maximizes the sum of the total consumer and producer surpluses, where the consumer surplus is the difference between the consumers' willingness to pay and the market price, and the producer surplus is the difference between the market price and the producers' production costs (Krugman and Wells, 2005). In contrast to simulation models that are rule-based (such as WEAP), the model finds the optimal water, agriculture and energy management decisions, considering trade-offs and synergies between them. The optimization framework simulates 5 adaptation to new infrastructure and policies, climate change, and socio-economic development. Conversely, in a rule-based simulation framework, allocation rules are usually based on the current socio-economic conditions or new rules are estimated, which may lead to suboptimal allocation decisions and underestimation of project benefits (Pereira-Cardenal et al., 2016). The optimization approach is based on a perfect foresight formulation, assuming that optimal decisions are found with full knowledge of the planning period; limitations of this common approach in sectoral planning models are discussed in Sect. 5. 10 The main outputs are economic indicators (such as market prices, consumer and producer surpluses), as well as water, energy and agriculture management decisions (such as supply, consumption, storage, production and transport). To calculate the economic impacts of an investment plan or a specific project, with/without analyses are performed, and different options can be compared. With/without analyses tend to overestimate benefits when no alternative is represented, particularly in growing economies (Griffin, 2008). Therefore, the model also integrates capacity expansion representations for the energy system and 15 alternative supply sources for agriculture, such as import or rainfed agriculture. To represent uncertainties linked to future climate or socio-economic development, the same investment plan or infrastructure is evaluated for different scenarios defined by the user. Hence, the decision support tool can be used as a discussion platform for stakeholders, answering questions such as "What are the economic impacts on producers and consumers of crops, energy and water of the projects?", "What if in the future available water resources are reduced because of climate change?" or "How robust is a plan considering uncertainties 20 in socio-economic development?". The water, agriculture and energy system are connected in the economic optimization framework. The blocks represent the different processes used in the model to represent the water, energy and food systems, while the circle contains the economic and physical interactions. The block representation is only for explanatory purposes; interactions are solved in a holistic approach.

5
The model is open-source and coded in the python programming language, using the pyomo modelling framework (Hart et al., 2017). The code and installation instructions can be found on Github (https://github.com/RaphaelPB/WHAT-IF). The model can be connected to different open-source or commercial solvers; input data and output results are organized in MS Excel spreadsheets. We adopt a general framework that is study case independent. Depending on the context, the availability of data, and the questions that the decision support tool is supposed to answer, some components can be relevant or not. For this reason, the model is holistic in its resolution, but modular in its formulation, the user can activate or deactivate different modules and new modules representing relevant interrelations are easy to add. Mcintosh et al. (2011) describes some of the challenges and best practices of developing an environmental decision support system, it includes: start simple and small with a modular 5 approach, plan for longevity with a framework easy to update, design for ease of use including a user-friendly interface, and design for usefulness by including stakeholders' input. Following these recommendations, the flexibility of the framework and its open-source character will enable the tool to evolve with user and stakeholder inputs and additional features will be added such as GIS visualization and data acquisition modules.
In the following sections, we describe the individual modules represented in Figure 1. All the parameters, equations and 10 decision variables are detailed in the supplementary material. For the practical implementation of the modules and their parametrization, the reader is referred to Sect. 3 for the Zambezi study case.

Water management
The water module represents hydrology and water management. The basic hydrological time scale is at monthly time steps, but this is not a fixed requirement. The river network is described by a node-based approach, where the modelled area is 15 divided into catchments with corresponding precipitation, evapotranspiration, surface runoff and groundwater recharge. Water transfer channels form additional links to the river network. The water is stored and released from reservoirs and is allocated to water users, while lakes and groundwater are represented as linear reservoirs. Evaporative losses take place in the river network, reservoirs and lakes. Water supply costs and losses are also considered. Water users can be defined with a water demand and an associated marginal value; however, agriculture users and hydropower have a dynamic demand and marginal 20 value detailed in the agriculture and energy modules.
The water resource can have an important value for activities that are not directly represented in the model, such as ecosystems, tourism, fishing, and transportation. Rather than giving it an economic value that may be hard to define and very uncertain (Loucks et al., 2005), the environmental flows module enables to define minimum flow requirements that have to be guaranteed in the river. For methods to quantify environmental flow requirements, see Tharme (2003). 25

Agriculture production
The agriculture module computes local water demand for agriculture and production of crops depending on water allocation and rainfall. Farming zones represent agriculture areas with a specific farm type, have a limited area and belong to a catchment and a country. Farm types can represent different soil qualities, fertilizer/pesticides inputs and availability of irrigation and drainage systems. Farm types define the potential yields, cultivation and infrastructure costs, they can be used to represent 30 different kinds of agriculture, such as rainfed, irrigated and subsistence agriculture or differences among the countries/regions depending on available data and the user's interest. Crops (as a traded commodity) are produced at the yearly time step by cultures. Cultures are divided into growth phases (e.g. initial, crop-development, mid-season and late season) which take place during a specific period of the year. Water requirements by cultures are estimated using the FAO 56 method (Allen et al., 1998), with the reference evapotranspiration and a culture and phase specific crop coefficient. The relation between water allocated to cultures and yield is estimated using the additive yield water response function based on the FAO 33 method (Doorenbos and Kassam, 1979). In a farming zone the same area can be used by several cultures during different periods of 5 the year, representing multiple harvests per year; the schedules are defined by the user. The model either finds the optimal crop choice per year or assumes a fixed crop distribution for the entire simulation period. However, additional constraints such as maximum area per culture and farming zone can be used to represent physical, institutional or economic constraints which are otherwise not included in the modelling framework. Crop production costs represent costs of infrastructure, machinery, labour, land, chemicals and fertilizers, depending on the culture and farm type. 10

Crop markets
The crop market module represents the local demand, transport, and trade of crops. Crop markets are characterized by a demand, a marginal value and a demand elasticity for the different crops. A minimum supply requirement can be defined, to represent food security constraints. Crops produced in the farming zones are transported between crop markets through transport routes, with associated costs and losses. External markets can be introduced to represent imports and exports out of 15 the study area. These markets behave as the other crop markets, but their crop production is represented through an external crop production function which does not depend on farming zones (the function is assumed to be infinite and perfectly inelastic).

Energy production
The energy modules focus on electric energy, also called the "power system", and do not consider fuels for transportation, 20 cooking or heating. Power is produced by hydropower turbines and other power plants (such as thermal, solar, wind and biomass). Hydropower turbines are either linked to a reservoir or are run-off-the-river and have associated operation costs and water-energy equivalent factors. Other power plants are defined by their efficiency, fuel use, operation costs and production capacity. In addition, generic power technologies represent additional capacity that can be invested in, similarly to capacity expansion models (e.g. Howells et al. (2011)). They have associated capacity construction costs, fixed and variable operational 25 costs, fuel use and efficiencies that can be defined for every power market (see Sect. 2.5 for power markets). "Other power plants" and "generic power technologies" are represented in a similar way; the main difference is that the first can be used to represent specific existing or planned power production units, while the second represents potential technologies available to the capacity expansion model. Fuels represent the different natural resources that can be used to produce energy (e.g. coal, gas or sun); fuel consumption is determined by the power plant's efficiency and a fuel price can be defined per power market. CO₂ 30 emissions are associated to different fuels, which lead to CO₂ emission costs if a carbon cost is defined.

Energy markets
The power market module accounts for the power network and the power demand. Power markets define the resolution of the power network and the power demand, they can be defined nationally or regionally. As for crop markets, they are characterized by a demand and marginal value for power, however demand is assumed to be perfectly inelastic. Transmission lines carry energy between power markets with associated costs and losses and a limited capacity. This corresponds to a "transport model" 5 or "transhipment model", which does not consider reactive power flows and voltage angles, but is commonly used for planning energy systems as it requires less data and computation time than AC or DC power flow models (Krishnan et al., 2016). The base time scale for the power system is, as for the hydrology, the monthly time step. However, the power demand can be divided into different load segments (such as peak and base, day and night) defined by the user. Load segments are commonly used in energy models with large time steps to better represent the effects of peaking demand (Palmintier, 2013). Some generic 10 power technologies can have a limited capacity during specific load segments, this feature serves to represent renewable energies such as solar or wind (e.g. no solar energy is available at night, windy or less windy segments can be defined).

Economic optimization
The economic module is the objective function of the optimization model. The equations are solved to find the optimal water, agriculture and energy management decision variables minimizing the costs (/maximizing the benefits) resulting from previous 15 modules while respecting the physical, political and economic constraints. In welfare economic terms, this corresponds to the maximization of the total consumer and producer surplus for all commodities represented: water, crops, and energy (see Krugman and Wells (2005) for details on consumer and producer surplus). According to the second welfare economic theorem, any pareto optimal allocation can be reached by a competitive market. This means that the "centrally planned" solution from the economic optimization module, is the same as the individual profit maximization solution, assuming that water, energy 20 and crops could be traded on perfect markets.
The objective function φ to maximize is expressed as: φ = WSB − WSC + CSB − CSC − CPC + ESB − ETC − EPC Where WSB represents the water supply benefits, WSC the water supply costs, CSB the crop supply benefits, CSC the crop supply costs, CPC the crop production costs, ESB the energy supply benefit, ETC the energy transmission costs, and EPC the energy 25 production costs which are the sum of the energy operational costs, fuel consumption and CO₂ emission costs and the capacity expansion costs (see the Supplementary materials for the complete description of the equations).
The main link in the nexus, is the water resource for which hydropower, irrigation and ecosystems compete ( Figure 2). The energy markets provide a dynamic value to hydropower production, while the crop markets provide a dynamic value of irrigation. The markets are therefore indirectly linked through the water trade-offs between hydropower and irrigation. 30 Exogenous drivers on these markets such as new policies, technological and socio-economic changes, indirectly affect the water trade-offs and therefore all markets.
The main outputs of the economic optimisation are the optimal decisions in terms of water, energy and agricultural management and the resulting economic impacts on different groups of actors. Equally important outputs are the shadow prices of the constraints (also called duals) that reveal the equilibrium prices of the different commodities and give information about capacity constraints (e.g. the marginal value of additional storage or transmission capacity) that can help identify bottlenecks in the systems (Harou et al., 2009). 5

The Zambezi river basin study case 10
The Zambezi river plays a central role in the regional economy and is shared by eight riparian countries: Angola, Botswana, Malawi, Mozambique, Namibia, Tanzania, Zambia, and Zimbabwe. The countries formed the Zambezi River Commission (ZAMCOM) in 2014, which is the river basin organisation supporting transboundary water management. The water resource supports agriculture, fisheries, hydropower production, water supply and sanitation, navigation, tourism, industries and mining.
The basin extends over almost 1.4 million square kilometres, sustaining the basic needs of 40 million people and a rich and 15 diverse natural environment. In the river basin, 77% of the population have access to safe and adequate water supply and 60% has access to adequate sanitation, which is above the Southern Africa averages (SADC et al., 2015). The area is mainly covered by forest and bush (75%), while cropland represents only 13% of the area, mainly rainfed, as less than 5% of the cropland is irrigated (SADC et al., 2015). The main source of energy is biomass, fulfilling 80% of the demand; a limited share of the population has access to grid electricity, ranging from 12% in Zambia to 40% in Zimbabwe (SADC et al., 2015). Population 20 is expected to grow rapidly, reaching 51 million in 2025 and 70 million in 2050, which will increase the demand for water, food and energy (SADC et al., 2015). Therefore, the water resources of the river basin are critical to sustainable economic growth and poverty reduction in the region.
The World Bank carried out the Multi-Sector Investment Opportunities Analysis (MSIOA) study (World Bank, 2010), that analyses the value of the hydropower and irrigation projects and trade-offs between them. The study finds that the hydropower development plan is able to meet the region's current energy demand and that the implementation of the irrigation development 5 plan would reduce the current hydropower production by 9%.  also investigate trade-offs between hydropower and irrigation development in the Zambezi basin, using a stochastic hydroeconomic optimization formulation.
The study finds that some of the upstream irrigation projects are not viable if the downstream hydropower projects are developed. However, the study uses an exogenous price for hydropower and irrigation water, and, as the World Bank study, it does not consider climate or socio-economic changes. Beilfuss (2012) points out that most of the planned hydropower projects 10 were evaluated using historical hydrologic data, not considering climate change and may therefore be economically not viable.
Furthermore, the study highlights the lack of consideration of the impact on ecosystems of large hydropower projects. In a further World Bank study, Cervigni et al. (2015) assess potential impacts of climate change on water infrastructure in sub-Saharan Africa. The study finds for the Zambezi that in the driest scenario hydropower production could decline by up to 60% and unmet irrigation demand increase by up to 25%. Focused on the power system, the IRENA (2013) Cervigni et al. (2015) find that hydropower production could decline by 10-20% in a drying climate which could increase generation costs by 20 to 30% in the most hydropower-dependent countries. The agriculture system is, however, not part of the integrated analysis. In a 20 broader perspective, the Zambezi Environment Outlook study (SADC et al., 2015), presents an integrated analysis of the Zambezi river considering ecological, social and economic issues.

Hydrology, reservoirs and environmental flows
Figure 3: The water system representation. The river basin is divided into hydrological catchments defining the river network and a rainfall-runoff model gives water availability. Reservoirs can store and release water. Water users represent large non-agricultural consumption, such as mining.

5
The hydrologic data used in this study is the same as the data used in Cervigni et al. (2015). The historical climate dataset is from Sheffield et al. (2006), and runoff is given by a lumped rainfall-runoff model from Strzepek et al. (2011). As the annual flow follows long term cycles, we use a 40 years time series, from 1960 to 1999: the years 1982-1998 are significantly below average and the years 1960-1982 are above average (Beilfuss, 2012). The rainfall-runoff model exogenously considers the effect of wetlands that evaporate part of the river flow. Therefore, the impact of reservoir operations on wetland dynamics is 10 not represented; however, only the Kafue flats are located downstream of a major reservoir (Itezhi-Tezhi) and upstream of other water users. According to World Bank (2010) groundwater is not overexploited in the river basin, furthermore there is almost no data available concerning groundwater, therefore, like in similar studies in the basin, groundwater is ignored in this study. The main reservoirs of the Zambezi river, Itezhi-Tezhi, Kariba and Cahora Bassa dam ( Figure 3) have a total active storage capacity of 127 000 million m³, slightly higher than the mean annual flow. Evaporation from the reservoirs is the main 15 consumptive water use, ranging from 7 800 to 16 989 million m³ per year depending on the studies (Beilfuss, 2012;Euroconsult and Mott MacDonald, 2008;, see Sect Kafue flats and Barotse Plain in Zambia, Mana Pools in Zambia and Zimbabwe, and Zambezi Delta in Mozambique. We do not represent the economic value of these, but use environmental flow requirements from (World Bank, 2010), which are based on two assumptions: flow should not drop below the low-flow level in dry years and average annual flow should not drop below 60% of the mean average annual flow. This constraint is applied at the Barotse floodplain, the Kafue Flats, the Luangwa river, the lower shire, and the Zambezi delta ( Figure 3). 5

Energy
The national power utilities of the Zambezi basin are members of the Southern African Power Pool (SAPP), which is the institution overseeing the power sector in southern Africa. The goal of the SAPP is to develop of a competitive electricity market in which power is traded in bilateral, forward physical, day ahead and intraday markets. The SAPP power pool is dominated by South Africa which represents roughly 80 % of the demand and production (SAPP, 2015). Coal is the main 10 source of power production (77%), followed by hydropower on the Zambezi and Congo river basins (21% of installed capacity), nuclear, gas and renewables representing only a minor share (SAPP, 2015). The members of the SAPP are interconnected with transmission lines, except for Angola, Malawi and Tanzania which are isolated. The demand for electricity is growing rapidly, and in recent years power shortfalls became common particularly in Mozambique, Malawi, South Africa, Zambia and Zimbabwe (World Bank, 2010). Figure 4 shows an overview of the energy system representation. 15

Energy markets
To represent the energy system, we consider one power market per country (Figure 4), including South Africa which is the main power exchanger with the Zambezi basin. National power demands are found in SAPP (2015). We assume non-satisfied power demand is compensated by running fuel generators, so power curtailment costs are estimated at 240 $ MWh -1 . The monthly energy demand is divided in two load segments: a base demand and a peak demand. Based on SAPP (2015), the peak 20 load is during day and covers 70% of the total demand, while the base load is during night and covers 30% of the demand, both are assumed to cover half of the monthly time step. Energy demand is assumed to be perfectly inelastic, as most consumers do not have hour-by-hour metering, the price signal from the marginal cost of production is assumed to not reach the consumer.
The transmission network is represented by aggregated transmission lines among countries that are connected, the transmission capacity and loss rate are found in IRENA (2013), SAPP (2018) and World Bank (2010). 25

Energy production
We represent the existing hydropower plants and one aggregated power plant per country (Figure 4) representing the total nonhydropower generation capacity, using data from World Bank (2010). For hydropower plants, the water-energy equivalent factor is derived from turbine capacity in m³/s and power output in MW from World Bank (2010). In addition, three generic technologies are available for additional investments: supercritical coal, combined cycle gas turbines (CCGT) and solar 30 photovoltaic. Investment costs, fix and variable operation and maintenance costs, lifetime, and efficiency of these technologies are found in (IRENA, 2013), we assume the same parameters for all countries. However, gas and coal (fuels) costs vary among countries, depending on their local availability (IRENA, 2013). To represent intermittency constraints in a simplified way, solar energy is assumed to be unavailable during the base load segment (night), and the peak load segment (day) is divided in two: days where solar energy can be produced and days where it can't. The length of these two load segments is adjusted to fit the load factor of 25 % used in (IRENA, 2013) for solar photovoltaic energy. 5

Agriculture 10
According to FAO (2018), the total production value of the agricultural sector in the Zambezi basin is around 6.7 billion dollars per year (the numbers are estimated by downscaling national statistics from 2010 to 2016 with the population ratio). Among these, 1.7 billion dollars is from exports and half of the exports are tobacco. The crop imports represent 1.2 billion dollars per year, wheat and rice being the most imported crops. Agricultural markets are heavily regulated by policies such as import or export bans and crop prices fixed by the governments, therefore little trade occurs among the Zambezi countries. The trade 15 among Zambezi countries accounts for only 320 million dollars per year, and almost half of it is exports of maize and tobacco from Zambia to Zimbabwe.

Main crops and cultures
To represent the most significant crops in the agricultural module different aspects should be considered: the cultivated area per crop has the strongest impact on water demands for agriculture, however the value of agricultural production indicates which crops have the biggest economic impact. Another factor is which crops are mainly used for irrigated agriculture, as these will have a bigger impact on the nexus and irrigation projects. To simplify the model, some crops are grouped, which assumes 5 that crops in the same group are fully substitutable and have the same value. Table 1 shows all selected crops; cassava, maize and roots represent more than half of crop production, cultivated area and value of production. However, for irrigated agriculture the most important crops are cereals, rice, sugar cane and stimulants. Some of the crops can be produced by different cultures (e.g. summer and winter); the represented cultures are: cassava, potato (roots), wheat and sorghum (cereals), summer and winter maize, vegetables, sugarcane, summer and winter rice, fruits, groundnuts and soybeans (oilseeds), stimulants, 10 summer and winter beans (pulses).
Potential yields of the different cultures are estimated as the maximum observed yield in each country from the FAO (2018) "Production quantity" and "Area harvested" data between the years 2000 and 2016. This assumes the maximum yield was obtained due to optimal hydrologic conditions, all other inputs being equal. In general, yields in Zambezi countries are lower than average expected yields because of very low inputs (World Bank, 2010). We consider four growing phases for all cultures 15 (initial, crop-development, mid-season and late season). The corresponding crop coefficients (Kc) and yield water response coefficients (kY) used in the model to calculate the water requirements and the resulting yields are found in FAO 56 (Allen et al., 1998), World Bank (2010) and FAO 33 (Doorenbos and Kassam, 1979). Average irrigation losses in the Zambezi area are estimated at 55% between gravity and sprinkler irrigation systems, considering conveyance, distribution and application losses (World Bank, 2010). Return flows are estimated at 30% for all cultures and catchments. Cultivation costs per hectare for 20 different cultures are derived from Social Accounting Matrices of Malawi, Mozambique and Tanzania (IFPRI, 2014(IFPRI, , 2015(IFPRI, , 2017a. Cultivation costs include seeds, fertilizers, chemicals, labour and capital costs, the cost per hectare is calculated by dividing the total economic flow by the area cultivated the corresponding year. As few data are available, we consider a different cost per culture but use an average cost over all countries. The land costs are not included as the model internally represents a market for agricultural land use. We consider two farming zones per catchment, representing irrigated and rainfed 25 land. Available area for rainfed and irrigated agriculture is obtained from the spatial data of the SPAM model (IFPRI and IIASA, 2017) and from World Bank (2010). For irrigated agriculture the crop choice is constrained by the observed area for each culture, this is to avoid over production of very profitable cash crops and takes into account non-represented physical, socio-economic or political constraints. production, cultivated and irrigated area and of the production value. The production value excludes meat and dairy products. Some crops have a moderate impact on the global economy (e.g. cereals, rice and stimulants) but are important for irrigated agriculture. The share of irrigated area is from World Bank (2010)

Crop markets, demands and values
To represent demand for crops, we consider one crop market per country, as data is usually at national level. Demand per country is derived from the "food supply quantity" data (in crops primary equivalent) from FAO (2018) averaging the years 2010-2016. National data is then downscaled by the ratio of population within the Zambezi basin to get the local demand. As no data was available, we assume the demand to be perfectly inelastic. To represent imports and exports out of the Zambezi 5 area, we also consider an international market that has an infinite demand for cash crops like sugarcane and stimulants.
Willingness to pay for crops in each crop market is evaluated as the "value of agricultural production" divided by the "production quantity" from FAO (2018). International market crop prices are the average import price for the Southern African market, calculated as the "value of import" divided by "import quantity" from FAO (2018). The same value is used for external supply costs from the international market, meaning that crop markets in the Zambezi can import crops at this price. As few 10 data are available on transport and transaction costs, we assume that the transaction costs for imports from the international market are the difference between the international market price and the observed import price in each country from FAO (2018). Similarly, for exports towards the international market, the transaction costs are estimated as the difference between the international market price and the observed export price in each country. Transaction costs among countries are set as the difference between the import prices.

Hydropower development plan
To respond to the rapidly increasing demand, SAPP countries are planning new or refurbished hydropower and thermal power plants, as well as new transmission lines. We refer to the " hydropower development plan" or "HDP" as the ensemble of projects described in World Bank (2010), it includes 15 projects with 7.2 GW of new operating capacity ( Figure 5, Table 2). Investment costs in the hydropower projects range from 837 $ kW -1 for Kapichira II to 3375 $ kW -1 for the Batoka Gorge 10 South project, total investment costs reach 12.5 billion dollars and fixed annual operating costs are estimated at 56 million dollars (IRENA, 2013). Transmission line projects are not considered as part of the HDP but are considered in future scenarios.
Other power generation projects are not considered individually, however the representation of generic power technologies simulates additional investments in power generation.

Irrigation development plan
We consider the irrigation development projects formulated in World Bank (2010), referred as "Irrigation development plan" or "IDP". With almost 100 identified irrigation projects aggregated per catchment, the IDP adds around 336 000 ha of equipped area to the 182 000 existing ( Figure 5, Table 3). "Equipped area" refers to the actual land use, while "irrigated area" usually double counts winter and summer crops on the same land. The total investment costs of the IDP are evaluated at 2.5 billion 5 dollars (World Bank, 2010). The most important cultures in terms of area are: sugarcane (23%), rice (17%), wheat (15%) and maize (14%). The crop choice for the irrigated areas is constrained to the planned crops using data in World Bank (2010). We assume that irrigation projects replace existing rainfed areas as long as the irrigated area does not exceed the total available area.

Climate change, future scenarios and uncertainty analysis
The Zambezi river basin was classified by IPCC as being severely threatened by the potential effects of climate change (IPCC, 2001), according to World Bank (2010) the runoff might be reduced by 12 to 34 % depending on the regions. Furthermore, population is expected to grow from 40 to 70 million until 2050 (SADC et al., 2015). This will drastically increase energy and food demand and accentuate the pressure on ecosystems. As the investment plans involve infrastructure with a long lifetime, 5 over 50 years for hydropower plants, it is crucial to consider the potential future climate and socio-economic scenarios. Table   4 offers an overview of the considered scenarios.
We consider four climate change scenarios from Cervigni et al. (2015): dry, semi-dry, semi-wet and wet for the period 2001 to 2050. The scenarios are derived using Bias Correction and Spatial Downscaling from the General Circulation Models (GCM) of the Climate Model Intercomparison Project -Phase 5 (Brekke et al., 2014), applied to historical climate data. Crop demand is expected to increase by 10% (roots and tuber, Angola) to 140% (fruits and vegetables, Zambia) by 2030, depending on crops and countries (IFPRI, 2017b). We consider demand growth in the 2030 and 2050 scenarios, using projected 25 demands for 2030 and 2050 from IFPRI (2017b). According to OECD and FAO (2017), yields will increase by 0.5 % (roots, Mozambique) to 3.8 % (rice, Zambia) per year; we consider this in the 2030 and 2050 scenarios, assuming continuous growth.
This might be optimistic when FAO (2018) data shows that yields for some crops (e.g. rice, wheat, and sugarcane) in the Zambezi countries have been stable for the past 20 years. Thus, we also consider no yield growth for the sensitivity analysis of the 2030 scenario. National and crop specific yield data are available for Mozambique, Tanzania and Zambia, the sub-30 Saharan average is used for the other countries. Similarly, rainfed area should increase by 1.2% (Tanzania) to 2% (Mozambique) per year (OECD and FAO, 2017), we include these changes in the 2030 and 2050 scenarios. As no data was available, we assume world market crop prices remain stable in the future scenarios. However, we test the sensitivity of this assumption by varying world market crop prices by +/-20% in the 2030 scenario.

Results and discussion
In this section, we illustrate how the Zambezi model can be used to answer questions such as "What are the potential impacts 5 of climate change on the agriculture and energy systems?", "What are the benefits of the hydropower and agricultural development plans?", "What is the sensitivity of these benefits regarding uncertainties in policies, future climate and socio-economic development ?", "What are the synergies and trade-offs between the irrigation and hydropower development plan?", and "What are the opportunity costs of restoring flood regimes in the Zambezi delta ?"

Model validation
To validate the model, we show the overall results of the 2010 scenario, which is the situation in the Zambezi river basin around the year 2010. The water balance for the Zambezi river basin (Table 5) shows that the main water consumption is 5 evaporative losses from reservoirs (mainly the Kariba and Cahora Bassa dams). The total water consumption reaches around 10% of the total available water. Agricultural uses represent only around 25 % of the total water consumption, and domestic and industrial consumption around 5%. The average runoff and reservoir evaporation vary significantly among the different studies (Table 5), it is unclear if the studies report net or gross evaporation (including or excluding rainfall on the reservoir area). For the average runoff, the difference is most likely due to different reference periods, according to our data the average 10 yearly runoff from 1960 to 1980 was 129 000 10 6 m³, while from 1980 to 2000 it was only 100 600 10 6 m³.
The model reproduces the patterns of agricultural water consumption per country (Table 6), with some differences between Zambia and Zimbabwe. These differences may be explained by differences in aggregation of agricultural areas at the border between Zambia and Zimbabwe between this and the World Bank (2010) study. The modelled value of crop production (Table   7) is in accordance with observations; main production is in Malawi, followed by Zambia and Zimbabwe. The "observed" 15 value is obtained by downscaling national statistics assuming constant per capita value, and is therefore not a precise number.
Hydroeconomic models often valuate agriculture by considering a willingness-to-pay for water by agriculture users, or by representing crop production and valuating crops at the farm level (Bauer-Gottwein et al., 2017;Harou et al., 2009). Nonmarket approaches include the following limitations: (1) crop demand is not represented, (2) crop trade, transaction costs, and losses are not represented, (3) food security constraints cannot be represented, (4) the interactions with rainfed agriculture 20 cannot be represented, and (5) it requires to calculate an exogenous willingness-to-pay for water or crops for each considered socio-economic development scenario potentially affecting the crop markets. In this study we use a market approach valuating crops at the consumer level. Non-market and market approaches can be similar if irrigated crops are a marginal share of the total production, and if supply, demand, and trade of crops remain stable. In the Zambezi, irrigated crops are a small share of the total production. However, we analyse the potential impacts of climate change, significantly affecting rainfed production, 25 and therefore crop supply and food security constraints, in the context of an increasing crop demand. Therefore, the market approach is necessary to perforn the analysis of this study.
Hydropower production per plant (Table 8) is similar to World Bank (2010), with small variations linked to differences in modelling approach and hydrologic data. A common approach to value hydropower production, is to use the concepts of firm and secondary power and value them differently to indirectly represent the power market. In the World Bank (2010) study, 30 firm power is calculated as the power production available 99% of the time (at the monthly scale) at a single plant, while secondary power is the remaining power production. Indeed, assuming a constant power demand at the monthly time scale, firm power can replace investments in thermal power capacity, while secondary power needs to be balanced by thermal capacity. Thus, secondary power is only saving fuel costs but not ramping and capacity investment costs and has therefore a lower value. In this study we do not use the firm power concept but simulate the power market instead. Although the hydropower plant production is not optimized for firm power, we find similar results to the World Bank (2010) study (Table   8). The reasons are that: (1) we do not consider seasonal variations in the availability of a power source (e.g. solar capacity has a diurnal variation but seasonal variation is assumed to be negligible), (2) low and high flow seasons occur at the same 5 time of the year throughout the basin reducing the benefit of coordinating hydropower production in different subbasins, and (3) reservoirs have a high storage capacity enabling hydropower plants to operate with relatively stable monthly releases.
Although the firm power and market approaches give similar results in this case, the firm power approach has some limitations: (1) it does not represent transmission constraints which are considered to be important in the SAPP power system (Spalding-Fecher et al., 2017b), (2) it does not consider the power demand, (3) it does not enable coordination between several 10 hydropower plants to balance fluctuations in production at individual plants, (4) it does not enable representation of the benefits of hydropower as a peak power source, satisfying peak demand or balancing an unstable power source such as solar or wind, and (5) it cannot be used to evaluate the impact of carbon tax policies, capital costs of renewable technologies, and future energy demand, which would require an exogenous model to calculate firm and secondary power values for each scenario.
In general, the model reproduces the trends observed in the reference scenario for the water, energy and agriculture systems, 15 but some differences appear. Therefore, in the following analysis, most of results are not shown as absolute values, but as relative changes between different scenarios. Table 5: Water balance of the reference scenario. Results are presented as the average for the 40 years simulation. The amount of runoff and reservoir evaporation varies significantly depending on the studies. Average yearly runoff might be influenced by the historical period considered. *It is not clear if the cited studies report reservoir evaporation as net (including rainfall) or gross values, t his might explain 20 differences. **The publication reports an average runoff of 130 300 10 6 m³ year -1 , however this is believed to be a reporting mistake (Strzepek 2019, Personal communication), the average runoff used in the calculations is 107 000 10 6 m³ year -1 .     Climate change is found to have important potential impacts, inducing losses of more than 2.3 billion dollars per year in the driest scenario to increasing benefits by 400 million dollars per year in the wettest scenario (Table 9). In the driest scenario, average runoff is more than halved, reducing by 50% current hydropower production. This causes economic losses to the energy sector of more than 700 M$ yr -1 . In the wettest scenario, the average runoff increases by 35%, increasing hydropower 5 production by almost 5 000 GWh yr -1 , resulting in an increased benefit of 220 M$ yr -1 for the energy sector. The agricultural sector is particularly sensitive as it mainly relies on rainfed agriculture. The driest scenario seems to be a critical threshold where an important portion of rainfed cultures show low yields. Indeed, from the semi dry to the driest scenario the induced economic losses rise from 200 to 1 640 M$ yr -1 and the crop price index from +4% to +33%. Similarly, the value of water in the Shire river (Malawi) is not affected in the semi dry scenario but rises considerably in the driest scenario (Figure 7). In fact, 10 in the semi dry scenario Malawi observes losses of only 8 M$ yr -1 , but in the driest scenario, losses reach more than 800 M$ yr -1 (mostly to the agriculture sector).

Hydropower development plan
The hydropower development plan (HDP) is found to produce an extra 28 000 to 33 000 GWh yr -1 (Table 10), which is in accordance with World Bank (2010) (30 400 GWh yr -1 ). For the 2030 scenario, the resulting value is around 1 932 M$ yr -1 .
Considering the total investment costs of 12.5 billion dollars as well as the fix annual operating costs and a lifetime of 50 years 20 for the hydropower projects, this represents an internal rate of return of 14.7 % (assuming overnight construction of the hydropower projects, excluding cost and benefits linked to non-represented elements such as fishing, tourism, flood regulation, navigation and ecosystem services). The main benefits occur in countries with new major hydropower projects (Zambia, Zimbabwe, Mozambique and Malawi), however even countries that do not have any projects (e.g. Namibia) benefit from cheaper power imports (Table 11). While Zambia and Zimbabwe use most of the additional energy for own supply, Malawi 5 exports half and Mozambique exports all of it. The impact of the HDP on the electricity price is relatively small as an important share of the demand is satisfied through thermal power. Therefore, the economic impact is mainly producer surplus, while consumer surplus is limited (Table 10). However, this varies locally, in Malawi the HDP makes the country almost independent from thermal power, lowering electricity prices by 16 $ MWh -1 and generating important consumer surplus (Table 11).
Hydropower production is around 4 000 GWh yr -1 lower in the 2010 than in the 2030 scenario (Table 10), this can be explained 10 by demand limits and the fact that in the 2010 scenario Malawi is not connected to the SAPP grid and cannot export over production of its Run-Off-the-River hydropower plants. In fact, under the HDP in the 2030 scenario, power transmission among SAPP countries is considerably increased, including transfers from Malawi to Mozambique (Figure 8). In the practical implementation of the HDP, projects would be implemented gradually, therefore the demand constraint would probably not be a problem, however in this study we do not consider the timing and sequencing of the projects. The main difference between 15 the 2010 and the 2030 scenarios is the generated benefits. The driving factor is the potential carbon pricing policy, as it will considerably affect fuel costs and therefore the cost of generating power with thermal power plants (Figure 9). We consider carbon price as a cost, while it could also be considered as a tax and therefore have no effect on the welfare impact (being a money transfer from producers to states). However, the principle of a carbon price/tax is to compensate for CO₂ emissions, which will therefore result in a cost. Thus, the price of electricity for consumers increases from 53 $ MWh -1 in the 2010 20 scenario to 73 $ MWh -1 in the 2030 scenario, increasing the value of developing hydropower.
The HDP has no impact on the agricultural system (Table 10), neither positive or negative, and vice versa, the development of the irrigation development plan does almost not affect its value (Figure 9). The value of the HDP is relatively sensitive to climate change; it varies from 1 651 to 2 075 M$ yr -1 for the driest to the wettest scenarios. The additional hydropower production is severely impacted in the driest scenario, producing only 25 000 GWh yr -1 against 37 000 GWh yr -1 for the wettest 25 scenario. However, climate change has more impact on the current hydropower plants, where the driest climate change scenario is found to halve current power production (Table 9). Another influencing parameter for the value of the HDP is the capital costs of solar photovoltaic power, as this affects the cost of producing alternative energy. With solar capital costs ranging from 2000 $ kW -1 to 500 $ kW -1 , the electricity consumer price varies from 80 $ MWh -1 to 70 $ MWh -1 , and the value of the HDP from 2070 to 1880 M$ yr -1 . Excluding solar photovoltaic technology from the simulation does result in the same value for the 30 HDP in the 2030 scenario. Solar power has a double effect on the value of hydropower plants: on one hand, it reduces electricity prices and therefore the value of hydropower energy; on the other hand, it increases intermittency of the power system and so the value of flexible hydropower generation. As there is already an important hydropower capacity available in the Zambezi river basin, both effects compensate in this case.
Figure 8: Power transmission, hydropower production and additional capacity investments before and after implementation of the hydropower investment plan. The implementation of the hydropower development plan is found to increase considerably the power exchanges among the SAPP countries and reduce the needs to invest in additional power generation capacity.

Irrigation development plan
The irrigation development plan (IDP) is valued between 650 and 1220 M$ yr -1 depending on the scenario (Table 12).
Considering investment costs of 2.5 billion dollars and a lifetime of 20 years for the infrastructure, this corresponds to an internal rate of return of 26 % to 49 % (ignoring maintenance costs). The important variation can be explained by the expected 10 growth in yields that should more than double between the 2010 and 2050 scenarios (OECD and FAO, 2017). This assumption might be optimistic given that according to FAO (2018) data, for several crops yields have been relatively stable over the past twenty years. The implementation of the IDP more than doubles irrigated area (+430 000 ha), as well as water consumption (+5 200 10 6 m³ yr -1 ). Because of the increased water consumption, the benefits of the IDP for the agriculture sector are to a limited extent counterbalanced by losses in the energy sector. In fact, around 5% of the benefits are lost because of resulting 15 hydropower shortages of about 1 200 GWh yr -1 (Table 12). This is a lower level of trade-offs than in World Bank (2010), which estimated hydropower shortages around 2 700 GWh yr -1 . The most affected country is Mozambique (-650 GWh per year); because it is the most downstream country, its hydropower production is affected by the water consumption in Zimbabwe, Zambia and Malawi (Table 13, Figure 10). More than 80% of the value of the IDP is generated through crop trade (Table 12, Figure 10), thus world market crop prices are a very sensitive parameter (Figure 11). A reduction of 20 % in world market crop prices would reduce by 25 % the value of the IDP. As most of the profits are linked to exports, the IDP has a 5 relatively small impact on crop prices, and therefore, benefits occur mostly as producer surplus rather than consumer surplus (Table 12). A drier climate has a twofold impact on the IDP (Figure 11): it reduces rainfed production and thus increases the value of irrigation, but it also increases trade-offs with the energy sector. In fact, in the current climate scenario the IDP saves 48 M$ yr -1 of import value from the world crop market to satisfy food security constraints, while in the driest scenario it saves 95 M$ yr -1 of import value. This shows the importance of representing rainfed agriculture to assess the value of irrigation 10 projects. However, hydropower shortages induced by additional water consumption range from 515 GWh yr -1 in the wettest scenario to 1 600 GWh yr -1 in the driest scenario, inducing losses in the range of 24 to 104 M$ yr -1 (representing up to more than 10% of the benefits) which counterbalance the import substitution effect in the crop market. The trade-offs are limited because the water consumption is a small share of the available water (around 15% including the irrigation development).

Implementation of the hydropower development plan is not found to increase trade-offs between irrigation and hydropower 15
and has no impact on the value of the IDP (Figure 11).   (10 6  Implementation of the IDP is found to increase crop exports to the world market and more than double water consumption. The "crop transactions" towards the exterior of the Zambezi area represent exports to the world market. Natural flooding in the wetlands and the Zambezi delta was severely affected by the construction of the Kariba and Cahora Bassa dams. Indeed, as at the monthly scale, thermal power plants have a stable production, hydropower production is more valuable when it is as constant as possible, therefore the dams tend to stabilize the water releases throughout the year. However, 10 floods play an important role for ecosystems in the wetlands and therefore a potential policy is to restore the natural floods (World Bank, 2010). Figure 12 shows the opportunity costs of restoring floods in February for three flood levels and the four climate change scenarios, considering a 100 % (the constraint is fulfilled every year) and an 80 % compliance (the constraint must be fulfilled 4 out of 5 years). Opportunity costs of the "base" environmental flow policy are almost zero except for the driest climate change scenario. The restoration of the natural floods induces increasing costs with the flood level target: costs 15 reach up to more than 800 M$ yr -1 for the driest scenario and the highest flood level, but stay under 150 M$ yr -1 for the semi wet and wettest scenarios. This is in accordance with  who found opportunity costs of 104 M$ yr -1 for restoring floods under current climate. We consider here only opportunity costs of the policy as trade-offs with hydropower production and irrigation, but not benefits linked to direct and indirect use and non-use values of ecosystems or costs linked to population displacement. More than half of the population depends directly on wetland ecosystems (SADC et al., 2015), 20 therefore benefits linked to the protection of ecosystems might be important and a complete cost-benefit analysis would reveal the value of such environmental policies.

Limitations and further research
By connecting the water, energy and food systems in a holistic framework and using an economic optimization approach we showed how we could evaluate the development plans in the Zambezi river basin considering different scenarios. We list here 5 some limitations of the model and avenues for further development that could be particularly interesting: Depending on the context, additional interrelations in the Water-Energy-Food nexus, which are currently not simulated in the framework, can play an important role such as: energy consumption for water treatment or desalinisation (Dubreuil et al., 2013), energy for water pumping in the agricultural or domestic sector Dubreuil et al., 2013), water for cooling purposes of thermal power plants (Payet-Burin et al., 2018;Van Vliet et al., 2016) and production of crops 10 for biofuels (Mirzabaev et al., 2015). For study cases where these interactions have an important impact, they can be added to the modelling framework.
In the next decades, renewables such as solar or wind energy will be crucial in the Southern African power sector (IRENA, 2013) and intermittence constraints will be a key element of future power systems. Hydropower plants have a lifetime of above 50 years and will therefore evolve among these future conditions. Hence, valuation of hydropower projects using a fixed price 15 (e.g.  or the concept of "firm energy" (e.g. World Bank, 2010) might no longer be appropriate (Palmintier, 2013). In this study, by using the concept of "load segments" (sometimes called "time slices"), we made a step towards the representation of intermittent energy systems, but a more detailed representation (considering e.g. ramping constraints, minimum loads, sun or wind profiles) will be key to correctly value hydropower projects.
In this study, we only considered the water resource in terms of quantity, however water quality may have an important impact 20 for water treatment, irrigation, fishing, and tourism. Different approaches could be considered: (Boehlert et al., 2015) combine a water management model with a water quality model considering chemicals and reactions and represent advection among river branches, while Martinsen et al. (2018) consider water quality classes, with associated treatment costs and quality requirements for the demands, in a hydroeconomic optimization framework.
We presented the economic values of the development plans and their sensitivity to different sets of parameters but did not 25 perform a complete Cost-Benefit Analysis of the projects. Costs and benefits linked to impacts on ecosystems, fishing, flood control, tourism, sedimentation and navigation need to be considered separately to complete a full Cost-Benefit Analysis of the infrastructure projects. Besides, some studies claim that the evaluation of investment costs, including financing, construction and resettlement costs are systematically and significantly underestimated (Ansar et al., 2014;Awojobi and Jenkins, 2015), which adds to the uncertainty in the net present value of the infrastructure projects. 30 By evaluating the development plans in the 2010, 2030 and 2050 scenarios, we showed that the timing of the investments plays an important role in an evolving socio-economic context. Furthermore, not all projects which are part of the development plans may be profitable. Therefore, an important analysis would be the selection of the optimal projects, as well as timing and sequencing of investments, considering gradual changes in the socio-economic and climatic context.
The optimization framework of the model assumes full cooperation among different political and sectorial entities (e.g. upstream farmers in Zimbabwe may forgo some water abstractions to benefit Mozambique's downstream hydropower production). The practical implementation of such trade-offs might be possible by using compensating payments (Tilmant et 5 al., 2009), another approach is to consider trade-offs between efficiency and equity by using a multi-objective optimization (Hu et al., 2016). However, as this may be institutionally and politically complicated, decision makers might be interested in knowing the impacts on the planned projects if one or several countries do not cooperate. This could be implemented in the current modelling framework by solving the management decisions using a local objective function from upstream to downstream. 10 Finally, we use a perfect foresight approach which is common to sectorial planning models (e.g. Kahil et al. (2018), Khan et al. (2018)). This means that optimal management decisions will anticipate future conditions such as droughts by storing additional water or cultivating crops with lower water requirements, leading to overestimation of system performance. In reality, water planners and managers will not have perfect foresight, and will be limited by the availability and skill of existing forecasting systems. The validation of the model against observed indicators, shows that the bias due to perfect foresight 15 assumption is not excessive. Furthermore, part of the bias is cancelled by doing relative analysis (e.g. with and without infrastructure development, with and without climate change scenario). However, as droughts have important economic impacts (SADC et al., 2015), a more realistic way of modelling reservoir operations and agriculture decisions could improve the reliability of the results. One way to implement this in the current modelling framework is to use Model Predictive Control and iteratively solve the optimal management decisions in each time step with a limited knowledge of the future (Sahu, 2016). 20

Conclusion
We presented a new open-source decision support tool for economic valuation of water infrastructure and policies in the waterenergy-food-climate nexus. The tool fills a gap in the existing planning tools, that are mostly single-resource focused, or do not have an optimization framework. Based on a hydroeconomic optimization framework, the tool considers synergies and trade-offs among WEF infrastructure and policies and can be used to evaluate different scenarios. 25 In the Zambezi river basin, we show how the integrated analysis of the energy, agriculture, and water systems, including commodity markets, provides additional insights to the economic impacts of infrastructure and policies. This may lead to different investment decisions than those based on models not considering the nexus or market effects. We show that in a rapidly evolving socio-economic context and under potential pressure from climate change it is crucial to consider risks linked to these uncertainties. In the driest climate change scenario, decrease in runoff reduces the hydropower production by 50%, 30 causing losses of 700 million dollars per year, while rainfed agriculture is severely impacted by increased evapotranspiration and reduced rainfall, causing losses of about 1.6 billion dollars per year. The benefits of the hydropower development plan are found to be around 1.9 billion dollars per year but are sensitive to future fuel prices or carbon pricing policies, capital costs of solar technologies and climate change. Climate change is the main factor impacting hydropower production as it affects the water resource availability. A carbon pricing policy could have a significant impact on fuel prices and thus power production costs and is therefore the main driver on hydropower production value. The development of solar capacity will increase the intermittency in the power system and thus the value of flexible hydropower, however it will decrease the cost of power 5 production, and thus potentially counterbalance the first effect. Similarly, the benefits of the irrigation development plan are found sensitive to the evolution of crop yields, world crop market prices and climate change. The potential improvements in yields could have significant positive impact on the crop production, however the increase is uncertain as past data does not show a clear improving trend. As most of the value of the irrigation development is generated through exports, the development plan is very sensitive to world crop market prices. A dryer climate will reduce the availability of water and thus the potential 10 benefits, however it also increases the value of crops during dry years as rainfed crops will be affected. The development of irrigation infrastructure will decrease hydropower production, leading to reduced benefits. As the total water consumption is a limited share of the available water, trade-offs represent only 5% of the value of the development plan. However, this effect could be exacerbated by climate change. Restoring natural flooding in the Zambezi delta involves limited economic trade-offs in the current climate, however under climate change it could result in major trade-offs with irrigation and hydropower 15 generation.

Code and data availability
The decision support tool is available under the GNU General Public License version 3 (GPLv3) and can be downloaded with the input data for the Zambezi study case from Github (https://github.com/RaphaelPB/WHAT-IF). The study case data are also available at https://zenodo.org/record/2646476 (Payet-Burin, 2019), with the detailed sources. 20 Author contribution SPC, MK, KS and PBG designed the study, MK and RPB developed the computer model, RPB performed the analysis and wrote the manuscript, all authors contributed to the interpretation of results and commented on the manuscript.

Competing Interests
The authors declare that they have no conflict of interest. 25