A resilient battery electric bus transit system configuration

Electric mobility is fundamental to combat climate change and attaining the United Nations Sustainable Development Goals (SDG-11). However, electric mobility necessitates a seamless integration between power and transportation systems, as the resiliency of both systems is becoming far more interdependent. Here, we focus on disruption to Battery Electric Bus (BEB) transit system charging infrastructure and offer a resilient BEB transit system planning model. The proposed model optimizes the BEB system costs while ensuring the system’s robustness against simultaneous charging station failures. In our case study, a single charging station failure would lead to up to 34.03% service reduction, and two simultaneous failures would reduce the service by up to 58.18%. Our proposed two-stage robust model addresses this issue with a relatively small added cost (3.26% and 8.12% higher than the base model). This cost enables uninterrupted BEB system operation during disruption, ensuring personal mobility, social interaction, and economic productivity.

The electrification of public transit is a promising solution to combat climate change 1 .Electric transit (e-Transit) renders substantial perpassenger greenhouse gas (GHG) emissions 2 , aiding significantly in reducing the transportation sector's high GHG emissions share (20% of global CO 2 emissions) 3,4 .During the past decades, battery electric buses (BEBs) have been identified as a feasible alternative to fossilfueled buses 5,6 .Moreover, BEBs' market share is growing rapidly (91.4% of the electric bus market in 2020) owing to their energy efficiency, quiet operation, low maintenance cost, and zero tailpipe emissions 7 .However, BEB transit system configuration requires advanced optimization models for charging infrastructure allocation, fleet configuration, energy management, and charging schedule [8][9][10] .Overall, the complexity of designing a BEB transit system stems from the need to balance contradictory objects/decisions, such as mitigating the upfront investment costs (e.g., charging stations and fleet), annual operational costs, GHG emissions, and utility grid impact.At the same time, the system should satisfy the operational timetable and level of service, energy supply considerations, and resiliency against uncertainties.
Several studies have considered en-route charging for BEBs, which exploits high-power fast chargers and utilizes layover times for charging, leading to uninterrupted operation 11,12 .En-route charging diminishes the need for a sizable battery size (overnight charging) or high labor cost (battery swapping) 13 .However, it relies on a seamless energy supply at the charging locations 14 .
However, BEB transit system operation is susceptible to several disruptions, such as power outages and equipment malfunction (real-world examples are detailed in Supplementary Discussion 1).Recent studies show that current BEB optimization models are robust against disruptions if solved promptly (within 1 h) 15 .However, daily disruption of one charging station could reduce the frequency of the service by 57%.Therefore, unexpected disruptions can prevent BEBs from being effectively and timely charged, halting their operation.
Concerns about the effects of charging disruptions on the BEB system have been pointed out as a critical issue, and calls for plans, best practices, and models for a resilient BEB system are in place 16,17 .Charging station failure is a binary random variable, and it should be included in BEB system configuration planning models to achieve a resilient system design.
BEB transit systems are vulnerable to several external energy management disruptions, such as energy consumption rates, disruptions to charging components, and electricity outages.Recent studies focused on BEB system planning under uncertainty, as summarized in Supplementary Table 1.These studies developed BEB models incorporating uncertainty parameters related to energy consumption, travel time, charging time, passengers' boarding and alighting time, battery degradation, and power supply fluctuation 6,18,19 .
Energy consumption is observed as the most investigated uncertain BEB operation parameter, as it is affected by numerous uncertain factors (e.g., the number of passengers, traffic, weather, etc.).Additionally, accurate energy consumption estimation is crucial to properly configure and operate the BEB system 20 .Some studies also investigated the uncertainty associated with the operation time 21 .
Most relevant to the present study are the recent works of refs.22,  23.Their work designed the BEB system considering power supply fluctuation uncertainty in single-stage robust optimization models using the budgeted uncertainty set.Their results, solidifying our argument, show that considering power supply fluctuation uncertainty impacts the resulting BEB system configuration depending on the priorities of decision-makers (changing the conservative level).Their charging power variability formulation differs from the charging station disruption uncertainty proposed herein.
First, the power supplied to a bus in a charging station was assumed to be a random variable that varies within a continuous uncertainty interval set.In comparison, the charging station failure should be formulated as discrete (whether the charging station is working or not).Second, the power supply fluctuation budgeted uncertainty set in their work is related to the bus lines/trips, not the charging stations 22,23 .In other words, the uncertainty set was formulated for each bus line in each trip and budgeted the summation of the supplied power deviation from the nominal value in all the charging stations in this bus line/trip.
That said, the scope of previous studies did not consider the optimal design of a resilient BEB system configuration under charging station disruption uncertainty, where the uncertainty set is formulated for the failure of the charging stations at the network level.
The definition of resiliency depends on application 24 .However, there is a consensus that systemic resiliency is the system's capacity to adjust or react to disruptive events 25 .Four different concepts of resiliency are coined 26 : (1) robustness: effectively managing disruptive events so that they have minimal or no impact on the functionality of the network.(2) Rebound: effectively resuming normal network operations after disruptions.(3) Extensibility: effectively addressing unexpected events that may disrupt current activities by extending system performance or capabilities.(4) Adaptability: effectively balancing competing priorities to develop the adaptive capacity that can respond to constantly changing contexts 26 .This study focuses on the robustness of BEB systems as the goal is to design a resilient BEB transit network against charging station disruption uncertainty.
Optimization models for network resiliency are introduced to assess how the network performance changes due to disruption and/ or identify operation recommendations to overcome network fragility and vulnerability.The output decisions could be taken before (preperturbation), during, and/or after (post-perturbation) disruption.
Generally, models to improve network robustness include survivable network design, fault tolerance problems, two-stage stochastic network optimization, interdiction, N − K, attacker-defender, defenderattacker-defender, and robust optimization (RO), as detailed in ref. 25.
For BEB networks, charging station disruption conforms to removing network components (nodes/edges).The design of resilient networks that are robust against component failure uncertainty is often referred to as survivable network design models (preperturbation) 27 .These models ensure the resultant network is robust against up to k network components removal while maintaining the network operation 25 .The survivable network design could be addressed in various ways, such as through probability-based models 28 , RO models 29 , and two-stage RO models 30 .The selection of system parameters before component failures naturally leads to min-max-min formulations, which nicely correspond to two-stage robust optimization problems.Moreover, the two-stage RO formulation avoids the necessity of the component failure distribution (probability-based models) and provides a less conservative design (single-stage RO models) 31 .As such, two-stage RO models have been widely used in many applications to design a survivable network under component failure uncertainty 32 .
Overall, the two-stage robust optimization method is a practical approach to address the uncertainty in situations like charging station failures in the BEB system configuration planning.The focus is not on the probability of charging station failures but on ensuring that the BEB system works even in the worst-case scenario.Herein, system disruption is defined as a charging station failure that impacts the entire operation day.
This work develops a resilient BEB system configuration model that optimizes the total costs (capital and operational) while ensuring the model's robustness against k simultaneous failures of charging stations, where k is a conservative risk level supplied by the decisionmaker.The proposed model provides the optimal BEB system infrastructure, including locations of the charging stations, stations' configurations (power of charger and the number of poles), and BEB's fleet battery sizes.Furthermore, it provides a resilient charging/operation schedule for the transit fleet under any k charging station failures.The model is applied to a real-world, large-scale bus transit network and demonstrates its effectiveness.Undeniably, a resilient BEB system design comes with additional costs.The Price of Robustness of the Robust Models with k = 1 and k = 2 are marginal (3.26% and 8.12% higher than the Base Model, respectively).This cost prevents a significant service reduction if one (34%) or two (58%) charging stations fail.

