Co-optimizing the Smart Grid and Electric Public Transit Bus System

As climate change provides impetus for investing in smart cities, with electrified public transit systems, we consider electric public transportation buses in an urban area, which play a role in the power system operations in addition to their typical function of serving public transit demand. Our model considers a social planner, such that the transit authority and the operator of the electricity system co-optimize the power system to minimize the total operational cost of the grid, while satisfying additional transportation constraints on buses. We provide deterministic and stochastic formulations to co-optimize the system. Each stochastic formulation provides a different set of recourse actions to manage the variable renewable energy uncertainty: ramping up/down the conventional generators, or charging/discharging of the transit fleet. We demonstrate the capabilities of the model and the benefit obtained via a coordinated strategy. We compare the efficacies of these recourse actions to provide additional managerial insights. We analyze the effect of different pricing strategies on the co-optimization. We also conduct congestion analysis in the power network, comparing our cooperative approach to a non-cooperative strategy when we assume electrified fleet sizes grow with greater battery capacities. Given the recent momentum towards building smarter cities and electrifying transit systems, our results provide policy directions towards a sustainable future. We test our models using modified MATPOWER case files and verify our results with different sized power networks. This study is motivated by a project with a large transit authority in California.


Introduction 1.Motivation
The global agenda established in the Paris agreement, which has been ratified by more than 180 countries (United Nations Climate Change 2020), has declared climate change to be at the forefront of challenges governments around the world are looking to overcome in the coming decades with green solutions.The global effort to reduce emissions encompasses various climate-conscious efforts, such as switching to renewable energy sources, decarbonization of transportation, and engineering of microbes to produce biofuels.Within the scope of electrification of mass transit systems, battery-electric buses play a crucial role in mitigation efforts.To this end, battery-electric buses (BEB) have been implemented throughout several countries including China, the United States, and many European countries (Pagliaro and Meneguzzo 2019).
In this work, we address challenges related to the electrification of transportation systems associated with the joint operation of power and transit systems.The key question we address is to determine how a fleet of electric buses can best be integrated into public transportation infrastructure.In particular, the task at hand is to determine where and when to charge and discharge the buses such that operating is not a detriment to the power system, but rather, offers flexibility to the grid depending on the transportation-operational requirements.By co-optimizing, we The multi-period optimal power flow problem (MPOPF) is a natural extension of the OPF problem, in which there are components involving multiple time periods such as storage units.In particular, storage units provide the capability of storing energy for a period of time and releasing it at a later time period, which introduces a temporal dependency rather than the snapshot of the system studied in the original OPF formulation.There are several works associated with the operation of the power grid by use of MPOPF, alternatively known as dynamic power flow (DOPF).By utilizing an MPOPF formulation, one can provide additional services to the power grid, such as voltage stability regulation and ramping reserves, which, in general, are referred to as ancillary services in the power systems literature; see, e.g., Wu et al. (2004).The role of ancillary services in MPOPF is studied by Yao et al. (2019), who propose an MPOPF formulation that incorporates demand-responsive loads specifically to improve steady-state voltage stability.Similarly, Costa and Costa (2007) present a DOPF-based model to clear both energy and spinning reserve day-ahead markets.Moreover, Lamadrid and Mount (2012) state that ancillary services are provided by uncertain renewable energy generation, which serves as ramping reserves.In the present work, we extend the standard MPOPF formulation to incorporate a fleet of public transportation buses that have the capability to charge and discharge within the power network.Bukhsh et al. (2016) propose a stochastic MPOPF model to cope with the uncertainty stemming from renewable generators.A sparse formulation of a robust MPOPF problem with storage units and renewable generators is provided by Jabr et al. (2015), whose solution methodology utilizes receding horizon control.Chen et al. (2005) propose an MPOPF formulation that integrates wind farms into the generation portfolio.Lorca and Sun (2018) address the nonconvexity in the power flow equations and uncertainty in renewable generation in terms of both active and reactive power.Their model incorporates transmission constraints and reactive capability curves of both conventional and renewable generators.To incorporate uncertain generation in our work, we also propose two additional formulations extended from stochastic MPOPF.
From a power systems perspective, our work can be considered as an extension of the MPOPF problem with (mobile) storage units.Under this interpretation, the storage units are the buses in the transit fleet with additional operational constraints related to the transportation system.Many papers model the use of energy storage in the power grid.As a closely related work, a model similar to ours can be found in a study by Wang et al. (2013).Here, the authors consider an MPOPF formulation that incorporates large-scale standalone battery energy storage devices to reduce the fluctuations in the grid and to handle peak shaving in the grid.The objective in the formulation is to minimize the total generation cost (which can be different in each time period), including the charging and discharging costs of the batteries.They also argue that the batteries may be used to handle the uncertainty introduced when renewable energy sources are considered.Note, however, that no public transportation aspects are considered in their work.
There are several papers in the transportation literature investigating problems associated with the electrification of transportation systems.Xylia et al. (2017a,b) propose mathematical optimization models to locate charging stations within an urban transportation network.They analyze the environmental outcomes, including emission of gases, based on a case study in Stockholm.Yi et al. (2018) investigate the effect of ambient temperature on the energy consumption of autonomous electric vehicles.Their results are demonstrated with a data-driven simulated transportation network in New York City.Additionally, Wei et al. (2017) focus on the coordinated operation of transportation and power systems.They assume an electrified transportation network capable of wireless power transfer coupled with a power network.They propose an optimal traffic-power flow model optimizing the generation schedule and congestion tolls as an optimization problem with traffic user equilibrium constraints.
The study of interdependent systems typically necessitates the use of multi-objective optimization techniques.Alarcon-Rodriguez et al. (2010) provide an overview of multi-objective planning of distributed energy resources (DERs) where the objective function involves terms from perspectives such as the distributed energy resources developer, the distribution system operator, and the regulator.They underline the importance of DER integration and argue that poor integration of DERs can result in increases in losses, as well as voltage and network instability.The insights provided by Alarcon-Rodriguez et al. (2010) exemplify the benefits obtained by a co-optimization framework.In our case, the co-optimization is considered between the independent system operator (ISO) of the power network and the transit authority.
From the perspective of interdependent systems, only a few papers focus on the joint operation of electric vehicles and the power grid.Azizipanah-Abarghooee et al. (2016) aim to coordinate plug-in electric vehicles in a multiobjective security-constrained DOPF problem to minimize the total operation cost and emissions.Zakariazadeh et al. (2014) propose a multi-objective method for charging/discharging electric vehicles to minimize the total operational costs and emissions.An important assumption in their methodology is that the EV owner decides the parking time for charging/discharging one day in advance.This assumption is one of the key differences between public and private means of transportation.Because it considers public transportation systems, our study assumes that the decision of when and where to charge/discharge is made as a consequence of the joint operation between the independent system operator (ISO) and the public transportation authority (TA).
A related methodology to ours is by Lin et al. (2019), who study a planning problem that decides the locations and sizes of charging stations, considering a coupled transportation network and power network.Specifically, they seek to determine a long-term plan with a horizon of roughly 10 years.An immediate drawback is that they assume that all information (electricity prices, infrastructure costs, demand, technology) will be relatively unchanged over their planning horizon.Thus, having such a long-term strategy may not be preferable.Further, the OPF problem is typically solved many times a day, sometimes as often as every five minutes (Cain et al. 2012), whereas the formulation by Lin et al. (2019) couples the transportation aspects with OPF only at two periods.The first of these represents the first 10 years of the planning horizon while the second stage is the once at a given stage of length 10 years, and the second represents 30 years.Another shortcoming of their model is that it captures instantaneous power flow, whereas storage optimization requires calculations of energy (power accumulated over time).In contrast, the time dimension in our model (and other MPOPF-based models) captures the relationship between power and energy.
From the perspective of public transit operators, Abdelwahed et al. (2020) develop models to optimize the charging operation of a fleet in Rotterdam.However, they do not address the coupling effect of the power system, such as power system operation and limitations, V2G possibilities, and offset of the intermittency of renewable generation.
In sum, our work differs from the related works in the literature in the following aspects: we consider (i) a fleet of electric vehicles and a power grid operated by a social planner, (ii) operational constraints related to the transit fleet while providing services to the power grid, including V2G, (iii) schedules for the battery (transit bus) connection, and (iv) relocation of the batteries within the power grid.Further, we address the joint operation of an electric public transit system and the power system, specifically when the fleet is "off-schedule.We use "off-schedule" to refer to the set of time periods when the buses are not on their routes.
Our primary contributions are as follows: 1. To the best of our knowledge, this is the first paper to address this problem in detail.We note that a preliminary, and abbreviated, version of this work appeared in Yetkin et al. (2020).
The rest of the paper is organized as follows.In Section 2 we provide a formal definition of the problem.In Section 3 we introduce the deterministic formulation of the optimization problem.In Sections 4.1 and 4.2 the two 2SSP formulations are provided.Numerical results are presented in Section 5, managerial insights are provided in Section 6, and Section 7 concludes the paper.Additional content can be found in Appendices A-D.

