Cost-efficient decarbonization of local energy systems by whole-system based design optimization

system operating modes, i

On the way toward Net Zero 2050, the UK government set the 2035 target by slashing 78 % emissions compared to the 1990-level.To help understand how an electrified local energy system could contribute to this target and the associated cost, we develop a whole-system based local energy optimization (LEO) model.The model captures a series of state-ofthe-art technologies including building fabric retrofit, battery storage, electro-mobility, electro-heating, demand response, distributed renewable, and Peer-to-Peer (P2P) energy trading.And the model enables trade-off assessment between cost and emissions minimization, compares two system operating modes, i.e., cost-oriented and grid-impactoriented, and evaluates the impacts from weather risks and capital cost assumptions.A case study in Wales reveals (1) capital cost assumptions can lead up to 30.8 % overall cost difference of the local energy system; (2) operating the system in cost-oriented mode can save up to 5 % cost than in the grid-impact-oriented mode; (3) electro-heating by heat pumps has the highest priority among all investigated technologies.Overall, this study demonstrates how to design and operate a cost-efficient and electrified UK local energy system by the whole-system incorporation of near-term technical and business model advances towards a decarbonized future.
☆ The short version of the paper was presented at ICAE2021, Nov 29 -Dec 5, 2021.This paper is a substantial extension of the short version of the conference paper.☆☆ Information on the data underpinning the results presented here, including how to access them, can be found in the Cardiff University data catalogue at http://doi.org/10.17035/d.2022.0218460215

Introduction
The UK government enshrined a new target in law to slash GHG emissions by 78 % by 2035 recently [1].Since energy services are commonly expected to be the linchpin of efforts to cut GHG emissions and contribute to the UK's decarbonization target.Significant change and efforts are needed for existing energy networks, the heating systems, and the fabric of homes and buildings by taking a whole-system approach.National decisions and policies already have a significant impact on energy transition pathways and system designs.However, buildings and existing energy networks all vary among different areas when it comes to the local level.The measures to decarbonize their energy systems are specific and different for each area accordingly.Due to these local differences, decisions need to be specified at a local level in line with decisions at the national level.

Why local energy
The local energy system is one of the keys to enabling the long-term transition to Net Zero 2050 as it plays a vital role to interact local building-level end-users with a whole nation's energy system.Such interactions provide possibilities for reducing local energy imbalances, offering flexibility for energy network, avoiding unnecessary network investment, as well as enhancing the whole-system resilience [2].Although there are many benefits to be gained, local energy systems are not easy to set up.They are complex, disrupt the status quo, and require investments willing to take significant risks until proven.Therefore, grant challenges and opportunities exist for local energy systems as specified as follows: (1) Technically, with the great progress of decarbonizing the electricity sector nationally, heating is now the largest emitter of CO 2 in the UK.Different from the electricity that is mainly provided through national infrastructure and is most appropriately decarbonized at a national level, heating is mainly delivered via local infrastructure, therefore decarbonization of heating needs to be managed at a local level.(2) Economically, energy assets are developing rapidly and becoming much more widely distributed (e.g., electric vehicles, solar, local batteries, and heat pumps), and without proper coordination, it would be a trouble to operate everything at once, meaning hugely expensive upgrades.Only by smart integration as a whole-system, it can make the best use of existing infrastructure and reward end-users the local flexibility and balancing of the system.(3) Societally, people live locally and tend to trust local communities more than anyone else.Change driven locally will be faster and more suited to needs.As the Climate Change Committee's paper on local authorities' role says: "Top-down policies go some way to delivering change but can achieve a far greater impact if they are focused through local knowledge and networks."[3].
Overall, since all local areas are different, one centrally planned solution is unlikely to be appropriate areas across all local areas.A local energy planning tool is inevitably needed to provide evidence, guidance, and framework to enable the long-term transition to the Net Zero future.

