1 Introduction

Nanogrids provide viable solutions for accommodating an ultra-high penetration level of distributed photovoltaic (PV) generation [1, 2]. A PV-based nanogrid usually spreads out in a smaller geographic area and entails a smaller capacity. It is technically simpler than a microgrid [3, 4], but its implementation and operations are more flexible. A recent study established a definition for nanogrids and outlined their common grounds and differences with microgrids [5]. In principle, nanogrids represent smaller versions of microgrids [2], thus they are subject to fewer technical challenges and regulatory hurdles than microgrids [1]. Nanogrids also have the advantage of being perceived by investors as less risky than microgrids. Besides, the modular nature of nanogrids delivers an opportunity to connect them to form a microgrid. Thus, this paper restricts its presentation to PV-based nanogrids.

A battery-based energy storage system (BESS) [6] is indispensable for compensating for the imbalances between generation and demand in an off-grid nanogrid [7, 8]. Nevertheless, a nanogrid employing a stand-alone BESS is very costly. Accordingly, studies focus on sharing generation and storage resources via transmission lines [9,10,11]. However, the cascading confluence of power electronics systems inevitably introduces new challenges, such as frequency and voltage transients, for PV-based nanogrids. Thus, our previous study [12] presents a system which allows sharing PV generation and energy storage resources by swapping batteries. It supposes that off-grid nanogrids could store surplus PV in batteries and then supply fully-charged batteries to a battery swapping station (BSS) serving electric vehicles (EVs). In this paper, we address a capacity planning framework for such a nanogrid. Various generation and storage technologies are feasible for deploying nanogrids [13, 14], this paper focuses on a PV plus BESS configuration.

At the planning stage, the uncertainties of PV generation and local demands should be adequately estimated and managed. Stochastic optimization (SO) [15] is a typical approach to cope with such uncertainties. It assumes prior probability distributions of uncertainties are known, and it could provide a probabilistic guarantee of its solutions [16, 17]. The SO has been employed to solve optimal capacity planning problems for microgrids [18, 19] and EV charging stations [20, 21]. However, this approach has some practical limitations, since it involves the accurate prior probability distributions, and its solution process incorporates plenty of scenarios that require significant computational effort.

The robust optimization (RO) handles the uncertainties using only the range of uncertain data rather than detailed probability distributions. It has received extensive attention and has been successfully applied to microgrid planning [22, 23] and energy storage planning [24]. All these works indicate that RO is an effective method for ensuring system operation against the worst scenarios [25]. However, it is overly conservative to satisfy all scenarios, and decision makers typically prefer a tradeoff between robustness and economy in some practical applications. Therefore, it is attractive to investigate methods for reducing the conservativeness of the RO solutions.

Adjusting uncertainty sets is one strategy to reduce the conservativeness of RO solutions. Bertsimas and Sim [26] constructed uncertainty sets in RO problems and introduced the concept of uncertainty budgets (Γ) to flexibly adjust the level of robustness of the solutions. An attractive aspect of their method is that it does not significantly increase the complexity of the original optimization problem. It has been widely adopted in solving various problems including unit commitment [27], generation expansion planning [28], load scheduling [29], and demand response [30], etc. This paper employs it for determining the PV and BESS mix in a nanogrid.

Main contributions are summarized and highlighted as:

  1. 1)

    Optimal sizing for an off-grid nanogrid is modeled in the MILP formulation and then solved with an RO approach, which minimizes the investment cost while guarantees the desired level of reliability in the energy supply.

  2. 2)

    The RO approach can control the robustness level of the capacity planning solutions by adjusting parameter Γ. It overcomes that if only the worst-case scenarios are utilized in the capacity planning, the results could be over-conservative.

  3. 3)

    Monte Carlo simulation-based analysis is introduced to emulate the long-term performance of the solutions, and case studies investigate the effects of battery swapping on optimal capacity planning for a nanogrid.

2 Framework of a nanogrid-based BSS

This section introduces the architecture of a typical PV-BESS nanogrid and demonstrates its potentials for serving a BSS. Besides, the framework for a nanogrids-based BSS is briefly illustrated.

2.1 Nanogrid

