Abstract:
Systems and methods are disclosed for energy management by receiving parameters from commercial building energy system components; optimizing models of system components; optimizing for selected objective functions; generating an optimal operation schedule for the system components; analyzing economic and environmental impacts and optimizing operations of electric vehicles (EVs) for mobile energy storage in commercial buildings.

Description:
This application claims priority to Provisional Application Ser. No. 61/565,201 filed Nov. 30, 2011, the content of which is incorporated by reference. 
    
    
     BACKGROUND 
     This application relates to mobile energy storage systems in commercial buildings. 
     Electric vehicles (EVs) have attracted much attention in recent years mainly due to economic and environmental concerns. It is expected that 3 million EVs to be on the road in California by 2015. While wide-scale penetration of EVs in electric systems brings new challenges to electric systems that need to be addressed, at the same time, it shows great potentials and new opportunities to improve efficiency of energy and transportation sectors. One can take advantage of the unique characteristics of these relatively new components of energy systems to address some of the existing issues of the grid. 
     In the context of smart grids, smart distribution systems are envisioned as coupled microgrids (μG) that not only are connected to the grid, but also utilize Distributed Energy Resources (DERs) to generate power. High level of DERs integration in μGs raises concerns about the availability of high quality power supply mainly due to the variable and intermittent nature of power generation by Renewable Energy Resources (RESs). To cope with these issues, energy storage systems have been proposed to be used in μGs with DERs. When added, an energy storage system can immediately improve μGs′ availability. Today, pumped hydro, flywheel, compressed air, and different types of batteries are the main energy storage technologies considered in the US electric power grid. In addition to these technologies, EVs can be considered as Mobile Energy Storage (MES) that are available only during certain hours of the day.  FIG. 1  shows an exemplary load profile of a large commercial building office during weekdays and weekends for summer and winter. As shown therein, peak energy usage occurs during working hours, and drops off during non-working hours. 
     SUMMARY 
     In one aspect, systems and methods are disclosed for energy management by receiving parameters from commercial building energy system components; optimizing models of system components; optimizing for selected objective functions; generating an optimal operation schedule for the system components; analyzing economic and environmental impacts and optimizing operations of electric vehicles (EVs) for mobile energy storage in commercial buildings. 
     In another aspect, systems and methods are disclosed that uses Electric Vehicles (EVs) as Mobile Energy Storage (MES) that are available only during certain hours of the day. For commercial buildings, employees can plug in their EVs to the building energy system to be charged and/or discharged by Energy Management System (EMS) of the building. One embodiment analyzes economic and environmental benefits of the application of EVs as MES in commercial building μGs. The system models energy systems of a commercial building including its grid connection, DERs, Stationary Energy Storage (SES), and demand profile. Based on the developed models, a Mixed Integer Linear Programming (MILP) problem is formulated in one embodiment to optimizes the operation of a commercial building μG. The objective is to minimize μG&#39;s daily operational costs and greenhouse gas emissions (GHG). Technical and operational constraints of DERs and Energy Storage (ES) systems such as minimum up time and down time, and charging and discharging power and capacity constraints of ES devices are formulated to appropriately model the operation of a grid connected commercial μG. 
     Advantages of the preferred embodiments may include one or more of the following. The system provides economic and environmental benefits of the application of EVs as MES in commercial building μGs. A comprehensive analysis is done where energy systems of a commercial building including its grid connection, DERs, Stationary Energy Storage (SES), and demand profile are modeled. Based on the developed models, a Mixed Integer Linear Programming (MILP) problem is formulated to optimizes the operation of a commercial building μG. The system minimizes μG&#39;s daily operational costs and greenhouse gas emissions (GHG). Technical and operational constraints of DERs and Energy Storage (ES) systems such as minimum up time and down time, and charging and discharging power and capacity constraints of ES devices are formulated to appropriately model the operation of a grid connected commercial μG. The ability to use EVs to augment energy supply is particularly of interest for commercial buildings, where employees can plug in their EVs to the building energy system to be charged and/or discharged by Energy Management System (EMS) of the building. Technical and operational constraints of DERs and ES such as minimum up time and down time, load sharing characteristics of diesel generators, and charging and discharging constraints of ES devices are formulated to appropriately model the operation of a grid connected commercial μG. This provides a more accurate model to assess economic and environmental impacts of EVs in commercial buildings. 
    
    
     
       BRIEF DESCRIPTION OF THE DRAWINGS 
         FIG. 1  shows an exemplary load profile of a large commercial building office during weekdays and weekends for summer and winter. 
         FIG. 2  shows an exemplary block diagram of a commercial building microgrid. 
         FIG. 3  shows an exemplary system for optimizing economic and environmental impacts using EVs as mobile energy storage systems. 
         FIG. 4  shows an exemplary system for Using EVs as mobile energy storage in commercial buildings. 
     
    
    
     DESCRIPTION 
     In Smart Grids, commercial buildings can be seen as μGs that not only have grid connection, but also utilize various types of DERs to supply their demand. In this context, commercial building EMSs are expected to have the capability of controlling the operation of various components of their energy systems including DERs, ESs, and energy trade with the grid. 
     In commercial building μGs, EVs can be considered as MES mediums that are only available during certain hours of the day, and during these hours, the EMS can utilize both the energy stored in these EVs and their connected capacity. In this work, we consider integrated values of all connected EVs to the commercial building as a single MES. This MES is assumed to have a known (forecasted) connection time, available capacity and stored energy. The available capacity and stored energy of the MES might change during the day, reflecting the connection/disconnection of EVs to/from the building. The developed model generates operational schedule for all the components, including MES. The charging/discharging control of the obtained schedule for the MES among the connected EVs can be estimated using suitable processes. 
     A block diagram of an exemplary commercial building μG used to carry out simulations is presented in  FIG. 2 . The μG consists of DC and AC buses and utilizes PV, FC, ICE, and MT in addition to the grid connection to supply its demand. SES and MES are connected to the DC bus of the system and their energy flow and storage can be controlled by the EMS of the μG. The μG trades energy with the grid and can sell to and/or buy from the grid. The grid charges the μG for its energy consumption and peak demand, and pays for its energy supply and spinning reserve capacity. As shown therein, MTs  1 , FC  2 , and ICE  3  supply energy over AC/DC buses to power AC load  40 , DC/AC converter  30 , and grid  50 . Each vehicle or MES  10  includes a plurality of battery units that are connected to a DC/DC converter  20  that provides energy over a private bus to supply power to a DC load  24 , SES  22 , and DC/AC converter  30 . A photovoltaic panel  26  can power a DC/DC converter  28  that supplies power to the private bus. 
       FIG. 3  shows an exemplary system for optimizing economic and environmental impacts using EVs as mobile energy storage systems. Power generation data and energy price forecast are provided ( 300 ). Load forecast data is also input ( 302 ). The system also receives commercial building energy system components and parameters ( 304 ). Weather forecast data ( 306 ) is provided. EV capacity and energy level forecast are also received ( 308 ). With the input data, the system performs one or more optimization models of the system components ( 310 ). Next, the system optimizes for selected objective functions ( 312 ). An optimal generation schedule of system components is generated ( 314 ). The system then analyzes economic and environmental impacts ( 316 ). 
       FIG. 4  shows an exemplary system for Using EVs as mobile energy storage in commercial buildings as Methods for Optimal Operation of EVs as Mobile Energy Storage  410 . In  412 , the system performs mathematical modeling of components. In  414 , modeling of EVs is done. This include modeling of charge/discharge constraints of EVs in  416 . In  418 , the system performs modeling degradation costs of EV batteries. In  420 , the system performs modeling contribution of EVs in Spinning Reserve requirements. 
     Next, in  430 , the system performs grid connection modeling. In  432 , peak demand charges are determined. In  434 , the system performs formulation of Ancillary Services. 
     In  436 , the system formulates objective functions in the problem. In  438 , the formulation of a Maximization of Daily Profit Objective function is determined. In  440 , the system minimizes a GHG Emissions Objective function. 
     In one implementation, the energy balance equation for MES is given as follows: 
     
       
         
           
             
               
                 
                   
                     e 
                     
                       mes 
                       , 
                       t 
                     
                   
                   = 
                   
                     
                       
                         ( 
                         
                           1 
                           - 
                           
                             Φ 
                             mes 
                           
                         
                         ) 
                       
                       ⁢ 
                       
                         e 
                         
                           mes 
                           , 
                           
                             t 
                             - 
                             1 
                           
                         
                       
                     
                     + 
                     
                       τ 
                       ( 
                       
                         
                           
                             p 
                             
                               mes 
                               , 
                               t 
                             
                             chg 
                           
                           ⁢ 
                           
                             η 
                             mes 
                             chg 
                           
                         
                         - 
                         
                           
                             p 
                             
                               mes 
                               , 
                               t 
                             
                             dch 
                           
                           
                             η 
                             mes 
                             dch 
                           
                         
                       
                       ) 
                     
                     + 
                     
                       E 
                       
                         mes 
                         , 
                         t 
                       
                       conn 
                     
                     - 
                     
                       E 
                       
                         mes 
                         , 
                         t 
                       
                       disc 
                     
                   
                 
               
               
                 
                   ( 
                   1 
                   ) 
                 
               
             
           
         
       
     
     where E mes,t   conn  and E mes,t   disc  represent energy level of EVs connected to and disconnected from the building at time t, respectively. These parameters are assumed to be exogenous inputs to this model. Energy storage level of MES is limited by minimum and maximum available capacities of the MES at each time interval,  E   mes,t  and Ē mes,t  respectively, as follows:
 
   SOC     mes   Ē   mes,t   ≦e   mes,t   ≦  SOC     mes   Ē   mes,t   (2)
 
     where Ēmes,t not only takes into account the physically available connected capacity of EVs to the building, but also considers EV owners&#39; preferences on available energy at the disconnection time of the EV. If EV owners do not provide any specific disconnection time energy level of their vehicles, then Ē mes,t  of the MES is built based on the rated capacity connected and disconnected EVs&#39; batteries using the following equation:
 
 Ē   mes,t =( Ē   mes,t-1   +Ē   mes,t   conn   −Ē   mes,t   disc )  (13)
 
   E     mes,t =( Ē   mes,t-1   +Ē   mes,t   conn   −Ē   mes,t   disc )  (4)
 
     where Ē mes,t   conn  and Ē mes,t   disc  represent connected and disconnected EV capacities at time t. 
     The system also considers charge/discharge constraints of EVs. The following constraints are considered to ensure that p mes,t   chg  and p mes,t   dch  are less than maximum charging and discharging power of the MES at each time interval:
 