Problem statement
We consider a single social planner who manages both the power and public transit systems.The goal of the social planner is to co-optimize the joint operation of these two systems, by optimizing the charging/discharging of the transit bus batteries when buses are off-schedule, over a horizon of one day.The only operational requirement on the transit buses is that they have to be fully charged before starting their schedules on the following day.The following decisions are addressed in the formulation while satisfying operational constraints: (i) where, among a prespecified subset of nodes that serve as charging stations, to locate transit buses to charge/discharge, (ii) how much electricity to charge/discharge, and (iii) power dispatch.
We simplify the problem by assuming the following: • All of the information related to the power network is known (topology, generator limits, line limits, etc.), except the ramping costs of conventional generators (which will be investigated in Section 6.2).
• Over the course of one day (the planning horizon) the topologies of both the transportation and power networks remain fixed.The power network is provided as a graph with edges representing power lines and nodes representing connection points of lines.In the transportation network, the nodes of the graph are interpreted as charging stations, and the edges as the transit routes among charging stations.Note that the charging stations in the transportation network act as coupling points between the two networks since they also appear as a subset of nodes in the power network.
• Electricity demand is known for the entire horizon, with the further assumption that an accurate day-ahead estimation of the demand is accessible.
• We consider direct current (DC) approximation for the power system (Conejo and Baringo 2018).This assumption is useful for simplifying the computational complexity of our optimization problem since the alternating current (AC) OPF problem is known to be nonlinear and non-convex (Gopinath et al. 2020).
• We assume black start capabilities for conventional generators.This assumption eliminates the start-up cost of conventional generators.
• All of the information related to the transit system is known (i.e. transportation network, schedules, travel times).
• All of the information related to batteries of the transit vehicles are known (the charge/discharge rate, total capacity, efficiency).We assume that the efficiency of the battery is the same for charging and discharging, though this assumption can be easily relaxed.
• Each charging station in the network has enough capacity for the entire fleet to charge simultaneously at one location.A related discussion is also provided in Appendix B.Moreover, buses can discharge at a charging station as part of the V2G technology.