Literature review
Energy systems are transforming to a more decentralized paradigm towards decarbonization with more distributed generation, local renewable energy, and emerging loads.These changes impact how energy systems are designed and operated.Different sectors, that are used to be managed separately, are now increasingly coupled with each other on the pathway towards "deep decarbonisation" from building-level, local-level, to national-level.
At the building level, a flurry of recent studies has outlined and explored pathways to deep decarbonization by investigating the concept of Net Zero Energy Building (NZEB) or near-NZEB.One decisive factor for achieving NZEB is to integrate power, heating, cooling, transport sectors as a whole.Doroudchia et al. conceptualized an intelligent building energy system that coupled local solar photovoltaic (PV), battery storage, heat pump, and electric vehicle (EV).Through a developed optimization model and scenario analysis, they found that involving EV in the building's energy system increases the chances of getting closer to a NZEB [4].Karunathilake et al. developed a planning model to optimize a hybrid renewable energy system at the building level to support the net-zero goals, which indicated that the combination of heat pump and PV are the optimal choice for Net Zero residential buildings in Canada [5].Wei et al. investigated economic feasibility for designing and scaling up near-NZEB homes in California [6].A comprehensive series of energy efficiency measures, rooftop PV, and battery storage were modeled; and the 16 California climate zones case studies indicated that the renewable-based electrification and battery play the key role when designing a NZEB for the U.S. Liu et al. further incorporated both hydrogen vehicle and battery storage into a hybrid renewable zeroenergy building design; and they found that battery storage is the key to achieve NZEB, which can improve the renewable self-consumption and hydrogen system efficiency [7].In general, these researches reveal that sector-coupling is a promising way for decarbonization at the building level.However, in order to capture the interactions between neighboring buildings as well as the interactions between buildings and the utility grid, the local level research is essential as reviewed below.
With the increasing penetration of distributed power sources and interactive demands, exploring the value of local energy flexibility and local balancing at the distribution network level gains increasing attention.In the UK, this is exemplified by the ongoing DNO-DSO transition (i.e., Distribution Network Operator towards Distribution System Operator), encouraging more active management on distribution networks, the provision of ancillary services at increasingly localized levels, and the increasing interest and business models around peer-topeer (P2P) energy services, which allow end-users to become more active energy system participants [8].Two promising aspects in the local energy research that deserve investigations are demand-side management and P2P energy trading.
The demand-side management refers not only to demand response but also thermal and electricity storage, as well as coupling with building (i.e., smart heating) and transport sector (i.e., smart EV charging and V2G).Wang et al. provided a systemic review of multiple demand-side management measures and their application within the scope of the multi-energy system and the prospect of corresponding technologies are foreseen accordingly [9].Mimica et al. investigated the role of energy storage and demand response participating in the reserve and network-constrained joint electricity and reserve market.They found significantly higher revenue can be achieved when enabling storage and demand response participation in the reserve market [10].Duman et al. proposed a home energy management system to unlock the value of smart thermostats for demand response in smart grids.The results indicate a daily bill saving up to $2.69 with a significant energy self-consumption rate up to 93 % can be expected [11].Wei et al. explored the economic value of integrating EV V2G with a multi-energy system.The application of V2G in commercial cases turns out to be more cost-efficient than the residential cases in China [12].
Along with the technical advances, P2P energy trading, as an innovative business model, is proposed and developed to better achieve local balancing and offer flexibility [13].The trading mechanism, the benefit quantification, and the human reactions all deserve investigation.Jing et al. evaluated the heating and power co-trading between commercial and residential prosumers, a non-cooperative game based trading mechanism is proposed to ensure the fairness of the trading prices [14].Morstyn et al. proposed a multiscale energy system design framework enabling P2P trading by inter-platform coordination and revealed that integrating P2P trading into planning and operation is beneficial for the adoption of large-scale DERs and can create economic, environmental, and social co-benefits [15].Pena-Bello et al. found that human decisionmaking is a vital factor for the financial benefits of prosumers and traditional consumers when participating in the P2P energy trading and also beneficial for reducing stress for the grid [16].Based on the rapid growth of P2P energy trading research, Soto et al. reviewed the current approaches, challenges, and future research in this area and the whole area was reviewed by grouping into six topics, i.e., trading platform, blockchain, game theory, simulation, optimization, and algorithms [17].
More recently, the emerging blockchain technology enables more active participation of every related energy stakeholder with an equal opportunity without a central authority controlling the information in some cases.P2P energy trading becomes more transparent and democratic and the potential of blockchain has now gained significant attention from academics.Hua et al. proposed a blockchain-based P2P trading framework considering electricity and carbon flow trading simultaneously.Through the smart contract based automated standardized auction procedure, regional energy balance and carbon savings can be expected [18].Chen et al. proposed a blockchain-ascoordination-committee energy trading framework to resolve the trust crisis in existing distributed-optimization-based trading schemes [19].Esmat et al. constructed a decentralized P2P energy trading platform composed of market and blockchain layers, within which the smart contract was integrated into the blockchain layer to secure real-time settlements.A novel decentralized market clearing method is further proposed and verified by real network data [20].Leeuwen et al. developed an integrated blockchain-based energy management platform enabling optimal power flow and trading as one optimization problem.The smart contract is utilized as a virtual aggregator and more than 34 % import cost reduction can be expected based on a real case analysis in Amsterdam [21].In general, blockchain has been increasingly recognized with great potential to facilitate P2P energy trading, however, as an emerging technology, its potential has not yet been explored, especially from the 'trilemma' perspective of scalability, security, decentralization [22].
Seen from above, a growing of pioneering efforts have been spent on exploring emerging technologies and business advances in electricity, heating, transport sectors, as well as supply-side and demand-side from building-level to local-level and up to national-level.Within this background, how to design and operate such a complex and deep decarbonized local energy system in a cost-efficient manner by integrating all available and emerging technologies as a whole remain a huge challenge.

