Abstract

The supporting position and role of smart grids in the construction of smart cities have not been fully explored. Based on systematizing the system architecture of smart cities, we first analyze the facilitating and constraining roles of smart grids and smart cities with each other and make a quantitative analysis of the coordination and supporting roles between them; in the smart grid environment, we propose a framework of energy management system based on particle swarm optimization (PSO) dispatching model. The algorithm optimizes the operation of dispatchable loads, electric vehicles, and energy storage systems based on outdoor temperature forecasts, renewable energy power output forecasts, day-ahead tariff signals, and customer preferences to minimize customer electricity costs. The performance of the algorithm is verified through simulation experiments, and the results show that the proposed algorithm significantly reduces electricity consumption costs by 32.54% compared to algorithms that only optimize the scheduling of loads or some components of the home energy management system.

1. Introduction

The process of urbanization is an important feature of human civilization, and the construction of smart cities is currently the development trend of countries around the world [1]. There are two main technical backgrounds for smart cities: (1) the development and application of information and communication technologies since the second half of the last century has injected new impetus into urban construction and (2) in the face of the multiple bottlenecks and diversified needs of energy, environment, space, and population faced by urban construction for a long time, the research and practice of theories about the new urban movement, ecocity, and digital city have laid a solid foundation for urban development [2]. The foundation for urban development has been laid by previous research and practice on the new urban movement, ecocity, and digital city.

Wisdom is characterized by perception, interconnection, intelligence, and efficiency (optimal circulation of matter and full use of energy). With deeper understanding, this technology-oriented concept has now gradually developed into a knowledge-oriented one, where people have given more connotations to the city based on digitalization and intelligence, which represent an intensive, green, intelligent, sustainable, and harmonious way of urban production and life, emphasizing innovation and ultimately a virtuous cycle of economic, social, and ecological sustainability [3].

In recent years, as people have begun to pursue a more comfortable, intelligent, and convenient living environment, smart communities have emerged, and the development of smart grids has led to widespread interest in smart communities as energy-using terminals [4]. Smart communities support clean energy and energy storage systems, encourage energy stepping and recycling, and guide users to optimize their energy use structure to improve energy efficiency and achieve energy saving and emission reduction [5]. Therefore, research on optimizing users’ energy use structure and adjusting the energy consumption structure is crucial to the development of smart communities.

Optimizing the energy use structure with the end user as the unit requires reliance on HEMS. HEMS responds to information such as time-of-use tariffs and reasonably implements demand side management, reducing residential electricity costs, smoothing the load curve, and improving power system security [6]. Based on the time-sharing tariff, a decision model for optimal operation of household equipment is established with the objective of minimizing the peak-to-valley load difference [7]. For the volatility and randomness of distributed power supply, the control strategy of flexible load in the object being supplied is studied, and the charging and discharging of energy storage equipment are controlled. But the literature only considers unilaterally matching the supply side from the user side, without considering two-way matching [8]. Analyzes the demand response mechanism, describes the user response with price elasticity of demand, and establishes a time-sharing tariff model provide reference and basis for the formulation and implementation of demand response projects [9].

Among the various types of residential electricity loads, air conditioning loads have become a major component of peak loads due to the concentration of electricity consumption. The CCHP system is a multigeneration energy system that integrates cooling, heating, and power generation processes and has good social and economic benefits [10, 11]. Currently, there is a lot of attention on the energy optimization management of CCHP-type microgrids. Vasudevan et al. [12] introduced in detail the model of each unit of CCHP-type microgrid, planning methods, system evaluation indexes, and energy optimization management methods. Xie et al. [13] proposed a new solution method based on the vertical and horizontal crossover algorithm that is proposed to solve the problem of economic scheduling optimization of cogeneration. In a study by Memme et al. [14] and Kumar et al. [15], stochastic optimization models for metered and distributed energy were developed and solved using an improved particle swarm optimization (PSO), respectively. Most of the current studies on energy management of CCHP-type microgrids only optimize the output of each part of the CCHP system and match the customer load unilaterally, without considering the two-way matching between the supply side and the customer side and without combining the demand of the customer side.