BEB system configuration: Base Model
The proposed resilient BEB system configuration model is formulated as a two-stage RO and applied to the transit network in Oakville City (see Supplementary Discussion 2).The solution framework is detailed in "Methods: Solution algorithm".In addition, the convergence of the solution framework is shown in Supplementary Discussion 3.
The BEB system configuration of the Base Model (no station failure) is presented in Table 1.The optimal BEB system under the nominal operation required five heterogeneous charging stations equipped with eight poles.A fleet of 91 BEBs with heterogeneous battery capacities is required to satisfy operation.Most buses (59.34%) are equipped with 100 kWh battery capacity.The distribution of the BEB system costs is presented in Table 2, with a total annual cost of $6,959,381.19.It should be highlighted that the capital expenses are amortized over the 12-year lifespan.The primary contributor is the fleet cost without batteries (76.63%), while operational costs (electricity ToU, demand charge, and GHG emissions) account for 11.58%.In comparison, BEBs' batteries contribute 10.03%, and the charging system (charging stations infrastructure and chargers) accounts for 1.77%.
The optimal five locations for the en-route charging stations are distributed across the network (see Supplementary Fig. 2).The number of BEBs charging at each station varies between 8 and 50 buses.In turn, the charging instances, overall duration of charging, and energy demand differ widely from one charging station to another.Each charging station failure scenario affects the BEB system operation differently.For example, Oakville GO Station (ID 1) is a critical charging point.It charges 50 BEBs out of 91, serving 15 routes, using 318 charging events with a total of 4837.02kWh daily energy demand (27.45% of the fleet energy demand).Therefore, any disruption to this station is expected to significantly impact the system's operation.
The robustness of the Base Model is assessed by estimating the number of daily failed buses and service reduction in all the r simultaneous charging station disruption scenarios (r interdiction method).This robustness assessment is calculated by solving the inner subproblem (ISP) (Eqs.75-77 in "Methods: Solution algorithm") for each failure scenario.It is worth noting that ISP is minimizing the impact of the charging station failure scenario on the BEB system operation by obtaining the optimal charging scheduling that reduces the number of failed buses.The results of r = 1 and r = 2 are presented in Tables 3 and  4, respectively.
In the event of a single charging station failure (designated as r = 1), the daily operation is reduced by up to 34.03%.In the case of two simultaneous charging station failures (r = 2), the failure of Stations ID 1 and 4 reduces the service by 58.18% due to a failure of 48 BEBs.
The robustness assessment of the Base Model emphasizes the sensitivity of the BEB system operation to the charging station failure.It demonstrates the importance of the developed resilient BEB system configuration model in preserving the full operation and level of service.