0 ≦p   mes,t   chg   ≦u   mes,t   chg     P     mes,t   (5)
 
0 ≦p   mes,t   dch   ≦u   mes,t   dch     P     mes,t   (6)
 
     where  P   mes,t  and  P   mes,t  are calculated as follows:
 
   P     mes,t =(   P     mes,t-1   +  P     mes,t   conn   −  P     mes,t   disc )  (7)
 
     Operational and maintenance costs of MES includes its degradation costs and considers the effect of charging and discharging cycles on capacity loss of the MES, is assumed to be proportional to the number of charging and discharging cycles, and is modeled as follows: 
     
       
         
           
             
               
                 
                   
                       
                   
                   ⁢ 
                   
                     
                       v 
                       
                         ses 
                         , 
                         t 
                       
                       chg 
                     
                     ≥ 
                     
                       
                         u 
                         
                           ses 
                           , 
                           t 
                         
                         chg 
                       
                       - 
                       
                         u 
                         
                           ses 
                           , 
                           
                             t 
                             - 
                             1 
                           
                         
                         chg 
                       
                     
                   
                 
               
               
                 
                   ( 
                   8 
                   ) 
                 
               
             
             
               
                 
                   
                       
                   
                   ⁢ 
                   
                     
                       v 
                       
                         ses 
                         , 
                         t 
                       
                       dch 
                     
                     ≥ 
                     
                       
                         u 
                         
                           ses 
                           , 
                           t 
                         
                         dch 
                       
                       - 
                       
                         u 
                         
                           ses 
                           , 
                           
                             t 
                             - 
                             1 
                           
                         
                         dch 
                       
                     
                   
                 
               
               
                 
                   ( 
                   9 
                   ) 
                 
               
             
             
               
                 
                   
                     C 
                     
                       mes 
                       , 
                       t 
                     
                   
                   = 
                   
                     
                       
                         C 
                         mes 
                         dg 
                       
                       ⁢ 
                       
                         1 
                         2 
                       
                       ⁢ 
                       
                         ( 
                         
                           
                             v 
                             
                               mes 
                               , 
                               t 
                             
                             chg 
                           
                           + 
                           
                             v 
                             
                               mes 
                               , 
                               t 
                             
                             dch 
                           
                         
                         ) 
                       
                     
                     + 
                     
                       
                         C 
                         mes 
                         c 
                       
                       ⁢ 
                       
                         
                           E 
                           _ 
                         
                         
                           mes 
                           , 
                           t 
                         
                       
                     
                     + 
                     
                       
                         
                           p 
                           
                             mes 
                             , 
                             t 
                           
                           dch 
                         
                         
                           η 
                           mes 
                           dch 
                         
                       
                       ⁢ 
                       
                         C 
                         
                           mes 
                           , 
                           t 
                         
                         s 
                       
                     
                     - 
                     
                       
                         
                           p 
                           
                             mes 
                             , 
                             t 
                           
                           chg 
                         
                         
                           η 
                           mes 
                           chg 
                         
                       
                       ⁢ 
                       
                         C 
                         
                           mes 
                           , 
                           t 
                         
                         d 
                       
                     
                   
                 
               
               
                 
                   ( 
                   10 
                   ) 
                 
               
             
           
         
       
     
     where C mes   dg  represents costs of the MES degradation per cycle to be paid by the μG operator to EV owners to reimburse their battery degradation due to charge and discharge by the EMS, C mes   c  denotes capacity costs to be paid by the μG operator to EV owners for the hours connecting their vehicles to the building EMS. C mes,t   s  and C mes,t   d  represent the selling and buying energy price of the EV, respectively. 
     In another embodiment, the system models degradation costs of EV batteries 
     
       
         
           
             
               
                 
                   
                     C 
                     
                       mes 
                       , 
                       t 
                     
                   
                   = 
                   
                     
                       
                         C 
                         mes 
                         dg 
                       
                       ⁢ 
                       
                         1 
                         2 
                       
                       ⁢ 
                       
                         ( 
                         
                           
                             v 
                             
                               mes 
                               , 
                               t 
                             
                             chg 
                           
                           + 
                           
                             v 
                             
                               mes 
                               , 
                               t 
                             
                             dch 
                           
                         
                         ) 
                       
                     
                     + 
                     
                       
                         C 
                         mes 
                         c 
                       
                       ⁢ 
                       
                         
                           E 
                           _ 
                         
                         
                           mes 
                           , 
                           t 
                         
                       
                     
                     + 
                     
                       
                         
                           p 
                           
                             mes 
                             , 
                             t 
                           
                           dch 
                         
                         
                           η 
                           mes 
                           dch 
                         
                       
                       ⁢ 
                       
                         C 
                         
                           mes 
                           , 
                           t 
                         
                         s 
                       
                     
                     - 
                     
                       
                         
                           p 
                           
                             mes 
                             , 
                             t 
                           
                           chg 
                         
                         
                           η 
                           mes 
                           chg 
                         
                       
                       ⁢ 
                       
                         C 
                         
                           mes 
                           , 
                           t 
                         
                         d 
                       
                     
                   
                 
               
               
                 
                   ( 
                   11 
                   ) 
                 
               
             
           
         
       
     
     where C mes   dg  represents costs of the MES degradation per cycle to be paid by the μG operator to EV owners to reimburse their battery degradation due to charge and discharge by the EMS, C mes   c  denotes capacity costs to be paid by the μG operator to EV owners for the hours connecting their vehicles to the building EMS. 
     Modeling contribution of EVs in Spinning Reserve requirements can be done. If p ses,t   sp  and p mes,t   sp  represent the spinning reserve provided by the SES and MES at time t, respectively, and calculated as follows: 
     
       
         
           
             
               
                 
                   
                     p 
                     
                       ses 
                       , 
                       t 
                     
                     sp 
                   
                   = 
                   
                     min 
                     ⁢ 
                     
                       { 
                       
                         
                           
                             ( 
                             
                               
                                 e 
                                 
                                   ses 
                                   , 
                                   t 
                                 
                               
                               - 
                               
                                 
                                   
                                     SOC 
                                     _ 
                                   
                                   ses 
                                 
                                 ⁢ 
                                 
                                   
                                     E 
                                     _ 
                                   
                                   ses 
                                 
                               
                             
                             ) 
                           
                           τ 
                         
                         , 
                         
                           
                             
                               P 
                               _ 
                             
                             ses 
                           
                           - 
                           
                             p 
                             
                               ses 
                               , 
                               t 
                             
                             dch 
                           
                         
                       
                       } 
                     
                   
                 
               
               
                 
                   ( 
                   37 
                   ) 
                 
               
             
             
               
                 
                   
                     p 
                     
                       mes 
                       , 
                       t 
                     
                     sp 
                   
                   = 
                   
                     min 
                     ⁢ 
                     
                       { 
                       
                         
                           
                             ( 
                             
                               
                                 e 
                                 
                                   mes 
                                   , 
                                   t 
                                 
                               
                               - 
                               
                                 
                                   
                                     SOC 
                                     _ 
                                   
                                   mes 
                                 
                                 ⁢ 
                                 
                                   
                                     E 
                                     _ 
                                   
                                   
                                     mes 
                                     , 
                                     t 
                                   
                                 
                               
                             
                             ) 
                           
                           τ 
                         
                         , 
                         
                           
                             
                               P 
                               _ 
                             
                             
                               mes 
                               , 
                               t 
                             
                           
                           - 
                           
                             p 
                             
                               mes 
                               , 
                               t 
                             
                             dch 
                           
                         
                       
                       } 
                     
                   
                 
               
               
                 
                   ( 
                   38 
                   ) 
                 
               
             
           
         
       
     
     These constraints are reformulated as linear constraints in the mode as follows: 
     
       
         
           
             
               
                 
                   
                     p 
                     
                       ses 
                       , 
                       t 
                     
                     sp 
                   
                   ≤ 
                   
                     
                       ( 
                       
                         
                           e 
                           
                             ses 
                             , 
                             t 
                           
                         
                         - 
                         
                           
                             
                               SOC 
                               _ 
                             
                             ses 
                           
                           ⁢ 
                           
                             
                               E 
                               _ 
                             
                             ses 
                           
                         
                       
                       ) 
                     
                     τ 
                   
                 
               
               
                 
                   ( 
                   39 
                   ) 
                 
               
             
             
               
                 
                   
                     p 
                     
                       ses 
                       , 
                       t 
                     
                     sp 
                   
                   ≤ 
                   
                     
                       
                         P 
                         _ 
                       
                       ses 
                     
                     - 
                     
                       p 
                       
                         ses 
                         , 
                         t 
                       
                       dch 
                     
                   
                 
               
               
                 
                   ( 
                   40 
                   ) 
                 
               
             
             
               
                 
                   
                     p 
                     
                       mes 
                       , 
                       t 
                     
                     sp 
                   
                   ≤ 
                   
                     
                       ( 
                       
                         
                           e 
                           
                             mes 
                             , 
                             t 
                           
                         
                         - 
                         
                           
                             
                               SOC 
                               _ 
                             
                             mes 
                           
                           ⁢ 
                           
                             
                               E 
                               _ 
                             
                             
                               mes 
                               , 
                               t 
                             
                           
                         
                       
                       ) 
                     
                     τ 
                   
                 
               
               
                 
                   ( 
                   41 
                   ) 
                 
               
             
             
               
                 
                   
                     p 
                     
                       mes 
                       , 
                       t 
                     
                     sp 
                   
                   ≤ 
                   
                     
                       
                         P 
                         _ 
                       
                       
                         mes 
                         , 
                         t 
                       
                     
                     - 
                     
                       p 
                       
                         mes 
                         , 
                         t 
                       
                       dch 
                     
                   
                 
               
               
                 
                   ( 
                   42 
                   ) 
                 
               
             
           
         
       
     
     The system also performs modeling of the grid connection in the problem formulation. It is assumed that the connection between the μG and the grid has a maximum power transfer capability limit, which implies that purchasing and selling power from/to the grid should be within this limit, as follows:
 