Figure 1 presents the schematic of a hybrid AC/DC nanogrid, Keating Nanogrid, at the campus of the Illinois Institute of Technology (IIT) [1]. The nanogrid powers a sports center, and it is an important part within the campus-wide IIT Microgrid [31]. Its PV arrays power the LED lighting systems directly, while simultaneously charge the batteries. It can work in both of off-grid mode and grid-connected mode. Successful operation of this nanogrid illustrates how a PV-plus-battery system can deliver resilient electricity to local users.

Fig. 1
figure 1

Architecture of Keating Nanogrid within IIT microgrid

The peak load of the Keating Nanogrid is close to 150 kW, whereas the installed capacity of its rooftop PV panels is 173.5 kW. A BESS (330.4 kWh) compensates the imbalances between PV generation and demand [1]. The BESS stores energy from periods of high PV output and uses it in periods of power shortage, and thus ensures reliable operation of the nanogrid. At certain hours that the BESS is fully charged, the nanogrid will curtail the surplus PV generation or feed it back to the broader IIT Microgrid. Nevertheless, this means strict electricity quality restrictions and costly bi-directional interface capacity.

Supplying fully-charged batteries to a BSS is an alternative for handling the surplus PV generation. In this way, the Keating Nanogrid could provide enough energy to a BSS for serving 16 to 20 EVs [32]. Furthermore, if the nanogrid could install more PV panels and batteries, as shown in the red parts in Fig.1, it could contribute more energy storage to the BSS while enhancing itself with more resilience. Accordingly, a nanogrid-based BSS is a potential approach for implementing a PV-to-vehicle system and reinforcing the operation of nanogrids.

A modular interface (MI) is embedded in the nanogrid for facilitating battery swapping. As given in Fig. 2, the MI integrates a group of modular batteries, bidirectional converters, and a battery management system. The modular batteries can be seen as mobile energy storages [33] and substitute for conventional storage of a nanogrid. The MI is a generalized facility that is beneficial for scalability. Various types of nanogrids with distinct characteristics can supply batteries to the BSS, as long as they are equipped with such an MI. Besides, the MI ensures that the plug-out and plug-in of batteries have no influences on the nanogrid’s local operation.

Fig. 2
figure 2

Modular interface embedded in a nanogrid

Since the nanogrid supplies fully-charged batteries to the BSS, a monotonic charge strategy [34] is adopted in the MI’s battery management system. This strategy forces a consistent charging/discharging direction for each battery. When a battery has been monotonously fully-charged, it gets ready for being swapped or powering the nanogrid. By this means, it can make sure that there are enough fully-charged batteries for performing battery swapping operation.

2.2 Nanogrid-based BSS

At a BSS, depleted batteries in an EV can be swapped momentarily with fully-charged ones. And existing works for PV-based BSSs [32, 35] mainly focus on centralized structures, in which large-scale centralized PV generation recharges all the depleted batteries centrally. Such structures require a lot of space to install centralized PV panels, and thus they are costly when the BSSs locate in urban areas. We develop a nanogrid-based BSS framework for implementing a distributed-PV-to-vehicle system, as shown in Fig. 3. A nanogrid can store its surplus PV generation in batteries and then exported fully-charged batteries to the BSS via a delivery truck. The truck also delivers depleted batteries from the BSS to the nanogrid, where the depleted batteries are integrated into the MI and recharged.

Fig. 3
figure 3

Sketch for nanogrid-based BSS

There is an agreement between the nanogrid and the BSS. According to the agreement, the BSS bears a portion of investment costs for installing additional BESS in the nanogrid, while the nanogrid exports fully-charged batteries to the BSS. Consequently, the nanogrid achieves cost savings and the BSS benefits from a lower investment on PV panels. Moreover, the agreement states the total amount of the exported fully-charged batteries, rather than forces a specific amount for each sub period. Thus, it is flexible and beneficial for balancing the variable PV generation and local demands in the nanogrid. Hence, a nanogrid-based BSS framework catalyzes the popularity of electrified transportation [36] and also magnifies the benefits of nanogrids.

Note that there should be multiple nanogrids to implement a nanogrid-based BSS system. The nanogrids can be owned by an operator or different operators. This will influence the choice of the control strategy. For example, if one operator owns all the nanogrids, a centralized control approach is preferable. Otherwise, a hierarchical approach can be more appropriate. A comprehensive analysis should be conducted for determining the control strategy for the nanogrid-based BSS, which is beyond the scope of this paper.

3 Problem formulation