A resilient BEB system configuration
The BEB system configurations of the Robust Models (k = 1 & 2) are summarized in Table 5 (for more details, see Supplementary Tables 4-6).For the Robust Model (k = 1), the BEB charging system comprises 18 charging locations with a heterogeneous charger-rated power and 19 poles.Moreover, the fleet configuration differs from the Base Model, introducing BEBs with higher battery sizes (400 kWh, 500 kWh, and 600 kWh).This resulting BEB system configuration is robust against any single charging station failure.During failure, the model creates a new charging schedule utilizing the remaining charging stations and ensures that all BEBs complete their scheduled trips (an example is illustrated in Supplementary Tables 7 and 8).For instance, the energy demand of Bus ID 3 is 412.8 kWh drawn from four en-route charging stations ID 4, 7, 19, and 24 in the nominal operation (163.79 kWh, 33.33 kWh, 118.52 kWh, and 97.18 kWh, respectively).In the case of the failure of any of these four charging stations, Bus ID 3 charges the same amount from the remaining three stations (for more details, see Supplementary Tables 9 and 10).
In the Robust Model (k = 1), the day-to-day operational costs vary from $2,021.47 (no disruption) to $2,069.85(disruption of Station ID 4).Supplementary Fig. 3 and Supplementary Table 11 illustrate the daily operational costs of all the scenarios of one and two charging station disruptions in the Robust Models with k = 1 and k = 2, respectively.
For a higher level of conservative (k = 2), a resilient BEB system requires 33 charging stations with 33 poles.The remaining 31 stations will satisfy the fleet energy demand if any two charging stations are jointly disrupted.
Even though the robust BEB system configuration has more allocated charging stations (18 locations in k = 1 and 33 locations in k = 2) compared to the Base Model (5 locations), the number of charging stations with multiple poles in the Robust Models is lower (one station in Robust Model with k = 1 and none in the Robust Model with k = 2).In comparison, the Base Model has two stations with multiple poles.
The energy demand shows the same trend (Supplementary Tables 12-14).The Base Model's highest daily energy demand location is 5679.78kWh.However, in the robust BEB system configuration with k = 1 and k = 2, the highest daily energy demands are 2807.45kWh (≈49% of the Base Model) and 1805.25 kWh (≈32% of the Base Model), respectively.

The Price of Robustness (PoR)
The proposed two-stage RO Model provides a resilient BEB system configuration against k simultaneous charging stations.However, this    comes at an additional cost, as presented in Table 6.This cost is called the Price of Robustness (PoR) (see Eq. 22 in "Methods: Two-stage robust model").The PoR of the robust BEB system configurations with k = 1 and k = 2 are 3.26% and 8.12%, respectively.Therefore, designing a robust BEB system for Oakville's transit network that can function with one charging station failure will only cost 3.26% more than the Base Model.This will prevent up to a 34.03% reduction in operation.The dollar value of such service reduction is enormous.For k = 2, a robust BEB system costs 8.12% more than the Base Model.However, it prevents up to 58.18% of service reduction if two charging stations are disrupted.Eventually, system robustness enhancement increases the total expenditure.
For further clarification, Fig. 1 shows the percentage cost deviation of each component between the Base Model and the Robust Models with k = 1 & 2. All the capital costs are increased in the Robust Models except the fleet cost (without batteries).The charging system costs are also increased, including infrastructure costs (number of stations) and chargers costs.The battery costs also increased, but not as much as the charging system costs.On the other hand, the operational costs in the Robust Models are lower.Similarly, the on-peak demand of the Robust Model with k = 2 is 77% lower than the Base Model.Most importantly, the total system GHG emissions of the Robust Model with k = 2 is 8% lower than that of the Base Model.