−   P     g   ≦p   g,t   ≦  P     g   (35)
 
     The formulation of Ancillary Services in the problem formulation can be done. In the grid-connected mode, the μG can participate in ancillary service markets of the grid such as spinning reserve market. This market participation is formulated as follows:
 
 p   sp,t =Σ i=1   N     i   (   P     i   u   i,t   −p   i,t )+Σ m=1   N     m   (   P     m   u   m,t   −p   m,t )+Σ f=1   N     f   (   P     f   u   f,t   −p   f,t )+ p   mes,t   sp   +p   ses,t   sp −0.1 P   D,t   (36)
 
     where p sp,t  is the amount of spinning reserve power that the μG can offer in the ancillary service market. Note that the spinning reserve is based on the controllable DERs and solar PV is not considered as a source of spinning reserve. Also, the μG should always have a 10% spinning reserve for itself in addition to its bid in the market. 
     The System can Perform Formulation of Maximization of Daily Profit Objective Function. 
     Daily profit of the μG, which is defined as the difference of its revenue and costs, is as follows: 
     
       
         
           
             
               
                 
                   
                     min 
                     ⁢ 
                     
                         
                     
                     ⁢ 
                     
                       p 
                       dc 
                     
                     ⁢ 
                     
                       C 
                       g 
                       dc 
                     
                   
                   + 
                   
                     
                       ∑ 
                       
                         t 
                         = 
                         1 
                       
                       T 
                     
                     ⁢ 
                     
                         
                     
                     ⁢ 
                     
                       τ 
                       [ 
                       
                         
                           
                             - 
                             
                               p 
                               
                                 sp 
                                 , 
                                 t 
                               
                             
                           
                           ⁢ 
                           
                             C 
                             
                               g 
                               , 
                               t 
                             
                             sp 
                           
                         
                         + 
                         
                           
                             p 
                             
                               g 
                               , 
                               t 
                             
                           
                           ⁢ 
                           
                             C 
                             
                               g 
                               , 
                               t 
                             
                             s 
                           
                         
                         + 
                         
                           
                             ∑ 
                             
                               i 
                               = 
                               1 
                             
                             
                               N 
                               i 
                             
                           
                           ⁢ 
                           
                               
                           
                           ⁢ 
                           
                             c 
                             
                               i 
                               , 
                               t 
                             
                           
                         
                         + 
                         
                           
                             ∑ 
                             
                               m 
                               = 
                               1 
                             
                             
                               N 
                               m 
                             
                           
                           ⁢ 
                           
                               
                           
                           ⁢ 
                           
                             c 
                             
                               m 
                               , 
                               t 
                             
                           
                         
                         + 
                         
                           
                             ∑ 
                             
                               f 
                               = 
                               1 
                             
                             
                               N 
                               f 
                             
                           
                           ⁢ 
                           
                               
                           
                           ⁢ 
                           
                             c 
                             
                               f 
                               , 
                               t 
                             
                           
                         
                         + 
                         
                           C 
                           pv 
                           om 
                         
                         + 
                         
                           c 
                           
                             ses 
                             , 
                             t 
                           
                         
                         + 
                         
                           c 
                           
                             mes 
                             , 
                             t 
                           
                         
                       
                       ] 
                     
                   
                 
               
               
                 
                   ( 
                   43 
                   ) 
                 
               
             
           
         
       
     
     where C g,t   sp , C g,t   s , and C g   dc  denote spinning reserve price, energy charges, and demand charges of the grid, respectively. 
     The System can Formulate and Minimize GHG Emissions Objective Function in the Problem Formulation. 
     Minimization of GHG emissions of the μG in the grid-connected mode is formulated as follows: 
     
       
         
           
             
               
                 
                   
                     min 
                     ⁢ 
                     
                       
                         ∑ 
                         
                           t 
                           = 
                           1 
                         
                         T 
                       
                       ⁢ 
                       
                           
                       
                       ⁢ 
                       
                         τ 
                         ⁡ 
                         
                           [ 
                           
                             
                               
                                 ∑ 
                                 
                                   i 
                                   = 
                                   1 
                                 
                                 
                                   N 
                                   i 
                                 
                               
                               ⁢ 
                               
                                   
                               
                               ⁢ 
                               
                                 
                                   ɛ 
                                   i 
                                   GHG 
                                 
                                 ⁢ 
                                 
                                   
                                     p 
                                     
                                       i 
                                       , 
                                       t 
                                     
                                   
                                   
                                     η 
                                     i 
                                   
                                 
                               
                             
                             + 
                             
                               
                                 ɛ 
                                 m 
                                 GHG 
                               
                               ⁢ 
                               
                                 
                                   p 
                                   
                                     m 
                                     , 
                                     t 
                                   
                                 
                                 
                                   η 
                                   m 
                                 
                               
                             
                             + 
                             
                               
                                 ɛ 
                                 f 
                                 GHG 
                               
                               ⁢ 
                               
                                 
                                   p 
                                   
                                     f 
                                     , 
                                     t 
                                   
                                 
                                 
                                   η 
                                   f 
                                 
                               
                             
                             + 
                             
                               
                                 ɛ 
                                 
                                   g 
                                   , 
                                   t 
                                 
                                 GHG 
                               
                               ⁢ 
                               
                                 p 
                                 
                                   g 
                                   , 
                                   t 
                                 
                               
                             
                           
                           ] 
                         
                       
                     
                   
                   + 
                   
                     
                       ( 
                       
                         
                           e 
                           
                             mes 
                             , 
                             T 
                           
                         
                         - 
                         
                           e 
                           
                             mes 
                             , 
                             0 
                           
                         
                       
                       ) 
                     
                     ⁢ 
                     
                       ɛ 
                       mes 
                       GHG 
                     
                   
                 
               
               
                 
                   ( 
                   44 
                   ) 
                 
               
             
           
         
       
     
     where ε g,t   GHG  denotes marginal GHG emission of the grid at time t. 
     A. Simulations Cases 
     Table I presents a summary of the simulation cases carried out to study the economic and environmental impacts of EVs&#39; integration into commercial building μGs. These cases are run for both maximization of daily profit and minimization of GHG emissions objective functions. 
     
       
         
               
             
               
               
               
             
           
               
                 TABLE I 
               
             
             
               
                   
               
               
                 PARAMETERS OF THE μG&#39;S ES COMPONENTS 
               
             
          
           
               
                 Case 
                 Summary 
                 Description 
               
               
                   
               
               
                 0 
                 No EV, No 
                 The power demand of the μG is 
               
               
                   
                 DER, No 
                 supplied by the grid connection 
               
               
                   
                 spinning 
                 and all the DERs are assumed to 
               
               
                   
                 reserve (only 
                 be turned off. This case is 
               
               
                   
                 grid 
                 considered to provide a base case 
               
               
                   
                 connection) 
                 for the comparison purposes 
               
               
                   
                   
                 only. 
               
               
                 1 
                 With DERs 
                 The μG is operated optimally 
               
               
                   
                 and grid 
                 while there is no EVs and spinning 
               
               
                   
                 connection, 
                 reserve market, and the μG is 
               
               
                   
                 without EVs 
                 only paid for its energy trade with 
               
               
                   
                 and spinning 
                 the grid. 
               
               
                   
                 reserve 
                   
               
               
                 2 
                 With DERs 
                 The μG is optimally operated 
               
               
                   
                 and spinning 
                 while there is no EVs connected 
               
               
                   
                 reserve 
                 to the building and the μG can 
               
               
                   
                 market, 
                 participate in the spinning reserve 
               
               
                   
                 without EVs 
                 and energy market. 
               
               
                 3 
                 With DERs 
                 The μG is optimally operated 
               
               
                   
                 and EVs, and 
                 while considering the EVs 
               
               
                   
                 without 
                 connected to the building and the 
               
               
                   
                 spinning 
                 μG cannot participate in spinning 
               
               
                   
                 reserve 
                 reserve market. 
               
               
                   
                 market 
                   
               
               
                 4 
                 With EVs, 
                 The μG is optimally operated 
               
               
                   
                 DERs, and 
                 while considering the EVs and 
               
               
                   
                 spinning 
                 spinning reserve market 
               
               
                   
                 reserve  
                 participation in its operation. 
               
               
                   
                 market 
                   
               
               
                   
               
             
          
         
       
     
     1) Case 0: The Base Case 
     In this case, the power demand of the μG is supplied by the grid connection and all the DERs are assumed to be turned off This case is considered to provide a base case for the comparison purposes only. 
     2) Case 1: No EVs and No Spinning Reserve Market Participation 
     In this case, it is assumed that the μG is operated optimally while there is no EVs and spinning reserve market, and the μG is only paid for its energy trade with the grid. 
     3) Case 2: No EVs with Spinning Reserve Market Participation 
     The μG is optimally operated while there is no EVs connected to the building and the μG can participate in the spinning reserve and energy market. 
     4) Case 3: with EVs and without Spinning Reserve Market Participation 
     The μG is optimally operated while considering the EVs connected to the building and the μG cannot participate in spinning reserve market. 
     5) Case 4: with EVs and Spinning Reserve Market Participation 
     In this case, the μG is optimally operated while considering the EVs and spinning reserve market participation in its operation. 
     Mathematical models representing a commercial building μG components are described in details as follows: 
     B. Stationary Energy Storage 
     Energy balance equation for SES is given as follows: 
     
       
         
           
             
               
                 
                   
                     e 
                     
                       ses 
                       , 
                       t 
                     
                   
                   = 
                   
                     
                       
                         ( 
                         
                           1 
                           - 
                           
                             φ 
                             ses 
                           
                         
                         ) 
                       
                       ⁢ 
                       
                         e 
                         
                           ses 
                           , 
                           
                             t 
                             - 
                             1 
                           
                         
                       
                     
                     + 
                     
                       τ 
                       ( 
                       
                         
                           
                             p 
                             
                               ses 
                               , 
                               t 
                             
                             chg 
                           
                           ⁢ 
                           
                             η 
                             ses 
                             chg 
                           
                         
                         - 
                         
                           
                             p 
                             
                               ses 
                               , 
                               t 
                             
                             dch 
                           
                           
                             η 
                             ses 
                             dch 
                           
                         
                       
                       ) 
                     
                   
                 
               
               
                 
                   ( 
                   1 
                   ) 
                 
               
             
           
         
       
     
     where e ses,t , φ ses , and τ represent energy storage level at time t, energy loss, and the time interval in hours, respectively. p ses,t   chg , η ses   chg , p ses,t   dch , and η ses   dch  stand for charging and discharging power and efficiencies of the SES, respectively. 
     Stored energy within the SES is limited by its minimum and maximum State Of Charge,  SOC  and  SOC  respectively, as follows:
 
   SOC     ses   Ē   ses   ≦e   ses,t   ≦  SOC     ses   Ē   ses   (2)
 
     It is assumed that energy storage level of the SES at the end of the scheduling horizon, T, to be equal to its initial value, as follows:
 
 e   ses,0   =e   ses,T   =E   ses,initial   (3)
 
     The following constraints are considered to ensure that p mes,t   chg  and p mes,t   dch  are less than maximum charging and discharging power ratings of the SES:
 