Deterministic formulation
In this section, we present the deterministic formulation to co-optimize the operation of the transit fleet and the power grid.The formulation can be seen as an extension of the MPOPF problem with additional transportation aspects.The problem is a mixed-integer quadratic program (MIQP).The following components are captured by this formulation: • Ensuring each bus has a full battery at the end of their off-schedule (also considered by Abdelwahed et al. (2020)).
• Dispatch of power subject to physical constraints of the grid, such as ramping rates, transmission limits, etc.
• Charging/discharging of the buses subject to physical constraints with respect to the batteries of the transit buses, such as charging capacity and charging/discharging rate.
• Relocation of the buses subject to constraints related to the travel time of the buses depending on the node to connect to the electrical grid.
Due to space limitations, we provide the complete deterministic formulation in Appendix B, and we verbally describe the model in this section.
Our objective aims to minimize a convex combination, with coefficient α, of the total power generation cost and the charging/discharging cost of the transit buses.The model contains standard DC OPF constraints with adjustments to include the effects of charging and discharging.Then, based on the fleet's schedule, we ensure that initial and final battery levels are respected.The model also includes updates for the battery levels.Assignment constraints ensure that a bus must either be traversing the network or be stationed at a connection point for charging/discharging at any time point.Specifically, a bus can only relocate between two points in the power network if there is enough time available.We initially assign all of the fleet to a depot node.In addition, we have several bounds on ramping amounts of generators, generation amounts, line flows, charge/discharge amounts of batteries, and battery levels.
The two terms in the objective function each "belong" to a different party: The generation costs are incurred by the power grid operator while the charging costs are incurred by the transit operator.We use a convex combination of these two terms since they are usually in different scales, and since the central decision-maker may wish to place more or less weight on one term or the other.Similarly, in the stochastic models presented in the following sections, we use a convex combination of costs that are in different scales, to differentiate between the costs of different parties in this cooperation.In all of our numerical experiments, we set the convex combination coefficient, α, to 0.5.Based on the requirements of the specific application, one can examine different objective terms such as line losses, voltage deviations, and many others tailored towards the desired goal.Note that, due to the specific application, we consider off-schedule periods as a single block of time (e.g., 5 pm-4 am); if there are multiple, non-contiguous blocks, one should account for initial and final conditions on the battery levels for each block of off-schedule times.

Two-stage stochastic formulations
In this section, we consider renewable generation units (e.g., wind generators) within the power grid.In each time period, the quantity of renewable generation is random.We incorporate the uncertainty regarding the renewable generation units using scenarios in a two-stage stochastic modeling approach.Each of these scenarios represents one realization of wind generation distribution.The details of the scenario generation scheme are described in Section 5.2.
In addition to the assumptions listed in Section 2, we assume that a forecast of the renewable generation is available for one day, though the actual generation may differ randomly from the forecast.
Specifically, we present two different two-stage stochastic formulations, which assume different recourse actions.In the first formulation (Section 4.1), the recourse action is ramping up/down the conventional generators, whereas in the second formulation (in Section 4.2), the recourse is additional charging/discharging of the transit fleet.The first formulation assumes that the ISO is taking the recourse actions to mitigate the uncertainty, whereas the second assumes the transportation authority is doing so.

Ramping-based formulation
The following formulation can be considered as an extension of the two-stage stochastic single-period OPF formulation presented by Morales et al. (2013) in the sense that we have the additional aspect of transportation and related operational constraints in the first stage.Briefly, we have the following set of decisions in addition to those listed in Section 3: a first-stage commitment of the renewable generation units on how much to generate; and a second-stage adjustment of power generation via ramping up/down the conventional generators.We again omit the complete model and provide the details in Appendix C.
Our objective is the summation of first-stage costs (as in the deterministic objective function) and second-stage costs including the expected renewable generation costs and expected ramping costs.Added to the constraints captured in the deterministic model in Section 3 are the second-stage nodal balance and flow constraints.We are further constrained by limits on renewable generation, limits on second-stage ramping, and limits on shedding in the second stage.We also have constraints on the transit bus battery levels, charging limits, and transit fleet operation.More importantly, we have each of the OPF constraints repeated for multiple time periods rather than a single time period, in contrast to Morales et al. (2013), where the time periods in our formulation are coupled via batteries on the transit fleet.The inclusion of multiple periods in the formulation increases the complexity of the problem dramatically.

Charging/discharging-based formulation
Rather than handling the uncertainty by ramping up/down the conventional generators, we now consider this service to be handled by the transportation authority via additional charging/discharging of the transit vehicles in the second stage.We assume that the realization of the scenarios occurs in near-real-time so that there is not enough time to relocate the transit buses after the scenario realizations.Then, we have the following set of decisions in addition to the ones in Section 3: a first-stage commitment of the renewable generation units on how much to generate; and an additional second-stage charging/discharging of the transit fleet.
A complete table of nomenclature can be found in Appendix A. The formulation of the 2SSP whose recourse is charging/discharging of the transit buses is given as follows: subject to: The objective function (1) accounts for the conventional generation cost in the first stage, expected renewable generation cost, charging/discharging cost of the fleet in the first stage and expected charging/discharging cost of the fleet in the second stage.We have already introduced the following sets of constraints in the deterministic formulation in Section 3: first-stage DC optimal power flow constraints (2), ( 4), ( 5), ( 7), ( 9), ( 11), (13); bounds on generation (15), ramping ( 16), and first-stage charging/discharging (26), (28); assignment constraints for vehicle to charging station connection and vehicle relocation (30)-(36).
We now additionally have second-stage nodal balance and flow constraints (3), ( 8), ( 10), ( 12), ( 14); limits on renewable generation (17), (18); and limits on shedding in the second stage (19).Unlike the formulation discussed in Section 4.1, we are also charging/discharging in the second stage.Thus, the battery level variables for vehicles e btω are second-stage variables over the set of scenarios ω ∈ Ω.Also, update constraints for battery levels are replicated for each scenario in ( 20)-( 23).Moreover, we have modified bounds on the charging/discharging of the vehicles in ( 24), (25).Note that the positioning variables for the vehicles z ibt , y bt remain as first-stage variables, since we assume that there is insufficient time to adjust the location of the vehicles after the scenario realizations.