Discussion
Several certain (e.g., maintenance) and uncertain actions (e.g., electricity outage and component failure) face BEB transit systems, accentuating the importance of a resilient BEB system configuration implementation.However, the cost of a resilient BEB system is related to the conservative level (k).The BEB system configuration, total system costs, and surely the degree of the system robustness depend on the k value.The appropriate k value for any given transit network should consider the project budget, the risk facing the charging system, the price of robustness (PoR) for several k values, and the robustness assessment.
Motivated by these issues, this work contributes to the development of a two-stage RO model for a resilient BEB system configuration, planning, and operation that considers charging station disruptions.In the first stage, the model decides the optimal locations and configurations of the charging stations and the BEB fleet configuration based on the worst-case realizations in the charging station failures uncertainty set.In the second stage, the recourse decisions of the charging schedule are obtained based on the first-stage BEB system infrastructure and the revealed uncertainty.In summary, the main contributions of this work 1.The model estimates the optimal locations of the charging stations, the number of poles and charger-rated power (heterogeneous), and the BEB fleet battery capacities (heterogeneous).
The model minimizes the BEB system infrastructure and operational costs while accounting for the electricity Time-of-Use (ToU) tariff and demand charges, the time-based spread of the GHG emissions intensity, and limit constraints of the utility grid demand.2. The model guarantees that the optimal BEB system satisfies full operation under any charging station failure scenario while optimizing the BEB system configuration for planning and operation.3. The proposed resilient BEB system configuration model is applied to a real-world, large-scale multiple hubs transit network under  the nominal condition (k = 0) and different charging station failure budgets (k = 1 & 2). 4. The model quantifies the price of robustness, enabling decisionmakers to balance costs and risks.5.The proposed resilient BEB system configuration model against charging station failure uncertainty could be readily implemented in practice.
Previous works in the literature, including our work in Foda 33 , focused on developing static and generic BEB system configuration optimization models that are insensitive to the impact of charging station disruptions on the system configuration.Considering our work in Foda 33 and recent BEB literature, the BEB system design is not robust against charging station failure.Therefore, the service is susceptible to severe operation reduction during charging station failure.
Thus, in this study, the proposed model provides an optimal BEB system configuration design that satisfies full operation under any charging station failure scenario while optimizing the BEB system configuration for planning and operation.The obtained resilient BEB system design provides a feasible charging schedule under any k simultaneous charging station failure scenario.
Specifically, this work is different from our previous work in Foda 33 across the following aspects: (1) the main objective here is to develop a resilient BEB system configuration that is robust against charging station disruptions.In comparison, the model in Foda 33 focused on providing a static and generic BEB system configuration for planning and charging schedules that did not consider the impact of the charging station disruption.(2) The optimization model in the present study is formulated as a two-stage robust optimization problem to address charging station failure uncertainty.The proposed model is solved using the nest column-and-constraint generation algorithm.In contrast, the model developed in Foda 33 is formulated as an integer linear programming problem and solved by an over-theshelf solver.Therefore, the two models are different in the model structure.
Indeed, the BEB transit system is susceptible to unexpected disruptions that could prevent BEBs from charging.In turn, BEB system configuration predominantly relies on cost-minimization-based models, which are vulnerable to charging station disruptions 15 .Postperturbation efforts (e.g., external generators or bus replacement) could either decrease the operation level of service (e.g., BEBs violate the timetable) or increase the costs, lowering the BEB system's economic and reliability competitiveness.These concerns emphasize the need for a resilient BEB system configuration model (pre-perturbation) that could handle the charging station failures uncertainty while minimizing the system costs and, most importantly, ensuring fullservice provision.
We developed a two-stage Robust Optimization model with a budgeted uncertainty set that minimizes the total system annual costs, including capital and operational costs.This formulation produces fewer conservative designs compared to a single-stage model and avoids the necessity of failure probability distribution required in stochastic models.
The model is applied to a real-world, large-scale bus transit network and demonstrates its effectiveness.The model is solved under two different levels of disruption (conservative k = 1 & 2), as summarized in Table 7. Undeniably, a resilient BEB system design comes with additional costs.However, these costs will be lower than any unoptimized post-perturbation activities to handle the charging station failures impact.The PoR of the Robust Models with k = 1 and k = 2 are 3.26% and 8.12%, respectively.This additional cost prevents a significant service reduction if one (34%) or two (58%) charging stations fail.Such service reduction could lead to enormous losses in economic productivity, personal mobility, and social interaction.Interested readers are encouraged to see Supplementary Discussion 4 for more details.
The proposed model is applied to another transit network with a different network structure, operational timetable, and number of buses (Guelph City, Ontario, Canada).The detailed results are presented in Supplementary Discussion 5.
Sensitivity analyses are conducted to understand the impact of parameter variations, including the charging system costs (infrastructure and chargers), battery costs, and operational costs (electricity ToU, demand charges, and GHG emissions).The results of the sensitivity analysis are detailed in Supplementary Discussion 6.

Methods
A BEB system comprises three components: a transit network, a fleet of BEBs, and charging infrastructure (stations and poles).As such, it could be abstracted as a directed graph G(N,E).A set of nodes N representing potential charging locations, a set of edges E representing routes served by BEBs.
This study develops a two-stage robust model for a generalized resilient BEB system configuration.The proposed model optimizes the total annual BEB system cost while handling up to k charging stations failure (k ≥ 1).The model estimates the optimal locations of the charging stations, system components (number and location of charger stations/poles, their rated power, and BEBs onboard battery size), and optimal charging schedule (which station, charging time, charging duration, and charged energy).Moreover, the model considers partial and continuous charging strategies, electricity ToU tariffs and demand charges, WTT GHG emissions temporal distribution, and the utility grid power constraints at the station and network levels.The proposed model follows six assumptions as follows: • The operational timetable of the transit network is satisfied 34 .
• All BEBs begin their operation day at full charge 35 .
• The battery capacities of the BEB fleet are heterogeneous 36,37 .
• The number of stations, poles, and charger-rated power are heterogeneous 38,39 .
• System disruption is defined as a charging station failure that will impact the entire operation day 15 .
• No backup buses are utilized to fulfill the trips of the failed buses due to the high added cost.
The rationale of the last assumption is (1) the high cost of the BEB relative to the cost of the charging station, (2) the high number of failed BEBs due to daily charging station disruption (more than the spare ratio), (3) and the need to provide smooth operation to the passengers, drivers, and transit agency even during charging station disruption.During operation, the recovering time between two consequence trips is exploited to charge BEBs.Specifically, during each recovering time, the decisions to charge and the charging duration are informed through the BEB system configuration optimization.Moreover, each charging event should satisfy two concepts: partial charging, which caps the charging duration by the available recovering time, and continuous charging, which restricts the charging to be in a continuous time interval.In addition, the charging power of each charging event is variable.It is related to several parameters, such as the charger pole-rated power limits, the available power depending on the station's charger unit-rated power, the number of BEBs charging simultaneously, and the BEB battery capacity.
For the reader's convenience, the abbreviations and notations are summarized in Table 8, and the decision variables are presented in Table 9.

