1 Introduction

In this work, we study the joint operation of the power grid and an electric public transit bus system, towards the electrification of the transit system. The global effort to reduce emissions, part of the Paris agreement ratified by more than 180 countries (United Nations Climate Change 2020), encompasses various climate-conscious efforts, such as switching to renewable energy sources and decarbonization of transportation. Within the scope of electrification of mass transit systems, battery-electric buses (BEBs) play a crucial role in mitigation efforts. To this end, BEBs have been implemented throughout China, the United States, as well as several European countries (Pagliaro and Meneguzzo 2019). 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 their operation 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 ensure that the additional demand imposed by the transit authority is satisfied while inducing minimal stress on the power system.

It is argued that within the next decade, most fossil-fueled buses across the globe will be replaced by electric buses (Pagliaro and Meneguzzo 2019). Transportation researchers (Creutzig et al. 2015) underline the reduction of transport demand growth via bus rapid transit and bicycle highways. Unless policy-makers’ attitudes towards transport issues do not change soon, transport may hinder global efforts to mitigate climate change (Creutzig et al. 2015). There is evidence suggesting that utilizing electric buses and electric taxis is the most efficient way of curtailing NO\(_\text {x}\) emissions (Chen et al. 2018). Electrification of transportation is essential to meet emission goals, and that infrastructure and technology must be deployed in a coordinated effort in order to realize their emissions-reduction goals (Williams et al. 2012). If charging is not operated properly, electric vehicles could negate a significant amount of the environmental benefits obtained from renewables (Williams et al. 2012). This discussion motivates a system-wide coordinated effort within the charging problem which we address in this work.

Chu and Majumdar (2012) highlight the importance in the integration of energy sources with electricity transmission, distribution, and storage to offset the variations in renewable generation. For light-duty fleets in the US, cooperation between electric vehicle (EV) drivers and electricity suppliers can be achieved by smart contracts (Milovanoff et al. 2020). Coordination of operations handled by different parties can increase the total efficiency of the system and has the potential to introduce positive externalities such as dealing with cases when total generation exceeds demand (which potentially causes negative electricity prices). Zhou et al. (2016) find that ignoring negative prices in decision-making can lead to a considerable loss of value; the disposal of extra electricity purchased from the system with negative prices could be preferable compared to a storage strategy. Related to our work, co-optimizing BEBs and the smart grid would introduce a more efficient approach when electricity prices are negative; the transit fleet could be co-optimized to store electricity from the system with negative prices for later use while serving transit demand. This additional flexibility would benefit both the independent system operator (ISO) and the transit authority.

1.1 Operational aspects of co-optimizing the power and transit systems

Our models builds on the optimal power flow (OPF) problem (Alsac and Stott 1974), considering energy storage, uncertainty from renewable energy sources, vehicle-to-grid (V2G) capabilities, and the electrification of transit networks. A subset of the topics studied in this paper have been extensively addressed in isolation in the literature (see e.g., Agrawal et al. 2014; Chen et al. 2016; Levron et al. 2013; Riffonneau et al. 2011). However, these papers differ from ours, as we aim to incorporate all of these aspects (renewables, storage, transit, etc.) in one formulation.

The optimal power flow (OPF) problem (Carpentier 1962), is an optimization problem that determines the optimal dispatch in a power network, in which one solves for a network operating point that satisfies power flow equations and physical constraints such as thermal limits and line capacities (Conejo and Baringo 2018). The multi-period OPF problem (MPOPF) is an extension of the OPF problem, in which there are constraints such as ramping, and components involving multiple time periods such as storage units. In particular, storage units introduce 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) posit 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 can 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 non-convexity 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, 2017b) 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 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 multi-objective 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 jointly by the independent system operator (ISO) and the public transportation authority. Accordingly, considering demand response as a market resource (Rahimi and Ipakchi 2010), our formulation provides the smart grid the ability to respond across both space and time.

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. To the best of our knowledge, this is the first paper to address this problem in detail.

Our primary contributions are as follows:

  1. 1.

    We provide a deterministic formulation that jointly optimizes the operation of a public transit authority and an ISO.

  2. 2.

    In the presence of renewable generation, we further extend this model to two two-stage stochastic programs (2SSPs) with different recourse actions, including additional charging/discharging of the transit fleet and ramping up/down of the conventional generators.

  3. 3.

    We additionally provide managerial insights: first, by conducting a benefit analysis of coordinated optimization; second, by demonstrating potential benefits of alternative recourse actions in the presence of variable renewable energy uncertainty; third, by analyzing the effect of pricing on the outcomes of co-optimization.

The rest of the paper is organized as follows. In Sect. 2 we provide a formal definition of the problem. In Sect. 3 we introduce the deterministic formulation of the optimization problem. In Sects. 4.1 and 4.2 the two 2SSP formulations are provided. Numerical results are presented in Sect. 5, managerial insights are provided in Sect. 6, and Sect. 7 concludes the paper. Additional content can be found in Appendices A–E.