Numerical experiments
In this section, we first provide (in Section 5.1) the results of a small case study for the deterministic formulation, then (in Section 5.2) the results of the stochastic formulations.Based on the transportation-electrification study on which we have collaborated with Santa Clara Valley Transportation Authority (VTA), we will focus on a regional study around San Jose, CA.Our partner VTA has been undertaking the integration of electric transit buses into their fleet in the city of San Jose, initially for a selected number of routes within their operating region.

Case study for the deterministic formulation
We consider a case study consisting of synthetic but realistic data meant to reflect the actual transit network in San Jose, CA.We overlay the 9-bus power network from MATPOWER (Zimmerman et al. 2011) atop the geographical area.Related parameters including demand (p d it ), line limits (Sij), generation limits (p g it ) and cost of generation (c g it , c g it ) are obtained from the MATPOWER case file.Figure 1 provides a visualization of the layout, indicating the locations of charging stations for electric bus connection in both the power and transit networks.Note that the transportation network is smaller than the power network since the charging stations are chosen to be a subset of nodes in the power network.In general, a power network is not confined within a city limit and hence is likely to encompass the transit region.
Line limits and demands from the 9-bus system are scaled down to the order of around 1 MWh so that we can clearly analyze the impact of the electric buses on the power network since battery energy capacities considered in this work are 0.66 MWh.Voltage angle limits δ are set to π/2 and ramping limits are chosen to be p g it 5 .Since the standard case file in MATPOWER provides a snapshot of the system in one time period, we expand the demand profile over the multiple time periods based on information obtained from the California Independent System Operator (CAISO) for the San Jose region.Moreover, the charging/discharging costs (cit) in the objective function are the electricity prices obtained by averaging the prices as described in Section 6.1.The total daily demand and the price data are displayed in Figures 2 and 4, respectively.We also provide the expanded demand profile for the power network over multiple time periods in Figure 3.
We assume that the four transit buses are 40-foot Proterra Catalyst E2Max models; the data on battery consumption, battery capacity, and charge/discharge limits are obtained from Proterra.The battery efficiency is set to 0.9.We consider hourly time steps and a 24-hour horizon.The schedules of the buses and charging station locations are obtained from VTA, where T b represents the time periods in which transit bus b is in its off-schedule.∆t(i, j) values are travel times between charging stations calculated using Google Maps (and discretized based on the resolution of the formulation).
We performed the optimization using Gurobi version 8.1.0developed by Gurobi Optimization (2020), with the default settings.The hardware was 2.2 GHz Dual-Core Intel Core i7 and 8GB memory.The solution time for this Figure 5 displays the optimal locations of the transit buses for 3 consecutive time periods.At time t = 21, all of the four vehicles are located at node 1, the transit depot.In the next time period, three of the buses remain at node 1, while the fourth is in transit.At t = 23, this bus arrives at its new location, node 2, to decrease total generation cost.Figure 6 (left) shows the generation and battery level profile.In the optimal solution, battery levels in the first periods increase due to the operational constraints and decrease in the last periods since the price of electricity and the demand are high.Further, during the periods in which the transit buses are on their schedule, we can observe that the battery levels (i.e., the amount of energy stored in the batteries of the transit vehicles when they are not connected to the grid) are displayed as zero.
Figure 6 (right) shows that the total operational cost and generation costs first slightly decrease then increase when we increase the battery capacity on the transit buses.This suggests that the presence of the batteries can alleviate some strain on the system even though the total generation amount increases.Moreover, we can observe that the charging/discharging cost is mostly negative and decreasing up to a certain level.Even though operational constraints on the transit fleet require more energy to be stored, the price difference over the course of the day causes the transit authority to be able to arbitrage and gain some profit.In Figure 7, we show that the generation profile changes dramatically as the battery capacities increase.Depending on the transit schedule, large batteries can cause added strain on the power system, while acting as generators during other periods.

Case study for the stochastic formulations
In this section, we consider the same instance described in Section 5.1, modifying the 9-bus system to include a wind generation unit located at node 4 in the power network displayed in Figure 5.No other changes are made to the 9-bus system.The generation cost of wind is assumed to be the minimum over the linear cost coefficients of conventional generation, that is, In this manner, we ensure that the wind generator is always the cheapest among all generators, conventional or renewable.The wind generation data is obtained from a simulation API (see Pfenninger and Staffell (2016), Staffell and Pfenninger (2016) for more details) for the day 09/09/19 within close proximity of the San Jose region with a maximum generation capacity set at 1 MWh.That is, the data are synthetic, but closely approximate the true wind generation of the area under consideration.Figure 8 illustrates the daily data.Moreover, we add normally distributed noise with mean zero and a small variance (on the order of approximately 0.01 MWh) to create the desired number of scenarios.When 100 scenarios are considered, we obtain the distribution shown in Figure 9.
The generated wind data are used as the renewable generation amounts for each scenario in both of the 2SSP formulations.The charging/discharging prices in the 2SSP formulations are derived as described in Section 6.2, and a visualization is provided in Figure 16.In each of the following sections, we are limited to only 10 scenarios for renewable generation due to computational limitations.Note that the primary goal of these two models is to assess the capabilities of two different formulations in terms of wind utilization, since in reality, the renewable generation cost should be the smallest among all other costs, including the ramping cost of conventional generators.Hence, one should try to utilize wind generation as much as possible.
There is evidence of asymmetry in the ramping up and down of thermal generators.There are three identified sources for these costs: (1) creep, when components operate above the design temperature; (2) thermal fatigue, when changes in temperature result in mechanical failure; (3) creep-fatigue interactions, when the two effects above compound.As studied by Moarefdoost et al. (2016), in the ramp-up of thermal generators, these three effects are present, whereas in ramp-down the main effect is thermal fatigue.For this reason, in the following numerical results, we use ramping costs defined by: That is, for ramping costs we only consider the linear generation cost coefficient c g it to make ramping slightly cheaper than generation, and, ramping down is much cheaper than ramping up.