Base Model
The Base Model, without failure uncertainty of charging stations, is constructed as follows.Let I denotes the set of candidates charging locations.The binary decision variable x i indicates whether location i ∈ I is selected as a charging station.The selection of candidate charging station locations is based on three measures.First, the weighted degree centrality (the number of buses recovering) of each bus stop, terminal, or hub in the network is estimated, and stations with a higher weighted degree are prioritized.Second, for each route, the start, end, and any other en-route stop with a lengthy recovering time (≥2 T s ) were considered.Third, the number of en-route candidate charging stations in the routes for each bus should be at least k + 1, where k is the budget of the charging station failure.The rationale is to ensure that the resulting solution is flexible to address the failure uncertainty using all the available decisions (charging station location and configuration, onboard battery capacity, and charging schedule).
The charging station in location i (x i = 1) is equipped with a charger unit of rated power P st i and a number of charger poles N po i .A penalty cost of unsatisfied operation is added, which accounts for failed BEB trips during disruption.This is to meet the relative complete recourse property of the proposed two-stage robust model.For each bus b ∈ B, z b,j is a binary variable indicating if bus b will fail to operate after serving segment j due to insufficient battery state of charge (SoC) under the lower limit.A high penalty cost with a suitably large value is included ensuring that a full operation is satisfied.The trips of each bus b are split into a set of segments J b , where the index j ∈ J b indicates a sub-trip between two consecutive potential charging locations.The working day is discretized to uniform timeslots T s and is indexed by t ∈ T. The objective function of the Base Model in (1) aims to minimize the total annual BEB system cost, comprising six terms.The capital costs are annualized using a factor τ related to lifespan and the discount rate.min x,P st ,N po ,Q,z,y,α,γ,P,P d ,P avg ,S dep τ X i2I In Eq. ( 1), the construction cost of charging stations is (ρ st ), followed by the cost of charging components (charger units ρ ch and charger poles ρ po ).The fleet cost includes batteries ρ batt and buses ρ bus .The penalty cost (ρ pen ) is allocated for unsatisfied trips due to failed buses if they exist.The operational costs include electricity ToU tariffs (ρ elect t ), well-to-tank (WTT) GHG emissions (ρ em t ), and demand charges (ρ DC ).The first two parts of the operational costs are related to the power to charge bus b in station i after serving segment j at timeslot t (P b,j,i,t ), and the latter is related to the daily peak power demand (P d i ).It is worth noting that including the temporal WTT GHG emissions resulting from electricity generation in the proposed model aims to decrease the overall GHG emissions of the entire system, enhances the environmental competitiveness of the BEB system, and aligns with carbon pollution pricing policies 40 .In Rupp 35 , the charging schedule is optimized, incorporating the electricity ToU rates and the time-based values of CO 2 e emissions per kWh.The research reveals that integrating WTT GHG emissions into the optimization process results in a 14.9% reduction in total system GHG emissions.Additionally, in Foda 33 , when both the ToU of WTT GHG emissions and electricity tariffs are taken into account, the total annual WTT GHG emissions decrease by 13.34%.
The model in ( 1) is solved under a set of constraints (2-18).Constraints for the battery state of charge (SoC) are described in (2-5).The battery capacity of each bus b during operation is limited to a predetermined range to satisfy the scheduled trips.In (2 and 3), the arrival battery capacity of bus b to location i after serving segment j should be higher than a minimum value (ϑ min Q b ).Equation (2) restricts the arrival battery level for the first subtrip as the buses are fully charged at the start of the operation ϑ max Q b (Assumption 2), while Eq. ( 3) constrains the remaining sub-trips.Where S dep b,j,i is the battery level when bus b departs from location i to serve segment j and d b,j e base + e batt Q b À Á is the consumed energy in this segment.The consumed energy during operation in segment j is a function of the segment length d b,j and the energy consumption rate.In this work, the energy consumption rate is formulated as e base + e batt Q b À Á , where e base is the energy consumption rate for the base component without including the battery weight, e batt Q b is the variable component of the energy consumption rate due to the weight of a battery pack with capacity Q b , and e batt denotes the extra energy consumption rate resulting from an increase in the battery size by one unit 41,42 .It is worth noting that raising the bus battery capacity results in an increase in the weight of the battery pack, subsequently leading to a higher bus energy consumption rate 43 .While the departure battery capacity (S dep b,j,i ) is restricted below a maximum percentage (ϑ max ) of the battery capacity (Q b ) as mentioned in Eq. ( 4).Moreover, the relation between the departure battery capacity of bus b from location i to serve segment j (S dep b,j,i ) and the following segment departure battery capacity S dep b,j + 1,i 0 is presented in Eq. ( 5).
In the case of a bus b failure after serving segment j (z b,j = 1), according to Eq. ( 5), all battery capacity constraints will be redundant, the bus will be out of the charging network, and a penalty cost will be added.While if no failure occurs, Eq. ( 5) emphasizes that the battery capacity when bus b departure to segment j + 1 (S dep b,j + 1,i 0 ) equals the summation of the battery capacity when the bus departure to the previous segment j (S dep b,j,i ) and the charged energy during the recovering time after serving segment j ð P t2R b,j,i 0 η ch T s P b,j,i 0 ,t Þ minis the consumed The charger unit-rated power at station i ∈ I