2 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 pre-specified 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:

  • All 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 Sect. 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. While we assume the topologies of the power and road networks remain fixed, our joint optimization framework allows to consider our system to be a smart grid in the following sense. We incorporate mobile distributed energy resources into the operation of the smart grid. This not only helps to improve supply and operational efficiency, but decarbonizing the transit fleet also serves to reduce greenhouse gasses emissions. As battery capacities of the EVs improves, the electrified transit fleet will play an increased role in the day-to-day operation of the power system; providing ancillary services and increased capacity.

  • 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 information related to the transit system is known (i.e. transportation network, schedules, travel times).

  • All 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.

3 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). We point out that while relaxations of the OPF problem that utilize second order cone programming (SOCP) provide tighter approximations to the power system operation, we make this trade-off in favor of model scalability and ease of incorporating the operation of the transportation system into our proposed formulation. 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 \(\alpha \in [0,1]\), of the total power generation cost and the charging/discharging cost of the transit buses. 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. Accordingly, choosing \(\alpha \) parameter allows to control the weight given to the electric and transportation system operators; choosing \(\alpha >.5\) assigns more emphasis on the operation of the transportation system, while setting \(\alpha <.5\) places more weight to the operation of the power system. In all of our numerical experiments, we set the convex combination coefficient, \(\alpha \), to 0.5. This is natural value since we are trying to minimize the total system cost, which is achieved by \(\alpha = 0.5\). One might try to explore different values in different cooperation contexts.

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. Note that, the off-schedule period can consist of multiple blocks and the model could be generalized easily as long as we set initial and final battery levels for each off-schedule block.

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.

Note that we do not consider any unit commitment decisions (here or thereafter), a choice that is largely motivated by the added complexity modelling these decisions would introduce (e.g., through additional binary variables and constraints). Moreover, the commitment and de-commitment of units is particularly important for units that require several periods of time (e.g., hours) to be spinning and able to provide reserves and energy into the electricity systems. Yet, in our setting, the transit system in this instance is not considered marginal, and is therefore unlikely to require more units coming online to be able to service the fleet.