Strategic capacity planning is important in achieving optimal long-term performance for a nanogrid [21]. In this section, capacity planning for a single nanogrid is modeled in the MILP formulation. A well-performing nanogrid should be able to handle the majority of uncertainties without the utility grid [18], and thus we only consider the off-grid cases.

3.1 Deterministic formulation

The deterministic problem is formulated as follows:

Objective function: (1) minimizes the investment cost for PV generation and battery capacity. And econ denotes the amount that the BSS can bear in the total cost for the installing BESS.

Constraints: (2) represents the power balance and the PV outputs are constrained by (3). The discharging/charging variables for the battery are governed by the power limits (4) and (5), logical relations for status (6), hourly energy balance (7) and energy capacity limits (8)–(10). Equation (11) avoids end-of-horizon effects by setting the final energy storage level to be close to its initial value. For battery swapping, (12) represents hourly energy export capacity constraints, (13) avoids frequent but inefficient energy exports by stating the minimum interval between two sequential battery export operations. Equation (14) states the lower limits for the total amount of energy exported from the nanogrid to the BSS before time t (referred to as battery swapping demand hereafter), which depends on the energy agreement. Equations (15) and (16) are bounds of decision variables. Related symbols in equations are defined in Table 1.

$${ \hbox{min} }\quad C = IC_{\text{PV}} e^{\text{PV}} + IC_{\text{ESS}} \left( {e^{\text{BESS}} - e^{\text{con}} } \right)$$
(1)
$${\text{s}} . {\text{t}} .\quad PV(t) + P^{\text{dis}} (t) = PL(t) + P^{\text{ch}} (t) + c(t)\quad \forall t$$
(2)
$$0 \le PV(t) \le PV_{\text{G}} (t)e^{\text{PV}} \quad \forall t$$
(3)
$$0 \le P^{\text{dis}} (t) \le I^{\text{dis}} (t)\bar{P}^{\text{dis}} \quad \forall t$$
(4)
$$0 \le P^{\text{ch}} (t) \le I^{\text{ch}} (t)\bar{P}^{\text{ch}} \quad \forall t$$
(5)
$$I^{\text{dis}} (t) + I^{\text{ch}} (t) \le 1\quad \forall t$$
(6)
$$E(t) = E(t - 1) + \eta^{\text{ch}} P^{\text{ch}} (t)\Delta t - \frac{{P^{\text{dic}} (t)\Delta t}}{{\eta^{\text{dis}} }} - E^{\text{sw}} (t)\quad\forall t$$
(7)
$$\underset{\raise0.3em\hbox{$\smash{\scriptscriptstyle-}$}}{E} \le E(t) \le \bar{E}\quad \forall t$$
(8)
$$\underline{E} = s^{*} e^{\text{BESS}}$$
(9)
$$\overline{E} = S^{*} e^{\text{BESS}}$$
(10)
$$E(0) - \Delta E \le E(NT) \le E(0) + \Delta E$$
(11)
$$I^{\text{sw}} (t)\underline{E}^{\text{sw}} \le E^{\text{sw}} (t) \le I^{\text{sw}} (t)\bar{E}^{\text{sw}} \quad \forall t$$
(12)
$$\sum\limits_{\tau = t}^{{t + T^{\text{sw}} }} {\left( {1 - I^{\text{sw}} (\tau )} \right)} \ge T^{\text{sw}} I^{\text{sw}} (t)\quad \forall t$$
(13)
$$\sum\limits_{\tau = 1}^{t} {E^{\text{sw}} \left( \tau \right)} \ge \kappa^{\text{ex}} (t)\quad \, \forall t$$
(14)
$$\underset{\raise0.3em\hbox{$\smash{\scriptscriptstyle-}$}}{e}^{\text{PV}} \le e^{\text{PV}} \le \bar{e}^{\text{PV}}$$
(15)
$$\underset{\raise0.3em\hbox{$\smash{\scriptscriptstyle-}$}}{e}^{\text{BESS}} \le e^{\text{BESS}} \le \bar{e}^{\text{BESS}}$$
(16)
Table 1 Nomenclature

Note that we take econ as a predefined parameter in the above formulations. An alternative is taking econ in (1) as a variable, and then (14) can be revised as:

$$\sum\limits_{\tau = 1}^{t} {E^{\text{sw}} \left( \tau \right)} \ge \vartheta^{\text{ex}} (t)e^{\text{con}} \quad \forall t$$
(17)