Q b
The battery size for bus b ∈ B z b,j A binary decision variable denotes whether the bus b failed after serving segment j or not y b,j,i,t A binary decision variable, y b,j,i,t = 1 if the bus b charged in charging station i after serving segment j at timeslot t, y b,j,i,t = 0 otherwise α b,j,i,t energy during segment j.
Through Eqs.(6 and 7), the charging power of bus b after serving segment j in location j during timeslot t (P b,j,i,t ) is bounded.Constraint (6) works in two ways.First, the charging power P b,j,i,t is zero if the binary decision variable of charging bus b in timeslot t (y b,j,i,t ) is zero.In addition, P b,j,i,t is lower than a maximum charger pole's power limit P max po .In Eq. ( 7), the charging power is lower than a maximum factor (λ 1 ) multiplied by the battery capacity.This factor is related to the battery C-rate (the rate of charge or discharge relative to the battery capacity).Charging above the C-rate will lead to accelerated battery fading 44 .
Equations (8-10) establish a continuous charging strategy using the auxiliary variables α b,j,i,t and γ b,j,i,t .From Eq. ( 8), α b,j,i,t captures the status of unplugging the charger pole.Similarly, in Eq. ( 9), γ b,j,i,t equals one if the charger pole is plugged into the bus.Therefore, Eq. ( 10) enforces the charging continuity by setting the status change of plugging and unplugging to be less than or equal to one during the same charging process.
The charging station constraints are presented in Eqs.(11-13).Equation (11) guarantees that if no charging station is built in location i, there is no charger unit with N po i charger poles deployed at this location.Moreover, the number of charger poles utilized in any allocated station is bounded by an upper limit N max i which varies across locations.Equation (12) ensures that the number of buses charging in the same timeslot t and location i is less than or equal to the deployed charger poles.Similarly, in Eq. ( 13), the summation of the charging power at the same location and timeslot will not exceed the chargerrated power at this charging station (P st i ).In Eqs.(14 and 15), the total charging power during each timeslot t for each allocated station and network level is restricted to be less than the upper bounds that depend on the ToU.
The electricity demand charges are determined by the peak power demand recorded during a billing period.It is measured as the maximum average electric power consumed within a specific time interval (e.g., 1 h).The average power of each demand measurement interval ω ∈ Ω in station i is calculated based on Eq. ( 16), where Ω is the set of daily demand charges measurement intervals and T ω is the set of timeslots in demand interval ω.In turn, in Eq. ( 17), the maximum daily power demand P d i in charging station i is estimated.
Equation ( 18) imposed the types of variables, such as x i ,z b,j ,y b,j,i,t ,α b,j,i,t and γ b,j,i,t are binary, N po i is a non-negative integer, and P b,j,i,t ,P d i ,P avg i,ω , and S dep b,j,i are continuous.The variables P st i and Q b are selected from predefined finite sets that represent a wide range of the available values/specifications in the market with the recent technology.The Base Model of the BEB system configuration is formulated as a mixed integer linear programming (MILP).
Two-stage robust model The two-stage robust model satisfies all the charging station failure scenarios at the minimum total system costs.A budgeted uncertainty set presented in Eq. ( 19) is defined to allow up to k simultaneous failures of charging stations from the beginning of the BEB system operation.Where ξ i is a random binary variable denoting whether the charging station in location i ∈ I fails.
Given the uncertainty set Ξ defined in Eq. ( 19), the resilient BEB system configuration model is formulated as follows.min Subject to: (2-12), (14-19), and In this two-stage RO model, the decisions of the charging stations allocation, charging unit-rated power, the number of charger poles in each station, and the battery capacity of each bus are taken in the first stage of minimization (here-and-now decisions).However, the actual operation decisions, such as the charging schedule (charging decision, charging power, and segments-specific departure battery SoC) and the bus failure decision, are taken in the second stage after the charging station perturbations have occurred via the maximization over the uncertainty set Ξ (wait-and-see decisions).
Most notably, multiplying the daily operational costs in the objective function by the parameter δ (number of workdays) does not mean that the charging station failure ξ ∈ Ξ will last for all the δ days.This approach is utilized as the operational costs are estimated daily (depending on the charging schedule), and the objective function is represented annually.Moreover, the two-stage optimization model relies on minimizing the impact of the worst-case scenario approach, which aligns with assuming the annual operational costs are caused by the worst-case charging station failure on all days.However, this is just the worst-case scenario.The actual annual operational costs of the obtained resilient model are estimated after the realization of each day charging station failure uncertainty.
The objective function of the two-stage RO model is solved under the same constraints of the Base Model after modifying Constraint (13)  to Eq. ( 21) to include the uncertainty budget set constraint presented in Eq. ( 19) and have the failure decision and the associate uncertainty set in the model.
Equation (21) ensures that the charging power in the failed station is zero.Moreover, this emphasizes that the charging decision variable y b,j,i,t of bus b ∈ B after serving segment j during timeslot t ∈ T in failed station i will equal to zero as restricted in Eq. (6).It is worth noting that this modification does not restrict charging infrastructure allocation in the failed location.In contrast, and due to the maximization max ξ2Ξ to estimate the worst-case scenarios, the random disruption variable ξ i will equal to one only in locations i chosen to build charging stations (x i = 1).Toward this end, the proposed resilient model provides the BEB system infrastructure planning (number and configuration of charging stations and BEBs configuration) that is robust against the charging system infrastructure disruption.
The price of robustness is calculated using Eq. ( 22) 27 , where ROSC(k) and DOSC are the optimal annual system cost of the Robust Model with budget k and the deterministic Basic Model.The PoR of the robust BEB system at each value k is calculated by comparing the annual system cost with the Base Model (k = 0).