Motivation and contribution
So far, more than 75 % of local authorities in the UK have declared a climate emergency with the target of 78 % reduction by 2035 and Net Zero by 2050, while few have a clear plan yet on how to get there [1].This is due to the significant differences from place to place for the UK and many other countries in terms of social factors, buildings, and energy infrastructure.These differences can further make it confusing for local energy system investors and planners to understand where and how to grow their businesses to overcome this complexity.In the meantime, achieving energy system decarbonization at the local level would be more cost-competitive and easy-to-implement compared to individual buildings as local areas have more options and opportunities for innovation across energy generation, supply, storage, and use (including heating in buildings).
However, research challenges remain in local energy decarbonization, e.g., the increasingly stronger interconnections among sectors and rapidly development of cross-sector technologies leading to a high degree of uncertainty around the costs, benefits, and even risks of decarbonizing local energy systems.New approach is urgently needed to incorporate all energy-impacted sectors and technologies toward the local energy decarbonization while ensure systemic cost efficiency.
To address the above challenge, we condense out a whole-system based framework for local energy decarbonization that could bridge the building-level energy model and larger-scale energy model.Its core is a local energy optimization (LEO) model that can inform local stakeholders the most cost-efficient design and operational strategy of local energy systems.Two major contributions of this study are: (1) Developing the LEO model that captures the interactions of all energy-impacted sectors (e.g., building, transport, power, heating) at local level and enables various technology advances so as to derive the least cost local energy solutions toward decarbonization.
(2) Incorporating both cost and weather uncertainties into the system design optimization, especially evaluating multiple weather uncertainties (e.g., rainfall, temperature, and wind speed) and even extreme weather risks based on the past 30-year historical and future 30-year projection weather data.
The rest of the paper is organized as follows.Section 2 describes the methods related to the proposed LEO model.Section 3 presents the results of an illustrative local case study in Wales.Results are presented and broader implications are discussed in Section 4. Conclusions and future perspectives are summarized in Section 5.

Outline of whole-system based design optimization
The local energy optimization (LEO) model aims to find to most costefficient local energy solution toward the UK 2035 decarbonization target following the whole-system thinking.It optimizes the decisions on the design and operation of local energy systems satisfying the total energy demand of a local district and subjecting to the emissions constraints.As illustrated in Fig. 1, six key aspects of inputs need to be considered with either direct or indirect impacts when developing the LEO model covering a wide range from social engagement, climate conditions, spatial granularity, temporal dynamics, energy portfolio to morphology & buildings.Meanwhile, the local energy system can be the bridge between the building energy systems (energy demands can be simulated by EnergyPlus) and the larger-scale energy systems (e.g., regional or national).Both the technical & market and political & social changes from the regional/national energy systems will affect the local energy planning.

Handling weather uncertainty
The weather uncertainty is an increasingly crucial factor in energy system design and operation as more weather-dependent renewable technologies (e.g., solar and wind) are adopted.The weather uncertainty could affect the optimization results from two aspects, i.e., one is the extreme weather risk, another is the renewable output variations.To assess the extreme weather risk, both historical weather data and projected weather data are utilized.These historical and projection data are in daily resolution including maximum wind speed, maximum precipitation, as well as minimum and maximum temperature, which corresponds to the possible hurricane, flood, and extremely cold risk, respectively.The 30-year (1991-2020) historical weather data is obtained from the NASA MERRA-2 database [23].The projection data is obtained from the HadGEM2-ES climate model (developed and widely utilized by the UK Met Office) considering RCP8.5 (a high-emissions scenario) and applying the linear scanning bias correction method for downscaling the data to the local level [24,25].To assess the renewable output variations, the local hourly resolution weather data, i.e., solar profiles, in this case, can be obtained from Renewable.ninja[26].All solar profiles are then classified into four groups in accordance with four seasons (i.e., spring, summer, fall, and winter).
For all groups, the k-means clustering technique (as detailed in Ref. [27]) is applied to generate the pre-defined number of representative solar profiles in consistence with the temporal setup of the LEO model.For instance, all solar radiance index (SRI) data points in one hour of a certain season are clustered into a pre-defined number of clusters (only one cluster in this case).Then, the centroid point for each hour is considered as the most representative SRI value for that hour.By connecting the centroid points of 24 h for one, the one representative solar profile for spring, summer, and fall can be obtained accordingly.The winter situation is slightly different as we specifically model the extreme cold and dark days during winter, all SRI data for winter is firstly divided into two groups, i.e., 5 % extreme low profiles and the rest 95 % normal solar profiles.Then, one representative solar profile is identified for each group by the k-means technique following the same procedure as mentioned above.

Buildings energy demand profiles
The electricity demand profiles for various categories of customers are obtained from the Elexon [28] and further validated with the annual total electricity consumption of the local district.The heating demand includes the spacing heating and domestic hot water (DHW) demands.The typical days' hourly heating demand profiles are generated by utilizing the clustering-based approach [29] based on the published dataset for domestic buildings [30] and non-domestic buildings [31].These heating demands in the dataset are based on building heat loss, heating technology, and outdoor air temperatures.