In order to optimize the comprehensive energy management of smart communities, it is a win–win situation for both the supply side and the user side. In this paper, we propose a two-stage optimization model for smart communities. In the first stage, the output of each part of the cogeneration system was optimized by maximizing the net profit of the property company, and the load arrangement was optimized by minimizing the user cost. Finally, the simulation results of different cases were compared. It combines the benefits of high energy efficiency and the financial advantages of combined cooling, heating, and power systems with the potential of demand side response of home loads [16]. In addition, based on existing relevant research, this paper provides an in-depth study of the system architecture and development stages of smart cities, the supporting role of smart grids for smart cities, and example analysis (hereafter, smart grid is abbreviated as SG, smart city is abbreviated as SC, and information and communication technology is abbreviated as ICT).

2. Preliminary

The SG provides support to SC, based on energy supply, but has been extended to various aspects such as environment (new energy, emission reduction, energy saving), transportation (electric vehicles), new ways of using energy (life) (microgrid, electricity consumption, demand response, distributed energy, etc.), information (integrated application of power data), and economic production (demand response, energy efficiency system) [17]. To this end, the supporting role of various SG technologies (of which factors such as power market, dispatch, and participating entities are grouped in the information and communication segment) for SC is sorted out in detail by segment, and its hierarchical distribution is shown in Figure 1.

For the various types of typical SG technologies and applications, as shown in Figure 2, expert scoring was used to assess them in terms of economic, social, and ecological aspects, and the typical contribution to SC construction was obtained, as shown in Table 1.

The support role of the same SG technology or application varies at different stages of SC development, and the SC has the greatest demand for the technology that best fits the characteristics of the current stage of development [18]. Combining the data, as shown in Table 1, the support degree for each SG technology is calculated as follows:where takes values from 1 to 4, indicating the stage of development of SC; takes values from 1 to 3; indicates the degree of contribution of the technology to the economy, society, and ecology (as shown in Table 1); and is the incentive-based variable weighting treatment function.where means the same as in Equation (2); denotes the characteristic index, when then it becomes constant weight, when , then the most emphasis is placed on the incentive assessment of individual factors, taking , the function satisfies the requirements of normalization, continuity, and incentive characteristics; and is a monotonically increasing function of , when is a monotonically decreasing function of . When tends to 0, its weight also tends to 0, i.e., . The results of the calculation are shown in Table 2.

As shown in Table 2, the overall supporting role of the SG in the four development stages of SC can be obtained by using the average value as follows:where is the overall support role calculated, defined in and .

3. Optimal Scheduling Models

3.1. Dispatchable Load Model and Operating Constraints
3.1.1. Air Conditioning System

The level of indoor temperature under the action of the air conditioning system is related to the outdoor temperature, the air conditioning characteristics, the structure of the house, and the construction materials. The indoor temperature model is shown in Equation (4) as follows:where is the time slot number, is the length of a single time slot (hr), indicate the room temperature in time slot and , respectively, and indicates the operating state of the air conditioning system in time slot , with 1 indicating operation and 0 stopping operation; see literature [19] for the meaning of the other parameters and the method of determining them. The model assumes that the air conditioning system operates with its power equal to the rated power. During the operation of the air conditioning system, the room temperature is to be maintained within the range preset by the user, as shown in Equation (5).

3.1.2. Electric Water Heaters

The temperature of the hot water is influenced by a number of variables, including the temperature of the water as it enters the valve, the surrounding environment, the flow of hot water, the design of the water heater, the materials used to make it, the power rating, and others. Equation (6) illustrates the model for determining the temperature of hot water in a water heater.where are the hot water temperature, ambient temperature, and inlet valve water temperature within time gap , respectively; see literature [20] for the meaning and determination of other parameters. The model assumes that the water heater operates in the on/off state, and if the operating state of the water heater during time slot t is 1, the power consumption of the water heater is equal to the rated power , otherwise it is 0. During the scheduling interval, the hot water temperature is maintained within the user’s preset range, as shown in Equation (7).

3.1.3. Energy Storage System

The SOC of the batteries in charge/discharge state is calculated by Equations (8) and (9), respectively, and the operating process satisfies the constraints (Equations (10)–(13)). Please refer to literature [20] for the meaning of specific parameters.

In the equation, the meaning of the symbols is similar to that of the corresponding symbols of the electric vehicle model and will not be repeated.