0 ≦p   ses,t   chg   ≦u   ses,t   chg     P     ses   (4)
 
0 ≦p   ses,t   dch   ≦u   ses,t   dch     P     ses   (5)
 
     where, u ses,t   chg  and u ses,t   dch  are binary variables representing charging and discharging operation modes of the SES. Notice that (4) enforces the charging power to be zero if the SES is not in the charging mode (i.e., u ses,t   chg =0); similarly, (5) for the discharge mode. 
     The SES can either operate in the charging or discharging modes at a time, which is formulated using the following constraint:
 
 u   ses,t   chg   +u   ses,t   dch ≦1  (6)
 
     To incorporate the operational costs of SES, and the cost of battery degradation due to charging and discharging in the objective function, start up flags are defined as follows:
 
 v   ses,t   chg   ≧u   ses,t   chg   −u   ses,t-1   chg   (7)
 
 v   ses,t   dch   ≧u   ses,t   dch   −u   ses,t-1   dch   (8)
 
     where v mes,t   chg  and v mes,t   dch  represent start up flags for the charging and discharging modes, respectively. 
     Operational and maintenance costs of SES, which includes its degradation costs, is assumed to be proportional to the number of charging and discharging cycles, as follows:
 
 C   ses,t   =C   ses   dg ½( v   ses,t   chg   +v   ses,t   dch )+ C   ses   m   Ē   ses,t   (9)
 
     where C ses   m  and Ē ses,t  denote maintenance cost and maximum capacity of the SES, respectively, and C ses   dg  represents degradation costs of the SES per cycle, calculated based on total number of charging and discharging cycles of the SES from manufacturer data and its replacement costs. 
     C. Mobile Energy Storage 
     Energy balance equation for MES is given as follows: 
     
       
         
           
             
               
                 
                   
                     e 
                     
                       mes 
                       , 
                       t 
                     
                   
                   = 
                   
                     
                       
                         ( 
                         
                           1 
                           - 
                           
                             φ 
                             mes 
                           
                         
                         ) 
                       
                       ⁢ 
                       
                         e 
                         
                           mes 
                           , 
                           
                             t 
                             - 
                             1 
                           
                         
                       
                     
                     + 
                     
                       τ 
                       ( 
                       
                         
                           
                             p 
                             
                               mes 
                               , 
                               t 
                             
                             chg 
                           
                           ⁢ 
                           
                             η 
                             mes 
                             chg 
                           
                         
                         - 
                         
                           
                             p 
                             
                               mes 
                               , 
                               t 
                             
                             dch 
                           
                           
                             η 
                             mes 
                             dch 
                           
                         
                       
                       ) 
                     
                     + 
                     
                       I 
                       
                         mes 
                         , 
                         t 
                       
                     
                     - 
                     
                       O 
                       
                         mes 
                         , 
                         t 
                       
                     
                   
                 
               
               
                 
                   ( 
                   10 
                   ) 
                 
               
             
           
         
       
     
     where I mes,t  and O mes,t  represent energy level of EVs connected to and disconnected from the building at time t, respectively. These parameters are assumed to be exogenous inputs to this model. 
     Energy storage level of MES is limited by minimum and maximum available capacities of the MES at each time interval,  E   mes,t  and Ē mes,t  respectively, as follows:
 
   SOC     mes   Ē   mes,t   ≦e   mes,t   ≦  SOC     mes   Ē   mes,t   (11)
 
     where Ē mes,t  not only takes into account the physically available connected capacity of EVs to the building, but also considers EV owners&#39; preferences on available energy at the disconnection time of the EV. If EV owners do not provide any specific disconnection time energy level of their vehicles, then Ē mes,t  of the MES is built based on the rated capacity connected and disconnected EVs&#39; batteries using the following equation:
 
 Ē   mes,t =( Ē   mes,t-1   +Ē   mes,t   conn   −Ē   mes,t   disc )  (12)
 
   E     mes,t =( Ē   mes,t-1   +Ē   mes,t   conn   −Ē   mes,t   disc )  (13)
 
     where Ē mes,t   conn  and Ē mes,t   disc  represent connected and disconnected EV capacities at time t. 
     The following constraints are considered to ensure that p mes,t   chg  and p mes,t   dch  are less than maximum charging and discharging power of the MES at each time interval:
 