4 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 Sect. 5.2. In addition to the assumptions listed in Sect. 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 (Sect. 4.1), the recourse action is ramping up/down the conventional generators, whereas in the second formulation (in Sect. 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.

4.1 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 Sect. 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 of 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 Sect. 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.

4.2 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 Sect. 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:

$$\begin{aligned} \min \quad&(1-\alpha ) \left[ \sum _{t \in \mathcal {T}} \sum _{i \in \mathcal {N}_g} c^g_{it} p^g_{i t} + c'^g_{it} (p^g_{i t})^2 + \sum _{\omega \in \Omega } \pi _\omega \left( \sum _{t \in \mathcal {T}} \sum _{i \in \mathcal {N}_r} c^r_{it} p^r_{it\omega } + \sum _{t \in \mathcal {T}}\sum _{i \in \mathcal {N}}c_{it}^{\text {shed}} p_{it\omega }^{d,\text {shed}} \right) \right] \nonumber \\&+ \alpha \left[ \sum _{t \in \mathcal {T}} \sum _{b \in \mathcal {B}} \sum _{i \in \mathcal {N}_b} c_{i t} \left( p^c_{ibt} - p^{dc}_{ibt} \right) + \sum _{\omega \in \Omega }\pi _\omega \sum _{t \in \mathcal {T}} \sum _{b \in \mathcal {B}} \sum _{i \in \mathcal {N}_b} c_{i t \omega }^{+} \left( p^{c,+}_{ibt\omega } - p^{dc,+}_{ibt\omega } \right) \right] \end{aligned}$$
(1)

subject to:

$$\begin{aligned} p^g_{it} + p^r_{it} - \sum _{b \in \mathcal {B}} p^c_{ibt} + \sum _{b \in \mathcal {B}} p^{dc}_{ibt} - p^d_{it} = \sum _{j: (i,j) \in \mathcal {L}} p_{ijt} - \sum _{j: (j,i) \in \mathcal {L}} p_{jit} \qquad \qquad \qquad ~\forall i \in \mathcal {N}, t \in \mathcal {T}\nonumber \\ \end{aligned}$$
(2)
$$\begin{aligned} p^r_{it\omega }-p^r_{it} - \sum _{b \in \mathcal {B}} p^{c,+}_{ibt\omega } + \sum _{b \in \mathcal {B}} p^{dc,+}_{ibt\omega } + p^{d,shed}_{it\omega }= \sum _{j : (i,j) \in \mathcal {L}} \left( p_{ijt\omega } - p_{ijt} \right) - \sum _{j : (j,i) \in \mathcal {L}} \left( p_{jit\omega } - p_{jit}\right) \nonumber \\ ~\forall i \in \mathcal {N}, t \in \mathcal {T}, \omega \in \Omega \end{aligned}$$
(3)
$$\begin{aligned}&-{\overline{\theta }} \le \theta _{it} \le {\overline{\theta }}, ~ -{\overline{\theta }} \le \theta _{itw} \le {\overline{\theta }}&\forall i \in \mathcal {N}, t \in \mathcal {T}, \omega \in \Omega \end{aligned}$$
(4)
$$\begin{aligned}&\theta _{1t} = 0, ~ \theta _{1t\omega } = 0&\forall t \in \mathcal {T}, \omega \in \Omega \end{aligned}$$
(5)
$$\begin{aligned}&p_{ijt} = \frac{\theta _{it} - \theta _{jt}}{x_{ij}}, ~ p_{ijt\omega } = \frac{\theta _{it\omega } - \theta _{jt\omega }}{x_{ij}}&\forall (i,j) \in \mathcal {L}, t \in \mathcal {T}, \omega \in \Omega \end{aligned}$$
(6)
$$\begin{aligned}&-{\overline{S}}_{ij} \le p_{ijt} \le {\overline{S}}_{ij}, ~ -{\overline{S}}_{ij} \le p_{ijt\omega } \le {\overline{S}}_{ij}&\forall (i,j) \in \mathcal {L}, t \in \mathcal {T}, \omega \in \Omega \end{aligned}$$
(7)
$$\begin{aligned}&0 \le p^g_{it} \le {\overline{p}}_{it}^g&\forall i \in \mathcal {N}_g, t \in \mathcal {T} \end{aligned}$$
(8)
$$\begin{aligned}&-p^{\delta g}_{it} \le p^g_{i,t+1} - p^g_{it}\le p^{\delta g}_{it}&\forall i \in \mathcal {N}_g, t \in \mathcal {T}\setminus \{T\} \end{aligned}$$
(9)
$$\begin{aligned}&0 \le p^r_{it} \le {\overline{p}}_{it}^r, ~ 0 \le p^r_{it\omega } \le {\tilde{p}}_{it\omega }^r&\forall i \in \mathcal {N}_r, t \in \mathcal {T}, \omega \in \Omega \end{aligned}$$
(10)
$$\begin{aligned}&0 \le p^{d,\text {shed}}_{it \omega } \le p^d_{it}&\forall i \in \mathcal {N}, t \in \mathcal {T}, \omega \in \Omega \end{aligned}$$
(11)
$$\begin{aligned}{} & {} e_{b T^1_b \omega } = e^1_b, ~ e_{b T^2_b \omega } + \eta _b \sum _{i \in \mathcal {N}_b} \left( p^c_{ib T^2_b} + p^{c,+}_{ib T^2_b \omega } \right) \delta t - \frac{1}{\eta _b} \sum _{i \in \mathcal {N}_b} \left( p^{dc}_{ibT^2_b} + p^{dc,+}_{ibT^2_b \omega } \right) \delta t \nonumber \\{} & {} \quad \quad \quad - s_b y_{bT^2_b} = {\overline{e}}_b \quad \forall b \in \mathcal {B}, \omega \in \Omega \end{aligned}$$
(12)
$$\begin{aligned}{} & {} e_{b,t+1,\omega } = e_{bt \omega } + \eta _b \sum _{i \in \mathcal {N}_b} \left( p^c_{ibt} + p^{c,+}_{ibt\omega } \right) \delta t - \frac{1}{\eta _b} \sum _{i \in \mathcal {N}_b} \left( p^{dc}_{ibt} + p^{dc,+}_{ibt\omega }\right) \delta t\nonumber \\{} & {} \quad \quad \quad - s_b y_{bt} \quad \forall b \in \mathcal {B}, \, t,t+1 \in \mathcal {T}_b, \omega \in \Omega \end{aligned}$$
(13)
$$\begin{aligned}&{\underline{e}}_{b} \le e_{bt\omega } \le {\overline{e}}_{b}&\forall b \in \mathcal {B}, t \in \mathcal {T}_b, \omega \in \Omega \end{aligned}$$
(14)
$$\begin{aligned}&p^c_{ibt} + p^{c,+}_{ibt\omega } \le {\overline{p}}^c_{b} z_{ibt}, ~ p^{dc}_{ibt} + p^{dc,+}_{ibt\omega } \le {\overline{p}}^{dc}_{b} z_{ibt}&\forall i \in \mathcal {N}_b, b \in \mathcal {B}, t \in \mathcal {T}, \omega \in \Omega \end{aligned}$$
(15)
$$\begin{aligned}&p^c_{ibt} \ge 0, ~ p^{dc}_{ibt} \ge 0, ~ p^{c,+}_{ibt\omega } \ge 0, ~ p^{dc,+}_{ibt\omega } \ge 0&\forall i \in \mathcal {N}_b, b \in \mathcal {B}, t \in \mathcal {T}, \omega \in \Omega \end{aligned}$$
(16)
$$\begin{aligned}&\sum _{i \in \mathcal {N}_b} z_{ibt} + y_{bt} = 1&\forall b \in \mathcal {B}, t \in \mathcal {T}_b \end{aligned}$$
(17)
$$\begin{aligned} z_{ibt} + z_{jbt'} \le 1 \qquad \qquad \forall t' \in \mathcal {T}_b, t < t' \le t+\Delta t(i,j), \forall i,j \in \mathcal {N}_b, i \ne j, b \in \mathcal {B}, t \in \mathcal {T}_b \end{aligned}$$
(18)
$$\begin{aligned}&z_{d b T^1_b} = 1&\forall d \in \{\mathcal {N}_{b}(1), \mathcal {N}_{b}(\text {end})\}, \forall b \in \mathcal {B}\end{aligned}$$
(19)
$$\begin{aligned}&y_{bt} \in \{0,1\}, ~ z_{ibt} \in \{0,1\}&\forall i \in \mathcal {N}_b, b \in \mathcal {B}, t \in \mathcal {T} \end{aligned}$$
(20)

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. Just as in the deterministic setting, choosing the value of \(\alpha >.5\) allows the social planner to emphasize the transportation system operation, whereas setting \(\alpha <.5\) assigns more weight to the operation of the power system. We have already introduced the following sets of constraints in the deterministic formulation in Sect. 3: first-stage DC optimal power flow constraints (2), (4), (5), (6), (7); bounds on generation (8), ramping (9), and first-stage charging/discharging (16); assignment constraints for vehicle to charging station connection and vehicle relocation (17)–(20). Note that the variables are only non-zero for appropriate indices (i.e. \(p^g_{it} = 0, ~ p^c_{ibt} = 0, ~ p^{dc}_{ibt} = 0, ~ p^{c,+}_{ibt\omega } = 0, ~ p^{dc,+}_{ibt\omega } = 0 \) for \(i \in \mathcal {N}{\setminus } \mathcal {N}_g\), \(p^r_{it} = 0, p^r_{it\omega } = 0 \) for \(i \in \mathcal {N}{\setminus } \mathcal {N}_r\), and \(y_{bt} = 0, ~ z_{ibt} = 0\) for \(t \in \mathcal {T}{\setminus } \mathcal {T}_b\)).

We now additionally have second-stage nodal balance and flow constraints (3), (4), (5), (6), (7); limits on renewable generation (10); and limits on shedding in the second stage (11). Unlike the formulation discussed in Sect. 4.1, we are also charging/discharging in the second stage. Thus, the battery level variables for vehicles \(e_{bt\omega }\) are second-stage variables over the set of scenarios \(\omega \in \Omega \). Also, update constraints for battery levels are replicated for each scenario in (12)–(14).Note that, \(e^1_b\) values are different for each bus and automatically reflect the remaining battery levels after their operational day. We set the lower bounds based on operability of the buses. Since we know the on-route consumption levels of the buses (assuming deterministic for now), we guarantee that the route on the next day will be feasible by setting the final battery level to the maximum. Since the battery level starts at the maximum level beginning operation, the battery level never drops below the required threshold. Moreover, we have modified bounds on the charging/discharging of the vehicles in (15). 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.

4.3 Complexity of formulation

Table 1 summarizes the size of the 2SSP-formulation with charging and discharging.

Table 1 Number of variables and constraints in 2SSP formulation

The presented information shows that both the number of continuous variables and the number of binary variables in the formulation grow linearly in \(| \mathcal {T}|\), the number of time periods in the planning horizon. As an example, doubling \(| \mathcal {T}|\) would double the total number of variables, whereas doubling \(| \mathcal {N}|\) or \(| \mathcal {L}|\) would less than double the total number of variables. Similarly, one can observe that the resolution of the time horizon directly impacts the number of constraints in the resulting formulation. It is therefore reasonable to conclude that the size of the time steps in the model will be the key influencing factor on its resulting complexity.

5 Numerical experiments

We performed the optimization using Gurobi version 8.1.0 developed by Gurobi Optimization (2020), with the default settings. The hardware was 2.2 GHz Dual-Core Intel Core i7 and 8GB memory.

In this section, we first provide (in Sect. 5.1) the results of a small case study for the deterministic formulation, then (in Sect. 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. In all of our numerical experiments, we set the coefficient \(\alpha \) to 0.5, such that equal weight is assigned to the operation of the power and transit systems. In other words, we choose \(\alpha \) such that our social planner is “operator neutral".

5.1 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_{it}^d\)), line limits (\({\overline{S}}_{ij}\)), generation limits (\({\overline{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. The solution time for this model was approximately 23 s.

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 \({\overline{\delta }}\) are set to \(\pi /2\) and ramping limits are chosen to be \(\frac{{\overline{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 (\(c_{it}\)) in the objective function are the electricity prices obtained by averaging the prices as described in Sect. 6.1. The daily demand and the price data are displayed in Figs. 2, 3 and 4.

Fig. 1
figure 1

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

Fig. 2
figure 2

Daily demand data

Fig. 3
figure 3

Complete demand profile in power network (constructed)

Fig. 4
figure 4

Price data

We assume that the 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-h horizon. We point out that our proposed formulation can generally handle any preferred time resolution, provided corresponding data; we simply choose hourly time steps to ensure that the numerical results can be carried out with relative ease in practice. The bus schedules and charging station locations are obtained from VTA, where \(\mathcal {T}_b\) represents the time periods in which transit bus b is in its off-schedule. Summary of bus schedules are provided in Table 2 and the energy consumption values are provided in Table 3. \(\Delta t(i,j)\) is the travel time between charging stations calculated using Google Maps (and discretized based on the resolution of the formulation).

Table 2 Transit bus schedules (hourly discretized)

Figure 5 displays the optimal locations of the transit buses for 3 consecutive time periods. At time \(t=21\), three of the four vehicles are located at node 1, the transit depot (one of them is still serving a route). In the next time period, the last bus finishes its route, and two of the buses are in transit. At \(t=23\), these buses arrive at their 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 Fig. 7, we show that the generation profile changes dramatically as the battery capacities increase. Depending on the transit schedule, large batteries can add strain to the power system, while acting as generators during other periods.

Table 3 Transit bus energy consumption values
Fig. 5
figure 5

Transit bus locations for \(t = 21\), \(t = 22\) and \(t = 23\) in optimal solution

Fig. 6
figure 6

Generation and battery level profile (left) and objective values via varying battery capacity (right)

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: \(c_{it}^{g,+} = 1.2 c_{it}^{g}\) and \(c_{it}^{g,-} = 0.5 c_{it}^{g}. \) That is, for ramping costs we only consider the linear generation cost coefficient \(c_{it}^{g}\) to make ramping slightly cheaper than generation, and, ramping down is much cheaper than ramping up.

Fig. 7
figure 7

Total generation via varying battery capacity

5.2 Case study for the stochastic formulations

In this section, we consider the same instance described in Sect. 5.1, modifying the 9-bus system to include a wind generation unit located at node 4 in the power network displayed in Fig. 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, \(c^r_{it} = \min _{i \in \mathcal {N}_g} \{ c^g_{it} \}.\) 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 Fig. 9.

Fig. 8
figure 8

Daily wind generation amount for 09/09/19 in San Jose (simulated)

Fig. 9
figure 9

Wind generation distribution over scenarios

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 Sect. 6.2, and a visualization is provided in Fig. 15. 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:

$$\begin{aligned} c_{it}^{g,+}&= 1.2 c_{it}^{g} \\ c_{it}^{g,-}&= 0.5 c_{it}^{g}. \end{aligned}$$

That is, for ramping costs we only consider the linear generation cost coefficient \(c_{it}^{g}\) to make ramping slightly cheaper than generation, and, ramping down is much cheaper than ramping up.

5.2.1 Case study for the ramping-based formulation

Figure 10 gives a summary of the optimal solution of the formulation presented in Sect. 4.1. We observe that only one generator uses ramp-up in the second stage.

Fig. 10
figure 10

Optimum generation, charging, and ramping levels

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. 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.

Fig. 11
figure 11

Wind usage amount in the optimal solution

In Fig. 11, we present the optimal values of wind generation corresponding to the second stage resulting from solving the optimization problem found in Sect. 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:

$$\begin{aligned} \text {Wind Utilization} = \frac{\text {total wind usage in optimal solution}}{\text {aggregation of wind generation from scenarios}}. \end{aligned}$$
(21)

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 our numerical results corresponding to the optimization problem found in Sect. 4.1, the wind utilization is found to be 1.0 (i.e., 100%). 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.

5.2.2 Case study for the charging/discharging-based formulation

In Fig. 12, we provide a summary of the solution of the formulation described in Sect. 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 Fig. 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.

Fig. 12
figure 12

Optimum generation and charging levels

Fig. 13
figure 13

Wind usage amount in the optimal solution

Similar to the previous subsection, we calculate the wind utilization measure given by equation (21) and find that for the solution to the optimization problem given in Sect. 4.2 the total wind utilization is 0.9645 (96.45%). In Fig. 13, we present the optimal values of wind generation corresponding to the second stage resulting from solving the the optimization problem found in Sect. 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 Fig. 11, we find that the model from Sect. 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.

5.3 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 Sect. 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 4 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 4 Solution times of the deterministic formulation

Table 5 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.

Table 5 Summary of results for the ramping-based formulation

Finally, Table 6 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 5.

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

The discussion in Sect. 4.3 and the results presented in Tables 4, 5 and 6 show that the relationship between the time to solution for each of the formulations, and system size is not monotonic. For the deterministic model the three fastest instances have 14, 30, 39 and 57 buses, respectively, whereas the two instances that require the longest amount of time are 9- and 118-bus systems. Similarly, the two stochastic formulations require the longest amount of time to solve the 9-, 57- and 118-bus systems, while the time these formulations require to solve the 14-, 30-, and 39-bus systems can be seen to be one to three orders of magnitude less.

6 Coordination, pricing, and expansion planning

6.1 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.

figure a

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 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 Sect. 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 Sect. 3 is solved, with baseline prices and the objective value being calculated with convex combination coefficient \(\alpha = 0.5\) in the objective function (23). 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.

Fig. 14
figure 14

Comparison of objective values

Figure 14 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 \(\alpha \) 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 Sect. 5.3. Table 7 summarizes 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.

Table 7 Benefit analysis of the deterministic formulation (summary)

6.2 Potential benefits of alternative recourse actions

In this section, we are interested in a comparison of the two stochastic formulations presented in Sects. 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, \(c_{it}\), and in the second stage, \(c_{it\omega }^+\). 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 15 illustrates the first-stage prices and the average second-stage prices for charging/discharging of the transit fleet.

Fig. 15
figure 15

First-stage and 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 Fig. 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 Sects. 4.1 and 4.2. The following parameters are relevant:

  • First-stage and second-stage charging/discharging prices \((c_{it}, c_{it\omega }^+)\)

  • Renewable generation cost \((c_{it}^r)\)

  • Ramp-up/down costs for conventional generators \((c_{it}^{g,+}, c_{it}^{g,-})\)

Observe that the renewable generation term appears in both of the objectives (47) 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.

figure b

In Procedure 2, we provide the scheme to obtain the trade-off by calibrating the ramping costs in objective (47). 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 \(\gamma \) in the following manner:

$$\begin{aligned} c_{it}^{g,+} = \gamma c_{it}^{g} ~\text {and}~ c_{it}^{g,-} = 0.5 c_{it}^{g}, \end{aligned}$$

where \(\gamma \in \{0.8,0.9,1,1.1,1.2,1.3 \}\). By allowing the value of \(\gamma \) to vary over these values, we obtain the results in Fig. 16.

Fig. 16
figure 16

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

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 \(\gamma \) 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.

6.3 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.

Fig. 17
figure 17

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

In Fig. 17, we provide the optimal solution, along with the benefit analysis under flat pricing. If we compare Fig. 17 (left) to the solution under peak pricing displayed in Fig. 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 Fig. 17 (right) to its counterpart in Fig. 14, 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 (\(\eta < 1\)). Moreover, these compromises made by the transit authority save more for the ISO, thus the total system cost decreases significantly.

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; Fig. 18 gives an overview.

Fig. 18
figure 18

Wind usage amounts of the charging/discharging-based formulation under different pricing schemes

It is immediate to see that wind usage profiles in Fig. 18 do not alter dramatically. Interestingly, when we calculate the wind utilization ratios explained in equation (21), 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.

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

We present the solution times of the charging/discharging-based formulation under different pricing in Table 8. 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.

6.4 Expansion planning for greenhouse gas reduction

At present, the limited quantity of BEBs being utilized in the transit fleet and the limited battery capacity of these BEBs result prohibit challenges to the grid by way of congestion. Yet, 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? This emphasizes the need to coordinate the expansion efforts via the investment in BEBs and their battery technology, along with investment in the infrastructure of the power network itself.

To analyze this in more detail, 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 19 gives an illustration for 9-node instance. We conduct this analysis for both cooperative and non-cooperative analysis, by using the same prices in both. There are two main conclusions: first, the congestion in the network increases with larger battery capacities; and second, cooperation can mitigate the extra demand introduced since the non-cooperative model becomes infeasible after a certain point (where \(-1\) indicates infeasibility). We have also investigated other power networks and obtained similar conclusions.

Fig. 19
figure 19

Congestion analysis by varying battery capacity

In this section, we develop a finite multi-period investment model for a social planner who seeks to reduce the greenhouse gas (GH) emissions of the transit system by investing to improve the transit and power systems. The social planner has three different ways they can invest in each time step; (i) purchasing additional BEBs, (ii) investing in the improvement of battery technology of BEBs, or, (iii) expanding transmission line capacities in the power network.

Let \(c_t^E\), \(c_t^B\) and \(c_t^L\) denote the costs of purchasing new BEBs, investing in BEB battery technology and replacing transmission lines at time t, respectively. Then, defining \(\tau \) to be the per unit social cost of \(\text {GH}\)s emitted into the environment by the transit system, the social planner seeks to minimize the total social cost of transit \(\text {GH}\) emissions, as well as the total cost of investment over the planning horizon, given by:

$$\begin{aligned} \min ~\sum _{t = 0}^T c_t^E I^E_t + c_t^B I^B_t + (c_t^L)^{\top } I^L_t + \tau \text {GH}_{{t}} \end{aligned}$$

where, for all \(t \in T\), \(I^L_t \in {\mathbb {R}}^{|\mathcal {L}|}_+\), \(I^E_t \in {\mathbb {N}}\), \(I^B_t \in {\mathbb {R}}_+\) and \(\text {GH}_{{t}} \in {\mathbb {R}}_+\).

This optimization is subject to the following constraints. First, each transmission line must have sufficient capacity to be able to accommodate the operation of a given number of BEBs at any time:

$$\begin{aligned} {\bar{F}}_{t+1}^l \ge \beta _{t} {\bar{P}}^B_{t+1} \quad \forall l \in \mathcal {L},~\forall t = 0, \dots , T-1. \end{aligned}$$

Note that \(\{ \beta _t \}_{t=0}^T\) is a non-decreasing sequence, with \(\beta _0 > 0.\) A priori, \(\beta \) represents an estimate of the desired portion of the BEB fleet that we require each line in the power network to be able to accommodate without congestion. Next, GH emissions must be strictly decreasing from one period to the next:

$$\begin{aligned} \text {GH}_{{t+1}} \le \gamma \text {GH}_{t} \quad \forall t = 0, \dots , T-1, \end{aligned}$$

for \(\gamma \in (0, 1)\). Further, GH emissions in the next period are calculated as

$$\begin{aligned} \text {GH}_{{t+1}} = \sigma \cdot (N^{B} - (1 + \rho _t) N^{EV}_t)^{+} \quad \forall t = 0, \dots , T-1, \end{aligned}$$

where \(\sigma > 0\) is a scaling factor that defines the greenhouse gas emission intensity of transit fleet operation, \(N^{B}\) is a constant that defines the number of conventional transit buses in the fleet, and \(\{ \rho _t \}_{t=0}^T\) is a non-increasing sequence that captures the additional flexibility resulting from having more electric buses. One can view this constant as how the model interprets electric buses taking over the routes of conventional buses, without necessarily requiring the retirement of conventional buses. Further, it is assumed that the impact is increasing, but with diminishing marginal returns.

Finally, the number of BEBs, the battery capacity of BEBs, and the capacity of lines in the next period are updated as follows

$$\begin{aligned} {\bar{F}}_{t+1}^l&= {\bar{F}}_{t}^l + I^l_t&\forall l \in \mathcal {L},~\forall t = 0, \dots , T-1, \\ {\bar{P}}^B_{t+1}&= {\bar{P}}^B_{t} + I^B_t&\forall t = 0, \dots , T-1,\\ N^{EV}_{t+1}&= N^{EV}_t + I_t^E&\forall t = 0, \dots , T-1. \end{aligned}$$

Consider a given initial point \((\text {GH}_{0}, N^{EV}_0, {\bar{F}}_0, {\bar{P}}_0)\). Then, the Lagrangian can be formulated as:

$$\begin{aligned}&\mathcal {L}(I^E, I^B, I^L, \text {GH}, N^{EV}, {\bar{F}}, {\bar{P}}; \lambda , \mu , \nu , \theta , \alpha , \delta )\\ {}&\quad = \sum _{t = 0}^T c_t^E I^E_t + c_t^B I^B_t + (c_t^L)^{\top } I^L_t + \tau \text {GH}_{{t}} \\&\qquad + \sum _{t=0}^{T-1} \sum _{l \in \mathcal {L}} \lambda _{lt} \left( {\bar{F}}_{t+1}^l - \beta _t {\bar{P}}^B_{t+1} \right) + \sum _{t=0}^{T-1} (\mu _{t}^L)^{\top } \left( {\bar{F}}_{t+1}^L - {\bar{F}}_{t}^L - I^L_t \right) \\&\qquad + \sum _{t=0}^{T-1} \nu _{t} \left( \gamma \text {GH}_{t} - \text {GH}_{{t+1}}\right) + \sum _{t=0}^{T-1} \theta _{t} \left[ \text {GH}_{t+1} - \sigma \cdot (N^{B} - (1 + \rho _t) N^{EV}_t)^{+} \right] \\&\qquad + \sum _{t=0}^{T-1} \alpha _{t} \left( N^{EV}_{t+1} - N^{EV}_t - I_t^E \right) + \sum _{t=0}^{T-1} \delta _{t} \left( {\bar{P}}^B_{t+1} - {\bar{P}}^B_{t} - I^B_t \right) . \end{aligned}$$

The first-order conditions associated with the Lagrangian, as well as all proofs for the theorems presented in this section, can be found in Appendix E. From the first-order conditions of the Lagrangian, we can infer several results regarding the optimization problem.

Theorem 1

The conditions (111)–(113) imply that the shadow prices of updating the quantity of buses, the capacity of bus batteries, and the capacity of lines, \((\alpha _t, \delta _t, \mu _t)\) are equal to the cost of investment for each of these goods at time t. That is,

$$\begin{aligned} (\alpha _t, \delta _t, \mu _t^L) = (c^E_t, c^B_t, c^L_t). \end{aligned}$$

Noting the fact that \(\sigma (1 + \rho _{t}) \ge 0\) for all \(t \in T\), we have the following result, which defines the implicit cost of reducing GH emissions by purchasing additional BEBs.

Theorem 2

Suppose the first-order conditions are satisfied. For \(\frac{N^{B}}{1 + \rho _{t}} \ge N^{EV}_{t}\), since \(\sigma (1 + \rho _{t}) \ge 0\) for all \(t \in T\), the shadow price associated with the GH emissions update, \(\theta _{t}\), is determined by the difference between the cost of purchasing more BEBs in the previous period, and the cost of purchasing more BEBs in the current period, \(c^E_{t-1} - c^E_t\). That is

$$\begin{aligned} \text {sign}(\theta _t) = \text {sign}(c^E_{t-1} - c^E_t). \end{aligned}$$
(22)

However, if \(\frac{N^{B}}{1 + \rho _{t}} < N^{EV}_{t}\), purchasing additional BEBs has no marginal effect on the optimization problem at time t.

The following result stipulates conditions under which the implicit cost of sufficiently reducing GH emissions will increase from one time period to the next.

Theorem 3

Suppose the first-order conditions are satisfied, and \(\frac{N^{B}}{1 + \rho _{t}} \ge N^{EV}_{t}\). If the cost of purchasing additional BEBs increases by at least \(\tau \sigma (1 + \rho _{t-1}) \ge 0\) at time t, then the shadow price of sufficiently reducing GH emissions in the next period will have increased from the previous period, i.e., \(\nu _t \ge \nu _{t-1}.\)

Due to the fact that \(\rho _0 \ge \rho _1 \ge \dots \ge \rho _T\), the threshold \(\tau \sigma (1 + \rho _{t})\) is non-increasing in time. Combining this with the result in Theorem 3, it is expected that \(\{\nu _t \}^T_{t=0}\) will be increasing in time. Hence, the social planner is becoming more incentivized to sufficiently reduce GH emissions as time progresses.

Theorem 4

Suppose the first-order conditions are satisfied. Consider the shadow price of updating line capacities in the power network at time t, \(\mu ^L_t\) and the shadow price of updating BEB battery capacities at time t, \(\delta _t\). We have:

$$\begin{aligned} \sum _{l \in \mathcal {L}}( \mu ^l_{{t+1}} - \mu ^l_{t} ) = \frac{\delta _t - \delta _{t+1}}{\beta _t} \ge 0. \end{aligned}$$

Therefore, \(\delta _t\) is non-increasing in time, and \(\mu _t^L\) is non-decreasing in time.

The implications of Theorem 4 are straightforward, yet insightful. The penalty with respect to the capacity update constraint is non-decreasing in time, implying that as we progress further along the planning horizon this constraint plays an increasingly important role (in a primal sense) in the optimization problem at hand. Conversely, the battery capacity update constraint is at its greatest importance at the early stages of the planning horizon. Intuitively, this result can be viewed in the following manner. Early on in the planning horizon, the \(\beta \)-scaled BEB battery capacity that each line must be able to accommodate is non-decreasing in time. Thus, ensuring a feasible update of the line capacities becomes more important over time.

The final result presented in this section provides bounds on the primal variable \(I^E\) under given conditions.

Theorem 5

Suppose the first-order conditions are satisfied. Then:

  1. (a)

    If \(\frac{N^{B}}{1 + \rho _{t-1}} \ge N^{EV}_{t-1}\) and \(\frac{N^{B}}{1 + \rho _{t}} \ge N^{EV}_{t}\), then

    $$\begin{aligned} I_{t-1}^E \ge N^B \cdot (1-\gamma ) \left[ \frac{\rho _{t-1} - \rho _t}{(1+\rho _t)(1 + \rho _{t-1})} \right] \end{aligned}$$
  2. (b)

    \(\frac{N^{B}}{1 + \rho _{t-1}} < N^{EV}_{t-1}\) and \(\frac{N^{B}}{1 + \rho _{t}} \ge N^{EV}_{t} \implies 0 \le I_{t-1}^E < N^B \left[ \frac{\rho _{t-1} - \rho _t}{(1 + \rho _{t})(1 + \rho _{t-1})} \right] \)

  3. (c)

    \(\frac{N^{B}}{1 + \rho _{t-1}} \ge N^{EV}_{t-1}\) and \(\frac{N^{B}}{1 + \rho _{t}} < N^{EV}_{t} \implies I_{t-1}^E > N^B \left[ \frac{\rho _{t-1} - \rho _t}{(1 + \rho _{t})(1 + \rho _{t-1})} \right] \)

7 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 co-optimization for two different pricing strategies, namely peak pricing and flat pricing.

Countries like the U.S. and most European countries have several transportation authorities in their control territories, and formulating a co-optimization of all those systems is a challenging problem. Thus, the formulation herein proposed could apply to smaller systems such as island systems and microgrids in e.g., military facilities; smaller states or non-interconnected zones inside both developed and developing countries. In those three examples of jurisdictions with conditions similar to the assumptions we have in our model, our formulation provides a way to manage the problem of managing both systems and providing optimal scheduling.

Additionally, as more distributed energy resources (DERs) are entering the system, aggregators of DERs may deal with similar problems as the one we formulate, with hierarchical interactions and imports/exports into the seam or boundary of the system managed by the aggregator. The case of a future distribution system operator as in Canizes et al. (2019) would be an example of another application. By co-optimizing both systems, our formulation provides a benchmark for what could the optimal management of the resources. In the case of e.g., military facilities, the ability to handle both systems simultaneously may obey to e.g., strategic priorities, and interconnections with external systems could be part of the management decisions to take. The handling of interactions with adjoining systems is the scope of future work.

Another 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. Likewise, it may be worthwhile to consider a formulation based on SOCP rather than QP; as relaxations based on SOCP provide tighter approximations to the OPF compared to those based on QP (as QP is a special instance of SOCP).

Table 9 Nomenclature

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. 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. Finally, we point out that our model considers “off-schedule" transportation buses; incorporating the “on-schedule" aspects would allow one to model constraints on the operation of the public transit system beyond the charging and discharging role of our model.