3.2. Scheduling Model

Let the optimal dispatch interval be and divide it equally into time slots of time duration . The net cost of electricity to the customer during the entire dispatch interval is equal to the sum of the cost of electricity purchased by the customer from the grid, the depreciation cost of the energy storage system, and the depreciation cost of the battery caused by the V2H function of the electric vehicle minus the revenue gained by the customer from selling electricity to the grid during the high tariff period, as shown in Equation (14).

Equation (14) takes into account the uncertainty introduced into the optimization problem by the errors in the outdoor temperature and renewable energy output forecasts and uses scenario analysis to describe this uncertainty. is a stochastic scenario in the set of outdoor temperature scenarios with the probability of occurrence ; is a stochastic scenario in the set of renewable energy output scenarios with the probability of occurrence ; denote the price of buying electricity from and selling electricity to the grid in time slot , respectively; denote the time slot number and SOC when the electric vehicle is connected to the grid, respectively; and denote the depreciation factor (yuan/kWhr) of the energy storage system and the battery of the electric vehicle, respectively.

The optimal dispatching model of the energy management system is shown in Equation (19).

3.3. Data Collection

There are several ways to collect data: sensors and measuring devices. By installing sensors and measuring devices in the power system, power data can be monitored and recorded in real time. For example, temperature sensors can be used to measure outdoor temperature, power meters can be used to measure power output and electricity price signals, and EV charging piles can be used to measure the amount of charge, etc.

Data acquisition system: By building a data acquisition system, the power data collected by sensors and measurement devices can be centrally managed and stored. The data acquisition system can include components such as data collectors, data transmission channels, and databases to acquire and store power data in real time.

Power monitoring system: The power monitoring system can monitor and record power data in real time by connecting to various nodes of the power system. These systems usually include data collectors, communication modules, and data processing software, which can provide real-time monitoring, analysis, and reporting functions for power data.

Data interfaces and APIs: Some power providers and energy management systems provide data interfaces and APIs through which power data can be obtained. Through data interface integration with suppliers or system providers, real-time power data can be obtained.

Questionnaires and user feedback: In order to understand the preferences and needs of customers, data can be collected by means of questionnaires and user feedback. By designing appropriate questionnaires and survey questions, it is possible to obtain customer information on electricity costs, renewable energy preferences, etc.

It should be noted that different power data may require the use of different collection methods. When designing the data collection scheme, the appropriate method should be selected according to the specific needs and data types, and the accuracy and reliability of the data should be ensured. In addition, relevant data protection and privacy regulations need to be complied to ensure data security and compliance.

4. Algorithm Design

4.1. Energy Allocation Methods for Different Scenarios

The energy exchange relationship between the EV and the rest of the HEMS system is divided into three situations throughout the scheduling process based on whether the EV is connected to the HEMS system and the current SOC value: (1) not linked to the HEMS system and not involved in the system’s energy exchange, (2) connected to the HEMS system but just serving as a load, and (3) connected to the HEMS system and acting as both a load and a power source.

indicates the number of time slots required to charge the electric vehicle from the charge state of time slot t to the specified state , as determined by Equation (20).where indicates an upward rounding operation.

In scenario 1, the flow of energy between the load, the electric vehicle, the energy storage system, the renewable energy source, and the grid is determined within each time slot t according to the flow (Figure 2). A display of various typical SG technologies and applications is shown in Figure 2, is the total power of all electric loads within time slot t and 01 denotes the minimum value of grid electricity price when time slot t allows users to sell electricity from the energy storage system to the grid and the maximum value of grid electricity price when users are allowed to purchase electricity from the grid for storage in the energy storage system, respectively, and their magnitudes are determined by Equations (21) and (22).where and are the algorithm parameters.

is a parameter introduced to prevent the charging/discharging of the energy storage system at the boundary of the permissible SOC range from causing the SOC to cross the boundary and its value can be determined directly, respectively.

Analysis of the flowchart, as shown in Figure 2, shows that the above energy allocation method ensures that the constraints in Equations (8)–(13) in the model, as shown in Equation (19), are satisfied. Due to space constraints, the energy allocation methods under scenarios 2 and 3 are not given again.

4.2. Algorithm Steps