Case study for the ramping-based formulation
Figure 10 gives a summary of the optimal solution of the formulation presented in Section 4.1.We observe that only one generator uses ramp-up in the second stage.Note that the behavior of the battery levels is similar to that resulting from the solution to the deterministic formulation, in that they have a similar charging pattern; they charge in the early hours of the morning, as well as late at night.That is, regardless of whether or not the decision is being made by the social planner, the risk associated with deciding when to charge/discharge does not drastically affect the charging/discharging times of the transit buses.This can be attributed to the fact that the generators are flexible enough to handle fluctuations in the amount of renewable generation.
In Figure 11, we present the optimal values of wind generation corresponding to the second stage resulting from solving the optimization problem found in Section 4.1 across all time periods and scenarios.For each scenario, we find that wind-generated energy is utilized in its entirety.We calculate the wind utilization measure as follows: Wind Utilization = total wind usage in optimal solution aggregation of wind generation from scenarios .
In essence, wind utilization calculates the ratio of utilized wind generation (in the optimal solution) to the total available wind generation over all of the scenarios.Since we consider all of the scenarios in the calculation of the measure, it can be thought of as an average utilization over the scenarios.This is useful to quantify in general, since we would like to utilize as much wind energy as possible in the solution.
In our numerical results corresponding to the optimization problem found in Section 4.1, the wind utilization is found to be 1.0 (i.e., 100%).As such, in this case, ramping as a recourse action is flexible enough to handle the deviations in wind generation over the entire planning horizon.However, if we restrict the ramping quantity in the second stage to only allow for very small deviations in the generation, this total utilization might not be attainable.This is because the wind generator is limited to a total hourly (periodic) generation capacity of 1 MWh, whereas in our numerical experiments we allow for ramping that can introduce fluctuations on the order of approximately 100 MWh.

Case study for the charging/discharging-based formulation
In Figure 12, we provide a summary of the solution of the formulation described in Section 4.2.It is clear that the generator outputs are much higher in the first stage compared to the solution of the alternative model displayed in Figure 10, as second-stage adjustment via ramping is not allowed in this formulation.Moreover, we also observe that the transit charging/discharging levels change in the second stage rather than in the first stage, to utilize the wind energy as much as possible.
Additionally, in Figure 13 one can view the battery levels of transit vehicles for each scenario (for 10 scenarios, as mentioned above).We can observe that the entire fleet adjusts its battery levels based on the availability of renewable generation while ensuring that the operational constraints are feasible.In particular, these operational constraints limit the solution space and make the recourse actions much more difficult than those of simple batteries.Similar to the previous subsection, we calculate the wind utilization measure given by equation ( 37) and find that for the solution to the optimization problem given in Section 4.2 the total wind utilization is 0.9645 (96.45%).

Generation profile and first-stage charging levels
In Figure 14, we present the optimal values of wind generation corresponding to the second stage resulting from solving the the optimization problem found in Section 4.2 across all time periods and scenarios.One observation is that in this case, the solution is limited by operational constraints and battery capacities.As a result, compared to the previous utilization displayed in Figure 11, we find that the model from Section 4.2 does not fully utilize wind generation later in the day (roughly from t = 15 on).These underutilized time periods occur specifically when the fleet is serving public transit demand.However, if the fleet contains numerous transit buses with complementary off-schedules that span an entire day, the utilization would certainly be superior.

Larger power grids
To verify the capabilities of the proposed formulation for cooperation, we further test it when larger power networks are coupled with the transit network.In particular, we utilize the MATPOWER case files (Zimmerman et al. 2011), specifically, case14, case30, case39, case57, and case118, where the number denotes the number of nodes in the system.These cases are directly accessible within the MATPOWER instance list.We only modify these instances by scaling down the demand, which is done similarly to the procedure explained in Section 5.1.Note that the information associated with the transit fleet remains the same.We always assume the charging stations are connected at the first six nodes of the power system.
We obtain similar findings in these instances.While imposing additional demand on the power network, the transit fleet can act as batteries for some periods and alleviate generation costs by smoothing the generation profile.Moreover, in instances in which congestion is present, we observe the effect of the transit fleet more clearly, since the unit prices of electricity set by the optimal dual variables associated with the nodal balance equations can dramatically change over time (due to congestion), and the transit fleet can utilize an arbitrage strategy, which, in fact, benefits the whole system in cooperation.
Table 1 provides a summary of solution times for the deterministic formulation.The solution time of the deterministic formulation with our modified case9 instance is much higher than the rest of the cases.This is primarily related to the additional congestion introduced into the power network.Aside from the case9 outlier, we observe that the solution times increase when we incorporate larger power networks.
Table 2 provides a summary of results for the ramping-based stochastic formulation on larger power networks.From the table, one can observe that we have complete wind utilization in every case because ramping limits of conventional generators are large enough to compensate for the uncertainty in the second stage.Moreover, in general, solution times increase when we integrate a larger power network into the formulation.
Finally, Table 3 provides a summary of results for the charging/discharging-based stochastic formulation on larger power networks.We can observe that in all of the cases, we have the same wind utilization (0.9645), since the charging limit of the transit fleet remains the same in all of the formulations, and the fleet can compensate for a portion of the uncertainty in the second stage.More importantly, we also observe that allowing second-stage charging/discharging of the fleet introduces additional complexity to the formulation since solution times are much larger than those in Table 2.