Solution algorithm
The proposed two-stage RO model is considered a tri-level optimization problem with mixed integer variables, which takes the form of min x,P st ,N po ,Q À max ξ2Ξ À min Z ,y,α,γ,P,P d ,P avg ,S dep . The solution algorithms are detailed in Supplementary Discussion 7.Moreover, computational performance enhancement approaches for the solution algorithm are described in Supplementary Discussion 8. Fig. 2 depicts a framework of the solution algorithm.
Nevertheless, the two-stage RO problems are generally NP-hard and computationally intractable for more realistic size models 45 .Moreover, the proposed model's second-stage problem is mixedinteger programming (i.e., z,y,α,γ ∈ {0, 1}).Therefore, the strong duality cannot be directly applied to the second-stage problem max ξ2Ξ À min Z ,y,α,γ,P,P d ,P avg ,S dep : This condition renders the standard decomposition methods such as the L-shaped method 46 , Benders decomposition 47 , and classical column-and-constrained generation (C&CG) method 27,48 unsuitable to solve the proposed model.Therefore, we apply the nested column-and-constrained generation (NC&CG) framework developed by Zhao and Zeng 49 to solve the twostage RO models with mixed-integer recourse problem.The NC&CG method is proven to be an exact algorithm for solving the two-stage RO problem in finite steps 49 .
In the NC&CG algorithm, the two-stage RO model is decomposed into outer-level and inner-level problems.Each problem is solved using the standard C&CG method.Specifically, the outer-level problem calculates the BEB system infrastructure configuration by solving the firststage problem under the worst-case scenarios estimated using the subproblem.While the inner-level problem iteratively solves the secondstage problem to identify the worst-case scenarios for the given BEB system infrastructure configuration (i.e., x,P st ,N po ,Q) resulted from the outer-level problem.
For any resulting first-stage variables (x,P st ,N po ,Q), the secondstage problem is feasible.As the recourse variables related to the charging schedule (y,α,γ,P,P d ,P avg ,S dep ) and penalizing the unsatisfied operational trips are addressed in the objective function of the second stage (z).Therefore, the relative complete recourse condition is maintained in the proposed model under any scenario estimated according to the maximization function with respect to the random failure variable (ξ).
Outer-level C&CG solution algorithm.The outer level of the NC&CG algorithm is considered a standard C&CG framework 49 .Generally, the C&CG procedure comprises two problems, a Master Problem (MP) and a Sub-Problem (SP), solved in an iterative process 48 .This is based on the formulation of the two-stage RO problem that includes a master problem (first stage) in the form of min and a sub-problem (second stage) in the form of max − min.
The MP and the SP of the proposed two-stage RO BEB system configuration model are presented in Eqs.(23-40) and Eqs.(41-50), respectively.
[MP]: min x,P st ,N po ,Q,z q ,y q ,α q ,γ q ,P q ,P d,q ,P avg,q ,S dep,q τ X i2I Article https://doi.org/10.1038/s41467-023-43924-6 Nature Communications | (2023) 14:8279 Subject to: (2), (11), S dep,q b,j + 1,i 0 ≤ S dep,q b,j,i À d b,j e base + e batt Q b + X t2R b,j,i 0 γ q b,j,i,t ≥ y q b,j,i,t À y q b,j,i,tÀ1  X b2B P q b,j,i,t ≤ P st i 1 À ξq [SP]: X b2B y b,j,i,t ≤ Npo i 8i 2 I,j, 2 J b ,8t 2 T ð47Þ X b2B P b,j,i,t ≤ Pst i 8i 2 I,j 2 J b ,8t 2 T ð48Þ X b2B P b,j,i,t ≤ Pst i 1 À ξ i À Á 8i 2 I,j 2 J b ,8t 2 T,ξ 2 Ξ ð49Þ z b,j 2 0,1 f g 8b 2 B,8j 2 J b y b,j,i,t 2 0,1 f g,α b,j,i,t 2 0,1 f g,γ b,j,i,t 2 0,1 f g,P b,j,i,t ≥ 0 8b 2 B,8j 2 J b ,i 2 I,8t 2 R b,j,i S dep b,j,i ≥ 0 8b 2 B,8j First, the MP is solved to obtain the optimal first-stage variables representing the optimal infrastructure configuration, such as the allocated charging stations x, charger-rated power in each station Pst , number of charger poles Npo , and the BEB fleet battery capacities Q considering the charging station failure scenarios q ≤ n obtained from the SP solutions.Where q is the failure scenario index, and n is the number of scenarios.In the first iteration, the MP is solved with the initial charging station failure scenario (n = 0).Then, the output MP solution (x, Pst , Npo , Q) are provided to the SP to estimate the worstcase scenario of charging station failure ( ξ) that has the highest operational cost and failed buses (minimum level of service).In the next iteration, the resulting worst-case scenario q ( ξ) is added to the MP (variables (z q ,y q ,α q ,γ q ,P q ,P d,q ,P avg,q ,S dep,q ) and Constraints (24-40)) to improve the first-stage solution (more robust).The new solution of the MP will satisfy all the added charging station failure scenarios (q ≤ n) and provide robust BEB infrastructure decisions against these failure scenarios.As such, in each iteration, the sub-problem is mainly solved to obtain the worst-case charging station failure ξ ∈ Ξ scenario under the BEB system configuration estimated using the MP to add this scenario in the next iteration.The SP takes the form of maxmin.
The outer-level C&CG algorithm iterates until reaching a robust BEB system configuration against all the charging station failure scenarios that increase the second-stage costs.The MP's objective function value is the solution LB.In addition, the summation of the objective function of the SP and the first-stage infrastructure cost denotes the solution UB.The gap between the UB and LB decreases during iterations and the algorithm terminates after reaching a predefined relative optimality gap (ε).It is worth noting that the relative complete recourse property is satisfied in the proposed model.Therefore, there is no need to add the feasibility cuts during the iterations.Moreover, the algorithm guarantees convergence in finite iterations as the extreme points of the feasibility region of the uncertainty variable are finite.Finally, the outer-level C&CG solution procedure framework is summarized in Algorithm 1 in Supplementary Discussion 7.
Inner-level C&CG solution algorithm.The inner-level C&CG solution algorithm is utilized to solve the sub-problem (SP) presented in Eqs.(41-50) that takes the form of maxmin and supplies the MP with the worst-case charging stations failure scenarios ( ξ).The bi-level SP cannot be directly reduced into a monolithic optimization problem using the Karush-Kuhn-Tucker (KKT) conditions or the strong duality property because of the integer recourse variables in the second level of the SP (z,y,α,γ).The main idea of the NC&CG method developed in ref. 49 is to solve the bi-level SP by its equivalent tri-level problem.The tri-level problem will take the form of maxminmin that is similar to a twostage RO model after separating the discrete variables (z,y,α,γ) from the continuous variables (P,P d ,P avg ,S dep ) in the second-stage problem as presented in Eq. (51).In this case, the recourse variables in the third level are continuous.Therefore, the standard C&CG solution framework could solve the SP.This is called the inner-level C&CG solution Open Access This article is licensed under a Creative Commons Attribution 4.0 International License, which permits use, sharing, adaptation, distribution and reproduction in any medium or format, as long as you give appropriate credit to the original author(s) and the source, provide a link to the Creative Commons licence, and indicate if changes were made.The images or other third party material in this article are included in the article's Creative Commons licence, unless indicated otherwise in a credit line to the material.If material is not included in the article's Creative Commons licence and your intended use is not permitted by statutory regulation or exceeds the permitted use, you will need to obtain permission directly from the copyright holder.To view a copy of this licence, visit http://creativecommons.org/ licenses/by/4.0/.