The scheduling algorithm schedules the operating state of the dispatchable load based on the predicted outdoor temperature, the predicted power output of renewable energy, the day-ahead tariff signal, and the customer preference settings (e.g., indoor temperature, hot water temperature, etc.), so as to minimize the total electricity consumption cost of the customer while satisfying the customer comfort.

The constrained optimization model, as shown in Equation (19), is converted to an unconstrained optimization model using the penalty function method. The penalty function and the converted model are shown in Equations (23) and (24), respectively. Equation (23) only considers the constraints in Equations (5) and (7), and the other constraints are guaranteed to be satisfied by the energy allocation method in the algorithm; in Equation (24) is a sufficiently large positive number.

Particle swarm algorithms have been widely used due to the advantages of simple algorithms, strong global search capability, and high robustness [21]. Therefore, in this paper, an improved particle swarm algorithm proposed in the literature [22] is used to solve model (24), and a particle swarm algorithm-based HEMS optimal scheduling algorithm is proposed. The scheduling algorithm takes the operating states of the air conditioning system and water heater in each time slot and the task starts moments of the washer, dryer, and dishwasher as decision variables and encodes them, as shown in Figure 3, where the first 2n variables are binary variables taking values 0 and 1 and the rest are positive integer variables.

We do not consider the power constraint at the time of purchase. First, we do not consider the power constraint at purchase in our study mainly for two reasons. First, considering the power constraint at the time of purchase will increase the complexity of the problem and make the optimization problem more difficult. In our study, we have introduced multiple constraints, such as customer power demand and renewable power output, etc., which already make the problem quite complicated. Considering power constraints at the time of purchase will further increase the complexity of the problem, leading to computational and optimization difficulties. Second, power constraints at the time of purchase may not be common or limited in practice. In our research area, we have conducted extensive discussions with electricity providers and energy management systems and have learned that the power constraint at the time of purchase is not a pervasive limitation in practical applications. Therefore, in our study, we pay more attention to other important constraints and objectives, such as reducing the electricity cost of customers and optimizing the schedulable load, among others. Even though we do not consider the power constraint at the time of purchase in our study, we believe that our study is still valuable for practical applications and provides useful insights and methods to solve related problems.

The specific steps of the optimal scheduling algorithm for energy management system are given as follows:(1)Read the tariff signal , the outdoor temperature forecast and the renewable energy power output forecast , and generate the outdoor temperature scenario set and the renewable energy power output scenario set according to the scenario analysis method.(2)Set the parameters of the particle swarm algorithm: Population size , maximum number of iterations , minimum inertia weight , maximum inertia weight , learning factor , etc.(3)Set the user preference parameter and the allowed scheduling interval for schedulable noninterruptible devices, etc.(4)Initialize the particle swarm: First, for each particle in the population, perform the operation:(i)Initialize the position vector , the velocity vector , and the individual optimal position vector .(ii)Calculate the total load power within each time slot for each scenario based on the position vector and then determine the amount of energy exchanged between the electric load, electric vehicle, renewable energy, energy storage system, and the grid within each time slot based on the given energy allocation method.(iii)Calculate the objective function value of the particle according to Equation (24); the smaller the value, the higher the fitness value of the particle.Then, determine the global optimal position vector based on the fitness value and clear the algorithm loop counter .(5)Enter the main loop and perform the following operations:(i)Calculate the inertia weight for this cycle according to Equation (25).(ii)Update the particle velocity vector according to Equation (26).where denotes the fitness function.

5. Simulation Experiments and Analysis of Results

5.1. Input Data and Parameter Settings

The scheduling interval is 1-day long and is evenly divided into 120 time slots of 0.2 hr duration, i.e., . Assuming that the customer has a PV system with a capacity of 5.75 kW installed, the input data for the tariff signal, the outdoor temperature forecast, and the PV system power output value during the dispatch interval are shown in Figure 4.