Benefit of coordinated optimization
In this section, we use the deterministic formulation to evaluate the benefit of employing a coordinated strategy between the ISO and the transportation authority.To serve as a baseline, we consider their uncoordinated operation where each party acts to manage its own objective.The uncoordinated optimization scheme is summarized in Procedure 1.
Step 1 of Procedure 1 generates a given number of scenarios, which only takes feasible charging of batteries into consideration.That is, the charging anticipated by the ISO is guaranteed to satisfy transit-operational constraints.This proves to be beneficial to the ISO, as this procedure can be seen as educated anticipation from the ISO, where ISO solves dispatch problem with additional demand determined by the scenario and obtains a set of prices from dual variables associated with nodal balance constraints 4: Using the prices, transit authority optimizes its own problem and obtains a charging/discharging policy 5: Charging/discharging policy is realized by ISO, and ISO objective value is obtained 6: Charging/discharging policy is evaluated under baseline prices to obtain transit objective they have access to some information related to the transportation system.
Step 3 simply solves an MPOPF without any of the transportation aspects in the formulation described in Section 3. In Step 4, only the transportation aspects such as charging/discharging and location/relocation of the transit buses are considered in a separate formulation.Then, Step 5 solves the formulation in Step 3 with the optimal charging/discharging obtained in Step 4 as an additional demand.Next, to make the comparison fair, in Step 7, we consider a set of baseline prices to evaluate the solution obtained in Step 4. This can also be seen as the average prices over the scenarios anticipated by the ISO.For coordinated optimization, the deterministic formulation in Section 3 is solved, with baseline prices and the objective value being calculated with convex combination coefficient α = 0.5 in the objective function (38).Then, since the uncoordinated cost accounts for the summation of the two costs (rather than a convex combination), we scale down the total uncoordinated cost by halving it, to make a fair comparison.
Figure 15 details the uncoordinated objective values for the transit authority, ISO, and their sum (all of the quantities are scaled down by 0.5 due to the presence of α in the co-optimization), and compares these with the coordinated objective values.It is immediate to see that the total and ISO objective values are always worse in the non-cooperative case.An immediate reason is that the anticipation of charging schedules made by the ISO is quite different from the actual strategy employed by the transportation authority, and the power system incurs additional generation cost.However, since we consider charging prices that are averaged over scenarios as the baseline prices, the transit objective values are comparable between the two strategies.These results suggest that the ISO benefits largely from cooperation with the transit authority.This was expected since the ISO minimizes its cost when it has full knowledge of the optimal charging schedule, and anticipation of any deviation from the optimal charging schedule will of course worsen the ISO's operation.
We also tested the benefit of coordination in the larger power networks discussed in Section 5.3.rizes the results.Note that the non-cooperative objectives are calculated by taking the average of the objectives over 100 different anticipation scenarios.As expected, on average, the transit objectives in both strategies match, since we use the average prices (over 100 anticipation scenarios) as our electricity prices in the evaluation step.Moreover, we observe that in all of the cases the ISO benefits from the cooperative strategy, with the magnitude of the benefit becoming less significant when larger power networks are considered.This supports our previous results concluding that the scale of the battery capacities (or the transit fleet) plays a crucial role in the benefit obtained by a cooperative strategy.Observing the intricacies of the benefit analysis on the stochastic formulations is yet another exploration.However, for the sake of conciseness, we believe that the primary aspect of coordination is demonstrated.