Peer-to-Peer energy trading
The peer-to-peer (P2P) energy trading is a decentralized trading scheme that enables individual prosumers, energy suppliers, and aggregators to directly exchange energy over utility grids in achieving the local energy balance and cost reduction [32].Under such a decentralized scheme, individual energy sellers can export surplus energy at a higher price compared to the wholesale market prices, and individual energy buyers can import energy at a lower price compared to the retail market prices.The decentralized offering or bidding prices can directly motivate individual sellers or buyers, respectively, to reshape their energy patterns to maximize their trade-offs.In this case, we consider the electricity trading among different aggregators assuming the smart metering and trading management facilities are available.The trading for other forms of energy is not considered, e.g., heating or gas, as the district heating network are uncommon in UK and there is no surplus onsite gas generation.Note that we merely consider the blockchain enhanced P2P energy trading as one emerging technology among all technical advances in our model, while not intend to advance the research on blockchain.Meanwhile, the P2P energy trading handled by a trusted third party could also work.
The Blockchain technologies is expected to assist the existing information infrastructures to enable energy trading with the features of automation, trustworthiness, and information efficiency [33].As one of the most potential applications of Blockchain technologies in the energy field, smart contracts provide a platform to integrate the engagement of stakeholders in energy markets, e.g., generation companies, power system operators, and consumers.Each participant can register an account in the Blockchain networks and initiate a smart contract to execute predefined functions.The control policies, negotiation procedures, and market clearing mechanisms during the operations of energy systems can be standardized and tailored into such functions as smart contracts.Each function is automatically self-enforced by smart contracts, which prevents unforeseen trading behaviors in energy markets or malicious attacks on energy systems.
The smart contracts are programmed by the Solidity language and executed on the Ethereum Blockchain networks [34].Each cluster in the local area can register an account to participate in the P2P trading platform.Once the account is registered, an encrypted address would be assigned as the unique identity.The account balance will be related to this unique identity.The execution of smart contracts and transactions will incur transaction fees in the form of GAS costs.The execution of smart contracts and transactions of energy trading are recorded in Markle partial tree and collectively updated by every node in the Blockchain networks.The Markle partial tree is stored in each block, and all blocks are chronologically linked together by including the hash of the previous block in the next block header, forming a Blockchain.

Cost and benefit of building fabric retrofit
Building fabric retrofit is well-documented priority action delivering consistent benefits for reducing energy bills.Based on the fact that over 70 % of cavity walls and over 90 % of roofs or lofts have been insulated [35], only solid wall insulation (SWI) and double glazing window (DGW) retrofit measures are further considered.These measures could be either implemented individually or combined as listed in Table 1.The cost data for different measures and different house types are available in Ref. [36].Note that the cost for one certain measure could be different as the material and labor cost would vary and the local most common house-type is the small detached house.The energy savings are estimated by performing building energy simulation tools of EnergyPlus [37], the results are presented by percentage savings as the heating demand would scale down proportionally when implementing retrofit measures, while the shape of demand profiles remain similar.

Domestic and EV demand response
The smart EV charging and domestic appliances (i.e., dishwasher and washing machine) are considered taking part in demand response.They are considered as the shiftable tasks during certain time periods (i.e., between the earliest start and last finish) and the associated power loads are the shiftable loads.The model would identify cost-efficient time slots to execute these tasks, i.e., charging the EV and running the domestic appliances.The power requirements, earliest start time, latest finishing time, and operating time of these shiftable tasks are given in Table 2.The demand response model formulations are detailed in Appendix Eq. (A3).

Model establishment
As shown in Fig. 2, the proposed LEO model follows a bottom-up structure and considers the project horizon of 15 years.The design decisions are optimized considering the operation and the 15-year project horizon.The LEO model captures the demand fluctuations at an hourly time interval and 9 typical days considering seasonal and weekday/ weekend differences; the operational decisions are optimized on an hourly basis.One extra typical day during winter is modeled so that the energy demands can be fulfilled even during dark and cold winter.Meanwhile, the whole local district is clustered into 5 clusters based on the building categories and the local Peer-to-Peer (P2P) energy trading is enabled among clusters.The technology advances mentioned in Section 2.3-2.6 are all modeled in the LEO model including multi-energy sources integration, domestic demand response, energy storage, electro-mobility, and electro-heating.
The outline of the LEO model is as follows.The objective function is to minimize the total discounted cost (TDC) of the local energy system over the modeling horizon.The TDC consists of annualized capital investment, fuel cost, and operation & maintenance cost.The model constraints include energy balances (heating and power supply are larger than demands), capacity constraints (expansion of installed capacity within limits and energy output constrained by capacity), operational constraints (on/off and ramp-up/down control), P2P trading constraints (electricity trading among local clusters), conversion constraints (other energy sources such as natural gas and coal to electricity), thermal storage constraints (constraints on water tank), battery constraints (constraints on battery charging and discharging), grid connection constraints, domestic demand response constraints (select optimal time slot to operate washing machines and dishwashers), EV charging constraints (select optimal time slot to charge EV), and GHG emissions limit (net zero).The mathematical formulations of LEO model are detailed in Appendix A.2. min obj opt = total discounted cost (TDC).S.T. Energy balances.Capacity constraints.System operational constraints.Energy trading constraints.Energy conversion constraints.Thermal storage constraints.Battery storage constraints.Grid interaction constraints.Demand response constraints.EV charging constraints.Carbon emissions limit.
In addition, the LEO model assesses the trade-off between costminimization and emissions-minimization as a multi-objective optimization problem, where the widely applicable epsilon-constraint method has been applied.More details on applying the epsilon-constraint method for solving energy systems' multi-objective optimization problem have been presented in our previous research [38,39].The system design trade-off between different objectives can be presented as a Pareto frontier for further decision-making [40].
Overall, the LEO model is formulated as a Mixed Integer Linear Programming (MILP) model and solved by CPLEX 28.2 solver via a 1.8 GHz Core™ i7-8565U CPU with 8 GB of RAM.The model has 4.8 × 10 5 variables (2.2 × 10 3 are binary variables) and is solved with an optimality gap of 2 % in 4 min CPU time.