The air conditioning system parameters are the same as in the literature [23], with a rated power of 2.352 kW and at 23 and 26°C, respectively. Energy storage system is 4.5 kW, at 15.5, 42°C, respectively, 50°C, ambient temperature. Energy storage system is of 16 kWhr, for 90, 0.5, 0.9, 0.2, 1.0, 0.95, and 0.95, respectively, for 3.3 kW, for 3.3 kW. Energy storage system is of 13.44 kWhr, maximum charge/discharge power of 2 kW, charge/discharge efficiency of 0.95, and and for 0.2 and 1.0, respectively. The washing machine is rated at 0.5 kW, with an operating time of 1 hr and a dispatch interval of 9:00–19:00; the dryer is rated at 4 kW, with an operating time of 2 hr and a dispatch interval of 19:00–24:00; the dishwasher is rated at 1 kW, with an operating time of 1 hr and a dispatch interval of 9:00–21:00.

The parameters , and of the particle swarm algorithm are 30, 3000, 0.2, 0.9, 2, and 2, respectively. The energy allocation process takes the values 0.8 and 0.6 for parameter , respectively.

5.2. Analysis of Results

The results of the simulation experiments for one scheduling cycle are shown in Table 3. In order to compare the performance of the algorithms, the simulation results for other scenarios are also shown in Table 3. Considering the stochastic nature of the algorithms, the results presented, as shown in Table 3, are the average results of 30 separate runs of each algorithm.

Comparative case 1 only dispatches the load, the user has no PV system and no energy storage system, and the EV is only used as a load; comparative case 2 adds a PV system and energy storage system to case 1, but the energy storage system is only used to smooth out fluctuations in the output of the PV system and the user has no ability to sell electricity to the grid; the difference between comparative case 3 and the algorithm in this paper is that the EV does not have a V2H function.

As shown in Table 3, the cost of electricity is higher in scenario 1 than in the other three scenarios because the customer purchases all of its electricity from the grid, indicating that the installation of renewable energy systems and energy storage systems under the dynamic tariff mechanism of the SG can effectively reduce the cost of electricity for the customer. Scenario 3 has the ability to sell electricity to the grid, increasing the utilization of the PV system, and it can purchase electricity from the grid during low tariff periods and then supply it to the load during high tariff periods or sell it to the grid for revenue, thus reducing its net electricity costs by 81.11% compared to scenario 2 [19].

Compared to the three comparison scenarios, the algorithm in this paper has the lowest net electricity cost of $1.70 because it not only has all the advantages of comparison scenario 3, but also the algorithm in this paper takes into account the V2H function of electric vehicles, which can discharge to other electricity-using loads during high tariff hours, reducing the amount of electricity purchased from the grid during high tariff hours and helping to reduce electricity costs for customers. Compared with case 1, case 2, and case 3, the algorithm in this paper reduces the net electricity consumption cost by 93.72%, 87.25%, and 32.54%, respectively [24].

The above analysis shows that making full use of dynamic tariffs, renewable energy sources, and energy storage systems, the ability to sell electricity to the grid and the V2H function of electric vehicles in a smart grid environment and dispatching the various components of the HEMS as a whole can effectively reduce the cost of electricity to customers.

The charging/discharging power and SOC values of an EV connected to a HEMS during primary dispatch are shown in Figure 5. The negative power in the figure indicates that the EV is discharging to other power-using loads via the V2H function.

As shown in Figure 5, the SOC of the EV is within the safe range throughout the dispatch interval, and its SOC value of 0.9063 at the end of the dispatch reaches the user’s preset target value .

Because the technique suggested in this research is a stochastic optimization algorithm, it was run 30 times independently to test its robustness. The time of each run and the customers’ net electricity consumption costs were recorded, and the statistics were gathered, as shown in Table 4. It is clear that the algorithm presented in this research has strong robustness and a quick execution time, which can satisfy the needs of practical applications.

5.3. Real-Life Case Study