where ϑex(t) is a predefined ratio stating that the total amount of exported energy at time t should be not less than ϑex(t) econ. More related discussions are given in Section 4.

3.2 Robust formulation

For the deterministic problem described in (1)–(16), hourly PV generation PV(t) and local demand PL(t) are uncertain parameters. It is a practical problem to determine the optimal PV and BESS mix that minimizes the investment cost while guarantees a required level of robustness against the uncertainties. RO has potentials for tackling with such problems. Classical RO method minimizes the total cost in the worst cases, and it solves the following generic min-max problem with objective function f(•) and constraints g(•).

$$\mathop { \hbox{min} }\limits_{{\varvec{x} \in \varvec{X}}} \quad \mathop { \hbox{max} }\limits_{{\varvec{h} \in {\varvec{H}}}} \, \varvec{f}(\varvec{x},\varvec{h})$$
(18)
$${\text{s}} . {\text{t}} .\quad \varvec{g}\left( {\varvec{x},\varvec{h}} \right) \le {\mathbf{0}}$$
(19)

where x is a vector of decision variables belonging to set X; h represents the uncertain parameters taking values in the uncertainty set H.

However, the above method sometimes tends to be too conservative. To tackle this problem, [26] proposed an adjustable RO method to handle the problem (20) with polyhedral uncertainty sets.

$$\left\{ {\begin{array}{*{20}l} {} {{ \hbox{min} }\;\varvec{c}^{{\prime }} \varvec{x}} \hfill \\ {{\text{s}} . {\text{t}} .} {\sum\limits_{n = 1} {\hat{a}_{mn} x_{n} } \le b_{m} }\\ \quad\,{l_{n} \le x_{n} \le u_{n} } \hfill \\ \end{array} } \right.$$
(20)

where uncertain coefficient âmn takes values in interval [amn − Δamn, amn + Δamn], in which Δamn is the maximum deviation from the nominal value amn. The corresponding polyhedral uncertainty sets are described as follows:

$$\hat{a}_{mn} = a_{mn} + \xi_{mn} \Delta a_{mn} \left| {_{{\sum\limits_{m = 1} {\left| {\xi_{mn} } \right| \le\varvec{\varGamma}_{m} } ,\;\left| {\xi_{mn} } \right| \le 1,\quad \forall m,n}} } \right.$$
(21)

where ξmn = (âmn − amn)/Δamn, which obeys an asymmetric distribution that is described using only the upper and the lower uncertainty boundaries.

For (20), its robust counterpart formulation with consideration of conservatism is recast as an MILP formulation in (22).

$$\left\{ {\begin{array}{*{20}l} {} \hfill {\hbox{min} }&\;\varvec{c}^{{\prime }} \varvec{x} \hfill & {} \hfill \\ {{\text{s}} . {\text{t}} .} \hfill & {\sum\limits_{n = 1} {\hat{a}_{mn} x_{n} } - z_{m}\varvec{\varGamma}_{m} - \sum\limits_{n = 1} {p_{mn} } \le b_{m} } \hfill & {\forall m} \hfill \\ {} \hfill & {z_{m} + p_{mn} \ge \Delta a_{mn} x_{n} } \hfill & {\forall m,n \in J_{m} } \hfill \\ {} \hfill & {z_{m} + p_{mn} \ge - \Delta a_{mn} x_{n} } \hfill & {\forall m,n \in J_{m} } \hfill \\ {} \hfill & {p_{mn} \ge 0} \hfill & {\forall m,n \in J_{m} } \hfill \\ {} \hfill & {z_{m} \ge 0} \hfill & {\forall m \in J_{m} } \hfill \\ {} \hfill & {l_{n} \le x_{n} \le u_{n} } \hfill & {\forall n} \hfill \\ \end{array} } \right.$$
(22)

For constraint m, a parameter Γm taking values in the interval [0, |Jm|] (where Jm is the set of coefficients âmn, n \(\in\) Jm) is used to adjust the robustness of the solution. zm is the dual variable of constraint m and pmn is an auxiliary variable to linearize the model. By varying Γm, we have the flexibility of adjusting the robustness of the solutions. If Γm = 0, no deviations are considered, and thus the constraints are same as that of the nominal problem. Otherwise, if up to ⌊Γm⌋ of the |Jm| coefficients change within their bounds, and up to one coefficient changes by (Γm–⌊Γm⌋)Δamn, then the solution of (22) will always remain feasible. Thus, if Γm is |Jm|, the maximum deviation is considered, and this is the most conservative case. In other words, predefined Γm can control the tradeoff between the robustness and economic performance of the solutions, and thus we call Γm as uncertainty budgets. The detailed description of this adjustable RO method can be found in [26].

According to (22), the robust counterparts for the deterministic formulation are established as follows:

$$\begin{aligned} & PV(t) - pv(t) - s_{\text{PV}}\varvec{\varGamma}_{\text{PV}} + P^{\text{dis}} (t) \\ &\quad = PL(t) - pl(t) - s_{\text{LD}}\varvec{\varGamma}_{\text{LD}} + P^{\text{ch}} (t) + c(t) \\ \end{aligned}$$
(23)
$$pv(t) + s_{\text{PV}} \ge (\overline{PV}_{\text{G}} (t) - \underline{PV}_{\text{G}} (t))e_{\text{PV}}$$
(24)
$$pl(t) + s_{\text{LD}} \ge \overline{PL} (t) - \underline{PL} (t)$$
(25)

where ΓPV and ΓLD are predefined uncertainty budgets, which adjust the conservativeness of the solutions; pl(t) and pv(t) are dual variables of constraints (2) and (3); sPV and sLD are auxiliary variables used for linearization purpose. Equation (23) forces the auxiliary variables to take values following the uncertainty budgets. If uncertainty budgets are equal to 0, then (23) is identical to the deterministic formulation in (2). Otherwise, the new formulation will force increments in the installed PV and BESS capacity to seek higher robustness of the solutions.

3.3 Solution methodology

The proposed robust formulation for the optimal capacity planning has been transformed into an MILP formulation. The MILP is a deterministic optimization technique that can be solved by well-developed commercial solvers, such as CPLEX. General advantages of the MILP method include: 1) it can guarantee the global optimality of the solution; 2) it provides a more direct measure of optimality; 3) it is flexible and can enhance modeling capabilities and adaptability [37]. Poor performance in scalability is the main disadvantage of the MILP. However, it is not an issue in this paper since our problem has a small size. There is extensive literature comparing the pros and cons of MILP with its competitors [38, 39].