0 ≦p   mes,t   chg   ≦u   mes,t   chg     P     mes,t   (14)
 
0 ≦p   mes,t   dch   ≦u   mes,t   dch     P     mes,t   (15)
 
     where  P   mes,t  and  P   mes,t  are calculated as follows:
 
   P     mes,t =(   P     mes,t-1   +  P     mes,t   conn   −  P     mes,t   disc )  (16)
 
     Operational and maintenance costs of MES includes its degradation costs and considers the effect of charging and discharging cycles on capacity loss of the MES, is assumed to be proportional to the number of charging and discharging cycles, and is modeled as as follows:
 
 v   ses,t   chg   ≧u   ses,t   chg   −u   ses,t-1   chg   (17)
 
 v   ses,t   dch   ≧u   ses,t   dch   −u   ses,t-1   dch   (18)
 
     
       
         
           
             
               
                 
                   
                     C 
                     
                       mes 
                       , 
                       t 
                     
                   
                   = 
                   
                     
                       
                         C 
                         mes 
                         dg 
                       
                       ⁢ 
                       
                         1 
                         2 
                       
                       ⁢ 
                       
                         ( 
                         
                           
                             v 
                             
                               mes 
                               , 
                               t 
                             
                             chg 
                           
                           + 
                           
                             v 
                             
                               mes 
                               , 
                               t 
                             
                             dch 
                           
                         
                         ) 
                       
                     
                     + 
                     
                       
                         C 
                         mes 
                         c 
                       
                       ⁢ 
                       
                         
                           E 
                           _ 
                         
                         
                           mes 
                           , 
                           t 
                         
                       
                     
                     + 
                     
                       
                         
                           p 
                           
                             mes 
                             , 
                             t 
                           
                           dch 
                         
                         
                           η 
                           mes 
                           dch 
                         
                       
                       ⁢ 
                       
                         C 
                         
                           mes 
                           , 
                           t 
                         
                         s 
                       
                     
                     - 
                     
                       
                         
                           p 
                           
                             mes 
                             , 
                             t 
                           
                           chg 
                         
                         
                           η 
                           mes 
                           chg 
                         
                       
                       ⁢ 
                       
                         C 
                         
                           mes 
                           , 
                           t 
                         
                         d 
                       
                     
                   
                 
               
               
                 
                   ( 
                   19 
                   ) 
                 
               
             
           
         
       
     
     where C mes   dg  represents costs of the MES degradation per cycle to be paid by the μG operator to EV owners to reimburse their battery degradation due to charge and discharge by the EMS, C mes   c  denotes capacity costs to be paid by the μG operator to EV owners for the hours connecting their vehicles to the building EMS. C mes,t   s  and C mes,t   d  represent the selling and buying energy price of the EV, respectively. 
     D. Solar Photo-Voltaic (PV) Generation 
     Recently, solar PV panels are being widely installed in various types of building, and are expected to be one the major renewable energy resources in μGs. Solar PV generation of a building at each time interval is calculated using the following:
 
 P   pv,t   =S   pv η pv   R   t ,  (20)
 
     where S pv , η pv , and R t  denote solar panels area, PV efficiency, and solar irradiation, respectively. Operational costs of PV is assumed to be a fixed maintenance cost per time interval, C pv   m . 
     E. Internal Combustion Engines 
     Internal Combustion Engines (ICEs) include spark- or compressed-ignition engines powered by either natural gas, petroleum, gasoline, or diesel fuels. ICEs&#39; technology maturity, relatively high efficiencies and low costs, and rapid start-up and shutdown make them competitive for many DER applications, particularly for commercial buildings [14]. The mathematical model formulated for ICEs is presented next. 
     Minimum and maximum power output characteristics of ICE units are modeled as follows:
 
   P     g   u   g,t   &lt;p   g,t   &lt;  P     g   u   g,t ,  (21)
 
     where  P   g  and  P   g  denote upper and lower bounds of ICE&#39;s power generation, respectively, and u g,t  represents a binary variable indicating On/Off state of ICE g in time t. 
     Minimum up-time and down-time characteristics of ICEs are formulated using the following constraints:
 
 v   g,t   −w   g,t   =u   g,t   −u   g,t-1   ,∀tε[ 2 T]   (22)
 
 v   g,t   +w   g,t ≦1,∀ tε[ 2, T]   (23)
 