Case description
We applied the LEO model to a local district case in Flintshire, Wales, UK, lies in the fact that roughly 76 % of the population live in this kind of county accounting for 97 % of Welsh land.As shown in Fig. 3a, the local district has 200 houses, 15 offices, 2 food & beverage stores, 2 school & public buildings, and 1 shopping mall.Fig. 3a also shows the PV shading evaluation result for the local district indicating that all roofs would not be shaded by neighborhood buildings even during the dark winter.While the solar radiance varies significantly among different seasons as shown in Fig. 3b.The local authority is actively engaging in renewable energy development with a PV farm under construction and the onsite generated solar power can be either consumed locally, stored in battery storage or sold to neighbors.
Overall, we apply the proposed LEO model to assess possible solutions for the local energy system considering different scenarios in this case.The scenarios of two system operation modes under two capital cost levels are evaluated considering two objective functions.In specific: (1) Two system operation modes are the Cost-oriented and the Gridimpact-oriented.The Cost-oriented mode aims to minimize the local energy design and operational cost by formulating the objective function as detailed in Appendix A.2.1 and the Grid-impact-oriented mode aims to have minimum impact on the grid by flattening the demand profile.The Grid-impact-oriented mode is formulated by setting constraints on the variation of hourly grid import power while still using the objective function of cost minimization.In specific, we set the upper bound for the hourly variation of the grid import power by 3 %.(2) Two capital cost levels are Existing capital cost and Low capital cost.(3) Two objectives are minimizing cost and minimizing CO 2 emissions.

Results and discussion
This section discusses the findings from the case study from five perspectives with the focus on cost-efficient decarbonization of local energy systems: (1) evaluating the possible weather risk that may lead to extra cost for hardening the energy system design and adjusting the system operation; (2) assessing the system performance trade-off when considering cost and emissions objectives with two different capital cost levels; (3) comparing the system operation between cost-oriented and grid-impact-oriented modes that has directly impact on the operational cost of the local energy system; (4) P2P energy trading schemes to achieve cost-efficient self-sufficiency at local level; (5) prioritizing the monetary value of the investigated technologies towards decarbonization.
Fig. 3.The case district map.(a) All buildings in the case district are suitable to install PV panels with no shading from nearby buildings even during winter (the district map is adapted from [41]); (b) Hourly solar radiation for different seasons.

Characterizing weather risks
The local historical (1991-2020) and projection (2021-2050) weather data of daily maximum wind speed, the daily lowest temperature, and the daily maximum precipitation are plotted in Fig. 4a-c, respectively.It can be seen that the daily maximum wind speed is 20.9 m/s and the lowest temperature is − 4 • C. Both these two parameters are expected to remain stable until 2050 indicating this area has very low hurricane and blizzard risks.In contrast, the historical daily maximum precipitation is not over 40 mm/day but the value could go up to 76 mm/day during 2020-2050.So, we further performed the flood risk assessment using the tool developed by the Natural Resources Wales [42].The assessment tool directly output the results indicating that the local district has a 0.1 %-1 % chance per year flooding risk from surface water and less than 0.1 % chance per year river flooding risk, which denotes a low and very low level, respectively.More details on calculating the risk can be found in Ref. [43], and the possible flood risk area has been visualized in Fig. 4d.Overall, the above extreme weather risk assessment indicate that the local energy infrastructure, e.g., the PV panels, heat pumps, distribution network, and gas network, would have low risk to be damaged by extreme weather events, e.g., flood, blizzard, or hurricane.Fortunately, it is not necessary to consider hardening the local energy infrastructure by increasing redundancy or backup (which would usually lead to a higher investment) in this case.