Figure 4 outlines the solution procedure. The required input data include PV generation, local demands, and battery swapping demand, etc.

Step 1::

Based on measurements and historical data, define upper and lower bounds for uncertain parameters. Set all uncertainty budgets (ΓPV and ΓLD) to zero, which corresponds to the least conservative case

Step 2::

Solve the MILP with current values of the uncertainty budgets, and save the corresponding solutions

Step 3::

Increase the uncertainty budget ΓLD with step size stLD. Then, if the current value of ΓLD is not larger than its upper limit Γ maxLD , go to Step 2, otherwise, increase the uncertainty budget ΓPV with step size stPV. If ΓPV is larger than its upper limit Γ maxPV , go to Step 4, otherwise, reset ΓLD to zero and go back to Step 2. Note that the values of stLD and stPV result in a tradeoff between desired accuracy and computational performance. In theory, for N uncertain parameters and each Γτ increases from Γ min τ  to Γ max τ in stτ increments, the total number of combinations to be solved is \(\mathop \Pi \limits_{{\tau { = 1}}}^{N} [st ^{-1}_{\tau} (\varGamma_{\tau }^{ \hbox{max} } - \varGamma_{\tau }^{ \hbox{min} } ) + 1]\)

Step 4::

Save the solutions for different values of the uncertainty budgets, and then run all of them against the Monte Carlo scenarios to identify their performance. The Monte Carlo simulation calculates infeasible samples and the infeasibility probability regarding different realizations of the uncertain parameters. Lower infeasibility probability means the solution is more robust against uncertainties and can cover more cases. Then it can give a measurement of how much the decision maker can rely on each solution

Fig. 4
figure 4

Flowchart for the solution methodology

4 Simulation and results

Figures 5 and 6 show the profiles for the involved hourly PV generation and local demands. The input data were measured at a nanogrid at the IIT campus [1]. Data measured in January and June are selected to represent the seasonal variations, and an hourly averaging was performed based on these two months to limit the number of variables. Then the minimum and maximum of the hourly averaged values are set as lower and upper bounds of uncertain parameters.

Fig. 5
figure 5

Profiles for daily solar power, where the red line represents the maximum value and the box spans the range

Fig. 6
figure 6

Profiles for daily local demands in the nanogrid