Potential benefits of alternative recourse actions
In this section, we are interested in a comparison of the two stochastic formulations presented in Sections 4.1 and 4.2.Recall that the first model investigates recourse actions taken by the ISO (ramping), whereas the second model considers the actions taken by the transit operator (using batteries to handle the randomness in the second stage).
To ensure a fair comparison, we consider the same set of charging/discharging prices in both of the formulations.Note that in the second formulation, there are two sets of prices, corresponding to the prices in the first stage, cit, and in the second stage, c + itω .These prices are obtained by solving the two-stage stochastic multi-period dispatch problem given in Appendix D. In more detail, the optimal values for the dual variables associated with the first-stage nodal balance equations determine the first-stage prices, and the second-stage prices are derived similarly.Figure 16 illustrates the first-stage prices and the average second-stage prices for charging/discharging of the transit fleet.
In both stages, we observe that prices sharply increase near the end of the day due to the extra stress imposed by the extra wind generation around similar times as previously shown in Figure 8.Moreover, the second-stage prices are much lower than the first-stage prices.This could be attributed to the fact that the second-stage flows are much smaller, as the scale of recourse actions is typically much smaller than that of the first-stage decisions.
Next, we analyze the costs in each of the two models provided in Sections 4.1 and 4.2.The following parameters are relevant: • First-stage and second-stage charging/discharging prices (cit, c + itω ) • Renewable generation cost (c r it ) • Ramp-up/down costs for conventional generators (c g,+ it , c g,− it ) Observe that the renewable generation term appears in both of the objectives ( 62) and (1).Then, the only freedom we have is in determining ramping costs for conventional generators.Based on this, we vary the ramping cost values and obtain a trade-off between the costs of the two models.We provide the scheme for comparing the two stochastic formulations in Procedure 2.
In Procedure 2, we provide the scheme to obtain the trade-off by calibrating the ramping costs in objective (62).In more detail, we systematically vary the ramping costs and obtain the adjusted prices for both first and second stages via locational marginal prices in step 2. Currently, for simplicity, in step 2, we do not consider the demand added by the transit fleet.Alternatively, one could also incorporate an average demand for transit charging/discharging.Then, by way of these new prices, we separately solve the two formulations and compare their objective values.Note that, in our experiments, we only vary the ramp-up cost by changing the multiplier γ in the following manner: it and c g,− it = 0.5c g it , where γ ∈ {0.8, 0.9, 1, 1.1, 1.2, 1.3}.By allowing the value of γ to vary over these values, we obtain the results in Figure 17.Using the first-stage prices and ramping costs, solve the model with ramping as the recourse action and obtain an objective value 4: Using the first-stage and second-stage prices, solve the model with charging/discharging as the recourse action and obtain an objective value 5: end for  As can be seen, when the ramp-up cost multiplier value is around 1, the total objective values in the two models become competitive.Since having the value around 1 is reasonable, we can conclude that the recourse action provided by charging, as opposed to ramping, can be a useful alternative depending on the generator ramping costs.Moreover, it is interesting to observe that the transit objective in the second formulation is much smaller.One possible reason for this could be that the batteries have more flexibility in the second formulation since they can also arbitrage between the first and second stages, whereas in the first formulation, they can only charge/discharge in the first stage.
We further conducted a similar analysis when larger power networks are coupled with the transit network.In general, we obtained similar findings in which the trade-off values for γ were close to 1.This supports the idea that the two 2SSP models can be alternatives to each other depending on ramping costs, and more importantly, total battery capacity.We omit further details to avoid displaying repetitive findings.
In a broad view, in this section, we compared two types of recourse actions in our framework.It is crucial to note that for additional flexibility promoting the integration of renewable generators, one can utilize these two recourse actions simultaneously.

Pricing and co-optimization
In this section, motivated by the work of Kök et al. (2018), which analyzes the effect of pricing policies (flat pricing vs. peak pricing) on the investment levels of renewable and conventional sources from the perspective of utility firms, we investigate co-optimization under different pricing policies for the transit authority.Specifically, we compare peak pricing (pricing obtained from locational marginal prices) to flat pricing (which is obtained by averaging peak prices) in different aspects.
In Figure 18, we provide the optimal solution, along with the benefit analysis under flat pricing.If we compare Figure 18 (left) to the solution under peak pricing displayed in Figure 6 (left), we can observe that under flat pricing, both charging and generation fluctuate less, simply due to the elimination of arbitrage for the transit authority.However, since peak prices can be thought of as proxies for congestion information, the indirect benefit (in terms of relieving congestion) of utilizing peak prices is lost under flat pricing.Further, if we compare Figure 18 (right) to its counterpart in Figure 15, we immediately observe that costs increase under flat pricing.One immediate reason is that arbitrage is not possible under flat pricing and transit objectives increase dramatically.It is interesting to observe that under different scenarios, non-cooperative transit charging under flat pricing remains the same since buses only charge to satisfy their operational requirements.Moreover, cooperative transit objective values are higher than non-cooperative values because the fleet is charging more in total due to two reasons: firstly, the fleet is relocating to decrease the system cost; and secondly, the fleet is discharging to decrease generation cost and the efficiency of batteries is less than 1 (η < 1).Moreover, these compromises made by the transit authority save more for the ISO,    We also analyze the effect of flat pricing in the charging/discharging-based 2SSP formulation and similarly observe less fluctuation in the generation and charging amounts.Specifically, we experimented with alternating prices in both of the two stages; Figure 19 gives an overview.
It is immediate to see that wind usage profiles in Figure 19 do not alter dramatically.Interestingly, when we calculate the wind utilization ratios explained in equation ( 37), all of the different pricing approaches result in the same utilization, 0.9645.This suggests that even though the usage of wind alters in shape, the total utilization remains the same.It is safe to conclude that the actual limitation of wind usage is rooted in the operational requirements of the transit fleet.
We present the solution times of the charging/discharging-based formulation under different pricing in Table 5.One can observe that there is no single trend in solution times regardless of which pricing methodology is chosen.However, one should also note that some of the parameters chosen in these cases were problem-specific and could be the source of inconsistency.

Congestion analysis
At present, both the small quantity of BEBs being utilized in the transit fleet and the limited battery capacity of these BEBs result in the BEBs not presenting any challenges to the grid by way of congestion.But the question is raised, as more BEBs are integrated into the transit fleet, and the battery technology continues to improve, at what point will the operation of BEBs begin to stress the power system?To this end, in our case files, we fix the line capacities at 10 MW and systematically increase the battery capacities of the current fleet, to represent a form of expansion, while holding power network parameters (and hence, capabilities) constant.Then, we solve the deterministic formulation and collect the total number of lines with full utilization over a day. Figure 20 gives an illustration for 9-node instance.
We conduct this analysis for both cooperative and non-cooperative cases, by using the same prices in both.There