System performance trade-off
Fig. 5 shows the overall performance trade-off between Cost-oriented (i.e., minimize cost objective) and Grid-impact-oriented (i.e., flatten demand profile) considering two capital cost levels.Four Pareto frontiers represent four scenarios and each dot on the Pareto frontiers denotes an optimal local energy solution.In general, feasible solutions can be found for all scenarios under the local emissions threshold of 482 tonnes/year indicating that electrification of local energy systems can indeed achieve the 2035 emissions reduction target.The main reasons for the emissions reduction are: (1) The emission factor for the electricity grid would drop to 0.04 kg CO 2 /kWh.( 2) Based on such a low emission factor, electrification of the transport sector by adopting EVs and electrification of the heating sector by using heat pump could significantly reduce the emissions from the local transport and heating sectors.Other minor reasons that also contribute to the emissions reduction include the building energy efficiency improvement and local PV installation.More details on how the emission reduction is achieved and the contribution of individual technology can be found in our previous study Ref. [41].
The local emissions can be further reduced significantly with a minor rise of system cost until 169 tonnes/year.While the local emissions cannot be further reduced because it is not possible to achieve 100 % electrification for the local building, heating, and transport sectors by 2035 in this case even though the emissions factor for the electricity grid is already very low (i.e., 0.04 kg CO 2 /kWh).Meanwhile, the Costoriented solutions tend to achieve a 3.1 %-5 % lower overall system cost than the Grid-impact-oriented solutions.In addition, the two-level capital cost (i.e., existing cost and low cost) could result in a 29.4 %-30.8 % overall system cost difference.Note that since we calculate the cost and benefit from a local perspective, the costs of Grid-impactoriented solutions are usually slightly higher than the Cost-oriented Fig. 5. System overall performance trade-off between two objectives under two capital cost levels.Fig. 6.Hourly electricity supply-demand balances for three typical days and two modes.(a) Cost-oriented mode in a typical hot summer weekday, (b) Cost-oriented mode in a typical winter weekend, (c) Cost-oriented mode in an extreme dark and cold winter weekend, (d) Grid-impact-oriented mode in a typical hot summer weekday, (e) Grid-impact-oriented mode in a typical winter weekend, (f) Grid-impact-oriented mode in an extreme dark and cold winter weekend.solutions; but the Grid-impact-oriented solutions might generate larger benefits for the electricity grid, which is not taken into account in this case.

Representative hourly energy balancing for two modes
Fig. 6 shows the hourly electricity balances of the local energy systems in both Cost-oriented and Grid-impact-oriented modes during three typical days.The three typical days are a hot summer weekday, a winter weekend, and a winter extreme dark and cold day.In general, EV charging always happens during midnight and early morning, and the shiftable tasks of Dish washer and Wash machine are usually been carried out during 9 am-2 pm so as to keep away from the evening peak around 7 pm.
For the Cost-oriented mode as shown in Fig. 6(a-c), the local PV power output demonstrates significant seasonal differences, and such a difference is balanced by the power import from the grid.As for the heating, domestic hot water demand still exists during summer, the heat pump contributes the most in the typical winter weekend.In contrast, heat pumps contribute less amount in the extreme cold and dark winter weekend as the boiler might indicate a more cost-efficient solution.Meanwhile, the battery usually charges the surplus local PV generated power during 10 am-4 pm if the solar radiation is sufficient (extreme dark and cold winter days not applied), and then discharges during the evening period of 6 pm-10 pm.
The Grid-impact-oriented mode to flatten the profile of the import power from the grid (as shown by the smooth bandwidth of the import power profile over 24 h) while minimizing the system total cost.As plotted in Fig. 6(d-f), compared to the Cost-oriented mode, the larger capacity of the battery has been installed and more actively utilized during 6 am and 3 pm when the local PV generation is abundant.The power mainly discharges during the evening peak around 5 pm-11 pm.Since a larger capacity of batteries has been utilized in this mode, the total system cost is slightly higher than the Cost-oriented mode accordingly.
Note that Fig. 6 shows the energy balance from the whole local area perspective, while the energy trading within the local area cannot be observed directly.So, we further illustrate the energy trading results in the next section.

Blockchain based P2P energy trading
Fig. 7 shows the electricity trading among the five local clusters during four representative days under two operational modes.In general, more amount of electricity is traded in the Cost-oriented mode than that in the Grid-impact-oriented mode.This is due to a larger capacity of batteries are deployed in the Grid-impact-oriented mode to better maintain the inner-cluster balancing other than trade with other clusters.Another interesting finding is that the surplus electricity is usually traded from the non-residential sector (i.e., C2-C5) to the residential sector (i.e., C1) during the evening peak around 6 p.m.-10 p.m.The reason is that the residential and non-residential sector has demand supplementary effect, in other words, the demand for the nonresidential sector drops to a minimum level during the off-work time period, while the demand for the residential sector reaches its peak.So that the surplus power from the non-residential sector is transferred to the residential sector.Besides, compared an extremely dark and cold winter weekend with a typical winter weekend, since less electricity can be generated from the PV panels while the demand for heating is higher,  the amount of surplus electricity for trading is less accordingly.
Based on the optimal trading scheme, we demonstrated the execution of smart contracts for the P2P energy trading between local areas, the energy trading at 11 pm is instantiated.As presented in Fig. 8, the local areas C2 and C5 are energy sellers and the local area C1 is the energy buyer.First, the buyer C1 initializes the smart contracts with the specified information of trading time (11 pm), demand volume (102 kWh), maximum accepted price (£115/MWh).The initialization of smart contracts is subsequently broadcast over the Blockchain networks.Second, the sellers C2 and C5 which are willing to sell their surplus energy enter the smart contracts of the C1 by providing their selling volumes (C2: 80 kWh and C5: 55 kWh) and offering prices (C2: £95/kWh and C5: £80/kWh).Third, the buyer C1 decides whether to accept the offers from sellers.Since the seller C5 offers a cheaper price of £80/kWh, the 55 kWh of selling volume is accepted by the buyer C1.The total £4.4 of payment is subsequently deducted from the buyer C1's account and frozen by the Blockchain networks.Fourth, the seller C2 further decreases its offering price to £85/kWh.The buyer accepts this offer to meet the remaining 47kWh of energy demand.The total £4.0 of payment is subsequently deducted from the buyer C1 ′ s account and frozen by the Blockchain networks.Lastly, once the Blockchain networks receive the delivery signal from the buyer C1, the frozen £4.4 and £4.0 are transferred to the seller C2 and seller C5's accounts.