The investment costs for PV and BESS are $839/kW and $945/kWh, respectively. Charging and discharging efficiencies are 0.9. Upper and lower energy limits for the battery are 0.2 and 0.8. Besides, the initial value of stored energy in the batteries is 60%, and the final value should fall in an interval of 55%–65%. The lower limits for the total amount of exported energy κex(t) at 13:00, 18:00 and 24:00 are 340 kWh, 700 kWh and 750 kWh, respectively.

4.1 Solutions for capacity planning

We give capacity planning solutions for the nanogrid. Figure 7 presents a benchmark for the case that the nanogrid exports no fully-charged batteries to a BSS (Case 1), whereas Fig. 8 shows the results for the proposed framework (Case 2). Case 1 and Case 2 show that we have to install more PV panels and batteries for seeking higher reliability. In Case 2, as the nanogrid supply energy to both of its local load and a BSS, it has to install more PV panels (25%–51%) than that in Case 1. However, the installation of batteries in Case 2 is 3%–5.5% less than that in Case 1, even though that the nanogrid in Case 2 exports batteries to a BSS. This is because that the increased PV generation alleviate the burden of energy storage in the nanogrid.

Fig. 7
figure 7

Installation of PV, BESS and investment versus different uncertainty budgets ΓPV and ΓLD in Case 1 (the nanogrid exports no batteries to a BSS)

Fig. 8
figure 8

Installation of PV, BESS and investment versus different uncertainty budgets ΓPV and ΓLD in Case 2 (the nanogrid exports batteries to a BSS)

The investment cost in Fig. 8 has no consideration of the agreement that the BSS bears a portion (defined as δ) of the investment costs for BESS. If the BSS can bear 10% of the cost for BESS, the total investment in Case 2 will fall below that in Case 1, as given in Table 2. Table 2 also compares Cases 1 and 2 adopting different values of δ, ΓPV and ΓLD. It shows that the nanogrid will achieve significant cost savings in Case 2. If the BSS can pay for all the BESS, the nanogrid can save more than half of the total investment. Note that this is also beneficial to the BSS, since it avoids installing a large number of PV panels.

Table 2 Investment cost for Cases 1 and 2 with different δ

Case 2 takes econ as a predefined value, however, as remarked earlier, another alternative is taking econ as a variable. Case 3 takes econ as a variable, and the lower limits for total exported energy (ϑex(t)econ) before 13:00, 18:00 and 24:00 are defined as 35%, 75% and 95% of econ, respectively. Then Table 3 lists the results. It demonstrates that when the nanogrid seeks higher reliability, it will make a higher energy agreement with the BSS. Besides, taking econ as a variable further enhances the flexibility in the sizing PV and BESS in a nanogrid, and thus, Case 3 shows better performance than Case 2.

Table 3 Installation of PV, BESS and investment cost in Case 3

Here, we re-define the lower limits for total exported energy before 15:00, 18:00 and 24:00 as 45%, 75% and 90% of econ, respectively. Then the resulting counterparts for Table 3 are given in Table 4. It demonstrates that different profiles of battery swapping demand from the BSS may result different sizes of a nanogrid.

Table 4 Installation of PV, BESS and investment cost in Case 3

4.2 Performance of the solutions

The Monte Carlo simulation generates a large number of scenarios to represent uncertainties in hourly PV generation and local demand. And the number of studied scenarios is reduced by a fast-forward technique [40]. Consequently, 900 scenarios are employed, and we run the resulting solutions in Cases 1 and 2 against these scenarios to assess their performance. The simulated PV generation and local demand scenarios follow a normal distribution with a standard deviation (volatility) of 10% of expected values, which are median value in Figs. 6 and 7. Note that when δ = 10%, Case 2 has similar investment cost with Case 1 (see Table 2). Thus, Case 2 with δ = 10% is taking as an example to be compared with Case 1.

Figure 9 shows the proportion of infeasible hours that the nanogrid suffers a stored energy level below 20%, which is denoted as an infeasible probability (IP). It also provides the amount of averaged curtailed PV generation (CPV). In both of Case 1 and Case 2, as expected, the number of infeasible hours tends to decrease as the investment cost increases, while the amount of CPV follows an opposite trend. Table 5 provides a more detailed analysis.

Fig. 9
figure 9

Average IP and CPV versus the investment cost in Cases 1 and 2

Table 5 IP and CPV versus uncertainty budgets in Cases 1 and 2