Σ s=t-UP     g     +1   t   v   g,s   ≦u   g,t   ,∀tε[UP   g +1, T]   (24)
 
Σ s=t-DN     g     +1   t   w   g,s ≦1− u   g,t   ,∀tε[DN   g +1, T]   (25)
 
     where v g,t  and w g,t  are binary variables indicating start-up and shutdown states of ICEs, respectively, UP g  is the minimum up time of device g in hours, and DN g  is the minimum down time of device g in hours. 
     Ramp up and ramp down characteristics of ICEs, which limit their power output change between two consecutive time intervals, are also modeled. Since these limits might be different for the start-up conditions, the following constraints are formulated to properly capture these physical characteristics of ICEs:
 
 p   g,t   −p   g,t-1   ≦  R     g   u   g,t-1   +R   g   SU (1− u   g,t-1 ),∀ tε[ 2, T]   (26)
 
 p   g,t-1   −p   g,t   ≦ R     g   u   g,t   +R   g   SD (1− u   g,t ),∀ tε[ 2, T]   (27)
 
     where  R   g  and  R   g  denote ramp up and ramp down limits of ICEs, respectively, and R g   SU  and R g   SD  denote these limits during start up and shutdown times. 
     If there is more than one ICE within a μG, the demand usually is shared between the operating generators in proportion of their rated power. This operational constraint is formulated using the following constraints: 
     
       
         
           
             
               
                 
                   
                     
                       
                         
                           
                             
                               p 
                               
                                 g 
                                 , 
                                 t 
                               
                             
                             
                               
                                 P 
                                 _ 
                               
                               g 
                             
                           
                           ≤ 
                           
                             r 
                             + 
                             
                               
                                 ( 
                                 
                                   1 
                                   - 
                                   
                                     u 
                                     
                                       g 
                                       , 
                                       t 
                                     
                                   
                                 
                                 ) 
                               
                               ⁢ 
                               M 
                             
                           
                         
                         , 
                       
                     
                     
                       
                         
                           ∀ 
                           g 
                         
                         , 
                         t 
                       
                     
                   
                 
               
               
                 
                   ( 
                   28 
                   ) 
                 
               
             
             
               
                 
                   
                     
                       
                         
                           
                             
                               p 
                               
                                 g 
                                 , 
                                 t 
                               
                             
                             
                               
                                 P 
                                 _ 
                               
                               g 
                             
                           
                           ≥ 
                           
                             r 
                             + 
                             
                               
                                 ( 
                                 
                                   
                                     u 
                                     
                                       g 
                                       , 
                                       t 
                                     
                                   
                                   - 
                                   1 
                                 
                                 ) 
                               
                               ⁢ 
                               M 
                             
                           
                         
                         , 
                       
                     
                     
                       
                         
                           ∀ 
                           g 
                         
                         , 
                         t 
                       
                     
                   
                 
               
               
                 
                   ( 
                   29 
                   ) 
                 
               
             
           
         
       
     
     where r represents the per unit ration of load sharing among the operating units, and M denotes a large positive number. 
     Operational costs of ICEs are approximated as a linear expression including fixed costs, fuel consumption costs considering a constant efficiency coefficient, and start up and shut down costs, as follows: 
     
       
         
           
             
               
                 
                   
                     C 
                     
                       g 
                       , 
                       t 
                     
                   
                   = 
                   
                     
                       A 
                       g 
                     
                     + 
                     
                       
                         B 
                         g 
                       
                       ⁢ 
                       
                         
                           p 
                           
                             g 
                             , 
                             t 
                           
                         
                         
                           η 
                           g 
                         
                       
                     
                     + 
                     
                       
                         v 
                         
                           g 
                           , 
                           t 
                         
                       
                       ⁢ 
                       
                         C 
                         g 
                         SU 
                       
                     
                     + 
                     
                       
                         w 
                         
                           g 
                           , 
                           t 
                         
                       
                       ⁢ 
                       
                         C 
                         g 
                         SD 
                       
                     
                     + 
                     
                       
                         C 
                         g 
                         m 
                       
                       ⁢ 
                       
                         
                           P 
                           _ 
                         
                         g 
                       
                     
                   
                 
               
               
                 
                   ( 
                   30 
                   ) 
                 
               
             
           
         
       
     
     where A g  and B g  denote the fuel cost coefficients, C g   SU  and C g   SD  represent start up and shut down costs, and η g  and C g   m  indicate efficiency and maintenance costs of ICE units, respectively. 
     F. Micro Turbines 
     Micro Turbines (MTs) are high speed combustion turbines that are suited for smaller-capacity applications, and can use variety of fuels including natural gas, gasoline, diesel, and bio-gases. MTs&#39; compact sizes, low capital and maintenance costs, and low emissions make them attractive for commercial μG applications. By using a MT appropriately sized for power-only applications, the mathematical formulations developed for ICEs, (15) to (21), with different parameter settings can be used to model the operation of MTs. Operational costs of MTs is formulated as follows: 
     
       
         
           
             
               
                 
                   
                     
                       C 
                       
                         MT 
                         , 
                         t 
                       
                     
                     = 
                     
                       
                         A 
                         MT 
                       
                       + 
                       
                         
                           B 
                           MT 
                         
                         ⁢ 
                         
                           
                             p 
                             
                               MT 
                               , 
                               t 
                             
                           
                           
                             η 
                             MT 
                           
                         
                       
                       + 
                       
                         
                           v 
                           
                             MT 
                             , 
                             t 
                           
                         
                         ⁢ 
                         
                           C 
                           MT 
                           SU 
                         
                       
                       + 
                       
                         
                           C 
                           MT 
                           m 
                         
                         ⁢ 
                         
                           
                             P 
                             _ 
                           
                           MT 
                         
                       
                     
                   
                   , 
                 
               
               
                 
                   ( 
                   31 
                   ) 
                 
               
             
           
         
       
     
     G. Fuel Cells 
     Fuel Cells (FCs) are electrochemical devices that generate power supply by converting hydrogen energy to Direct Current (DC) electricity. Phosphoric Acid (PAFC), Molten Carbonate (MCFC), and Solid Oxide (SOFC) are the most appropriate FC technologies for distributed generation mainly due to their high efficiency, fuel flexibility, low maintenance costs, and high reliability [DOE, energy center]. These FCs have a long start up time and are not suitable for frequent On/Off switching applications. Mathematical model formulated for FCs is presented next. 
     Operational costs of FCs is approximated as a linear expression including fuel consumption costs, start up costs and maintenance costs: 
     
       
         
           
             
               
                 
                   
                     
                       C 
                       
                         FC 
                         , 
                         t 
                       
                     
                     = 
                     
                       
                         
                           B 
                           FC 
                         
                         ⁢ 
                         
                           
                             p 
                             
                               FC 
                               , 
                               t 
                             
                           
                           
                             η 
                             FC 
                           
                         
                       
                       + 
                       
                         
                           v 
                           
                             FC 
                             , 
                             t 
                           
                         
                         ⁢ 
                         
                           C 
                           FC 
                           SU 
                         
                       
                       + 
                       
                         
                           w 
                           
                             FC 
                             , 
                             t 
                           
                         
                         ⁢ 
                         
                           C 
                           FC 
                           SD 
                         
                       
                       + 
                       
                         
                           C 
                           FC 
                           m 
                         
                         ⁢ 
                         
                           
                             P 
                             _ 
                           
                           FC 
                         
                       
                     
                   
                   , 
                 
               
               
                 
                   ( 
                   32 
                   ) 
                 
               
             
           
         
       
     
     where η FC , C FC   SD , and C FC   m  denote electrical efficiency, start up costs, shut down costs, and maintenance costs of the FC, respectively. 
     Minimum and maximum power outputs, minimum up time and down time, ramp up and ramp down, and start up and shut down constraints of FCs are formulated similar to the ones for ICEs (i.e., (15)-(21)). 
     H. Grid Connection 
     In the context of Smart Grids, commercial building μGs should be able to operate in both grid-connected and isolated modes. When connected to the grid, the μG can trade energy with the grid to buy/sell energy and provide ancillary services. The μG is assumed to pay to the grid based on Time of Use (TOU) prices for energy purchase (in $/kWh) and flat rate for peak demand charges (in $/kW-month), and to be paid by the utility market operator based on day-ahead Real-Time (RT) pricing for energy supply (in $/kWh) and flat rates for Demand Response (DR) and spinning reserves (in $/kW). Peak demand of the μG is found using the following constraint:
 
 p   dc   ≧p   Gr,t ,  (33)
 
     where p Gr,t  represents power trade between μG and the grid (with a positive value for buying power from the grid and a negative value for selling to the grid) and p dc  represents the peak demand of the μG, respectively. 
     I. Load Profile 
       FIG. 1  depicts historical electricity demand profiles of a large commercial building. The demand profiles can be divided into three main categories: weekday, weekend, and peak demand days. The average profile for each of these categories is constructed to be used as μG&#39;s load (P L,t ) in the simulations, as shown in  FIG. 2 . Notice that losses of the μG are considered in the load profile. 
     J. Spinning Reserve 
     To have a certain degree of reliability in operation of a energy system, the system should be able to respond to unexpected changes and provide a reliable power supply. This is referred as energy system “security”, and considering spinning reserve is one of the approached to improve energy system security. This is even more crucial in μGs with intermittent RERs and fluctuating loads, where the system should have the capability of responding quickly to supply and demand changes. Various approaches can be used to determine the amount of spinning reserve for an energy system. Although both DERs and DR can be used as spinning reserve resources, in this work, we assume that at least a generation capacity equal to 10% of μG&#39;s load at each time must be available as spinning reserve. 
     Two modes of operation are considered for a commercial building μG: Isolated and grid-connected modes. In this section, appropriate optimization models are formulated to optimally operate the μG in each mode. 
     K. Grid-Connected Operation Mode 
     1) Power Balance Constraint 
     Power balance constraint in the grid-connected mode is as follows:
 