Fig. 1 |
Fig. 1 | Cost comparison between Base Model, Robust Model (k = 1), and Robust Model (k = 2).Each parameter in the Robust Model with k = 1 (one charging station failure) and the Robust Model with k = 2 (two charging stations failure) is compared with the Base Model parameter (no charging station failure).These parameters include the system costs, GHG emissions, and energy demand in each period.Each bar represents the parameter's relative percentage change in Robust Models from the Base Model value.The relative percentage value is estimated using the following formula: (Robust Model parameter value − Base Model parameter value)/ (Base Model parameter value).

Fig. 2 |
Fig.2| Nested column-and-constraint generation solution The algorithm started with solving the master problem (MP) to estimate the first-stage variables (locations of the charging stations x, charger-rated power in each station P st , number of poles N po , and fleet battery capacities Q) and the iteration lower bound (LB).Then, the sub-problem (SP) is solved using the column-and-constraint (C&C) generation method.The SP includes solving the inner master problem (IMP) to obtain the failure scenario ξ and the inner problem upper bound (IUB), along with solving the inner sub-problem (ISP) to get the value of the discrete variables of the ISP (z,y,α,γ) and the inner problem lower bound (ILP).The values of the ISP discrete variables z,y,α,γ are used iteratively to update the IMP until the convergence condition of the SP is reached (relative optimality gap of the inner problem G I is lower than a small number ε).The solution of the SP is taken as the iteration upper bound (UB).The obtained failure scenario from this iteration (ξ) is used to update the MP of the next iteration by adding the associated C&C.This procedure runs iteratively until the termination criteria of the outer problem are achieved (relative optimality gap of the outer problem G O is lower than a small number ε).

Table 1 |
Results of BEB system configuration (Base Model) Total system cost ($/year) BEB fleet configuration (# × kWh) Number of charging stations Power of charging units (# × kW) Number of poles (#)

Table 2 |
System annual costs (Base Model)

Table 3 |
Failed buses and service reduction at r = 1 (Base Model)

Table 4 |
Service reduction at r = 2 (Base Model)

Table 5 |
Results of BEB system configuration (Robust Models)

Table 6 |
System annual costs (base and robust models) a Operational costs include the electricity ToU, demand charges, and emissions costs and are estimated in the Robust Models based on the scenario of no charging station failures (nominal operation).Please note that the battery capacity of each model is a decision variable, hence the variation of the battery cost across models.Electricity demand charge ($)Off-Peak Energy demand (kWh) Mid-Peak Energy demand (kWh) On-Peak Energy demand (kWh)

Table 7 |
Cost and behavior of the proposed resilient BEB models

Table 8 |
Abbreviations and notations tThe network upper limit of power in timeslot t according to ToU (kW)

Table 9 |
Decision variables A non-negative continuous variable presents the battery level of bus b before departure to serve segment j from the potential location i (kWh)ξ iA binary decision variable, ξ i = 1 if the charging station in location i is failed, ξ i = 0 otherwise Nature Communications | (2023) 14:8279 2 J b ,i 2 I