Table 5 and Fig. 9 show that Case 2 exhibits better performance than Case 1. At similar investment cost level, Case 2 has lower IP and less CPV. Providing energy storage as service to the BSS can enhance the economy and reliability of the nanogrid. Thus the proposed structure realizes the potential benefits of dispersed batteries that are used for backup energy storage in the nanogrids and also catalyzes the electrification of the public transport [15, 41].

Table 6 briefly lists results derived from the classical SO [15] and RO method [23]. Table 6 also gives the results of deterministic optimization (DO) using the median value in Figs. 6 and 7. In general, it also shows that Case 2 performs better than Case 1. Besides, the RO solution is the most expensive one. Correspondingly, the RO solution performs quite well in the feasibility analysis as it is feasible in almost all scenarios. However, this also indicates that the uncertainty the RO solution can withstand is somehow much larger than the practical requirement. The SO approach seems to be less conservative than the worst-case-oriented RO approach, and it is barely better than the deterministic one.

Table 6 Comparisons between different solution methods

Comparison between Tables 5 and 6 further illustrates the advantages of the proposed approach. It can control the robustness of its solutions. Moreover, by adjusting uncertainty budgets, it can provide much more options than the classical SO and RO approaches. This meets the requirements of decision makers preferring a tradeoff between robustness and economy in practical applications.

4.3 Energy dispatch with one group of solutions

Figure 10 demonstrates daily power components of the nanogrid in Case 2. Here we take capacity planning solution for ΓPV = 0.6 and ΓLD = 0.6 as example, and it consists of 41.1% PV capacity increment, 11.7% battery capacity increment, and 18.4% total investment increment than the base case (ΓPV = 0 and ΓLD = 0).

Fig. 10
figure 10

Demonstration of daily power components of the nanogrid

The nanogrid keeps charging between Hour 7 and Hour 18. Since it can export fully-charged batteries (at Hours 9, 11, 13 and 15) to the BSS, its BESS always has enough capacity to store the surplus PV generation. Thus, no PV generation is curtailed. At Hour 16, the nanogrid stops exporting batteries to prepare for the periods with insufficient PV generation. The nanogrid periodically adjusts its energy dispatch to meet local energy requirements and to fulfillment energy exporting agreement with the BSS. As mentioned in Sect. 2, although the agreement claims that the nanogrid should export enough fully-charged batteries to the BSS, it has no restricted requirements on the detailed amount of energy exported at each period in the operation horizon of the nanogrid. Therefore, this agreement can be seen as a dispatchable load in balancing the variable PV generation and demands in the off-grid nanogrid.

For comparison, Fig. 11 gives the corresponding cases that the nanogrid exports no batteries to the BSS. In this case, the BESS in the nanogrid keeps charging till it is fully charged at Hour 12. Then, in the following hours, the nanogrid has to curtail a considerable part (43.4%) of the costly PV generation. This inevitably leads to underutilization of the costly PV and BESS resources.

Fig. 11
figure 11

Demonstration of daily power components of the nanogrid without exporting batteries to the BSS

4.4 Computational issues

All simulations were carried out using CPLEX 12.1 under the MATLAB interface YALMIP on a PC with Intel i7 2.8 GHz processor (8 GB RAM). Each MILP computation requires 25 s to 70 s, and it took a little more than 72 min to obtain all the solutions. The computational requirements would grow when the number of uncertain parameters increases. However, it should not be an issue since the simulation is performed off-line in the design stage, and parallel computing technique can be employed to speed up the solutions.

5 Conclusions and future work

This paper presents an RO approach to determine the optimal mix of PV generation and BESS in an off-grid nanogrid, which powers its local loads and supplies fully-charged batteries to a BSS. The employed RO approach uses distribution-free bounded intervals to model uncertainties of PV generation and demands. It can control the robustness of the capacity planning results by flexibly adjusting the predefined uncertainty budgets. The results of case studies show that a nanogrid-based BSS framework has potentials to offer economic benefits, ensure reliability, and prevent underutilization of capital-intensive PV and BESS.

Swapping batteries between a BSS and a nanogrid can achieve mutual benefits, and it is a potential approach to facilitating higher penetration levels of distributed PV and catalyzing the popularity of EVs. Future studies will focus on developing flexible energy management strategies for nanogrids and expanding the role of the BSS in coordinating various distributed energy resources.