There are 50 households in the smart community, mainly divided into two types: 25 households in category A are of the “normal work and rest type,” with a certain degree of load during the day and night and 25 households in category B are of the “early to leave and late to return type,” with the load mainly concentrated at night. We give the classification criteria of “normal sleep type” and “early leave late return type” and explain how the differences between different types of users are reflected in the simulator, as follows: first, we define “normal” users as those who are more active during the day and more rested at night. These users usually leave the house for work or school during the day and return home for rest at night. Their electricity demand peaks during the day and valleys at night. On the other hand, “early and late” users are those who leave home early in the morning and return late in the evening. These users may leave for work or school in the morning and return home in the evening. Their electricity demand peaks in the morning and evening and peaks during the day. In the simulator, we reflect the differences between different types of users by considering their work and rest time and electricity consumption habits. Specifically, we will model the electricity demand patterns of different types of users as different load curves. These load curves reflect the electricity demand intensity of users in different time periods [25, 26]. By matching these load curves with renewable power output, we can evaluate the degree of matching between power supply and demand for different types of users and propose corresponding optimization methods. By investigating the loads of the two types of households on a typical summer day, the customer load parameters, as shown in Tables 5 and 6, were obtained. The power of air conditioners, refrigerators, and water heaters, as shown in Tables 5 and 6, refers to the rated electrical power, which is converted into hot and cold power by multiplying by the hot and cold energy efficiency ratio. All appliances are selected with energy efficiency class 1, and the energy efficiency ratio is taken as 3.4. Here, plug-in hybrids are only considered as ordinary electrical loads for charging, and their releasability is not considered. As some devices are used more than once a day and the same type of device in a household may have different power ratings, they can be controlled as different devices for the same type of device when there are different working periods or different working hours and power ratings.

Figure 6(a) shows the predicted load data for class A households. When HEMS does not optimize the load, the peak load is mainly during the peak price hours, with the peak load appearing at around 20:00 at night, reaching 7.5 kW; Figure 6(b) shows the optimized load data for class A households when there is only grid supply; As shown in Figure 6(b), the original load during the peak hours (18:00–21:00) is significantly reduced. The peak load is also reduced to 6.26 kW, with a reduction of 1.24 kW and a reduction rate of 16.5%, but since there is only grid on the supply side at this time, the load optimization at this time is only a demand side response based on the tariff; Figure 6(c) shows the data after the optimization of class A household load during the integrated supply; compared to case 2, case 3 has not only a response to the tariff but also the peak load is reduced to 6.26 kW compared to case 1, and the peak load is not reduced compared to case 2, but the various types of load are rescheduled in the time sequence.

The result of power output optimization of CCHP system is shown in Figure 7. In the early morning hours, the electric load and cold load are low, and the electricity price is low at this time, so the gas turbine output is low and the shortage of electricity is purchased from the grid; from 8:00 to 9:00, because there is no hot and cold load at this time, only electric load and the electric load is not high, and the electricity price is still flat at this time, so the gas turbine is not started and electricity is purchased directly from the grid; from 10:00 to 15:00, because there is cold load and PV, due to the cold power load, the PV output is larger and the electricity price is higher, so the gas turbine and PV meet the power demand and almost no electricity is purchased from the grid; from 18:00 to 20:00, due to the large heat load at this time, the heat generated by the gas turbine is not enough, so the gas boiler is needed to make up the combustion.

The variation of battery energy storage in the CCHP system is shown in Figure 8. The batteries are charged during the flat hours of electricity prices and discharged during the peak hours, thus reducing the cost of the system and increasing the net benefit to the property.

6. Conclusion

In this paper, we studied the two-stage optimization model for smart communities with integrated energy supply, optimizing the output of each part of the CCHP system in the first stage with the objective function of maximizing the net profit for the property company, and optimizing the load arrangement in the second stage with the objective function of minimizing the cost for the user, and finally comparing the simulation results of different cases, the following conclusions were drawn:(1)The two-stage optimization of smart communities with integrated energy supply is not only economical for the property company, but also for the user side, and can achieve a win–win situation for both the user side and the property side.(2)The customer side responds according to the time-sharing tariff and the capacity of the community CCHP system, and the load working hours are reasonably arranged through HEMS, effectively reducing the peak load.(3)The energy supply side adopts a combination of grid supply and CCHP supply, with the grid supplying energy when the tariff is low and the cooling and heating loads are not high, and the CCHP system supplying energy when the tariff is high and the cooling and heating loads are large, i.e., the integrated energy supply is more flexible and economically efficient compared to a single grid supply.

Data Availability

The experimental data used to support the findings of this study are available from the corresponding author upon request.

Conflicts of Interest

The authors declare that they have no conflicts of interest regarding this work.

Authors’ Contributions

All authors reviewed the results, approved the final version of the manuscript, and agreed to publish it.

Acknowledgments

The authors would like to show sincere thanks to those techniques who have contributed to this research.