Prioritizing technologies towards decarbonization
A series of technologies from electricity, building, heating and transport sectors are all integrated in the LEO model to achieve a costefficient solution meeting the emission reduction target.One interesting question would be which technology should be deployed with a higher priority from the cost perspective?In other words, which technology contributes the most to the emission reduction target systemically?To answer the question, we applied the system value (SV) approach to quantify the value of all investigated technologies and prioritize them by the SV of each technology in the local energy system.
The SV of a technology within a system is defined as the marginal benefit that the technology can bring to the whole-system as a function of its existence (i.e., installed capacity or investment).As illustrated in Fig. 9 (a), the system value can be calculated by the difference between Benefit Aggregate and Investment Aggregate; the maximal value of system value is achieved at the tipping point when the slope of Benefit Aggregate is less than the slope of Investment Aggregate.In this case, both the Benefit and Investment are the optimal cost (i.e., monetary) obtained from the LEO model.The optimal capacity and associated Benefit and of a certain technology can be obtained by running the LEO model directly; the technology exclusion benchmark indicates the capacity of a certain technology is fixed to zero by adding an additional constraint to the LEO model.More details of the system value approach can be found in Ref. [29].
Specifically, we selected the Cost-oriented and Existing cost scenario and run the LEO model with the cost minimization objective.The system values of local PV, battery storage, heat pump, P2P energy trading, domestic demand response (DDR), smart EV charging, and building fabric retrofit options are plotted in Fig. 9(b-d), respectively.In Fig. 9 (b), the maximal SV for heat pump reaches £125 × 10 3 , which is the highest among all investigated technologies; the local PV and battery storage shows similar SV around £35 × 10 3 .Fig. 9(c) shows the system value for P2P energy trading, EV smart charging, and DDR.Note that we only consider the 'Dis-enabled' and 'Enabled' as two discrete decisions for these technologies, though future research can calculate the SV of these technologies as a function of their participating ratio (i.e., 0-100 %) with minor revisions of the LEO model.it is seen that compared to dis-enabled these technologies, the SV of P2P energy trading, EV smart charging, and DDR are £110 × 10 3 , £28 × 10 3 , and £18 × 10 3 , respectively.Fig. 9(d) shows the SV for four discrete decisions of building fabric retrofit.It is interesting to see that compared to 'no upgrade', implementing SWI achieves a SV of £8 × 10 3 as SWI is a cost-efficient option in this case.In contrast, implementing DGW and SWI + DGW achieve a negative SV indicating that these two decisions are not economically efficient as the associated energy saving cannot offset the extra investment, and forced to implement them would not generate any benefit (i.e., negative SV).Overall, based on the SV, the priority of technologies, in this case, is heat pump > P2P energy trading > local PV > battery storage > EV smart charging > DDR > building fabric retrofit by DGW.Note that though the system value method can also be applied to assess other quantitative values, the above priority is case specific and based on the cost assessment, the emissions reduction value and other social welfare of the investigated technologies have not been involved.

Conclusion and the way forward
To help understand how an electrified local energy system could contribute to the UK 2035 emission target and the associated cost, we develop a whole-system based local energy optimization (LEO) model.The LEO model enables comprehensive assessment for the trade-off between cost and emissions minimization and the performance of two system operational modes, i.e., cost-oriented and grid-impact-oriented, considering weather risks and different capital cost.The application of the LEO model to a representative local district case in Wales reveals a series of insightful implications as listed but not limited below: (1) Electrification of local energy systems can indeed meet the UK 2035 emission target and operating the electrified local energy system in cost-oriented mode can save up to 5 % cost than in the grid-impact-oriented mode.(2) The capital cost assumptions can lead up to a 30.8 % overall cost difference of the local energy system while the weather risks would not affect significantly in this case.(3) Electrification of the local heating sector by heat pumps has the highest priority among all investigated technologies in terms of contributing to achieving the emission target in a cost-efficient way.
The model developed and the associated case analysis in this study demonstrate the feasibility of local energy electrification to meet the UK emission reduction target by 2035.Note that there is no one size fits all solution.It is important to retain optionality and flexibility in the energy network, transport, and building sectors so as to support an affordable transition towards net zero.For instance, many argue that low-carbon electricity and heat pumps will not be sufficient to heat every home in the UK, and the hydrogen and biomethane boilers could be an alternative as they can utilize existing engineering practice though heavy investment is needed to retrofit the gas network infrastructure.Hence, local energy electrification could help local authorities achieve the 2035 near-term emission target and buy more time to develop other promising but not-ready-yet technologies for other difficult-to-decarbonize sectors towards Net Zero by 2050.
Future research can further explore the following two directions: (1) the present study addresses the cost-efficiency problem of designing local energy systems, while the retirement and demolishment of the existing facilities have not been considered, future research could explore the transition pathway of the local energy system from its existing portfolio to that of 2035; (2) the present study use flattening the electricity import profile from the grid as a measure of minimizing the impact of local energy systems for the utility grid, future research could explore more comprehensive measures of minimizing the grid impact and how much economic benefit can be brought.