Σ g=1   N     g     p   g,t +Σ m=1   N     m     p   MT,t +Σ f=1   N     f     p   FC,t   +P   pv,t   +P   Gr,t   +p   ses,t   dch   +p   mes,t   dch   =P   D,t   +p   ses,t   chg   +p   mes,t   chg   (34)
 
     2) Grid Connection 
     It is assumed that the connection between the μG and the grid has a maximum power transfer capability limit, which implies that purchasing and selling power from/to the grid should be within this limit, as follows:
 
 − P     Gr   ≦p   Gr,t   ≦  P     Gr   (35)
 
     3) Ancillary Services 
     In the grid-connected mode, the μG can participate in ancillary service markets of the grid such as spinning reserve market. This market participation is formulated as follows:
 
 P   sp,t =Σ g=1   N     g   (   P     g   u   g,t   −p   g,t )+Σ m=1   N     m   (   P     MT   u   MT,t   −p   MT,t )+Σ f=1   N     f   (   P     FC   u   FC,t   −p   FC,t )+ p   mes,t   sp   +p   ses,t   sp −0.1 P   D,t   (36)
 
     where P sp,t  is the amount of spinning reserve power that the μG can offer in the ancillary service market. Note that the spinning reserve is based on the controllable DERs and solar PV is not considered as a source of spinning reserve. Also, the μG should always have a 10% spinning reserve for itself in addition to its bid in the market. It is assumed that price bid by the μG is such that all the offered spinning reserve is accepted in the market. p ses,t   sp  and p mes,t   sp  represent the spinning reserve provided by the SES and MES at time t, respectively, and calculated as follows: 
     
       
         
           
             
               
                 
                   
                     p 
                     
                       ses 
                       , 
                       t 
                     
                     sp 
                   
                   = 
                   
                     min 
                     ⁢ 
                     
                       { 
                       
                         
                           
                             ( 
                             
                               
                                 e 
                                 
                                   ses 
                                   , 
                                   t 
                                 
                               
                               - 
                               
                                 
                                   
                                     SOC 
                                     _ 
                                   
                                   ses 
                                 
                                 ⁢ 
                                 
                                   
                                     E 
                                     _ 
                                   
                                   ses 
                                 
                               
                             
                             ) 
                           
                           τ 
                         
                         , 
                         
                           
                             
                               P 
                               _ 
                             
                             ses 
                           
                           - 
                           
                             p 
                             
                               ses 
                               , 
                               t 
                             
                             dch 
                           
                         
                       
                       } 
                     
                   
                 
               
               
                 
                   ( 
                   37 
                   ) 
                 
               
             
             
               
                 
                   
                     p 
                     
                       mes 
                       , 
                       t 
                     
                     sp 
                   
                   = 
                   
                     min 
                     ⁢ 
                     
                       { 
                       
                         
                           
                             ( 
                             
                               
                                 e 
                                 
                                   mes 
                                   , 
                                   t 
                                 
                               
                               - 
                               
                                 
                                   
                                     SOC 
                                     _ 
                                   
                                   mes 
                                 
                                 ⁢ 
                                 
                                   
                                     E 
                                     _ 
                                   
                                   
                                     mes 
                                     , 
                                     t 
                                   
                                 
                               
                             
                             ) 
                           
                           τ 
                         
                         , 
                         
                           
                             
                               P 
                               _ 
                             
                             
                               mes 
                               , 
                               t 
                             
                           
                           - 
                           
                             p 
                             
                               mes 
                               , 
                               t 
                             
                             dch 
                           
                         
                       
                       } 
                     
                   
                 
               
               
                 
                   ( 
                   38 
                   ) 
                 
               
             
           
         
       
     
     These constraints are reformulated as linear constraints in the mode as follows: 
     
       
         
           
             
               
                 
                   
                     p 
                     
                       ses 
                       , 
                       t 
                     
                     sp 
                   
                   ≤ 
                   
                     
                       ( 
                       
                         
                           e 
                           
                             ses 
                             , 
                             t 
                           
                         
                         - 
                         
                           
                             
                               SOC 
                               _ 
                             
                             ses 
                           
                           ⁢ 
                           
                             
                               E 
                               _ 
                             
                             ses 
                           
                         
                       
                       ) 
                     
                     τ 
                   
                 
               
               
                 
                   ( 
                   39 
                   ) 
                 
               
             
             
               
                 
                   
                     p 
                     
                       ses 
                       , 
                       t 
                     
                     sp 
                   
                   ≤ 
                   
                     
                       
                         P 
                         _ 
                       
                       ses 
                     
                     - 
                     
                       p 
                       
                         ses 
                         , 
                         t 
                       
                       dch 
                     
                   
                 
               
               
                 
                   ( 
                   40 
                   ) 
                 
               
             
             
               
                 
                   
                     p 
                     
                       mes 
                       , 
                       t 
                     
                     sp 
                   
                   ≤ 
                   
                     
                       ( 
                       
                         
                           e 
                           
                             mes 
                             , 
                             t 
                           
                         
                         - 
                         
                           
                             
                               SOC 
                               _ 
                             
                             mes 
                           
                           ⁢ 
                           
                             
                               E 
                               _ 
                             
                             
                               mes 
                               , 
                               t 
                             
                           
                         
                       
                       ) 
                     
                     τ 
                   
                 
               
               
                 
                   ( 
                   41 
                   ) 
                 
               
             
             
               
                 
                   
                     p 
                     
                       mes 
                       , 
                       t 
                     
                     sp 
                   
                   ≤ 
                   
                     
                       
                         P 
                         _ 
                       
                       
                         mes 
                         , 
                         t 
                       
                     
                     - 
                     
                       p 
                       
                         mes 
                         , 
                         t 
                       
                       dch 
                     
                   
                 
               
               
                 
                   ( 
                   42 
                   ) 
                 
               
             
           
         
       
     
     4) Objective Functions 
     a) Maximization of Daily Profit 
     Daily profit of the μG, which is defined as revenue—costs, is as follows:
 