Conclusion
In this work, we propose a deterministic mathematical programming formulation to co-optimize the operation of the public transit system and the power grid when the electric transit buses are in their off-schedule considering generators without uncertainty.Furthermore, we propose two different two-stage stochastic programming formulations, in which uncertainty is present within the generation units with different recourse actions: (i) ramping up/down the conventional generators, (ii) additional charging/discharging of the transit fleet.
Our numerical results demonstrate that coordinated operation between the ISO and the transit authority can decrease the generation costs while ensuring that the charging can be done at no detriment to the power system.Additionally, we conclude that in the presence of renewable generators, charging/discharging of the fleet as a recourse action can serve as a useful alternative to ramping up/down the conventional generators.Yet, as detailed, the benefits of charging/discharging of the fleet as a recourse action depend on battery capacities, ramping costs, and ramping limits.Our proposed formulations are general in the sense that they can incorporate different schedules, and different renewable generation units, different transportation, and power networks.
We explore the effect of pricing the charging/discharging of the transit authority on the characteristics of the cooptimization for two different pricing strategies, namely peak pricing and flat pricing.Further, we also underline the effect of cooperation compared to a non-cooperative strategy by conducting a congestion analysis considering larger battery capacities.We found out that in the case of a non-cooperative strategy, the power dispatch problem becomes infeasible earlier in the electrification endeavor whereas in the cooperative approach, the fleet can charge/discharge at different points to ensure a feasible power flow with higher costs.
A valuable extension to these formulations would be to consider separate renewable generation units owned and managed by the transportation authority.In this case, the charging/discharging costs of the vehicles would depend on which generator is chosen to be used.That is, it would be the same as the generation cost if they use their own generators, and it would be the market price derived from locational marginal prices if they use other generators within the power grid operated by the ISO.
Moreover, due to the fine resolution of the formulation, incorporating a physical model for battery degradation within the framework would decrease the losses further, and increase the flexibility of the co-optimization overall.
Within the capabilities of the current framework, external effects such as battery degradation and charging technology could be represented by updating the necessary parameters.Finally, it is worth noting that while our approach does not address the decision of locating charging stations, the solutions obtained from our model would provide valuable managerial insights about the charging station locations.
Constraints (54) are assignment constraints specifying that a transit bus can either be connected to one of the possible nodes in the power network or relocating within the network.Then, constraint set (55) guarantees any relocation made throughout the horizon is feasible while ensuring that a transit bus cannot relocate in fewer time steps than the required travel time ∆t(•, •).Finally, equation ( 56) is the initial assignment of the transit buses to the depot node, whereas (57) and ( 58) ensure that assignment only occurs within the off-schedule periods of the vehicles.Note that the periods in the formulation are inherently cyclic (i.e.considering hourly intervals, period 23 connects to period 0).
As a note related to the assumption on the capacities of charging stations, considering constant charging capacities per station Ci, depending on the specific application, one can incorporate the following constraint set: Appendix C Complete formulation of the two-stage stochastic rampingbased formulation The complete formulation is as follows: subject to: y bt ∈ {0, 1} ∀b ∈ B, t ∈ T (99) Here, the objective function ( 62) is the summation of first-stage costs (which has already been captured by the deterministic objective function ( 38)) and second-stage costs including the expected renewable generation costs and expected ramping costs.In addition to the constraints captured in the deterministic model in Section 3 are the second-stage nodal balance (64) and flows (69), ( 71), ( 73), (75); limits on renewable generation (81), (82); limits on second-stage ramping (76), ( 78), (79); and limits on shedding in the second stage (83).The main differences from the two-stage stochastic OPF formulation presented in Morales et al. (2013) are constraints on the transit bus battery levels (87)-( 90), charging limits (91)-( 93), and transportation constraints (94)-(100).More importantly, we have each of the OPF constraints repeated for multiple time periods rather than a single time period presented by Morales et al. (2013).The inclusion of multiple periods, and their coupling by the presence of batteries, increase the complexity of the problem dramatically.
Note that we have two sets of ramping quantities p δg it , and variables (p g,+ it , p g,− it ) associated with ramping in different time periods.Specifically, the parameters p δg it serve as upper bounds on the ramping of conventional generators between two time periods in the formulation, whereas the variables (p g,+ it , p g,− it ) correspond to ramping of conventional generators between the two stages of the stochastic formulation.
Appendix D Two-stage stochastic multi-period OPF formulation to obtain prices of charging/discharging In this section, we present a baseline OPF formulation in order to estimate the first-stage and second-stage prices of charging/discharging in formulations presented in Section 4. The complete formulation is as follows: This formulation is a direct extension of the two-stage single-period optimal power formulation presented by Morales et al. (2013).Specifically, we use the optimal dual variables cit, c + itω associated with constraints ( 102) and (103), respectively, to determine the first-stage and second-stage charging/discharging prices.

Figure 1 :
Figure 1: Transit layout (left) and power network schematic (right), where charging stations are assumed to be located at Transit Centers.

Figure 6 :FigureFigure 8 :
Figure 6: Generation and battery level profile (left) and objective values via varying battery capacity (right)

Figure 12 :
Figure 12: Optimum generation and charging levels

Figure 15 :
Figure 15: Comparison of objective values

Figure 16 :
Figure 16: First-stage and second-stage prices for charging/discharging of the transit fleet

Figure 17 :
Figure 17: Comparison of objective values in stochastic formulations by varying ramp-up cost

Figure 18 :
Figure 18: Deterministic co-optimization results under flat pricing: generation and battery level profile (left) and comparison of objective values (right)

( a )Figure 20 :
Figure 19: Wind usage amounts of the charging/discharging-based formulation under different pricing schemes

Table 1 :
Solution times of the deterministic formulation

Table 2 :
Summary of results for the ramping-based formulation

Table 3 :
Summary of results for the charging/discharging-based formulation

Table 4 :
Benefit analysis of the deterministic formulation (summary) Instance Coop.t. a obj.Non-coop.t. a obj.Coop.I. b obj.Non-coop.I. b obj.
a Transit authority, b ISO

Table 5 :
Solution times of the charging/discharging-based formulation under different pricing schemes (s)