Declaration of Competing Interest
The authors declare that they have no known competing financial interests or personal relationships that could have appeared to influence the work reported in this paper.
where the subscripts s is season, h is hour, i is clusters' serial number, k is the building fabric retrofit options' serial number, and these subscript symbols apply in the following description of models; Q Base is the heating demand baseload, φ RF is the binary variable to ensure at most one building fabric retrofit option been selected, Q FR is the heating demand savings due to the building fabric retrofit, Q cha is the heating charged to storage tank, Q dis is the heating discharged from storage tank, Q HP is the heating supply from heat pump, Q B is the heating supply from boiler (see Fig. A1).
Eq. (A4) shows the electricity balance.The electricity generated from roof PV panels E PVfarm  The electricity generated from local PV farm E P2P  The electricity transfer among clusters [kWh] E im  The electricity bought from the grid [kWh] E ex The electricity fed back to the grid [kWh] Energy activity All related energy activity GHG EGY  The energy related CO2 emissions AREA PVroof  The installed area for roof PV panels [m 2 ] AREA PVfarm  The installed area for local PV farm [m 2 ] E P2P(j,i)  The electricity transfer from cluster j to i [kWh] Q HP  The heating output from heating pump [kWh] Q B  The heating output from boiler [kWh] Q st  The heating stored in storage tank [kWh] Q cha  The heating charge into cooling storage [kWh] Q disc The heating energy discharged [kWh] Q st  The heating energy stored in the tank [kWh] NG B  The natural gas consumed by boiler [kWh] Fig. A1.The electricity and heating demand per building for five categories of buildings in the local district [28,45].a-e, electricity demand per building for five categories of buildings.f-j, heating demand per building for five categories of buildings.

Fig. 1 .
Fig.1.Overview of developing the whole-system based local energy optimization (LEO) model.Six aspects of data inputs, i.e., social engagement, climate conditions, spatial granularity, temporal dynamics, energy portfolio, and morphology & buildings, for constructing a whole-system based LEO model and the associated data acquisition methods.The LEO model follows the bottom-up structure, and it is a Mixed Integer Linear Programming (MILP) based optimization model.It optimizes the system design and operational decisions subjecting to the modeling constraints.Optimal outputs can be achieved including cost, emissions, system design and dispatch strategy.

Fig. 4 .
Fig. 4. The historical and projected local climate data in this case.(a-c) The local historical (1991-2020) data and projection data (2021-2050) for maximal wind speed, temperature, and precipitation, respectively.(d) Flood risk assessment map for Wales showing the potential areas with flood risk from river and surface water.

Fig. 7 .
Fig. 7. Energy trading among five (i.e., for four representative days under two operational (a) Cost-oriented mode in a typical spring weekday; (b) Cost-oriented mode in a typical hot summer weekend; (c) Cost-oriented mode in a typical winter (d) Cost-oriented mode in in an extreme dark & cold winter weekend; (e) Cost-oriented mode in a typical spring weekday; (f) Cost-oriented mode in a typical hot summer weekend; (g) Cost-oriented mode in a typical winter weekend; (h) Cost-oriented mode in an extreme dark & cold winter weekend.

Fig. 8 .
Fig. 8. Schematic illustration of executing smart contracts in the Ethereum Blockchain networks.The solid black arrows indicate the information exchange among participants of Blockchain networks, and the dashed grey arrows indicate the information recorded by the Blockchain networks.

Fig. 9 .
Fig. 9. System value approach quantifying the contribution of individual technology for the whole local energy system.(a) Illustration of the system value concept; (b) System value (×10 3 £) for heat pump (capacity in kW), local PV (capacity in kW), and battery (capacity in kWh); (c) System value (×10 3 £) for discrete (i.e., dis-enabled enabled) of P2P energy trading, EV smart charging, and domestic demand response; (d) System value (×10 3 £) for discrete options of building fabric retrofit (i.e., No upgrade, SWI only, DGW only, and SWI + DGW).

Table 1
[35]ding retrofit measures with estimated energy savings and cost per house[35].

Table 2
Power and possible time schedules for domestic shiftable tasks.
6 Fig. 2. Temporal setup of the LEO model.R. Jing et al.

Table A3
Definitions and values of parameters.

Table A5
Cost assumptions for each energy technology and electricity tariff.