min  p   dc   C   Gr,t   dc +Σ t=1   T   τ[−P   sp,t   C   Gr,t   sp   +p   Gr,t   C   Gr,t   s +Σ g=1   N     g     C   g,t +Σ m=1   N     m     C   MT,t +Σ f=1   N     f     C   FC,t   +C   pv   om   +C   ses,t   +C   mes,t ]  (43)
 
     where C Gr,t   sp , C Gr,t   s , and C Gr   dc  denote spinning reserve price, energy charges, and demand charges of the grid, respectively. 
     b) Minimize GHG Emissions 
     Minimization of GHG emissions of the μG in the grid-connected mode is formulated as follows: 
     
       
         
           
             
               
                 
                   min 
                   ⁢ 
                   
                     
                       ∑ 
                       
                         t 
                         = 
                         1 
                       
                       T 
                     
                     ⁢ 
                     
                       τ 
                       ⁢ 
                       
                           
                         
                           
                             [ 
                             
                               
                                 
                                   ∑ 
                                   
                                     g 
                                     = 
                                     1 
                                   
                                   
                                     N 
                                     g 
                                   
                                 
                                 ⁢ 
                                 
                                   
                                     C 
                                     g 
                                     GHG 
                                   
                                   ⁢ 
                                   
                                     
                                       p 
                                       
                                         g 
                                         , 
                                         t 
                                       
                                     
                                     
                                       η 
                                       g 
                                     
                                   
                                 
                               
                               + 
                               
                                 
                                   C 
                                   MT 
                                   GHG 
                                 
                                 ⁢ 
                                 
                                   
                                     p 
                                     
                                       MT 
                                       , 
                                       t 
                                     
                                   
                                   
                                     η 
                                     MT 
                                   
                                 
                               
                               + 
                               
                                 
                                   C 
                                   FC 
                                   GHG 
                                 
                                 ⁢ 
                                 
                                   
                                     p 
                                     
                                       FC 
                                       , 
                                       t 
                                     
                                   
                                   
                                     η 
                                     FC 
                                   
                                 
                               
                               + 
                               
                                   
                               
                               ⁢ 
                               
                                 
                                   C 
                                   
                                     Gr 
                                     , 
                                     t 
                                   
                                   GHG 
                                 
                                 ⁢ 
                                 
                                   p 
                                   
                                     Gr 
                                     , 
                                     t 
                                   
                                 
                               
                             
                             ] 
                           
                           + 
                           
                             
                               ( 
                               
                                 
                                   e 
                                   
                                     mes 
                                     , 
                                     T 
                                   
                                 
                                 - 
                                 
                                   e 
                                   
                                     mes 
                                     , 
                                     0 
                                   
                                 
                               
                               ) 
                             
                             ⁢ 
                             
                               C 
                               mes 
                               GHG 
                             
                           
                         
                       
                     
                   
                 
               
               
                 
                   ( 
                   44 
                   ) 
                 
               
             
           
         
       
     
     where C Gr,t   GHG  denotes marginal GHG emission of the grid at time t. 
     The above system determines economic and environmental benefits of the application of EVs as MES in commercial building μGs. Energy systems of a commercial building including its grid connection, DERs, Stationary Energy Storage (SES), and demand profile are modeled. Based on the developed models, a Mixed Integer Linear Programming (MILP) problem is formulated to optimizes the operation of a commercial building μG. The objective is to minimize μG&#39;s daily operational costs and greenhouse gas emissions (GHG). Technical and operational constraints of DERs and Energy Storage (ES) systems such as minimum up time and down time, and charging and discharging power and capacity constraints of ES devices are formulated to appropriately model the operation of a grid connected commercial μG.