*3.1. Objective Function*

The objective function is to minimize the operating cost, as shown in Equation (1). *CL*(*t*) represents the total fuel cost of all diesel generator sets at time *t*, *Cst*(*t*) is the total startup cost of all diesel generator sets at time *t*, and *Cbatt*(*t*) represents the ESS cost. The power generation cost of PV in this study is set to 0. *F* represents the total economic cost.

$$\text{Min } F = \sum\_{t=1}^{24} [\mathbb{C}\_L(t) + \mathbb{C}\_{st}(t) + \mathbb{C}\_{batt}(t)] \tag{1}$$

#### *3.2. Diesel Generator*

Equation (2) indicates the total fuel cost of a diesel generator in quadratic form, where *FCn* represents the fuel cost of the nth diesel generator. The *an*, *bn* and *cn* represents the quadratic fuel cost constants of the *n*th diesel generator. *Pn*(*t*) is the power generated by the *n*th diesel generator at time *t*. Figure 2 shows a typical fuel cost in quadratic form. However, because MILP is used, the quadratic curve needs to be linearized. In order to have a linear equation that is near the quadratic form, the curve is divided into segments and a line is drawn in each segment as the linear representation of the fuel cost curve for the *i*th segment.

$$FC\_n(P\_n(t)) = \
u\_n + b\_n P\_n(t) + c\_n P\_n(t)^2 \tag{2}$$

**Figure 2.** Typical generator cost curve with piecewise linearization.

Equations (3)–(5) are limits on the amount of electricity generated by the generator, where *Pn*\_*i*\_*max* and *Pn*\_*i*\_*min* are the maximum and minimum power generation in the *i*th line segment of the *n* generator set, respectively. *Bn*\_*i*(*t*) is a binary integer representing whether diesel generator *n* is running in the *i*th linear interval at time *t*. *Pn*\_*i*(*t*) is the amount of electricity generated in line segment *i*. The *i* represents the number of the line segment in the quadratic curve. Inequality (5) ensures that only one line segment is selected for the *n*th generator at any given time *t*.

$$B\_{n\_i}(t)P\_{n\_{im}} \le |P\_{n\_i}(t)| < B\_{n\_..}(t) \; P\_{n\_-i\_\* \max} \tag{3}$$

$$P\_n(t) = \sum\_{i=1}^{I} P\_{n\\_i}(t) \tag{4}$$

$$\sum\_{i=1}^{I} B\_{n\_i}(t) \; \le \; 1 \tag{5}$$

The total fuel cost of all generators set at time *t* is expressed in Equation (6). *Un*(*t*) represents a binary integer variable of whether the *n*th diesel generator is turned on at time *t*. *N* represents the total number of diesel generators. *αn*\_*<sup>i</sup>* and *βn*\_*<sup>i</sup>* represent the slope and intercept, respectively, of the linear fuel cost when the *n*th diesel generator operates on line segment *i* at time *t*.

$$\mathbb{C}\_{L}(t) = \sum\_{n=1}^{N} \sum\_{i=1}^{I} \mathcal{U}\_{n}(t) B\_{n\_{i}}(t) \left[ \alpha\_{n\_{i}} P\_{n\_{i}}(t) + \beta\_{n\_{-}i} \right] \tag{6}$$

Equation (7) represents the total startup cost of *N* diesel generators at time *t*. *STprice* represents the startup cost of generators.

$$\mathcal{L}\_{st}(t) = \sum\_{n=1}^{N} ST\_{price}(\mathcal{U}\_{\mathbb{R}}(t) - \mathcal{U}\_{\mathbb{R}}(t-1))\tag{7}$$
