**Electrification of Smart Cities**

Editors

**Chun Sing Lai Kim-Fung Tsang Yinhai Wang**

MDPI ' Basel ' Beijing ' Wuhan ' Barcelona ' Belgrade ' Manchester ' Tokyo ' Cluj ' Tianjin

*Editors* Chun Sing Lai Department of Electronic and Electrical Engineering Brunel University London London United Kingdom

Kim-Fung Tsang Department of Electrical Engineering City University of Hong Kong Hong Kong

Yinhai Wang Department of Civil and Environmental Engineering University of Washington Seattle United States

*Editorial Office* MDPI St. Alban-Anlage 66 4052 Basel, Switzerland

This is a reprint of articles from the Special Issue published online in the open access journal *Electronics* (ISSN 2079-9292) (available at: www.mdpi.com/journal/electronics/special issues/electrification cities).

For citation purposes, cite each article independently as indicated on the article page online and as indicated below:

LastName, A.A.; LastName, B.B.; LastName, C.C. Article Title. *Journal Name* **Year**, *Volume Number*, Page Range.

**ISBN 978-3-0365-3964-5 (Hbk) ISBN 978-3-0365-3963-8 (PDF)**

© 2022 by the authors. Articles in this book are Open Access and distributed under the Creative Commons Attribution (CC BY) license, which allows users to download, copy and build upon published articles, as long as the author and publisher are properly credited, which ensures maximum dissemination and a wider impact of our publications.

The book as a whole is distributed by MDPI under the terms and conditions of the Creative Commons license CC BY-NC-ND.

## **Contents**


## **About the Editors**

#### **Chun Sing Lai**

Dr. Chun Sing Lai received the B.Eng. (First Class Hons.) in electrical and electronic engineering from Brunel University London, London, UK, in 2013, and the D.Phil. degree in engineering science from the University of Oxford, Oxford, UK, in 2019. He is currently a Lecturer with the Department of Electronic and Electrical Engineering, Brunel University London. From 2018 to 2020, he was a UK Engineering and Physical Sciences Research Council Research Fellow with the School of Civil Engineering, University of Leeds, Leeds, UK. His current research interests are in power system optimization and data analytics. Dr. Lai was the Publications Co-Chair for both the 2020 and 2021 IEEE International Smart Cities Conferences. He is the Vice-Chair of the IEEE Smart Cities Publications Committee and Associate Editor for IET Energy Conversion and Economics. He is the Working Group Chair for IEEE P2814 Standard and the Chair of the IEEE SMC Intelligent Power and Energy Systems Technical Committee. He is an IEEE Senior Member, an IET Member, and a Chartered Engineer.

#### **Kim-Fung Tsang**

Dr. Kim-Fung Tsang received an Associateship degree in electrical engineering from The Hong Kong Polytechnic University, Hong Kong, in 1983, and the M.Eng. (by research) and Ph.D. degrees in electrical engineering from the University of Wales College of Cardiff (formerly known as the University of Wales Institute of Science and Technology), Cardiff, U.K., in 1987 and 1995, respectively. In 1988, he joined the City University of Hong Kong, where he is currently an Associate Professor in the Department of Electronic Engineering. He has authored or coauthored about 200 technical papers and four books/chapters.

Dr. Tsang is a Fellow of The Hong Kong Institution of Engineers, a Chartered Engineer and a Member of IET, an Associate Editor and a Guest Editor of the IEEE Transactions on Industrial Informatics, an Associate Editor for the IEEE Industrial Electronics Magazine, an Associate Editor for the IEEE ITeN, and an Editor of the KSII Transactions on Internet and Information Systems. He is an IEEE Senior Member. Since 2022, Dr. Tsang is the Editor-in-Chief of the IEEE Transactions on Consumer Electronics.

#### **Yinhai Wang**

Prof. Yinhai Wang received a Ph.D. degree in transportation engineering from the University of Tokyo in 1998, a master's degree in computer science and engineering from the University of Washington (UW), and a master's degree in construction management and a bachelor's degree in civil engineering from Tsinghua University, China. He is currently a Professor in the Civil and Environmental Engineering (CEE) Department and the Electrical and Computer Engineering (ECE) Department, UW, where he is also the founder of the Smart Transportation Applications and Research Laboratory (STAR Laboratory). He also serves as the Director for Pacific Northwest Transportation Consortium (PacTrans), USDOT University Transportation Center for Federal Region 10. He has conducted extensive research in traffic sensing, transportation big data management and analytics, large-scale transportation system analysis, transportation data science, traffic operations, and decision support. He is an IEEE Senior Member.

## **Preface to "Electrification of Smart Cities"**

Electrification plays a key role in decarbonizing energy consumption for various sectors, including transportation, heating, and cooling. There are several essential infrastructures for a smart city, including smart grids and transportation networks. These infrastructures are the complementary solutions to successfully developing novel services, with enhanced energy efficiency and energy security. Five papers are published in this Special Issue that cover various key areas expanding the state-of-the-art in smart cities'electrification, including transportation, healthcare, and advanced closed-circuit televisions for smart city surveillance.

> **Chun Sing Lai, Kim-Fung Tsang, and Yinhai Wang** *Editors*

### *Editorial* **Electrification of Smart Cities**

**Chun Sing Lai 1, \* , Kim Fung Tsang <sup>2</sup> and Yinhai Wang 3**


#### **1. Introduction**

Electrification plays a key role in decarbonizing energy consumption for various sectors, including transportation, heating, and cooling. There are several essential infrastructures for a smart city, including smart grids and transportation networks. These infrastructures are the complementary solutions to successfully developing novel services, with enhanced energy efficiency and energy security.

Five papers are published in this Special Issue that cover various key areas expanding the state-of-the-art in smart cities' electrification, including transportation, healthcare, and advanced closed-circuit televisions for smart city surveillance.

#### **2. Publications in the Special Issue**

With regard to transport electrification in smart cities, Gao et al. [1] proposed an improved multi-exposure image fusion method for intelligent transportation systems. In addition, a novel multi-exposure image dataset for traffic signs, TrafficSign, is presented to verify the proposed method. In the intelligent transportation system, as a type of important road information, traffic signs are fused by this method to obtain a fused image with moderate brightness and intact information. By estimating the degree of retention of different features in the source image, the fusion results have adaptive characteristics similar to that of the source image. Considering the factors of weather and environmental noise, the source image is preprocessed by bilateral filtering and a dehazing algorithm. In addition, the authors used adaptive optimization to improve the quality of the fusion model's output image. The qualitative and quantitative experiments on the new dataset show that the multi-exposure image fusion algorithm proposed in this paper is effective and practical in the intelligent transportation systems.

In another work of this Special Issue, Mansfield et al. [2] claimed that achieving carbonneutral transportation is the ultimate goal of the ongoing joint efforts of governments, policy makers, and the transportation research community. The electrification of smart cities is a very important step towards the above objective; therefore, accelerating the adoption and widening the use of electric vehicles are required. However, to achieve the full potential of electric vehicles, ground-breaking detour computation and charging station selection schemes are needed. Hence, Mansfield et al. [2] developed a new scheme that finds the most suitable detour/route for electric vehicles whenever an unexpected event occurs on the road. This scheme is based on A\* and uses an original, Simple Additive Weighting (SAW)-based charging station selection method. The performance evaluation carried out using the open-source traffic simulation platform SUMO under a grid map, as well as a real road network map, highlighted that our scheme ensured that more than 99% of electric vehicles will reach their destination within a reasonable time, even if a battery recharge

**Citation:** Lai, C.S.; Tsang, K.F.; Wang, Y. Electrification of Smart Cities. *Electronics* **2022**, *11*, 1235. https://doi.org/10.3390/ electronics11081235

Received: 31 March 2022 Accepted: 9 April 2022 Published: 14 April 2022

**Publisher's Note:** MDPI stays neutral with regard to jurisdictional claims in published maps and institutional affiliations.

**Copyright:** © 2022 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (https:// creativecommons.org/licenses/by/ 4.0/).

is needed. This is a significant improvement compared to the baseline scheme that uses A\* only.

Huang et al. [3] presented a novel blockchain-based energy-trading mechanism for electric vehicles consisting of day-ahead and real-time markets. In the day-ahead market, electric vehicle users submit their bidding price to participate in the double auction mechanism. Subsequently, the smart match mechanism will be conducted by the charging system operator to meet both personal interests and social benefits. After clearing the trading result, the charging system operator uploads the trading contract made in the day-ahead market to the blockchain. In the real-time market, the charging system operator checks the trading status and submits the updated trading results to the blockchain. This mechanism encourages participants in the double auction to pursue higher interests, in addition to rationally utilize the energy unmatched in the auction and to achieve improvements in social welfare. Case studies are used to demonstrate the effectiveness of the proposed model. For buyers and sellers who successfully participate in the day-ahead market, the total profit increase is 22.79% and 53.54%, respectively, as compared to profits without energy trading. With the consideration of social welfare in the smart match mechanism, the peak load reduces from 182 kW to 146.5 kW, which is a 19.5% improvement.

Examining the topic of smart healthcare with regard to electrification, Taha et al. [4] presented a new methodology to identify potential energy waste and negative energy usage behavior in an NHS hospital. The work presents an analysis of electricity consumption vs. occupancy during minimal consumption periods (i.e., bank holidays and weekends), and it presents a log of any equipment left switched on outside of working hours in order to highlight the level of energy-conscious behavior. The results revealed that the proposed technique is not only able to identify negative energy usage behavior amongst the hospital staff but helps identify areas where immediate energy savings can be made, with potential savings of more than GBP 30,000 if action is taken.

The final article to be presented is with regard to advanced closed-circuit televisions for smart city surveillance. Wang, Teng, and An [5] claimed that with the help of deep neural networks, video super-resolution has made a huge breakthrough. However, these deeplearning-based methods are rarely used in specific situations. In addition, training sets may not be suitable because many methods only assume that under ideal circumstances, lowresolution datasets are downgraded from high-resolution datasets in a fixed manner. Hence, Wang, Teng, and An [5] proposed a model based on Generative Adversarial Network and edge enhancement to perform super-resolution reconstruction for low-resolution and blurry videos, such as closed-circuit television footage. The adversarial loss allows discriminators to be trained to distinguish between super-resolution frames and ground truth frames, which is helpful to produce realistic and highly detailed results. The edge enhancement function uses the Laplacian edge module to perform edge enhancement on the intermediate result, which helps to further improve the final results. In addition, we add the perceptual loss to the loss function to obtain a higher visual experience. At the same time, we also tried training the network on different datasets. A large number of experiments show that our method has advantages in the Vid4 dataset and other low-resolution videos.

**Funding:** This research received no external funding.

**Acknowledgments:** The guest editors would like to express their deepest gratitude to researchers who contributed articles to this Special Issue. The guest editors are also grateful to the reviewers who supported with the rigorous review process and providing constructive comments to enhance the articles. Last but not least, the guest editors are indebted to the *Electronics* editorial board for the invitation to establish this Special Issue, as well as, the Editorial Office team, who have worked relentlessly to make this Special Issue a success.

**Conflicts of Interest:** The authors declare no conflict of interest.

#### **References**


## *Article* **An Improved Multi-Exposure Image Fusion Method for Intelligent Transportation System**

**Mingyu Gao 1,2, Junfan Wang 1 , Yi Chen 1 , Chenjie Du 1,2 , Chao Chen <sup>1</sup> and Yu Zeng 1,2, \***


**Abstract:** In this paper, an improved multi-exposure image fusion method for intelligent transportation systems (ITS) is proposed. Further, a new multi-exposure image dataset for traffic signs, *TrafficSign*, is presented to verify the method. In the intelligent transportation system, as a type of important road information, traffic signs are fused by this method to obtain a fused image with moderate brightness and intact information. By estimating the degree of retention of different features in the source image, the fusion results have adaptive characteristics similar to that of the source image. Considering the weather factor and environmental noise, the source image is preprocessed by bilateral filtering and dehazing algorithm. Further, this paper uses adaptive optimization to improve the quality of the output image of the fusion model. The qualitative and quantitative experiments on the new dataset show that the multi-exposure image fusion algorithm proposed in this paper is effective and practical in the ITS.

**Keywords:** multi-exposure image fusion; intelligent transportation system; adaptive optimization

#### **1. Introduction**

With the rapid development of digital image technology, more and more digital image technologies will be applied to intelligent transportation systems [1]. As an important part of a smart city, intelligent transportation systems (ITS) are the effective comprehensive application of advanced science and technology in the field of transportation. It can strengthen the connection between vehicles, roads, and users, thereby forming a comprehensive transportation system that guarantees safety, improves efficiency, and saves energy. In the field of intelligent transportation, one of the very important pieces of information is the road signs taken by the camera. For different exposure environments, multi-exposure fusion technology [2] is very important to obtain high-quality road sign images.

Traditional fusion methods include three main steps: image transformation, activity level measurement, and fusion rule design [3]. However, it is time-consuming, expensive, and difficult to design the feature extraction and fusion rules. Gu et al. [4] proposed a new iterative correction method for gradient field by using quadratic average filtering and nonlinear compression. Mertens et al. [5] proposed a multi-resolution fusion method based on the Laplacian pyramid.

The trained network can automatically extract features from images and merge features without manual participation in transformation and activity level measurement. However, the ground-truth of supervised learning is also difficult to obtain in practical application. Therefore, this paper uses a unified unsupervised image fusion network, which does not need the ground-truth to generate fusion results and can fuse the source image adaptively [6].

At present, in the field of intelligent transportation, the light and the ambient noise will produce certain interference to the image. Considering the influence of extreme weather,

**Citation:** Gao, M.; Wang, J.; Chen, Y.; Du, C.; Chen, C.; Zeng, Y. An Improved Multi-Exposure Image Fusion Method for Intelligent Transportation System. *Electronics* **2021**, *10*, 383. https://doi.org/ 10.3390/electronics10040383

Academic Editor: Tomasz Trzcinski Received: 31 December 2020 Accepted: 27 January 2021 Published: 4 February 2021

**Publisher's Note:** MDPI stays neutral with regard to jurisdictional claims in published maps and institutional affiliations.

**Copyright:** © 2021 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (https:// creativecommons.org/licenses/by/ 4.0/).

the irrelevant information in the image is eliminated by preprocessing, the detectability of important information is enhanced, and the reliability of subsequent feature extraction is improved. The fusion results are adaptively optimized to ensure that the output image can reflect the retained important information to the greatest extent. The main contributions of our work are summarized as follows:


The rest of the paper is arranged as follows: The current methods and applications of multi-exposure image fusion are described in Section 2. The proposed method for multi-exposure image fusion is introduced in Section 3. Additionally, the effectiveness of this method is verified through computer simulation in Section 4. Finally, the conclusion is described in Section 5.

#### **2. Related Works**

At present in intelligent transportation systems, intelligent vehicles make decisions by sensing the surrounding environment. The image taken by the camera is an important source of information. In recent years, the research on image fusion has developed rapidly and has received widespread attention. Li et al. [8] decomposed the source image into a basic part and a detailed part, and used the deep learning network to extract the features of the detailed part for fusion. Paul et al. [9] proposed to mix the gradient of the brightness component of the input image, utilized the maximum gradient amplitude at each pixel position, and obtained the fused brightness by using image reconstruction technique based on Haar wavelet. The above algorithms are mainly aimed at the fusion between infrared and visible images and multi-focus images [10–12]. In the camera shooting process, the phenomenon of over-exposure or under-exposure will occur due to the influence of light and environmental factors. Therefore, the road sign information cannot be extracted, which is not conducive to subsequent decision-making.

This paper proposes an improved multi-exposure image fusion algorithm and applies it to the processing of traffic sign images in the field of intelligent transportation [6]. Prabhakar et al. [13] proposed a deep unsupervised approach for exposure fusion (Deepfuse), which uses a novel CNN (Convolutional Neural Networks) architecture that is trained to learn the fusion operation without reference ground-truth image. This fusion process will lose other key information, such as contrast and texture information. A new multi-exposure fusion method based on dense scale-invariant feature transform (DSIFT) is presented by Liu et al. [14]. The fusion effect of this method is largely based on the selection of reference images and the selection of specific scenes, and cannot be applied to the multi-change scenes under intelligent transportation. Yang et al. [15] proposed a strategy by producing virtual images. The downside of this approach is that it only deals with images that have equal exposure degrees. Paul et al. [9] presented multi-exposure and multi-focus image fusion in the gradient domain (GBM). This method is not suitable for multi-exposure images with too large of a gradient difference, and the fusion speed is slower than other methods, so it is not suitable for the intelligent transportation field that needs to process a large amount of information. Fu et al. proposed the fusions of visual and infrared images on the feature level and decision level. On the feature level, the feature fusion was realized by wavelet transformation. On the decision level, the fusion

method based on Dempster-Shafer evidence theory was proposed [16]. However, the wavelet transform for feature fusion will cause image distortion to a certain extent, and affect subsequent decision-making. Goshtasby et al. took non-overlapping blocks with the highest information from each image to obtain the fused result. This is prone to suffer from block artifacts [17].

All of the above works rely on hand-crafted features for image fusion. These methods are not robust in the sense that the parameters need to be varied for different input conditions say, linear and non-linear exposures, filter size depends on image sizes. At the same time, among the above-mentioned fusion methods, artificially designed extraction methods will make the fusion method more and more complex, thereby increasing the difficulty of fusion rule design. For different fusion tasks, the extraction method needs to be improved accordingly. In addition, attention needs to be paid to the appropriateness of the extraction method to ensure the integrity of the features.

This paper uses a unified unsupervised end-to-end image fusion network which is proposed by Xu et al. [6]. Through feature extraction and information measurement, an adaptive information preservation degree is given. Feature extraction is performed through the pre-trained VGGNet-16, and information is measured on the feature map to obtain the degree of information retention in the feature map, which is sent to the loss function. The method trains DenseNet to fuse the source images and minimizes the loss function to optimize the DenseNet network to achieve a better fusion effect. It has a high requirement for the quality of the input multi-exposure image. If noise or distortion occurs in the acquisition of the input image, the multi-exposure fusion model will amplify these problems. Based on this method, this paper utilizes the dehazing algorithm [18] and bilateral filtering to denoise the source image and reduce the influence of the weather environment. Further, Laplace operator and histogram equalization are applied to the proposed fusion network, which are utilized to keep the important information of the source image. Meanwhile, the Laplace operator is helpful to enhance the contrast and the entire brightness of the final image [19,20].

#### **3. Proposed Method**

In general, the photos taken by the camera are usually three-channel (RGB) images. We first convert them from RGB to YCbCr color space due to a large amount of calculation in processing RGB images. In the YCbCr space, Y is the luminance channel, and Cb and Cr are the density offset components of blue and red, respectively. When directly processing an RGB image, the brightness will also change when the color is adjusted, which is prone to color cast and is not beneficial to direct fusion. Focusing on the fusion of the Y channel, the detailed texture of the image is mainly represented by this channel [21]. The values of the Cb channel and Cr channel (chroma channel) adopt the traditional fusion method.

The fusion framework proposed in this paper is shown in Figure 1. Taking into account the camera shakes during shooting and the internal noise interference of the instrument, the input original image may have partial blur or more noise, which will have a greater impact on the subsequent multi-exposure fusion and may lead to express the information in the fusion image inaccurately. Therefore, we first preprocessed the image by using bilateral filtering and dehazing algorithm. After that, we merged the images that have been preprocessed. We used pre-trained VGGNet-16 to extract the shallow features and deep features of the multi-exposure image to estimate the amount of information. Subsequently, Laplace operator and histogram equalization were used to optimize the over-bright or over-dark images. The procedure is summarized in Algorithm 1.


#### **\* Training Procedure of the Proposed Method**

**Parameter:** *φn <sup>k</sup>* means the feature map of the *k*-th input image *I* ∗ *k* before the *n*-th max-pooling layer. *g<sup>I</sup>* means the information measurement of image *I*. *θ* denotes the parameters in DenseNet. *D* is the training dataset. *α* is set as 20. *c* is set as 3e3, 3.5e3, and 1e2. **Input**: RGB images *I n* 1 and *I n* 2 , *n* denotes the *n*-th pair images. ଵ <sup>∗</sup> <sup>←</sup> <sup>ଵ</sup> . ଶ <sup>∗</sup> <sup>←</sup> <sup>ଶ</sup> 

*ϕₙ*

*θ*

∗

1 5 1 1 ,

*θ*

**Output**: the parameters in DenseNet *θ.*


*θ*

*Lsim*(*θ*, *D*) = E h *ω*1 · 1 − *SI<sup>f</sup>* ,*I*1 + *ω*<sup>2</sup> · 1 − *SI<sup>f</sup>* ,*I*2 i <sup>+</sup> <sup>E</sup> h *ω*1 · *MSEI<sup>f</sup>* ,*I*<sup>1</sup> + *ω*<sup>2</sup> · *MSEI<sup>f</sup>* ,*I*2 i ; ௦(, ) ௦(, ) 1 2 12 1 , 2 , 1 ,2 , ,1 1

.


**Figure 1.** Multi-exposure image fusion framework.

#### *3.1. Image Preprocessing*

Bilateral filtering is an edge protection filtering method using a weighted-average strategy based on Gaussian distribution [22,23]. Bilateral filtering consists of two parts: spatial matrix and range matrix. The spatial matrix is analogous to Gaussian filtering, which is used for fuzzy denoising; the range matrix is obtained according to the gray-scale similarity, and is used to protect edges. The specific formulas of the spatial matrix and range matrix are as follows:

$$d(i,j,k,l) = e^{\frac{-(i-k)^2 + (j-l)^2}{2r\_d^2}}\tag{1}$$

$$r(i,j,k,l) = e^{\frac{-\|f(k,l) - f(i,j)\|^2}{2v\_r^2}}\tag{2}$$

where *(i, j)* is the coordinate of the center point of the filter window, and *(k, l)* is any point in the field of the center point.

For Gaussian filtering, only the weight coefficient kernel of the spatial distance is used to convolve the image to determine the gray value of the center point, the closer the point to the center point, the larger the weight coefficient. The weight of gray information is added to the bilateral filtering. In the field, the closer the gray value is to the center point, the greater the point weight [22]. This weight is determined by Equation (2). By multiplying Equations (1) and (2), the final convolution template is obtained.

Multiplying Equations (1) and (2) is the calculation formula of the bilateral filter weight matrix, the final weight matrix by multiplying the two weight matrices:

$$w(i,j,k,l) = e^{\frac{-(i-k)^2 + (j-l)^2}{2r\_d^2} + \frac{-\|f(k,l) - f(i,j)\|^2}{2r\_r^2}}\tag{3}$$

Finally, calculate the weighted average as the pixel value of the center point after filtering:

$$g(i,j) = \frac{\sum\_{(k,l)\in S} f(i,j)w(i,j,k,l)}{\sum\_{(k,l)\in S} w(i,j,k,l)}\tag{4}$$

In the dehazing algorithm [18], firstly, the dark channel prior theory believes that in most non-sky local areas, certain pixels will always have at least one color channel with a very low value.

Given a mathematical definition of the dark channel, for any input image *J*, the dark channel expression is as follows:

$$J^{dark}(\mathbf{x}) = \min\_{y \in \Omega(\mathbf{x})} \left( \min\_{c \in \{r, \mathbf{g}, b\}} J^c(y) \right) \tag{5}$$

where *J c* represents each channel of the color image, *x* and *y* represent the pixel. Ω(*x*) represents a window centered on pixel *x*. *J dark*(*x*) is the dark primary color of the image in the Ω(*x*) neighborhood. For clear and fog-free images, its value tends to 0.

In computer vision and computer graphics, the fog map formation model described by the following equation is widely used:

$$I(\mathbf{x}) = I(\mathbf{x})t(\mathbf{x}) + A(1 - t(\mathbf{x})) \tag{6}$$

where *I(x)* is the original image, *J(x)* is the image after defogging, *A* is the atmospheric light value, and *t(x)* is the transmittance.

The current known condition is *I*(*x*), and the target value *J*(*x*) is required. This is an equation with countless solutions. Therefore, some priors were needed.

The formula of the fog map formation model is processed and can be written by Equation (7).

$$\frac{I^c(\mathbf{x})}{A^c} = t(\mathbf{x})\frac{f^c(\mathbf{x})}{A^c} + 1 - t(\mathbf{x})\tag{7}$$

where *c* represents the R/G/B three channels.

He et al. [24] assumed that the transmittance was constant in each window, which was defined as e*t*(*x*). From the dark channel map, take the first 0.1% of pixels according to the brightness. In these positions, find the corresponding value of the point with the highest brightness in the original foggy image *I* as the value of *A*. Therefore, Equation (7) can be transformed into:

$$\min\_{y \in \Omega(x)} \left( \min\_{c} \frac{I^c(y)}{A^c} \right) = \tilde{t}(x) \min\_{y \in \Omega(x)} \left( \min\_{c} \frac{I^c(y)}{A^c} \right) + 1 - \tilde{t}(x) \tag{8}$$

According to the previous prior theory, the method to further deduce the estimated value of transmittance is as follows:

$$\widetilde{f}(\mathbf{x}) = 1 - \omega \min\_{y \in \Omega(\mathbf{x})} \left( \min\_{\mathbf{c}} I^{\mathbf{c}}(\mathbf{x}) / A^{\mathbf{c}} \right) \tag{9}$$

where *ω* is the artificially introduced correction constant (generally 0.95), which is used to retain the fog at part of the perspective and maintain the variation of the depth of field. We set the lower limit *t<sup>0</sup>* to limit *t(x)* in order to prevent the contrast from getting too large. When *t* is less than *t0*, t will be set to *t0*. Therefore, the final recovery Equation (10) is as follows:

$$J(\mathbf{x}) = \frac{I(\mathbf{x}) - A}{\max(t(\mathbf{x}), t\_0)} + A \tag{10}$$

where *t<sup>0</sup>* is set to 0.1.

In order to improve the speed of the dehazing algorithm and achieve real-time effects, when optimizing the image, the original image is first down-sampled. First, the image is reduced to one-quarter of the original image, the transmittance of the reduced image is calculated, and then the approximate transmittance of the original image is obtained by interpolation, which greatly improves the execution speed, while the effect is basically unchanged.

#### *3.2. Fusion Module*

The multi-exposure images fusion model mainly includes three aspects: fusion network, feature retention, and loss function. The specific structure is shown in Figure 2.

**Figure 2.** Fusion model.

ଵ ∗ ଶ ∗ <sup>భ</sup> (ଵ) <sup>ఱ</sup> (ଵ) <sup>భ</sup> (ଶ) <sup>ఱ</sup> (ଶ) 1 2 \* 1 *I* \* 2 *I* \* 1 2 The input multi-exposure images are represented as *I* ∗ 1 , *I* ∗ 2 and the fusion image is generated through DenseNet training in the fusion network. In the feature retention module, the outputs of feature extraction parts are feature maps *φC*<sup>1</sup> (*I*1), . . . , *φC*<sup>5</sup> (*I*1) and *φC*<sup>1</sup> (*I*2), . . . , *φC*<sup>5</sup> (*I*2). In information measurement, the amount of information extracted from the special graph is expressed as *gI*<sup>1</sup> and *gI*<sup>2</sup> . Through subsequent processing, the degree of information retention in the final obtained source images is represented by *ω*<sup>1</sup> and *ω*2. *I* ∗ 1 *, I* ∗ 2 *, I* ∗ *f , ω*1*, ω*<sup>2</sup> are sent into the loss function without the need for groundtruth. During the training, the DenseNet was continuously optimized to minimize the loss function [25]. It was not necessary to measure *ω*<sup>1</sup> and *ω*<sup>2</sup> again in the process of testing, and the fusion speed was faster in practical application.

1 2 The DenseNet architecture in the fusion network consisted of 10 layers, each of which had a convolutional layer and an activation function [26]. Dense connections were applied inside each Dense Block, and a convolutional layer plus a pooling layer were utilized between adjacent Dense Block. The advantage of DenseNet is that the network is narrower, has fewer parameters, and reduces the phenomenon of gradient disappearance.

<sup>భ</sup>

() <sup>మ</sup>

()

The activation function of the first nine layers is LeakReLu with a slope of 0.2 and the last layer is the *tanh*. The kernel size of all convolutional layers is set to 3 × 3, and the stride is set to 1 [6].

We extracted the features through the pre-trained VGGNet-16, which is shown in Figure 3. The convolutional layer output before the maximum pooling layer is the feature graph, which was used for subsequent information measurement [27]. In the source image, the underexposed image has lower brightness. Therefore, the overexposed image contains more texture details or greater gradients than the underexposed image. The shallow features such as texture and details were extracted from *φC*<sup>1</sup> (*I*) and *φC*<sup>2</sup> (*I*), and the deep features such as structural content were extracted from the feature maps of the later layers.

#### **Figure 3.** VGGNet-16.

After the image gradient was estimated, the feature map information could be measured. Information measurement is defined as follows:

$$\mathcal{g}\_I = \frac{1}{5} \sum\_{j=1}^5 \frac{1}{H\_j \mathcal{W}\_j D\_j} \sum\_{k=1}^{D\_j} \left\| \nabla \phi\_{\mathcal{C}\_j^k}(I) \right\|\_F^2 \tag{11}$$

ೕ () where *φC<sup>j</sup>* (*I*) is the feature map and *k* denotes the feature map in the *k*-th channel of *D<sup>j</sup>* channels. k·k<sup>F</sup> represents Frobenius norm and ∇ represents a Laplace operator.

‖∙‖ *ω ω* In this method, *ω*<sup>1</sup> and *ω*<sup>2</sup> were obtained through *gI*<sup>1</sup> and *gI*<sup>2</sup> . As the difference between *gI*<sup>1</sup> and *gI*<sup>2</sup> is an absolute value and is too small compared with itself, therefore, we scaled them with a predefined positive number *c* to better distribute the weight. Through the function, the expressions of *ω*<sup>1</sup> and *ω*<sup>2</sup> are as follows:

$$\left[\omega\_1, \omega\_2\right] = softmax\left(\left[\frac{\mathcal{G}\_{I\_1}}{\mathcal{c}}, \frac{\mathcal{G}\_{I\_2}}{\mathcal{c}}\right]\right) \tag{12}$$

1 2 1 2 , , The loss function consists of two parts defined as follows:

$$L(\theta, D) = L\_{\text{sim}}(\theta, D) + \alpha L\_{\text{msc}}(\theta, D) \tag{13}$$

,, , where *θ* represents the parameter in DenseNet and *D* represents the training dataset. *Lssim*(*θ*, *D*) is the similarity loss between the fused image and the source multi-exposure image, and *Lmse*(*θ*, *D*) is the mean square error loss between the images. α is used to control the trade-off.

*θ* (*θ* ) (*θ* ) α Structural similarity index measure (SSIM) [28,29] is widely used in modeling distortion based on the similarity of light, contrast, and structural information. In this paper, SSIM was used to constrain the structural similarity between *I* ∗ 1 , *I* ∗ 2 and *I* ∗ *f* . The loss function under the SSIM framework is as follows:

$$L\_{\rm sim}(\theta, D) = \mathbb{E}\left[\omega\_1 \left(1 - S\_{I\_f, I\_1}\right) + \omega\_2 \left(1 - S\_{I\_f, I\_2}\right)\right] \tag{14}$$
 
$$\text{In values of } \mathfrak{CCM} \text{ determines around } \omega$$

[ 1 ,2 , 1 2 ,1 1

[ 1 ,2 , 1 2 ,

1

2

*f*

where *Sx,y* denotes the value of SSIM between *x* and *y*.

Considering that SSIM only focuses on contrast and structure changes and it shows weaker constraints on the difference of the intensity distribution, we supplemented it by mean square error (MSE) between two images, and the loss function of this part was as follows:

$$L\_{msc}(\theta, D) = \operatorname{E}\left[\omega\_1 MSE\_{I\_f, I\_1} + \omega\_2 MSE\_{I\_f, I\_2}\right] \tag{15}$$

#### *3.3. Image Optimization*

The fusion result should be a normal exposure under ideal conditions, which can reflect the road sign information. However, due to the limited training set and the small number of individual road signs, the exposure of the fusion result will still not reach the normal level. Therefore, we utilized histogram equalization and Laplacian to optimize the image with a poor fusion effect.

In actual applications, the fusion image was not what we expected due to the defects of our fusion algorithm. Although it retained the general characteristics of the underexposure image and the over-exposure image, the overall brightness presented made ours feel inappropriate. Therefore, we introduced optimization algorithms next to adjust the brightness of the image without affecting the image quality.

When the brightness of the fusion image is lower than the pre-set value, the Laplace algorithm [30] is used to sharpen the image. When the value is higher than the pre-set value, Histogram equalization [31] is adopted to enhance the over-bright part of the image. The procedure is summarized in Algorithm 2.


The function of image sharpening is to enhance the gray-scale contrast, so that the sharpness of the image is improved. The essence of image blur is that the image is subjected to averaging operation or integration operation. The Laplacian operation is a kind of differential operator; through the inverse operation of the image, it enhances the region of the gray mutation in the image, highlights the details of the image, and obtains a clear image.

An image that describes the gray level mutation is generated through the Laplacian operator to process the original images, then the Laplacian image is superimposed with the original image to produce a sharpened image. This principle is actually a convolution operation.

Laplacian operator is the simplest isotropic differential operator with rotation invariance. The Laplace transform of two-dimensional image function is the isotropic second derivative, which is defined as:

$$
\nabla^2 f = \frac{\partial^2 f}{\partial x^2} + \frac{\partial^2 f}{\partial y^2} \tag{16}
$$

In a two-dimensional function *f*(*x,y*), the second-order difference in *x* and *y* directions is as follows:

$$\frac{\partial^2 f}{\partial x^2} = f\_{\mathbf{x}+1,\mathbf{y}} + f\_{\mathbf{x}-1,\mathbf{y}} - 2f\_{\mathbf{x},\mathbf{y}} \tag{17}$$

$$\frac{\partial^2 f}{\partial y^2} = f\_{\mathbf{x}, y+1} + f\_{\mathbf{x}, y-1} - 2f\_{\mathbf{x}, y} \tag{18}$$

where *fx,y* represents *f*(*x,y*).

In order to be more suitable for digital image processing, the equation is converted into a discrete form, which is as follows:

$$
\nabla^2 f = \left[ f\_{\mathbf{x}+1,y} + f\_{\mathbf{x}-1,y} + f\_{\mathbf{x},y+1} + f\_{\mathbf{x},y-1} \right] - 4f\_{\mathbf{x},y} \tag{19}
$$

The basic method of Laplace operator enhanced image can be expressed as follows:

$$g(\mathbf{x}, y) = f(\mathbf{x}, y) + c \left[\nabla^2 f(\mathbf{x}, y)\right] \tag{20}$$

where *f(x, y)* and *g(x, y)* are the input image and the sharpened image, respectively. *c* is the coefficient, indicating how much detail is added.

This simple sharpening method can produce the effect of Laplacian sharpening while retaining the background information. The original image is superimposed on the processing result of the Laplace transform, so that the gray value in the image can be retained, and the contrast at the gray level mutation can be enhanced. The end result is to highlight small details in the image while preserving the background of the image.

The fusion result will have the phenomenon of partial exposure. In the case, histogram equalization was utilized to optimize the fusion image.

Histogram equalization is a simple and effective image enhancement technology that changes the grayscale of each pixel in the image by changing the histogram in the image. The gray levels of overexposed pictures are concentrated in the high brightness range. Through the histogram equalization, the gray value of the large number of pixels in the image is expanded, and the gray value of the small number of pixels is merged, and the histogram of the original image can be transformed into a uniform distribution (balanced) form. This increases the dynamic range of the gray value difference between pixels, thereby achieving the effect of enhancing the overall contrast of the image [31,32].

The gray histogram of the image is a one-dimensional discrete function, which can be written as:

$$h(r\_k) = n\_{k'} \ k = 0, 1, \dots, L - 1 \tag{21}$$

where *n<sup>k</sup>* is the number of pixels whose gray level is *r<sup>k</sup>* in the source image.

Based on the histogram, the relative frequency *Pr*(*rk*) of gray level appearing in the normalized histogram is further defined, and the expression is as follows:

$$P\_r(r\_k) = n\_k / N \tag{22}$$

where *N* represents the total number of pixels in the source image *I*.

Histogram equalization is to transform the gray value of pixels according to the histogram. *r* and *s* represent the normalized original image grayscale and the histogram equalized grayscale, respectively, and the values of them are between 0 and 1. For any *r* in

the interval of [0, 1], a corresponding *s* can be generated by the transformation function *T*(*r*), the expression is as follows:

$$s = T(r) \tag{23}$$

*T*(*r*) is a monotonically increasing function to ensure that the gray level of the image after equalization does not change from black to white. At the same time, the range of *T*(*r*) is also between 0 and 1, ensuring that the pixel gray of the equalized image is within the allowable range.

The inverse transformation of the above formula is as follows:

$$r = T^{-1}(s) \tag{24}$$

It is known that the probability density function of *r* is *pr*(*r*) and *s* is the function of *r*. Therefore, the probability density *ps*(*s*) of *s* can be obtained from *pr*(*r*). Further, because the probability density function is the derivative of the distribution function, the probability density function of *s* is further obtained through the distribution function *Fs*(*s*). The specific derivation process is as follows:

$$F\_{\mathbf{s}}(\mathbf{s}) = \int\_{-\infty}^{\mathbf{s}} p\_{\mathbf{s}}(\mathbf{s}) d\mathbf{s} = \int\_{-\infty}^{r} p\_{r}(r) dr \tag{25}$$

$$p\_s(s) = \frac{d F\_s(s)}{ds} = \frac{d\left[\int\_{-\infty}^{r} p\_r(r) dr\right]}{ds} = p\_r(r) \frac{dr}{ds} = p\_r(r) \frac{dr}{d[T(r)]}\tag{26}$$

Equation (26) shows that the probability density function *ps*(*s*) of the image gray level can be controlled by the transformation function *T*(*r*), thereby improving the image gray level. Therefore, in the histogram equalization, *ps*(*s*) should be a uniformly distributed probability density function. As we have normalized the *r*, the value of the *ps*(*s*) is 1. Therefore, *ds = pr*(*r*)*dr*, the integral on both sides of the formula can be obtained as follows:

$$s = T(r) = \int\_0^r p\_r(r) dr \tag{27}$$

Equation (24) is the expression of the transformation function *T*(*r*). It shows that when the transformation function *T*(*r*) is the cumulative distribution probability of the original image histogram, the histogram can be equalized. For digital images with discrete gray levels, using frequency instead of probability, the discrete mindset of the transformation function *T*(*r<sup>k</sup>* ) can be expressed as:

$$s\_k = T(r\_k) = \sum\_{i=0}^k p\_r(r\_i) = \sum\_{i=0}^k \frac{n\_i}{N'} \ k = 0, 1, \dots, L-1 \tag{28}$$

*rk* is between 0 and 1, which represents the gray value after normalization, which is calculated by the quotient of *k* and *L* − *1*. *k* represents the gray value before normalization. Equation (28) shows that the gray value *s<sup>k</sup>* of each pixel after equalization can be directly calculated from the histogram of the source image.

#### **4. Experimental Result and Analysis**

Since there are few multi-exposure datasets available, which can hinder our training for exposure fusion tasks. So we selected some images from the existing road-related datasets to make the multi-exposure dataset. We selected 1400 images of various traffic scenarios from the CCTSDB (CSUST Chinese Traffic Sign Detection Benchmark) as the dataset to be processed later and use ACDsee [33] to produce the multi-exposure images. We compared our approach with the other four representative methods, including DSIFT, FLER, GBM, and DeepFuse. Experiments were performed on an NVIDIA Geforce 920M and 2.4 GHz Intel(R) Core i7-5500U CPU. All of our training procedure is on NVIDIA GTX 1080Ti and 32 GB memory.

#### *4.1. Qualitative Comparisons*

We chose typical images as comparison pictures for qualitative analysis. The fusion results of this paper are compared with the other four fusion methods, which are shown in Figure 4a.

(a) The separate from left to right in Figure 4a are source image, multi-exposure image pairs, DSIFT, FLER, GBM, Deep-Fuse, our method.

(b) The separate from left to right in Figure 4b are source image, DSIFT, FLER, GBM, DeepFuse, our method.

**Figure 4.** Qualitative comparison of our method with four methods on three typical multi-exposure image pairs in our dataset.

> It can be seen from the figure that the fusion result of DSIFT and FLER will reduce the sharpness of the image, the degree of preservation of the details of the image is not high, and there will be obvious black areas in local areas. FLER also has the defect of poor fusion effect of large-scale exposure. The final fusion of GBM and DeepFuse has a natural visual effect but suffers from a lack of detail and texture. The fusion result of GBM also has the problem of low contrast, which makes it impossible to display the road sign information. The method proposed in this paper shows that the fusion result looks the best overall, as it has the highest definition, the edge contour is closer to the source image, and the information retention is more complete than other methods.

> We further analyzed the experiment results. The overall image visual effects of the FLER and DeepFuse results are more consistent with human visual perception, but at traffic signs, their results also lose some detailed texture information. In contrast, the landmark in our result has rich texture information, and its contour information is closer to the real information.

We also placed an enlarged view of the road signs in one of the experimental results in Figure 4b. It can be seen that our method can retain the road sign information as much as possible. It can be seen from the results of GBM and DSIFT that their information is a bit vague, and it is not suitable for intelligent transportation systems and smart cities that require precise identification of road signs. The signpost information in our method is clearest, and the exposure level seems to be the most appropriate.

In the optimization process, the images with poor fusion effects are processed. The brightness of the image ranges from 0 to 1. Laplace algorithm and histogram equalization are applied to images with brightness values less than 0.3 and brightness values greater than 0.7, respectively, to ensure that the image brightness is within the normal range.

**Figure 5.** The results of optimizing the fusion images, *If1* denotes the fusion image with a brightness value lower than 0.3 and *Io1* is a result image after processing by Laplace algorithm; *If2* denotes the fusion image with a brightness value higher than 0.7, and *Io2* is a result image after processing by histogram equalization.

#### *4.2. Quantitative Comparisons*

We made a quantitative comparison of 16 pairs of multi-exposure images in the dataset, and the results are shown in Figures 6 and 7. In the figure, we also indicate the average value of each method's corresponding indicator. In the test dataset, the method proposed in this paper achieves the optimal value in all the other five indexes except MI. Figure 6 compares spatial frequency (SF) [34], standard deviation (STD) [35] and entropy (EN) [36]. The larger these parameters, the better the retention of information. Table 1 shows the comparison results of five methods in six indicators. The average value of these indicators in our method is 12.990, 70.907, and 7.328. The results show that the method in this paper retains more information and has higher image quality. Figure 7 shows the comparison results of mutual information (MI) [37], SSIM and peak signal to noise ratio (PSNR) [38]. The larger these parameters, the better the retention of information. In addition, the average value of these indicators in the proposed method is 4.409, 0.923, and 24.720. It seems that MI is a suboptimal index. It can be seen that the fusion results of our method have a higher similarity with the source images.

**Figure 6.** Quantitative comparisons of the SF, STD, and EN on 16 image pairs from our dataset.

**Figure 7.** Quantitative comparisons of the SSIM, MI, and PSNR on 16 image pairs from our dataset.


**Table 1.** Quantitative comparisons of the six metrics.

**Note:** There are six metrics in the table. SF is the spatial frequency, STD is the standard deviation, EN is the entropy, SSIM is the structural similarity index measure, MI is the mutual information, PSNR is the peak signal to noise ratio.

From the result, we see that our method can achieve comparable efficiency compared with the other four methods.

#### *4.3. Expended Experiment*

In order to better illustrate the application of multi-exposure image fusion in the field of intelligent transportation, we carried out experiments on the recognition and classification of traffic signs. We applied the multi-exposure image fusion method proposed in this paper to the identification of traffic signs, and the recognition accuracy of traffic signs has been improved. According to the traffic sign recognition method in [39], the fusion method proposed in this paper is compared with the other four fusion methods. The multiscale recognition method for traffic signs based on the Gaussian Mixture Model (GMM) and Category Quality Focal Loss (CQFL) to enhance recognition speed and recognition accuracy. Specifically, GMM is utilized to cluster the prior anchors, which are in favor of reducing the clustering error. Meanwhile, considering the most common issue in supervised learning (i.e., the imbalance of data set categories), the category proportion factor is introduced into Quality Focal Loss, which is referred to as CQFL. Furthermore, a five-scale recognition network with a prior anchor allocation strategy is designed for small target objects i.e., traffic sign recognition. We chose this algorithm due to its superior recognition accuracy and recognition speed. The classifier used can distinguish specific road signs in 30, which is shown in Table 2.


**Table 2.** Categories of traffic signs.

We selected 1400 pairs of multi-exposure images from our dataset (*TrafficSign*) [7] for the traffic sign classification experiment. The classification results of fusion images from our method, and the over-exposure and under-exposure images are shown in Table 3. It can be seen from Table 3 that the fusion result has a certain influence on the recognition of traffic signs in the case of over-exposure and under-exposure. The last row of Table 3 shows the recognition accuracy of all classes of traffic signs.

**Table 3.** Classification accuracy of over-exposure, under-exposure and fusion images.


Since the dataset we use is a wide range of road images, the classification accuracy of many traffic signs is not high, but this will not affect our comparison of the final results. It can be proved in Table 3 that the accuracy of our fusion results in the classification of traffic signs is generally higher than that of over-exposure images and under-exposure images, which shows that our method can effectively avoid over-exposure and under-exposure situations that the traffic sign information is not accurate enough.

We not only compare the accuracy of traffic sign classification among the overexposure image, the under-exposure image, and the fusion image, but also compare our method with the other four methods in the field of traffic sign recognition. Using the result image of these five methods for traffic sign recognition or traffic sign classification can be very effective and clear to know whether the fusion results of various methods are good.

We selected 1000 pairs of multi-exposure images from our multi-exposure dataset (*TrafficSign*) and obtained the fusion result images of each method. We conducted experiments on the classification of traffic signs on these fusion results and compared them. The results obtained through the experiment are shown in Table 4, which shows the accuracy of various methods for the classification of some traffic signs. Further, the last row of Table 4 shows the recognition accuracy of all classes of traffic signs.

From Table 4, compared with the other four methods, we can see that the classification accuracy obtained by our method is mostly the best. For example, for the traffic sign "Strictly No Parking", our accuracy can reach 0.9178. Although the images obtained by our method are used for traffic sign recognition, the recognition effect of some traffic signs is not good, such as "Go Straight Slot", but it will be too far that compared with the result with the highest accuracy and the result obtained by our method.


**Table 4.** Comparison of classification accuracy of other four methods and ours.

It is worth mentioning that because our dataset contains many traffic signs, and there are few specific traffic signs, such as traffic lights, the accuracy results of the classification test are generally low. However, this result will not affect our comparison of over-exposure images and under-exposure images and the images obtained by the other four methods.

#### **5. Conclusions**

In this paper, multi-exposure image fusion was applied to the identification of traffic signs. Fusion images were generated using a unified unsupervised end-to-end fusion network, U2Fusion. By obtaining the degree of information retention in the source image, the adaptive similarity between the fusion result and the source image was maintained. Considering the influence of weather and environmental noise, image preprocessing should be carried out before image fusion. At the same time, image optimization was carried out for fusion results. Through brightness judgment, the fusion results are adaptive adjusted, so that the final result diagram could reflect the information and facilitate subsequent analysis and decision. The qualitative and quantitative results show that the method was effective and practical in traffic signs. In addition, we have released a new multi-exposure image data set, which provides a new evaluation option for image fusion.

**Author Contributions:** Methodology, M.G.; software, J.W.; validation, Y.C. and C.D.; resources, C.C.; data curation, Y.Z.; writing—original draft preparation, M.G.; writing—review and editing, C.C. and J.W.; visualization, C.C.; supervision, C.D.; funding acquisition, M.G. All authors have read and agreed to the published version of the manuscript.

**Funding:** This research was funded by the Key R&D Program of Zhejiang Province (No. 2020C01110).

**Acknowledgments:** The authors would like to thank the editorial board and reviewers for the improvement of this paper.

**Conflicts of Interest:** The authors declare no conflict of interest.

#### **References**


## *Article* **An Efficient Detour Computation Scheme for Electric Vehicles to Support Smart Cities' Electrification**

**Cole Mansfield 1 , Jack Hodgkiss 1 , Soufiene Djahel 1,2, \* and Avishek Nag 3**


**Abstract:** Achieving carbon-neutral transportation is the ultimate goal of the ongoing joint efforts of governments, policy-makers, and the transportation research community. Electrification of smart cities is a very important step towards the above objective; therefore, accelerating the adoption and widening the use of Electric Vehicles (EVs) are required. However, to achieve the full potential of EVs, ground-breaking detour computation and charging station selection schemes are needed. To this end, this paper developed a new scheme that finds the most suitable detour/route for an EV whenever an unexpected event occurs on the road. This scheme is based on A\* and uses an original, Simple-Additive-Weighting (SAW)-based, charging station selection method. The performance evaluation carried out using the open-source traffic simulation platform SUMO under a grid map, as well as a real road network map highlighted that our scheme ensured more than 99% of EVs will reach their destination within a reasonable time even if a battery recharge is needed. This is a significant improvement compared to the baseline scheme that uses the A\* only.

**Keywords:** electric vehicles; detour; route computation; smart cities

#### **1. Introduction**

Electric Vehicles (EVs) are on the rise, and electricity is slowly becoming the primary fuel type for automotive vehicles. Governments around the globe are increasingly prioritising the climate in their agendas, and more movements are being developed that call for an urgent change in the crisis that falls in front of us. The main concern that is exacerbating the situation is the amount of fossil fuel we are burning. This leads to more carbon in the atmosphere and an increase in global greenhouse gas emissions. Due to the reliance of modern society on vehicles, transportation has become one of the main causes of the increase in greenhouse gas, representing around a quarter of Europe's emissions [1]. Consequently, this has driven up the demand for EVs and led governments to restrict other types of vehicles that cause a more severe impact on the environment. Over their lifetime, EVs are considerably less impactful, especially when paired with cleaner energy sources [2].

The shift towards EVs leads to new problems, one of these being routing and finding an optimal journey for the EVs. Optimal vehicle routing is a widely researched problem due to the reductions it can have on traffic congestion, which in turn can have significant effects on the economy and human health. When routing is applied to EVs, new challenges arise as compared to routing in traditional transportation vehicles, due to the specific constraints of EVs such as their limited battery capacity, the availability of charging stations, the lengthy charging and waiting time compared to traditional fuelling, in addition to the range anxiety experienced by drivers. Aiming to alleviate such issues, we focused on a specific scenario of re-routing or detour, which is needed whenever an unexpected event happens on the road, and developed a new computation scheme to find the most suitable

**Citation:** Mansfield, C.; Hodgkiss, J.; Djahel, S.; Nag, A. An Efficient Detour Computation Scheme for Electric Vehicles to Support Smart Cities' Electrification. *Electronics* **2022**, *11*, 803. https://doi.org/10.3390/ electronics11050803

Academic Editors: Chun Sing Lai, Kim-Fung Tsang and Yinhai Wang

Received: 4 November 2021 Accepted: 2 March 2022 Published: 4 March 2022

**Publisher's Note:** MDPI stays neutral with regard to jurisdictional claims in published maps and institutional affiliations.

**Copyright:** © 2022 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (https:// creativecommons.org/licenses/by/ 4.0/).

detour/route for an electric vehicle to avoid the excessive delay that it might experience due to this event.

The remainder of this paper is organised as follows. In Section 2, we give an overview of EVs, the traffic congestion problem, and the vehicle routing problem and explain how the latter is more challenging in the context of EVs. A selection of related works is then discussed and compared in Section 3. Section 4 describes the essentials of our proposed EV detour computation scheme including our original EV charging station selection mechanism. The details of the performance evaluation configuration, the scenarios, and the analysis of the obtained results are reported in Section 5. Finally, we conclude the paper in Section 6.

#### **2. Overview of the Electric Vehicle Routing Problem**

#### *2.1. The Rise of Electric Vehicles*

The production and purchase of EVs in recent years have been growing rapidly. Passenger EV sales increased from USD 450,000 in 2015 to USD 2.1 million in 2019 [3]. EVs use a rechargeable battery and electric motors for propulsion. They have many advantages that are directly contributing to their rising popularity. Companies such as Tesla and Volkswagen are progressing EV technology, innovating private transport so that EVs can become more accessible to the general population and aid in the fight against climate change.

Despite the reduction in car sales due to the COVID-19 pandemic, the future is positive for EVs; with government policy changes and environmental concerns, they look to be on an increasing trajectory. The sustainable development scenario estimates that in 2030, EVs will constitute 13% of the global car fleet, representing a substantial increase compared to the 1% share achieved in 2020 [4]. Policies set in place around the world by various governments will be a contributing factor in the continuing rise. Seventeen countries have announced 100% zero-emission targets, as well as phasing out internal combustion engines till 2050, with France being the first to put the intention into law [5]. Additionally, the EV credit system implemented in China and India's faster adoption and manufacturing of EVs [3] show the progression and push from governments to shift towards EVs, contributing to their rise in the coming years.

Studies have found that even though in the production of EVs, more carbon is produced than Internal Combustion Engine Vehicles (ICEVs) [2], over their life-cycle, the carbon emitted from an EV is up to 70% less in countries with decarbonised power generation. In 2015, EVs contributed to 31% lower emissions per vehicle-kilometre compared to petrol cars [6]. EVs also present benefits to humans' health by reducing harmful emissions and noise pollution. In terms of fuel cost efficiency, also EVs are advantageous. A study conducted in 2016 found that when driving a Nissan Leaf (EV) instead of a Honda Civic (ICEV) over the 10-year life of the vehicle, the estimated fuel savings would be \$4130 at a time when fuel prices were at a 10-year low [7].

#### *2.2. Traffic Congestion*

Traffic congestion refers to the travel delay caused by the interaction of vehicles on roads, particularly as the volume of the vehicle traffic approaches the road's capacity [8]. It is a global issue affecting the majority of the population of the Earth, mostly in urban areas. There are two main types of traffic congestion, recurring and non-recurring. Recurring congestion is "the congestion present on a normal day if nothing bad has happened on the roadway" [9], such as typical rush hour traffic. Non-recurrent congestion is defined as "unexpected or unusual congestion caused by an event that was unexpected and transient relative to other similar days" [9], such as accidents on the road or weather changes.

In the U.K., new vehicle registrations are forecast in 2022 to increase by 30% from 2020 [10]. Traffic congestion is expected to increase with the growing vehicle population. Besides the vehicle population, the growth in the general population will increase traffic congestion. The U.K. population is projected to grow by three million by 2028 [11], resulting in an increase of trips needed to be taken, resulting more congestion. Traffic from 2014 to

2019 escalated by 7.2% [12], and through the rise in the vehicle and general population, it is forecast to rise further to between 17% and 51% by 2050 [13].

Both types of congestion affect people daily, adding significant delays to their lives. This has substantial economic and social impacts on society. A 2019 traffic report scorecard found that the average British driver lost 115 h annually due to traffic congestion, and overall, EUR 5.2 billion was lost [14]. These can have negative effects on businesses and the economy, as it is a non-productive activity and could be a direct cause for employee tardiness. Traffic congestion can also affect people's health. Stress and aggressiveness brought on by traffic congestion can be detrimental to others' safety on the roads and cause more delays. The 2019 RAC Report on Motoring found that increasing traffic levels is the most common cause of stress at 40%, which represents 10 million motorists [15]. The congestion issue is of significance and, if not managed, will continue to disrupt different parts of society.

#### *2.3. Vehicle Routing*

Vehicle routing is one of the main ways of combating traffic congestion. Finding the optimal shortest path between two vertices in a network of vertices is a challenging task studied in graph theory. When applying this concept for vehicle routing, we would represent the vertices and edges as systems of junctions and roads, as illustrated in Figure 1. When adding vehicles to the problem, it becomes challenging due to factors such as weather conditions, traffic congestion, and the state of the road. Choosing the correct algorithm is an issue for many current transportation navigation systems as there are numerous approaches developed to tackle this issue, each with its pros and cons.

**Figure 1.** Representation of a road network as a graph of vertices and edges.

Shortest path algorithms guarantee finding the optimal routing through exploring the whole set of available solutions [16]. One example of a shortest path algorithm is Dijkstra's algorithm, which finds the shortest path between two nodes in a graph [17]. The route is found by initially creating a set of nodes not visited, then beginning at the starting node and calculating the cost of movement to each node connected to the starting node [18]. After all neighbouring nodes have been considered, the starting node is then deleted from the nodes not visited set, and the next node is chosen as the one with the lowest cost of movement from the starting node [18]. These steps are then iterated until the destination node is deleted from the nodes not visited set or all nodes have been considered [18].

Heuristic-based shortest path algorithms explore available solutions and find an approximate optimal solution that is close to or the same as the optimal one [16]. The main heuristic-based approach developed is the A\* algorithm [19]. The difference between the

Dijkstra and A\* algorithm is that the latter introduces a heuristic. A heuristic is a function that is used to solve problems faster and when traditional problems fail to find a solution. In the case of A\*, the most popular method used for the heuristic calculates the distance from the node currently being evaluated to the end node, then using that cost, it decides which node to go to next.

In addition to A\*, another example of a heuristic-based approach is the genetic algorithm [20]. It is a meta-heuristic used to solve optimisation problems and is based on the principles of genetics and natural selection [16,21]. The genetic algorithm has been used in the shortest path problem and can be an approach to solving harder problems such as when vehicles have to visit all nodes in a large network [22].

The different algorithms for the shortest path problem have advantages that better suit them for specific scenarios. Heuristic-based approaches reduce computation time, but can be more resource dependent due to more memory usage for storing the heuristic. Dijkstra and A\* will always give the best route solution as long as A\* does not overestimate the heuristic [23]. Meta-heuristic optimisation approaches such as the genetic algorithm and tabu search are better suited for multi-location vehicle routing where the dataset is much larger.

#### *2.4. Electric Vehicle Routing*

When it comes to routing electric vehicles, the problem becomes even more difficult. Extra constraints when routing EVs make calculating a route more challenging than normal ICEVs. Firstly, the EV charging station infrastructure is still not there, with demand for chargers rising rapidly. The U.K. would need to install Charging Stations (CSs) five-times faster if it was to reach between 300,000 and 500,000 stations, which is required for 2030 with current EV projections [24]. Refuelling times of EVs are also a problem that needs to be factored in when routing. An EV can take between 26 h for the slowest chargers (alternating current chargers) and 6 min for the fastest chargers (direct current fast chargers) to add 100 mi to its range [25]. In addition, with the CS infrastructure not being there and the added issue of timely charging, their availability is also affected. With EV demand and consumption continually grow and government policy changes around the globe, the issue will only worsen without major changes.

Range anxiety, the fear of battery capacity depleting mid-trip, is a concern of EV drivers [26]. This is something that could be reduced with electric vehicle routing and progression in CS infrastructure. Additionally, conditions in the EV environment can affect the battery capacity such as the weather. A 2019 study found that an EV at 20 °F resulted in a 12% decrease in driving range, and when the Heating, Ventilation and Air Conditioning (HVAC) system was used, there was a 41% decrease. This could result in a need for more charges and will put a strain on CS availability at colder temperatures [27]. With these added constraints, a new comprehensive solution for electric vehicle routing needs to be developed.

#### **3. Related Works**

Several research works have been conducted on the EV routing problem in recent years. The authors in [28] investigated how to calculate a route for EVs based on stops at CSs if the current battery capacity was not enough to reach the destination, providing a route with the minimum travelling cost. Their method takes the EV range and CS locations and, using these, calculates a new route. When the current range of the EV is sufficient enough to reach the destination without the need for a refuelling stop, a route is calculated conventionally with the remaining capacity upon arrival. Meanwhile, when the starting range is insufficient, CSs based on the EVs range are selected as potential stops. Then, with the distance between CSs, estimated travel time, and charging time, the most cost-effective route is selected. Routes were created based on Dijkstra's algorithm and the appropriate CSs. The algorithm was then evaluated on a Japanese map with hypothetical CSs on the route, assessing execution time for selecting potential CSs and for conventional route searching with some of the selected CSs.

The obtained results showed that the point of interest search time, which is the execution time for selecting CSs and the route search time, was evidently higher for users needing to stop at CSs. However, the computation time can be seen as much faster and more accurate than manually planning CS visits on the route. Furthermore, their solution computes routes with accessible charging over a large network efficiently. A drawback of the solution is its failure to evaluate CSs further. Checking the availability and current capacity of CSs are things that could affect the journey times and distances that need to be travelled. Additionally, it does not take into account time delays such as traffic when evaluating routes.

In [29], the authors presented a routing solution for EVs focusing on energy efficiency. They modelled an EV with accurate energy consumption and then found the optimal route using a Bellman–Ford approach. They aimed to tackle the energy-efficient routing problem in its simplest form. They first modelled the energy consumption of an EV using parameters such as vehicle mass, gravitational acceleration, tyre rolling resistance coefficient, mass density, and the drag coefficient. Using this model, they computed the route from the start to the destination through the graph using the Bellman–Ford algorithm, finding the energy consumption between each node and making decisions on which path to take based on the least energy consumption from node to node. Their proposal was then simulated on various map sizes represented as graphs. From this, they found in large-scale maps that their approach was not scalable, taking 203 h on a graph with 270,780 edges, although on smaller-scale maps, it was effective, taking 0.128 s on a graph with 63 edges. Their solution was adequate and found routes based on energy efficiency for EVs in small networks with the Bellman–Ford algorithm working well for energy-weighted graphs. Furthermore, the EV energy model was an accurate representation of EV energy consumption. A downside of the model was its failure to highlight environmental issues such as the impact of weather conditions on the battery consumption speed. Another limitation to the routing proposal was that it did not take into account charging and CS selection when routing. As an extension to this solution, traffic conditions and vehicle remaining range could be considered when computing routing decisions.

Reference [30] developed a routing solution for Mobility on Demand (MoD) EV systems. MoD is a one-way vehicle sharing system, a promising way to reduce greenhouse gas emissions, and a sustainable solution for private mobility over the current reliance on a personal vehicles. They aimed to reduce the inconvenience surrounding MoD systems with the occasional customer needing to perform in-route charging and retrieve the optimal average trip time. The authors proposed a system of routing between multiple passenger stations while considering in-route charging and allocating passengers with fewer delay constraints to EVs needing to be charged. Using a multi-server, cloud-based infrastructure for connectivity through all components in the system, they calculated the routing probabilities of EVs to CSs and then made routing decisions based on these. Their model only considers EVs that need to be charged on the way to their destination. It was then simulated extensively using battery swapping to reduce excess charging delays and different system parameters. It was then evaluated against conventional shortest time decisions. The results from the simulations carried out showed a reduction in CS delays and trip times compared to other shortest time and random routing schemes. MoD systems could be a great implementation for private mobility using electric vehicles and may be a future system of transport to tackle population growth and climate change. The presented solution for routing and scheduling of vehicles in the system finds optimal solutions and would significantly reduce the frustration levels of customers that are forced to charge in-route.

A nearest-neighbour approach to EV routing, finding the most energy-efficient route, was proposed in [31]. This work aimed to develop a new routing solution for EVs taking into account vehicle battery capacity and CSs after the recent surge in the EV market share and the environmental benefits they bring with them. Their solution concentrates on

multi-node traversal where each node only can be visited once. Using Dijkstra's algorithm from each current node, they found the next nearest node in the graph. They iteratively performed this until each node had been visited once. For routing an EV, their solution checks whether the vehicle can make it to the next node or next CS without losing all charge, charging fully at each CS it visits, and again iteratively checking at each node whether the vehicle will make the journey to the nearest neighbour. This was then simulated using the coordinates of cities (nodes), finding the accurate optimal solution based on the shortest route between each city. The simulation results revealed accuracy when calculating an optimum routing path for EVs with charging taken into account. It also highlighted a good basic solution to multi-stop vehicle routing, with checks on vehicle current range and routing the vehicle via CS when the current battery capacity could not reach the next city (node). As an extension, the algorithm could have a better estimation of EV range to take in more vehicle parameters such as vehicle weight, front surface area, and propulsion efficiency. Furthermore, route constraints such as traffic and weather conditions could be incorporated into the algorithm to test its effectiveness against real-world scenarios. Furthermore, accessing the algorithm next time against more conventional routing solutions would give a better insight into how well it performs.

A routing and charging algorithm for an Internet of Electric Vehicles (IoEV) was proposed in [32]. Their solution allows routing to be calculated in a distributed manner by users and a system operator. They aimed to protect the anonymity of users and reduce the computational complexity of the system operator. Their algorithm selects an approximate path for each EV, then optimises the charging scheduling of the EVs based on the approximate path. This was then simulated extensively, comparing the solution with two other benchmark algorithms on a dataset that maps real-world data to nodes and edges from Washington DC, USA. Overall, the simulation results showed that the proposed routing solution outperformed the two conventional methods used in the simulation and always produced a near-optimal performance with low computational complexity. Using an IoEV is a promising way of tackling the NP-hardness and computational complexity of EV routing for larger systems with multiple destinations, such as delivery couriering. Having a centralised location for distributing EVs and scheduling them at CSs would also reduce queuing times at CSs and allow for improved selection. A downside of their proposal is the infrastructure needed to be put into place to get the system up and running, as it needs a centralised system to manage multi-car rerouting. To extend their implementation, we propose to incorporate CS availability into the decision-making, which could further decrease travel and wait times.

The authors of [33] proposed a shortest time path planning algorithm with an energy consumption warning method for EVs with insufficient battery capacity for their journey. They also used the Java Spark Parallelization framework [34] to reduce the computation time. It was designed to help EV drivers with the charging problem of slow charging times, small CS availability, and best CS to which to route. They first presented an energy warning model that monitors the energy consumption of the vehicle and, using its average speed and regression coefficients, issues a warning when the current battery capacity of the EV will not reach its destination. Then, a path planning algorithm was developed. They used Dijkstra's algorithm to find the shortest path from the current node to CSs and then to the destination, choosing the optimal CS to stop at, factoring in queuing and charging times. When calculating the shortest path, they also implemented Spark to compute the shortest path in parallel. This improved the efficiency of the algorithm. Their solution was then run through a real-world traffic network to test its effectiveness. The simulation results demonstrated how with the addition of Spark Parallelization, significant reductions were seen in the time taken to find the optimal route. Notably, when the number of nodes in the graph grew larger, the runtime of the algorithm dropped compared to small graphs, for example on a road network with 300 nodes, the computation time decreased from 1.2 s to 0.1 s. The implementation of synchronous computing in the routing algorithm is an encouraging feature for large pathfinding in road networks.

The authors of [35] presented a pathfinding solution to the Electric Vehicle Routing Problem (EVRP). They used the tabu search approach to multi-objective route planning for EVs and aimed to combat the issues of limited battery capacity and charging demands when routing these vehicles. They aimed to optimize routing for logistics services when using EVs as the issue becomes more prominent with major U.S. companies implementing fleets of these vehicles. The authors proposed a routing solution using tabu search, where the vehicle has multiple destinations to visit on its journey. Tabu search is an optimization technique that uses a meta-heuristic and a tabu list, which mimics the human memory function, blocking all areas that have been searched in a route to avoid detours. It begins by creating a random initial route, then from that searches for possible routes, compares each route until it finds the optimal one, taking into account the electrical charging demands of the EVs. Their proposal was then evaluated using the coordinates of locations, CSs, and the locations that need to be visited. The tabu search solution was then evaluated against another commercial routing algorithm. The obtained results, based on a routing for two different distances, highlight that the time taken for tabu search was significantly reduced, with no time increasing with distance increase, unlike the method used by the mathematic program software CPLEX. Overall, the proposed algorithm is a good solution to the routing problem using EVs with multiple stops. It has significant time reductions compared to other existing solutions and always finds the optimal route considering EV battery limitations. A potential improvement to this algorithm would be to develop a more sophisticated mechanism for CS selection, taking into account the availability and the efficiency.

#### *Comparative Study*

Each of the above-discussed works aimed to design an efficient routing solution for EVs. It is clear that all CS constraints need to be considered when deciding on which CS to route the EV through. The path planning method proposed by researchers at the Xi'an University of Technology [33] considers more CS constraints, such as vehicles' waiting and charging times, when making a decision, making the path calculated more optimal for an EV. Compared to earlier works, such as [28,29], where these constraints were not considered, this work allowed for better judgement on the true optimal route. Moreover, the mobile on-demand proposal includes a promising idea with the CS schedule, although this would, in turn, affect the privacy of drivers and their vehicles [30]. To further improve the above works, the inclusion of more constraints for CSs such as CS charging efficiency, price, and vehicles' waiting will ensure a greater accuracy in the computing of the optimal route. Table 1 compares the above works in terms of their complexity, achieved scalability level, overall effectiveness, in addition to whether they took into account CS attributes or not.



#### **4. Proposed Solution**

In this section, we present the key principle and detailed operation of our EV detour computation algorithm.

#### *4.1. Routing Process Design*

We propose a detour routing algorithm that attempts to find the optimal route for an EV taking into account the current vehicle range, route length (i.e., the remaining distance to the destination), and traffic conditions. Figure 2 shows a high-level overview of our algorithm.

**Figure 2.** Flowchart illustrating the main steps of our detour computation algorithm.

The process of finding a detour is initialized when the current location of the EV and the destination are input. A route is then calculated based on these two locations using the path searching technique described in Section 4.2. When evaluating each node, the stopping criterion is put in place to check whether the current EV range is sufficient enough for the current route length. This ensures that the range does not fall much below the minimum State of Charge (SoC), which was set by default to 10%, but it can be configured by the user to a different value. Having a minimum SoC threshold is essential to ensure that battery capacity never becomes too low, as low and high SoCs can have a direct effect on battery health and ageing [36]. In addition, this stopping criterion will reduce the computation time as calculating the full route would be unnecessary if the current battery capacity does not allow reaching the final destination. The EV range was computed by multiplying the SoC by a factor called metres per Watt-hour (*mWh*). mWh represents the energy consumed by the EV per metre. We computed this factor by running several simulations and computing the average value of *mWh*, as shown in Equation (1), for the category of the EV.

$$m\text{Wh} = \frac{d}{e} \tag{1}$$

where *d* is the distance driven by the EV and *e* is the total energy consumed. If a route reaches the end node without dropping below the minimum SoC, then this route is output back to the user. When it falls below the minimum SoC, then re-routing via a CS is initialized. A CS is selected following the technique described in Section 4.3. A route is then found from the start to the CS, again using the path search technique described in Section 4.2. Once the route is found, a new start point will be set after the CS location, and the algorithm iterates again from the beginning with the new start point until the destination is reached.

#### *4.2. Vehicle Routing Algorithm*

In our detour computation scheme, a graph-traversal algorithm is needed to calculate optimal routes for EVs. There are numerous methods developed in the literature for computing how a vehicle will traverse a road network, starting at one designated point and ending at another. As discussed in Section 3, several algorithms have been developed in graph theory to search for a path in a graph, typically the shortest one, such as Dijkstra, A\*, tabu search, genetic algorithm, and breadth-first traversal. The main aim of these algorithms is to find the optimal route, achieve faster computing, and provide the ability to incorporate other constraints than the distance, such as travel time, road safety level, and easiness of driving level, when routing.

#### 4.2.1. Chosen Path Search Algorithm

Upon evaluation of the algorithms used for graph traversal and vehicle routing, the A\* algorithm is the one being most used to traverse road networks and find an optimal route. A\* is a heuristic-based path finding algorithm that is considered an extension of the Dijkstra algorithm. A\* was our chosen algorithm due to various factors. Firstly, the use of a heuristic function benefits the solution, with the main benefit being faster computation times due to searching fewer nodes. This is beneficial when the number of nodes in a graph increases. In addition, when the heuristic is admissible (can never overestimate the cost to reach the goal), A\* is guaranteed to output the optimal path that has the least cost [37]. Moreover, the complexity of A\* compared to the meta-heuristic techniques such as tabu search and genetic algorithms is much lower, making it easier to implement and add custom constraints. Likewise, these techniques are better suited for multi-objective routing problems such as the vehicle routing problem and the travelling salesman problem, where the routing criteria and graph size are much larger.

4.2.2. Network Costs and Heuristic

Equation (2) shows the A\* path cost formula, which uses the minimum value for path selection.

$$f(n) = g(n) + h(n) \tag{2}$$

The term denoted as *g*(*n*) traditionally is the cost of movement from the start node to the current node (*n*) in the graph (the weight from node to node in the network). The term *h*(*n*) is traditionally the heuristic function, which estimates the cost of movement from the current node to the destination node. *h*(*n*) is usually calculated through the Euclidean distance, which is denoted in Equation (3), with p and q being the coordinates of the nodes in the graph [18].

$$d(p,q) = \sqrt{\sum\_{i=1}^{n} (q\_i - p\_i)^2} \tag{3}$$

When finding a path for vehicle routing, using the traditional methods for A\* will not suffice. This is due to more real-world constraints such as traffic affecting routing choices and finding the shortest path will only find the optimal shortest solution. Instead, our goal was to minimize the travel time of the vehicle routing, changing the traditional cost values for *g*(*n*) and the heuristic function *h*(*n*) from Equation (2) to fit these criteria.

$$\mathbf{g}(n) = \frac{l(n)}{s(n)}\tag{4}$$

$$h(n) = \frac{d(n)}{m(n)}\tag{5}$$

Equation (4) denotes the new value of *g*(*n*), which is the travel time from the start node to the current node (*n*) in the graph. This is calculated by dividing the length from the start node to the current node, which is shown as *l*(*n*), by the mean edge speed in the last time step for the same nodes, which is denoted as *s*(*n*). Equation (5) denotes the new heuristic function formula for the value *h*(*n*). *d*(*n*) represents the Euclidean distance calculation used in the traditional A\* heuristic function. This is then divided by *m*(*n*), which is the max speed of any edge in the network. Using the max speed of any edge in the network allowed us to never overestimate the cost to reach the goal for the heuristic, making it admissible and giving us the optimal route.

#### *4.3. Charging Station Selection*

The selection of the optimal CS is an important step in our proposed detour computation scheme. Figure 3 depicts a visual representation of our CS selection. Various parameters were considered when deciding at which CS the vehicle should refuel. Therefore, this makes it a Multiple-Attribute Decision-Making (MADM) problem. There are numerous methods developed to help make optimal decisions, and the technique we used was Simple Additive Weighting (SAW). Selection begins by obtaining all the CSs in range of EV current battery capacity and then deciding on the optimal one with the SAW method. The centre point of the range is first defined as the node from which the initial route calculation dropped below the minimum SoC. If no CSs are found from there, the node changes to the starting point if the search node is not initially that. A goal capacity at the end can also be defined, which outlines the preferred capacity when routing is complete, which will be accounted for when calculating the duration to charge for at the CS.

**Figure 3.** Illustration of our proposed charging station selection mechanism.

#### 4.3.1. Simple Additive Weighting

SAW is one of the most popular and best-known MADM techniques used [38]. It uses a weighted sum of all attributes for each instance of objects and compares the total of each, with the higher overall weighted sum being the better choice [39]. To begin, each attribute value needs to be normalized for each CS, making each value within a common scale so values with more extreme ranges do not influence the end summation. There are many different techniques for data normalization such as linear, min–max, vector, and logarithmic normalization. A 2007 comparative study on normalization procedures in MADM found that vector normalization is the most suitable for SAW [38].

$$r\_{ij} = \frac{\mathbf{x}\_{ij}}{\sqrt{\sum\_{i=1}^{m} \mathbf{x}\_{ij}^{2}}} \tag{6}$$

$$r\_{i\bar{j}} = 1 - \frac{\mathbf{x}\_{i\bar{j}}}{\sqrt{\sum\_{i=1}^{m} \mathbf{x}\_{i\bar{j}}^2}} \tag{7}$$

Equation (6) shows the formula used to normalize the data using beneficial vector normalization, and Equation (7) shows non-beneficial vector normalization. The beneficial formula is used when the attribute's value aims to be higher, and the non-beneficial formula is used when the value desired is lower. Once the data have been normalized, each value can then be multiplied by its weighting value.

$$w\_{\dot{l}} = \sum\_{j=1}^{n} w\_{\dot{l}} \ast r\_{\dot{l}\dot{j}} \tag{8}$$

Weightings are determined by how much the given parameter matters when making a decision, and they all have to add up to 100%. Equation (8) depicts how the score for each CS, based on SAW, is computed, where *i* represents the index of the CS, *v* is the overall score, and *j* refers to the index of the CS parameter. *r* holds the added score of the CS parameters, and *w* is the weighting value for the given parameter. Parameters for each CS are multiplied by its weighting, then each are summed together for its overall score.

#### 4.3.2. Charging Station Decision Attributes

Deciding on which CS to route the EV to requires the decision attributes used in the SAW to be defined. Table 2 shows the parameters used in SAW. The distance from the search attribute is the straight line distance from the current CS search node to the CS, computed using the Euclidean distance. The distance from the divider attribute is the straight line distance from a line that connects the current node and the end node, which highlights whether the CS is in the right direction. Figure 3 shows a visual representation of how the distances work in context with the CSs in the vicinity of the EV's current range. Refuelling price, the number of vehicles charging, and the charging efficiency are CS properties used as attributes in SAW as well. Charging efficiency refers to the kilowatts gained by the EV battery per time step from the CS.

**Table 2.** Charging station attributes for SAW MADM.


#### **5. Performance Evaluation**

In this section, we evaluate the performance of our proposed solution, using Simulation of Urban MObility (SUMO) [40], which is an open-source, highly portable, microscopic, and continuous multi-modal traffic simulation package, and analyse the obtained results. The detour computation scheme was assessed on a number of simulated test scenarios using different weighting metrics and a baseline routing algorithm.

#### *5.1. Evaluation Configuration*

#### 5.1.1. Creating Test Data

The real-time interaction, including simulation initialization, with SUMO can be achieved through TraCi and Python [41]. To collect meaningful and reproducible results, SUMO needs to be run multiple times. To this end, we ran our simulations 10 times for each of the parameters listed below in Section 5.1.3.

SUMO uses seed values to ensure randomness in the simulation, which can be reproduced when the same seed value is run again. This will ensure that results from the different parameter variations and the baseline algorithm can be compared correctly. Fifty EVs were introduced into each simulation scenario with randomly assigned start and end nodes in the network to allow a variety of results for comparison. The random start and end nodes were controlled again by the SUMO seed. The maximum battery capacity of the vehicles was set to 10,000 Wh.

Once the iterations of the simulations are finished, a CSV file is output for analysis. SUMO has default output XMLs that show vehicle and simulation information from each time step and an overview of each. A Python function was built that output the data needed at the end of the simulation to a CSV file. This file consisted of the parameters used, the EV distance travelled, the EV routing travel time, the number of CS stops, the duration spent at each CS stop, the algorithm runtime, the EV battery capacity at the end of the simulation, the start and end nodes used by an EV, whether the algorithm was used, and whether the vehicle had reached its destination before its battery capacity ran out.

#### 5.1.2. Evaluation Metrics

Once all the data were found for each iteration of the simulation, the data were collated for comparison. For the evaluation against the baseline routing algorithm, two metrics were needed.

$$ABE = \frac{\sum\_{i=1}^{n} b\_i}{n} \tag{9}$$

Equation (9) above highlights how the average battery capacity at the end (*ABE*) of the simulation for the EVs was calculated. *n* is the total number of EVs in the simulation, and *b* is the battery capacity at the end of its journey. This was used to compare the end capacities for vehicles routed by our proposed detour computation scheme and the baseline algorithm. Having an ABE around the defined value of the goal capacity at the end of the journey highlights that the proposed routing algorithm is efficient in battery health monitoring.

$$\%V\text{CJ} = \frac{\sum\_{i=1}^{n} c\_i}{n} \ast 100\tag{10}$$

Equation (10) depicts the formula to obtain the percentage of vehicles that have completed the journey before the battery is empty (%*VCJ*). *n* again is the total number of EVs in the simulation, and *c* represents whether the EV completed the journey before its battery is empty. This was used again when comparing the baseline algorithm with our proposed detour computation algorithm and showed the success of the algorithm in routing the EV.

#### 5.1.3. Evaluation Parameters

Firstly, an evaluation was carried out on different values for the SAWs, which aligned with what users would define when using the algorithm in real-world scenarios. Table 3 highlights the different SAWs used in the evaluation. The first four weightings give importance to the type of attribute they represent. Weighting A splits the two distance parameters' importance between them. B, C, and D each give the importance to the price, the number of vehicles charging, and the overall charging efficiency of the CS, respectively. The last gives equal weighting values to each parameter.



Next, we evaluated our algorithm against a SUMO baseline routing algorithm. Using the "—noalg" option when running the Python script allowed the routed vehicle to be run without our proposed scheme and use the default SUMO routing algorithm (i.e., standard Dijkstra) [42]. The baseline routing algorithm has no options for EV charging, and so it will run until the battery is empty. Comparing the two algorithms highlighted the effectiveness of our proposed scheme in reducing the range anxiety (i.e., ensuring that the chosen detour will enable the EV to reach its destination without the need for recharging or its chosen route includes a CS where the EV can recharge its battery) of EV drivers.

Each of the different SAW weightings and the baseline routing algorithm were run using three different starting values for the EV's actual battery capacity, 500 Wh, 1250 Wh, and 2250 Wh. This gives a value under the default SoC threshold at 5%, just above it at 12.5%, and a value higher at 22.5%. Using these different capacity values gave us an idea of how each would affect routing and CS selection because both would be initialized at different stages due to the CS search node.

#### *5.2. Evaluation Scenarios*

#### 5.2.1. Grid Road Network Scenario

The first simulation scenario was the grid road network, which was created to show how the detour computation scheme works within a simple road network layout. In addition, this scenario highlights how an EV can benefit from using our proposed algorithm and the positive results it outputs even on a smaller scale.

Figure 4 illustrates the 3 × 3 grid road network within the SUMO GUI. The grid was built using the netedit tool and was a small-scale replica of a grid road network that is used in big cities around the world such as New York and Barcelona. It had four CSs, highlighted in light blue, added in different parts of the grid for EVs to consider when routing using our proposed scheme. The simulation took advantage of the "randomTrips" SUMO tool and generated random vehicles with a defined route to simulate a realistic traffic scenario. EVs were generated in increments of ten time steps to route from two random nodes until fifty EVs were introduced in the simulation.

**Figure 4.** Example of the 3 × 3 grid road network within SUMO.

Figure 5 highlights the achieved travel time under different SAWs as defined in Table 3. The results showed a greater travel time for a starting battery capacity of 500 Wh compared to the other two. This was due to having a battery capacity lower than the default SoC threshold at 10% and needing to stop at a CS to recharge the battery to increase its capacity above this threshold. Upon comparison of the different weightings used, a starting battery capacity of 500 Wh was the only one we could make a good comparison of due to the grid road network being small, which simulated shorter trips for EVs where the need for recharging the battery is low. Weighting A, which weights towards CS distance, performed best out of the five weightings due to having a lower median and smaller spread for its Inter-Quartile Range (IQR), making it more consistent in achieving a lower travel time for EVs. The next best was the weightings for E due to the slightly lower spread for its IQR and median, then B was slightly behind, but it had less outliers and extreme values. Lastly, C and D were found to be the least effective in reducing the travel time of an EV. Overall, this showed that on a smaller road network, giving importance to distance when selecting a CS yields the best outcome and that waiting times at the CS increase the travel times the most.

**Figure 5.** The achieved travel time under varying the weightings: the case of the grid road network.

The 3D scatter graph shown in Figure 6 depicts the CS stop durations needed for different starting battery capacities in the grid road network scenario. It shows how these two metrics affect the remaining battery capacity when the EV reaches its destination and the overall vehicle travel time. Furthermore, it highlights how charging is needed when the starting battery capacity is below the threshold at 500 Wh, which in turn increases the CS charging duration and thus the overall travel time. Moreover, at 500 Wh, it kept the remaining battery capacity above the default goal capacity at the end, which was 10%, although there were a few outliers with the remaining capacity being over 20%. The occurrence of outliers here was due to the overestimation of the range value and increases in the braking of vehicles in route, enabling regenerative braking of the EV and battery capacity gains. Under a starting battery capacity of 1250 Wh, the plotted results show that a few CS stops only were needed because the network was smaller and only dipped below the capacity threshold a few times. In the case of a starting capacity of 2250 Wh, no CS stop was needed due to the fact that the battery capacity never fell below the end goal, keeping the travel time low.

According to these results, we can conclude that our scheme performed well and as expected in the grid road network scenario. In addition, the overall goal end battery capacity was met with the exception of a few outliers, maintaining the battery health.

Lastly, the performance of our detour computation scheme was compared against the SUMO baseline routing algorithm. The comparison results in terms of the achieved %VCJ and ABE are shown in Table 4. This table exhibits the results obtained from running the simulation ten times with the three starting battery capacities for the baseline routing algorithm and our proposed scheme, calculating the metrics defined in Section 5.1.2 for each of them. In every instance, every vehicle completed its journey without draining its battery. This was because the EV grid was a smaller network and the routes were shorter in length. The differences in the data here were the ABE values; starting capacities of 500 Wh and 1250 Wh had ABE SoC values of 11.4% and 11.5% when the detour computation scheme was used, and only 3.3% and 8.7% when it was not. This highlights how our EV detour scheme was successful in achieving its goal of maintaining battery health and keeping the SoC above the end goal. Again, due to the size of the used grid, a starting capacity of 2250 Wh did not show much difference change in the results because the need for CS selection and stops was not there. However, the slightly higher ABE indicated that travel-time-based routing performed better than the distance-based routing used in the baseline in retaining the battery capacity.

**Figure 6.** The achieved travel time under varying starting battery capacities and CS stop durations: the case of the grid road network.

**Table 4.** Our detour computation scheme vs. the SUMO baseline routing algorithm: the case of the grid road network.


5.2.2. Manchester Road Network Scenario

Once the EV grid was created and evaluated, a larger-scale road network representing Manchester's city centre was produced for evaluation. Figure 7 shows an illustration of such a road network using the SUMO GUI.

The Manchester scenario was generated using *OSMWebWizard* and mimicked the road network of the city centre of Manchester in the U.K. Within *OSMWebWizard*, there is the demand generation feature, which allows the random generation of different modes of transport on the network. The Manchester SUMO simulation includes cars, trucks, buses, motorcycles, cyclists, and pedestrians.

**Figure 7.** Illustration of Manchester's city centre road network within SUMO.

The box plots in Figure 8 illustrate the travel times achieved for the different weightings discussed in Section 5.1.3, under three different starting battery capacities, using the Manchester road network. For the highest starting battery capacity, 2250 Wh, there was no need for CS stops due to the battery capacity not dropping below the threshold. The travel times were similar due to this, with the median and IQR spread being around the same values. Following the previous EV grid simulation, when the starting battery capacity was set to 1250 Wh, Weighting A (giving importance to distance) performed better with C and D just behind. With weighting importance towards distance, the overall spread, median, and IQR were better than the others at 1250 Wh and achieved more consistent results. When the starting battery capacity was set to 500 Wh, Weightings A and E came out with similar results. The only difference between the two was Weighting A having a slightly smaller IQR and spread, making the results more consistent. Overall, the results from comparing the travel times and different weightings for the two simulations were comparable. Weighting importance on distance had the best-performing results in the reduction of travel time when making a CS selection decision with equal weightings coming just behind that.

Figure 9 shows a 3D scatter graph comparing the remaining battery capacity at the end of the simulation, with the CS re-charging duration and overall travel time of the EVs' journey. When the vehicles starting battery capacity was set to 500 Wh, similar to the EV grid scenario, the CS stop duration and travel time increased due to the SoC being below the default threshold at 5%. A starting capacity of 1250 Wh had similar results in that the CS stop duration rose due to the network being larger and routes needing higher battery capacity to complete. However, the duration was less for a 1250 Wh starting capacity compared to the 500 Wh values because of the higher capacity at the start and less re-charge time required. The travel time outliers for 1250 Wh may correlate with the traffic congestion being high at the different times when CS re-charging ends at 500 Wh. Most of the simulation points had CS stop durations and travel times just below the values for 500 Wh. Finally, the remaining capacities at the end mostly equated to or were just above the default goal capacity at the end, reflecting successful management of battery health. The outliers here with remaining capacity were due to the same reasons as the EV grid with the overestimation of the range or capacity gains from regenerative braking.

**Figure 8.** The achieved travel time under varying weightings: the case of the Manchester road network.

**Figure 9.** The achieved travel time under varying starting battery capacities and CS stop durations: the case of the Manchester road network.

Table 5 highlights how the baseline routing algorithm performed for the EVs in the simulation compared to the detour computation scheme under the Manchester road network. For starting capacities of 500 Wh and 1250 Wh, only 55% and 91% of vehicles completed the journey without running out of charge, compared to 99.4% and 100% when the algorithm was used. When the algorithm was used for 500 Wh, three out of fivehundred vehicles evaluated with these criteria did not make the journey, making the %VCJ 99.4%. Upon evaluation, this was down to the range estimation not estimating the range correctly when vehicles were travelling on faster roads and the battery capacity starting as a low value. Further work can be performed for range estimation of the proposed solution, predicting the range for each individual EV through its runtime instead of using a

previous simulation. In addition, the average battery capacity at the end was greater for both capacities when the proposed algorithm was used, supporting battery health. These results highlight the benefits of using our detour computation scheme, specifically aiding in the reduction of the range anxiety of EV users and overcoming the limitations of current EVs such as the finite amount of CSs and restricted battery capacities.

**Table 5.** Our detour computation scheme vs. the SUMO baseline routing algorithm: the case of the Manchester road network.


#### **6. Conclusions**

This paper proposed a new detour computation scheme for EVs with the aim to alleviate the range anxiety issue of EV drivers, reduce traffic congestion, and make EVs more appealing to drivers to increase their market share. Towards that end, we designed an adapted version of A\* algorithm, which uses travel-time-based path finding instead of the distance, and used the simple additive weighting method for charging stations selection. The performance evaluation results and their analysis, using two representative road network scenarios, proved the effectiveness and feasibility of the proposed scheme.

**Author Contributions:** Conceptualization, C.M. and S.D.; methodology, C.M.; software, C.M. and J.H.; validation, C.M., J.H., S.D. and A.N.; formal analysis, C.M., J.H., S.D. and A.N.; investigation, C.M.; resources, S.D.; data curation, C.M.; writing—original draft preparation, C.M. and J.H.; writing—review and editing, S.D. and A.N.; visualization, C.M.; supervision, J.H. and S.D.; project administration, S.D. All authors have read and agreed to the published version of the manuscript.

**Funding:** This research received no external funding.

**Institutional Review Board Statement:** The study was conducted in accordance with the Declaration of Helsinki, and approved by the Institutional Review Board (or Ethics Committee) of Manchester Metropolitan University (EthOS approval number 26136 on 12 October 2020).

**Informed Consent Statement:** Not applicable.

**Data Availability Statement:** Not applicable.

**Conflicts of Interest:** The authors declare no conflict of interest.

#### **References**


## *Article* **A Novel Power Market Mechanism Based on Blockchain for Electric Vehicle Charging Stations**

**Zhaoxiong Huang 1 , Zhenhao Li 1 , Chun Sing Lai 1,2 , Zhuoli Zhao 1, \*, Xiaomei Wu 1 , Xuecong Li 1, \*, Ning Tong 1, \* and Loi Lei Lai 1, \***


**Abstract:** This work presents a novel blockchain-based energy trading mechanism for electric vehicles consisting of day-ahead and real-time markets. In the day-ahead market, electric vehicle users submit their bidding price to participate in the double auction mechanism. Subsequently, the smart match mechanism will be conducted by the charging system operator, to meet both personal interests and social benefits. After clearing the trading result, the charging system operator uploads the trading contract made in the day-ahead market to the blockchain. In the real-time market, the charging system operator checks the trading status and submits the updated trading results to the blockchain. This mechanism encourages participants in the double auction to pursue higher interests, in addition to rationally utilize the energy unmatched in the auction and to achieve the improvement of social welfare. Case studies are used to demonstrate the effectiveness of the proposed model. For buyers and sellers who successfully participate in the day-ahead market, the total profit increase for buyer and seller are 22.79% and 53.54%, respectively, as compared to without energy trading. With consideration of social welfare in the smart match mechanism, the peak load reduces from 182 to 146.5 kW, which is a 19.5% improvement.

**Keywords:** blockchain; double auction; electricity trading; smart match mechanism

#### **1. Introduction**

Several countries have maintained an optimistic attitude towards electric vehicles (EVs) in recent years to reduce air pollution and to make traveling affordable [1]. In China, the government has planned for the development of EV industry, aiming for 5 million EVs by 2020, with more than 4.8 million decentralized charging stations added [2]. In the USA, it is foreseen that the power load curve will rise significantly (about 18%) under the large-scale access of EV [3]. However, there are still some deficiencies in the development of EV technology in, such as charging facilities, battery capacity, charging time, and other technical problems [4,5].

At present, with the development of charging and discharging technology, the electricity exchange problem between EVs and the power grid, or among EVs, has attracted public attention. The charging and discharging behavior of EVs has a great impact on the power system stability and power market operation. For example, during the peak period of charging, the load curve shows a sharp peak, which aggravates power imbalance, and further affects the market electricity price. The development of charging technology and energy storage technology lays a foundation for the achievement of vehicle to grid (V2G) [6–9] and vehicle to vehicle (V2V) [10,11]. Reference [11] shows that the electrical energy storage will generate a higher profit if it is cycled more frequently (hence, a higher lifetime electricity output) although the lifetime is reduced due to degradation. Many topics

**Citation:** Huang, Z.; Li, Z.; Lai, C.S.; Zhao, Z.; Wu, X.; Li, X.; Tong, N.; Lai, L.L. A Novel Power Market Mechanism Based on Blockchain for Electric Vehicle Charging Stations. *Electronics* **2021**, *10*, 307. https:// doi.org/10.3390/electronics10030307

Academic Editor: Juan M. Corchado Received: 23 December 2020 Accepted: 21 January 2021 Published: 27 January 2021

**Publisher's Note:** MDPI stays neutral with regard to jurisdictional claims in published maps and institutional affiliations.

**Copyright:** © 2021 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (https:// creativecommons.org/licenses/by/ 4.0/).

are also carried out on the V2G and V2V, some of which have improved the transaction rules [12], discussed behavior planning from the perspective of EV owners [13,14], and considered the economic planning from the perspective of aggregators [15–17]. However, these methods cannot change the traditional centralized management pattern and do not give EV owners sufficient autonomy. Usually in these methods, EV owners only have the right to decide whether to participate in the charging process, but they do not reflect their specific needs, such as price sensitivity, charging urgency, and so on. In the transaction model proposed in this paper, the profit of EV owners will be fully considered and reflected in their bidding price.

Therefore, the effective management of EV owners' charging behavior not only can avoid the sharp load curve, but also improve transaction benefits and social welfare. This can reduce load peak. As an important topic to guide consumers' behavior, the minimization of price is discussed considering different aspects, such as the randomness of consumers' behavior [18,19], the form of cooperation or non-cooperation game [20–22], the load dispatch in smart building, including EVs, photovoltaic and controllable air conditioner loads [23,24], and so on. By relating all the cost and benefits with common parameters such as the number of charging piles, [25,26] offer a practical solution for the planning of the station size, and the solution balances the requirements between the customers and economic efficiency. In addition, the policy which encourages the discharging behavior can also reduce negative impact on the power system. Appropriate encouragement strategies for sellers can improve the situation that demand exceeds supply and can stimulate the competitiveness of the market. Proof of work about energy contribution, proposed in [27], is an important index of subsidy distribution for sellers. According to the above references, the charging and discharging behavior of EVs is characterized by greater uncertainty, and proper guidance and planning may bring positive impact to the grid. In a Delaware EV project reviewed in [28], an EV aggregator acts as an intermediary firm between PJM and flexibility service for EVs. This aggregator sells a certain amount of capacity to the grid operator and bids this in the hourly auction for frequency regulation and for the available power capacity. Such a distributed structure is comprehensive and worth considering. In addition, the establishment of a reliable communication network can also facilitate transactions between EVs [29,30].

With the reform of the power system [31], the energy transaction of the distribution network has become a new direction of development. In addition to the EV energy transaction, other forms of energy transaction are also considered in [32,33]. However, privacy and anonymity are a difficult problem in distributed transactions. This paper takes this into account and uses blockchain technology to encrypt information of users. The development of smart meters [34], low power wide area network [35], dynamic wireless charging [36], and other technologies of Internet of Things have made distributed transaction technologies such as blockchain possible. After the boom of bitcoin in recent years, the concept of blockchain has gradually penetrated into different fields. In the power system, blockchain generally appears together with the P2P transaction. Reference [37] also explains the importance of blockchain in P2P transaction. Getting rid of shackles from the traditional mode, the power system with blockchain can manage distributed energy more effectively. For example, credit bank [27], EV [38,39], demurrage mechanism [40], or demand side management [41] are added to the framework of blockchain, all of which have a positive impact on the distributed management of the power system. Blockchain also enriches the transaction forms of the power market, such as double auction [42], peer-to-peer (P2P) [43], energy transaction for multi-microgrids and internal microgrid [44], etc. Meanwhile, smart contracts have been applied in the power system, because of its fairness, low-cost, and efficiency. To ensure the safety of the transaction, smart contracts were introduced into the energy exchange of EV in [45]. These studies show that blockchain changes the original centralized management of systems and avoids the risk of attack on central institutions. In the studies reviewed in [46], P2P trading is an important example of blockchain in the energy exchange. According to research proposed there, some home-level

objects, including EV and other smart facilities, will participate in a distributed transaction. However, distributed transactions generally take place in small communities or microgrids, but how to integrate with the grid is also a key point. This paper will discuss the interaction between EV and grid.

Because the system does not require an authoritative third party after using blockchain, there is a potential danger in the security. For an information leakage problem, [47] improved the confidentiality mechanism in the blockchain. For collusion behavior, [48] proposed a blockchain-based coordination platform via Ethereum, to alleviate the harm caused by this behavior to some extent.

The simple double auction model and smart match model were proposed in [49]. Compared with the previous work, this paper proposes a more comprehensive double auction model, and adds the transfer strategy of charge and discharge behavior to the smart match. Moreover, this paper will also introduce the combination of blockchain and trading mechanism in detail. Due to blockchain technology, transaction data is in public. Therefore, participants can receive more current or historical information from the blockchain, which is helpful for participants to make decisions for more revenue. In the framework proposed in this paper, EV owners will evaluate their own interests to make a quotation and decide to take part in the double auction or not. EV owners will select to sign smart contracts and schedule their charging strategies based on considering operation cost, satisfaction of EV users, and social welfare. Blockchain is used to combine with the auction mechanism in this paper. On one hand, the inclusion of blockchain guarantees the security of transactions after the removal of third-party notarization. On the other hand, the auction mechanism increases the competition in the electricity market and avoids the vicious bidding. At the same time, the proposed mechanism allows EVs owners to choose an optimal price to enter the market based on their own characteristics (such as price sensitivity and charging urgency), to have a greater variety of choices.

The contributions of this paper are summarized as follows:


The rest of this paper is organized as follows. Section 2 introduces the framework of trading mechanism. Double auction mechanism and smart match mechanism are introduced in Sections 3 and 4, respectively. In Section 5, the case study is conducted to illustrate the effectiveness of the proposed model. Conclusion and future work are drawn in Section 6. The derivation of optimal bidding strategy function and proof of bidding price are presented in the Appendices A and B, respectively.

#### **2. Framework of Trading Mechanism**

*2.1. Charging Token Based on Blockchain*

For the proposed energy trading, an exclusive token named Charging Token will be circulated to ensure trading security by using blockchain technology. Charging Token is applied in EVs' trading and obtained in two ways, namely, selling energy and cashing with CSO.

The mechanism of Charging Token is partly similar to Bitcoin, which is embodied in the token storage and transmission technology, the construction and encryption method of electronic wallets. The system will create hash value for the username and wallet address to ensure security of trading when a participant enters into the market successfully. After every trading is completed in RTM, the value of Charging Token of all participants will be updated and recorded in blockchain.

#### *2.2. Charging Token Based on Blockchain*

In RTM, contract violation is taken into consideration. EVs affected by violation are those that have been matched successfully in the DAM but are affected by the defaulters in RTM. These people have successfully matched with other participants in the DAM and uploaded the transaction content to the blockchain. However, other participants may violate in RTM, which will affect their trading behavior. For those affected by violation, the mechanism necessarily ensures that their economical loss is reduced to a relatively low level or even zero. For those violating the contract, the punishment will be conducted, which effectively prevents some participants from profiting by deliberately violating the contract.

With the above considerations, EV users who are willing to trade, need to hand in an entrance fee when they enter the day-ahead part. The entrance fee, which is a form of deposit, is fixed for the duration of an EV's whole trading process, unless this EV owner breaks the contract.

When contract violation occurs, the compensation money will be obtained directly from the defaulter's entrance fee and will be transferred to the electronic wallet of affected EV or CSO. EVs affected by violation will trade with CSO in RTM.

#### *2.3. Trading Process*

The trading process includes DAM and RTM. DAM is cleared by the double auction mechanism among EVs and smart match mechanism between CSO and EVs. The EVs that fail to match in DAM needed to enter RTM and trade with CSO at the RTM clearing price (RTM-CP). For buyers, RTM-CP is generally higher than DAM's clearing price. For sellers, RTM-CP is generally below the DAM's clearing price. The framework of the whole trading process is depicted in Figure 1.


**Figure 1.** Framework of the proposed model.

When the blockchain technology is combined with the power system, the system will present a decentralized structure, avoiding the security risk brought by the centralized structure. Some security vulnerabilities are unavoidable in blockchain, so the system needs to face attacks against these vulnerabilities. Fortunately, blockchain has a decentralized structure. When a node is attacked, the system is not severely affected. In addition, blockchain can be used to protect the information of users. In addition, blockchain uses cryptography and other security tools to design different data information storage and processing methods. Blockchain also has traceability and non-tampering, so the information uploaded to blockchain is almost impossible to modify. These security features can guarantee the private data will not be disclosed.

#### **3. Optimal Bidding Strategy in Double Auction Mechanism**

When EV owners are willing to participate in electricity trading at a certain time, they must choose the role to play in the trading, i.e., buyer or seller. Auctions, including double auction, are generally an incomplete information game for participants. In other words, the participants do not have all the characteristics, and payment functions, etc., about other participants, and the uncertainty can be represented by probability distribution mathematically. Figure 2 is the schematic diagram of double auction in this mechanism. As shown in Figure 2, when buyer r and buyer s make the same bidding price, their ranking sequence will take into account their credit degree. The credit degree takes into account the number of violations in previous transactions. When an EV violates the transaction content in blockchain, CSO has the right to upload the content that records EV's reduction

of credit degree to blockchain. Bidding strategy is vital in the double auction. The optimal bidding strategy is as follows.

**Figure 2.** Double auction mechanism.

#### *3.1. Optimal Bidding Strategy for Buyer*

Firstly, buyer i has an evaluation price of electricity *λ* val *i* , which is used to estimate his rank expectation (denoted as *m<sup>i</sup>* and *n<sup>i</sup>* ) in the double auction mechanism. From Figure 2, it can be found that *m<sup>i</sup>* and *n<sup>i</sup>* ultimately determine the buyer's matching results, which include three situations, that is, full trading, partial trading, and unsuccessful trading. In other words, the higher rank expectation is, the more advantage the buyer i has in double auction. *m<sup>i</sup>* and *n<sup>i</sup>* can be solved by the following equations:

$$m\_i = m(\lambda\_i^{\text{b,val}}) = \sum\_{k=1, k \neq i}^{NB} P(\lambda\_k^{\text{b,bind}} > \lambda\_i^{\text{b,bind}}) \cdot \mathcal{Q}\_k^{\text{b,bind}} \tag{1}$$

$$m\_i = n(\lambda\_i^{\mathbf{b}, \text{val}}) = \sum\_{k=1, k \neq i}^{NB} P(\lambda\_k^{\mathbf{b}, \text{bid}} > \lambda\_i^{\mathbf{b}, \text{bid}}) \cdot Q\_k^{\mathbf{b}, \text{bid}} + Q\_i^{\mathbf{b}, \text{bid}}.\tag{2}$$

After determining *m<sup>i</sup>* and *n<sup>i</sup>* , the buyer i will determine the probability of its matching state. Set *a* as the auction breakpoint and *o* as the value of the breakpoint *a* on the x axis. It can be seen in Figure 2, when *n<sup>i</sup>* is less than *o*, the buyer i will match successfully in the double auction mechanism, and when *m<sup>i</sup>* is greater than *o*, the buyer i will fail to match. In other cases, buyers can only get less electricity than what they bid for. Therefore, the probability of the above three cases can be expressed as *P*(*n<sup>i</sup>* < *o*), *P*(*m<sup>i</sup>* > *o*), and *P*(*m<sup>i</sup>* < *o* < *ni*), respectively:

$$\lambda\_i^{\mathbf{b},\mathbf{b}\mathbf{id}\ast} = \operatorname\*{argmax}\{ \left| \mathbf{E}(\frac{|o-m\_i|}{n\_i - m\_i} \Big| m\_i < o < n\_i) \cdot \mathbf{P}(m\_i < o < n\_i) + \mathbf{P}(n\_i < o) \right| \cdot Q\_i^{\mathbf{b},\mathbf{b}\mathbf{id}} \cdot (\lambda\_i^{\mathbf{b},\mathbf{val}} - \lambda\_i^{\mathbf{b},\mathbf{b}\mathbf{id}}) \},\tag{3}$$

where *E*( |*o*−*m<sup>i</sup>* | *ni*−*m<sup>i</sup> m<sup>i</sup>* < *o* < *ni*) represents the expected ratio of buyer i's successfullymatched quantity to their whole demand, when *m<sup>i</sup>* is less than *o* and *n<sup>i</sup>* is greater than *o*.

According to the above planning problem for buyers, set the bidding strategy function *λ* b,bid *<sup>i</sup>* = *φ*(*λ* b,val *i* ) and *P<sup>b</sup>* (*λ* b,bid *i* ), and the latter transforms the original function into the following expression:

$$
\lambda\_i^{\mathsf{b,bid}\_{\cdot \cdot}} = \arg\max(P\_b(\boldsymbol{\phi}^{-1}(\boldsymbol{\lambda}\_i^{\mathsf{b,bid}})) \cdot Q\_i^{\mathsf{b,bid}} \cdot (\boldsymbol{\phi}^{-1}(\boldsymbol{\lambda}\_i^{\mathsf{b,bid}}) - \boldsymbol{\lambda}\_i^{\mathsf{b,bid}})).\tag{4}$$

The simplified planning problem is similar to the form in Reference [50]. Through the derivation reported in Reference [50], the expression of the optimal bidding strategy function can be obtained and is given as below:

$$
\phi(\lambda\_i^{\text{b,val}}) = \lambda\_i^{\text{b,val}} - \frac{\int\_0^{\lambda\_i^{\text{b,val}}} P\_\mathbf{b}(\mathbf{x})d\mathbf{x}}{P\_\mathbf{b}(\lambda\_i^{\text{b,val}})}. \tag{5}
$$

Appendices A and B shows the derivation of optimal bidding strategy function and provides the proof that the optimal bidding strategy function above to maximize earnings of buyer *i*, i.e., the optimal solution to the planning problem.

#### *3.2. Optimal Bidding Strategy for Seller*

The optimal bidding strategy from the seller's perspective is similar to that of the buyer.

The rank expectation of seller *j* (denoted as *p<sup>j</sup>* and *q<sup>j</sup>* ) is expressed as follows:

$$p\_{\bar{j}} = p(\lambda\_{\bar{j}}^{\text{s,val}}) = \sum\_{k=1, k \neq j}^{NS} P(\lambda\_k^{\text{s,val}} < \lambda\_{\bar{j}}^{\text{s,val}}) \cdot Q\_k^{\text{s,bid}},\tag{6}$$

$$q\_{\rangle} = q(\lambda\_{\text{j}}^{\text{s,val}}) = \sum\_{k=1, k \neq \text{j}}^{\text{NS}} P(\lambda\_{\text{k}}^{\text{s,val}} < \lambda\_{\text{j}}^{\text{s,val}}) \cdot \mathcal{Q}\_{\text{k}}^{\text{s,bid}} + \mathcal{Q}\_{\text{j}}^{\text{s,bid}}.\tag{7}$$

The planning problem that seller *j* should offer his bidding is mathematically described as follows:

$$\lambda\_j^{\text{s,bid}\*} = \operatorname\*{argmax} \left\{ \left| E(\frac{o - p\_{\hat{\gamma}}}{q\_{\hat{\gamma}} - p\_{\hat{\gamma}}}) \right| p\_{\hat{\gamma}} < o < q\_{\hat{\gamma}} \right\} \cdot P(p\_{\hat{\gamma}} < o < q\_{\hat{\gamma}}) + P(q\_{\hat{\gamma}} < o) \right\} \cdot Q\_{j}^{\text{s,bid}} \cdot \left( \lambda\_j^{\text{s,val}} - \lambda\_j^{\text{s,bid}} \right) \cdot \tag{8}$$

Similarly, for sellers, set the bidding strategy function *λ* s,bid *<sup>i</sup>* = *φ*(*λ* s,val *i* ) and *P*s(*λ* s,bid *i* ), and the latter transforms the original function into the following expression:

$$
\lambda\_i^{\rm s,bid} = \operatorname{argmax}(P\_\mathbf{s}(\boldsymbol{\phi}^{-1}(\boldsymbol{\lambda}\_i^{\rm s,bid})) \cdot \mathbf{Q}\_i^{\rm s,bid} \cdot (\boldsymbol{\phi}^{-1}(\boldsymbol{\lambda}\_i^{\rm s,bid}) - \boldsymbol{\lambda}\_i^{\rm s,bid})).\tag{9}
$$

It should be noted that the boundary condition is *φ*(*λ s*,*bid* max ) = 0, which is different from the situation for buyers as shown in Appendices A and B. Hence, the optimal bidding strategy function for seller *j* is:

$$\phi(\lambda\_j^{\rm sval}) = \lambda\_j^{\rm sval} - \lambda\_{\rm max}^{\rm sval} \cdot P\_{\rm s}(\lambda\_{\rm max}^{\rm sval}) + \frac{\int\_{\lambda\_j^{\rm sval}}^{\lambda\_{\rm max}^{\rm sval}} P\_{\rm s}(\mathbf{x}) d\mathbf{x}}{P\_{\rm s}(\lambda\_j^{\rm sval})}. \tag{10}$$

After buyers and sellers submit their bidding information, the trading price is cleared and set as the mean value of the bidding price of the seller and buyer to have a successful match [51].

#### **4. Smart Match Mechanism**

After double auction among EVs, some participants achieved their purpose (buying or selling electricity) and left DAM. The remaining participants are at a deadlock because their bidding prices cannot be matched. The transaction cannot proceed unless the remaining participants compromise their bidding price or other trading policies are provided. It was pointed out that a detailed correlation between blockchain, power market mechanism, EV charging stations, sustainability, social responsibility, corporate governance, and business performance is essential for smart cities development to enhance quality of life [52–54]. Therefore, in the smart match mechanism, CSO has the right to manage the charge and

discharge strategy, conduct the shift strategy among these unmatched EVs in the double auction mechanism, and aim to pursue higher personal gains as well as social welfare.

In the shift strategy, CSO offers a price that may be higher than RTM-CP in the double auction mechanism to the unmatched seller and a price that may be lower than RTM-CP in the double auction mechanism to the unmatched buyer. However, participants in the smart match will not be able to control their charge and discharge time. Through buying energy from unmatched sellers and selling energy to unmatched buyers, CSO dispatches unmatched EVs' charge and discharge strategy. In other words, CSO changes buyers' charge and sellers' discharge behavior to meet their demand according to their parking time in the charging station. Figure 3 shows the shift strategy. Considering the behavior of EV users, as an example, the EV parking time is set as 8 h, and charging and discharging behavior will be managed in 8 h.

**Figure 3.** Shift strategy of CSO in smart match mechanism.

*4.1. Objective Function*

$$\min \mathcal{C} = \mathcal{C}\_{\text{op}} + w\_1 \cdot \delta\_{\text{sat}} + w\_2 \cdot \delta\_{\text{SW}} \tag{11}$$

The optimization problem of CSO consists of three components, i.e., operational cost, satisfaction of EV, and social welfare. Operational cost includes the net cost of buying energy from unmatched sellers and selling energy to unmatched buyers:

$$\mathcal{C}\_{\rm op} = \sum\_{t=1}^{NT} (\sum\_{j=1}^{NS} Q\_{j,t}^{\rm s,ori} \cdot \lambda\_{\rm CSO,j}^{\rm s} - \sum\_{i=1}^{NB} Q\_{i,t}^{b,ori} \cdot \lambda\_{\rm CSO,i}^{\rm b}). \tag{12}$$

CSO also considers the satisfaction of EV users, including the cost of trading with CSO in RTM and the difference of contract price and original bidding price of unmatched EVs. Mean and variance are considered to evaluate the price difference:

$$\delta\_{\rm sat} = \sum\_{i=1}^{NB} \delta\_{\rm sat,i}^{\rm b} + \sum\_{j=1}^{NS} \delta\_{\rm sat,j}^{\rm s} \tag{13}$$

$$\boldsymbol{\delta}\_{\text{sat},i}^{\mathbf{b}} = (\lambda\_{\text{CSO},i}^{\mathbf{b}} - \frac{\sum\_{t=1}^{NT} \mathbf{Q}\_{i,t}^{\mathbf{b},\text{ori}} \cdot \mathbf{l}\_{i,t}^{\mathbf{b},\text{bi}} \cdot \lambda\_{i,t}^{\mathbf{b},\text{bi}}}{\sum\_{t=1}^{NT} \mathbf{Q}\_{i,t}^{\mathbf{b},\text{ori}} \cdot \mathbf{l}\_{i,t}^{\mathbf{b},\text{ori}}})^2 + \sum\_{t=1}^{NT} (1 - \boldsymbol{\mu}\_{i}) \cdot \mathbf{Q}\_{i,t}^{\mathbf{b},\text{ori}} \cdot \lambda\_{\text{RTM},i\prime}^{\mathbf{b}} \tag{14}$$

$$\delta\_{\rm sat,j}^{\rm s} = (\lambda\_{\rm CSO,j}^{\rm s} - \frac{\sum\_{t=1}^{NT} Q\_{j,t}^{\rm s,ori} \cdot I\_{j,t}^{\rm s,ori} \cdot \lambda\_{j,t}^{\rm s,bid}}{\sum\_{t=1}^{NT} Q\_{j,t}^{\rm s,ori} \cdot I\_{j,t}^{\rm s,ori}})^2 - \sum\_{t=1}^{NT} (1 - \beta\_j) \cdot Q\_{j,t}^{\rm s,ori} \cdot \lambda\_{\rm RTM,j}^{\rm s}. \tag{15}$$

In addition to satisfying the EVs' demand, CSO also has social welfare to minimize the power unbalance of the system. CSO should consider the forecasted demand of suburban system in DAM. *γ* denotes the market shares of charging station:

$$\delta\_{\rm SW} = \sum\_{t=1}^{NT} \left| \gamma \cdot D\_t^{\rm force} - P\_{\rm CSO,t}^{\rm net} \right|. \tag{16}$$

Net power in charging station is denoted as follows:

$$P\_{\rm CSO,t}^{\rm net} = (\sum\_{j=1}^{NS} Q\_{j,t}^{\rm s,sh} - \sum\_{i=1}^{NB} Q\_{i,t}^{\rm b,sh}) + (\sum\_{j=1}^{NS} (1 - \beta\_j) \cdot I\_{j,t}^{\rm s,ori} \cdot Q\_{i,t}^{\rm s,ori} - \sum\_{i=1}^{NB} (1 - \mathfrak{a}\_i) \cdot I\_{i,t}^{\rm b,ori} \cdot Q\_{i,t}^{\rm b,ori}).\tag{17}$$

#### *4.2. Constraints*

(a) Physical constraints:

$$\sum\_{t=1}^{NT} I\_{i,t}^{\mathbf{b}} \le \sum\_{t=1}^{NT} I\_{i,t}^{\mathbf{b}, \text{ori}} \; \sum\_{t=1}^{NT} I\_{j,t}^{\mathbf{s}} \le \sum\_{t=1}^{NT} I\_{j,t}^{\mathbf{s}, \text{ori}} \; \tag{18}$$

In the shift strategy, the shift time is limited, to avoid the charge and discharge strategy too scattered:

 8 ∑ t=1 *Q* b,sh *<sup>i</sup>*,*<sup>t</sup>* = *α<sup>i</sup>* · 8 ∑ t=1 *Q* b,ori *i*,*t* · *I* b,ori *i*,*t* , 8 ∑ t=1 *Q* s,sh *<sup>j</sup>*,*<sup>t</sup>* = *β<sup>j</sup>* · 8 ∑ t=1 *Q* s,ori *j*,*t* · *I* s,ori *j*,*t* 16 ∑ t=9 *Q* b,sh *<sup>i</sup>*,*<sup>t</sup>* = *α<sup>i</sup>* · 16 ∑ t=9 *Q* b,ori *i*,*t* · *I* b,ori *i*,*t* , 16 ∑ t=9 *Q* s,sh *<sup>j</sup>*,*<sup>t</sup>* = *β<sup>j</sup>* · 16 ∑ t=9 *Q* s,ori *j*,*t* · *I* s,ori *j*,*t* 24 ∑ t=17 *Q* b,sh *<sup>i</sup>*,*<sup>t</sup>* = *α<sup>i</sup>* · 24 ∑ t=17 *Q* b,ori *i*,*t* · *I* b,ori *i*,*t* , 24 ∑ t=17 *Q* s,sh *<sup>j</sup>*,*<sup>t</sup>* = *β<sup>j</sup>* · 24 ∑ t=17 *Q* s,ori *j*,*t* · *I* s,ori *j*,*t* . (19)

Constraint (19) is utilized to ensure the same energy charged or discharged as the original plan in the parking time after the shift strategy. Considering the behavior of EV users, the EV parking time is set as 8 h, hence the dispatch time is decomposed into three parts.

(b) Trading constraints:

$$\frac{1}{M} \cdot \mathbf{l}\_{i,t}^{\mathbf{b}} \le \mathbf{Q}\_{i,t}^{\mathbf{b},\mathbf{sh}} \le M \cdot \mathbf{l}\_{i,t'}^{\mathbf{b}} \cdot \frac{1}{M} \cdot \mathbf{l}\_{j,t}^{\mathbf{s}} \le \mathbf{Q}\_{j,t}^{\mathbf{s,sh}} \le M \cdot \mathbf{l}\_{j,t}^{\mathbf{s}}.\tag{20}$$

Constraint (20) shows the relationship between the transferred power and the transferred state and the shift energy is limited to zero when the shift status is zero at time slot *t*. *M* is a big positive number.

$$I\_{i,t}^{\mathsf{b}} \le \mathfrak{a}\_{i\prime} \quad I\_{j,t}^{\mathsf{s}} \le \mathcal{B}\_{j\prime} \tag{21}$$

$$
\lambda\_{\text{CSO},i}^{\text{b}} \le \mathfrak{a}\_{i} \cdot M,\ \lambda\_{\text{CSO},j}^{\text{s}} \le \mathfrak{beta}\_{j} \cdot M. \tag{22}
$$

Constraints (21) and (22) show that when CSO does not sign contract with EVs, the price offered by CSO and shift status will be set as zero.

$$0 \le Q\_{i,t}^{\text{sh}} \le Q\_{\text{max}}^{\text{sh}} \; 0 \le Q\_{j,t}^{\text{s,sh}} \le Q\_{\text{max}}^{\text{sh}} \; \tag{23}$$

Constraint (23) sets the charge and discharge rate per hour below the maximum.

$$
\alpha\_i \le \sum\_{t}^{NT} I\_{i,t}^{\mathbf{b}, \text{ori}}, \ \beta\_j \le \sum\_{t}^{NT} I\_{j,t}^{\mathbf{s}, \text{ori}}. \tag{24}
$$

Constraint (24) gives the relationship between contract formation status and initial charge (or discharge) state.

$$I\_{i,t}^{\mathbf{b}} \le 1 - I\_{i,t}^{\mathbf{b},\mathbf{a}\mathbf{c}},\ I\_{j,t}^{\mathbf{s}} \le 1 - I\_{j,t}^{\mathbf{s,a}\mathbf{a}\mathbf{c}}.\tag{25}$$

Constraint (25) indicates that the shift strategy cannot transfer the service within the time, in which trading happened between EVs.

To reduce computational complexity, the absolute value in Equation (16) is replaced by auxiliary variables *β t* 1 and *β t* 2 :

$$
\gamma \cdot D\_t^{\text{free}} - P\_{\text{CSO},t}^{\text{net}} + \beta\_1^t - \beta\_2^t = 0,\tag{26}
$$

$$
\beta\_1^t \ge 0, \quad \beta\_2^t \ge 0, \ \forall t. \tag{27}
$$

The social welfare function is transformed into Equation (28) as shown below:

$$\delta\_{\rm sw} = \sum\_{t=1}^{NT} (\beta\_1^t + \beta\_2^t). \tag{28}$$

#### **5. Results and Discussion**

The effectiveness and validity of the proposed model are proved by utilizing the EV data obtained from [55]. 140 EV buyers and 100 EV sellers are chosen to take part in the double auction mechanism. The data of 240 participants will be shown partly in Appendix C. After the double auction mechanism, the EVs that do not match successfully will participate in the smart match process automatically. The trading result is cleared by CSO. The constant parameters used in the experiment are shown in Table 1.

**Table 1.** Constant parameters used in the experiment.


Three cases will be considered. Case 1 is to demonstrate the effectiveness of the double auction mechanism. Case 2 focuses on the significance of the smart match conducted by CSO. Case 3 is utilized to show the blockchain interface. Case 1 and Case 2 are conducted on a Windows 10 64-bit personal computer with Intel Core i5-6500 3.2 GHz CPU and 8 GB of RAM using MATLAB 2016b with YALMIP and Gurobi. Case 3 is conducted by Python 3.8 and Postman.

#### *5.1. Double Auction Mechanism*

In Case 1, it is assumed that the price of electricity has a standard normal distribution and the mean value is set as 0.2 \$/kWh. The charging price and discharging price in RTM are set as 0.25 and 0.15 \$/kWh, respectively. After EV users submit their bidding price, the double auction mechanism is cleared by CSO. In Figure 4, the bidding price of all participants at hour 5 is ranked by price and the left part of intersection is regarded as a successful match. For the rest, buyer and seller fail to close the deal.

**Figure 4.** Bidding information at hour 5.

According to price ranking in Figure 4, Buyer 13 will buy 4.2 kWh electricity from Seller 16 and 2.2 kWh electricity from Seller 54 in hour 5. The trading price is set as mean value of bidding price of buyer and seller. Buyer 30 and Seller 69 cannot match and will take part in the smart match automatically. The evaluation and the quantity are important indicators of participants' bidding price. From the buyer's point of view, the evaluation price of Buyers 13, 22, and 30 are 0.1972, 0.1967, and 0.1603 \$/kWh, respectively, and the electricity quantity are 6.6, 4.4 and 1.1 kWh, respectively. Buyer 13 has the highest electricity quantity (equal to 6.6 kWh) and the highest evaluation price (equal to 0.1972 \$/kWh) in the 5th hour, so this is the highest bidding price (equal to 0.2034 \$/kWh) to maximize the successful trading probability. From the seller's point of view, the evaluation price of Sellers 16, 54, 29 and 69 are 0.1842, 0.1861, 0.1866 and 0.2094 \$/kWh, respectively, and the electricity quantity are 4.4, 5.5, 1.1, and 6.6 kWh, respectively. Seller 16 has the lowest evaluation (equal to 0.1842 \$/kWh), so this is the lowest bidding price (equal to 0.1834 \$/kWh) to maximize the successful trading probability.

#### *5.2. Smart Match Mechanism*

In Case 2, CSO optimizes the shift strategy, considering the satisfaction of EV users and social welfare, which are both introduced detailly in Section 4. For the satisfaction of EV users, CSO will select some of the unsuccessful matching EVs to sign the contract and minimize the deviation between the bidding price and contract price. For the social welfare, CSO will manage the charging and discharging time of EVs, adjust the net power of the charging station, and make the integrated load smooth, considering forecasted load of the distribution system and market shares of the charging station. As an organization that pursues profits, the CSO has an appropriate incentive to pursue higher benefits out of the consideration of benefits, such as benefits obtained by improving the balance of the load curve.

The suburban load curve is shown in Figure 5 [56]. Figure 6 shows the effectiveness of the shift strategy from the perspective of a CSO. In this case, the market share of selected CSO is set to 5%, which is reflected in the order of magnitude of Figures 5 and 6. In Figure 6, it can be easily found that the total power consumption (including urban power consumption and EV power consumption) is effectively adjusted to a flatter level after the implementation of the transfer strategy. Especially in the 16th–24th hours, the effect is obvious. In the 20th and 21st hours, the peak power consumption of the whole day will be greatly weakened, and this part of the power consumption will be transferred to 23rd and 24th hours. The shift strategy can alleviate the load peak effectively by reducing the quantity from 182 to 146.5 kW, which is a 19.5% improvement. It will help reduce the pressure on the power distribution operation.

**Figure 5.** Load curve.

**Figure 6.** Comparison of load curve.

#### *5.3. Analysis of Global Indicators in Cases 1 and 2*

The day-ahead market consists of Cases 1 and 2. Firstly, the global situation of the double auction in Case 1 is analyzed. Tables 2 and 3 show the result of the buyer and seller in the double auction with a different bidding price strategy. The former is under the optimized bidding method proposed in this paper, and the latter is under the original bidding method in [50]. For buyers who successfully participate in DAM, the profit is defined as cost reduction obtained by cost with trading minus cost without trading. For sellers who successfully participate in DAM, the profit is defined as a revenue enhancement obtained by revenue with trading minus revenue without trading:

$$P\_{\rm i}^{\rm b} = \mathcal{C}\_{\rm i,nt}^{\rm b} - \mathcal{C}\_{\rm i,t'}^{\rm b} \; P\_{\rm j}^{\rm s} = R\_{\rm j,t}^{\rm s} - R\_{\rm j,nt}^{\rm s} \tag{29}$$


**Table 2.** Result of the double auction mechanism with optimal bidding price.

**Table 3.** Result of the double auction mechanism with original bidding price.


Through the comparison of Tables 2 and 3, it can be found that the optimal bidding method proposed in this paper will greatly promote the matching between buyers and sellers, in which the number of transactions increases from 24 to 119, and the total profit increases from \$ 6.48 to \$ 32.44. This is because the optimal bidding price proposed in this paper considers rank expectation, including value price and bidding quantity. On the contrary, the original bidding price only considers the value price, so the bidding price with original method cannot match precisely. Therefore, participants with the optimal strategy are more likely to match successfully in the double auction than those with the original strategy.

Table 4 shows the result of the buyer and seller in the smart match mechanism. After the double auction mechanism and smart match mechanism, both buyer and seller will obtain profit, which is detailed in Table 5.


**Table 4.** Result of the smart match.

**Table 5.** Result of the day-ahead trading process (including double auction and smart match).


Table 4 shows the global information in the smart match. It can be seen that participants will get more profits in the smart match than in the double auction. The mean of profit in the smart match is \$ 0.496, which is significantly higher than \$ 0.273 in the double auction. However, according to the smart match mechanism, their charging and discharging behavior will be managed and their bidding time will be shifted to another time.

Table 5 shows the trading information of the whole process in the day-ahead market, which includes the double auction and smart match. Some EVs cannot complete the transaction in the day-ahead market due to over valuation or malicious bidding, so they need to enter the real-time market and accept the real-time price. Therefore, the trading mechanism can also avoid the malicious bidding to a certain extent. In the 5th hour, for example, Buyer 30 enters DAM with a very low bidding price, which can be seen as a malicious bidding. Obviously, this bidding will not be accepted in the double auction, because no seller is willing to accept such a low price as shown in Figure 4. Similarly, it will not be accepted by the CSO in the smart match, because CSO can select participants with better bidding from the 5th hour and nearby hours.

#### *5.4. Sensitivity Analysis*

Figure 7 describes the mean value of profit of buyers and sellers in the double auction mechanism and the whole trading process. In Figure 7a, the number of buyers is 140 and the number of sellers changes from 100 to 170. In Figure 7b, the number of sellers is 140 and the number of buyers changes from 100 to 170. For each situation, the number of participants changes. Because the evaluation of electricity is in random normal form, when the number of buyers or sellers changes, the evaluation of electricity changes. The bidding strategy will change based on the evaluation, leading to different trading results. From Figure 7, it can be seen that mean value of profit in the double auction is changed

from \$ 0.25 to \$ 0.4, and mean value of profit in trading is changed from \$ 0.47 to \$ 0.7. Participants can always gain profits from the trading mechanism.

**Figure 7.** (**a**). Profit with the change of the number of sellers. (**b**). Profit with the change of the number of buyers.

#### *5.5. Application of Blockchain*

Python is used to build a blockchain and interact information by software Postman to simulate the process of trading.

First, buyers and sellers participating in the day-ahead market need to upload and publish their own information, including electricity quantity, price, and entry time. Their user names are kept confidential with hash values, and other information is always open. The username of Buyer 125 is converted to hash value "81ef01a9fed5a1f0cc89ea14730f061570cb79 5474163307725f07f6a5e5b20e", which prevents personal information from being leaked. In addition, the hash value of the previous block, proof of work, and timestamp is also included in the block. These indicators ensure the normal continuation of the blockchain.

After receiving the personal information uploaded by participants, miners will use a cryptographic hash algorithm to solve the hash value. The first miner who figures out the correct hash will get the right to validate the transaction into blocks and records it on the blockchain. The miner will then receive some tokens as a reward.

The double auction and smart match will generate some matching information, such as buyer *i* matches seller *j*, buyer *k* matches CSO, and so on. After the matching result is uploaded to the blockchain, as the final clear result and requirements for participants to trade according to the block. Punishment is necessary for those who violate the block. Blockchain is open and transparent. Therefore, even without third-party supervision, the security of the trading process is guaranteed. This mechanism can improve the security of transactions between EVs. Various business models needed to be considered [57].

#### **6. Conclusions**

This paper presents a novel electricity trading mechanism for EV charging stations, mainly including double auction, smart match, and blockchain mechanism. A total of 140 EVs are selected as buyers and 100 EVs as sellers, to simulate a charging station model and consider the interaction with the power grid utilizing suburban load in the distribution system. From the perspective of personal interest, the number of successful transactions increases from 24 to 119 and the total return increases from \$ 6.48 to \$ 32.44 after the rank expectation proposed is considered. Due to the introduction of rank expectation, participants can understand more clearly about other participants in the auction and make more accurate judgments, resulting in a significant increase in the number of successful transactions. Smart match mechanism reduces the impact on the power grid by scheduling the charging and discharging behavior of EVs with consideration of satisfaction of EV users. Simulations demonstrate the effectiveness of the proposed model. EV users can benefit from the double auction mechanism and smart match mechanism. From the perspective of

social welfare, the peak load reduces from 182 to 146.5 kW, which is a 19.5% improvement after executing the smart match. This is because social welfare, referred to in this paper as the fluctuating level of load, is taken fully into account. To sum up, the trading mechanism can not only absorb nearby energy, but also has a positive impact on the grid stability. A number of issues in the electric vehicle industry have to be considered, such as policy implementation, technology innovation, and the whole supply chain. This work will be considered in the near future.

**Author Contributions:** Conceptualization, methodology, software, writing—original draft, data curation, Z.H. and Z.L.; conceptualization, methodology, writing—review and editing, C.S.L.; writing review and editing, Z.Z., X.W., X.L. and N.T.; writing—review and editing, supervision, funding acquisition, L.L.L. All authors have read and agreed to the published version of the manuscript.

**Funding:** This work is sponsored by the Department of Finance and Education of Guangdong Province 2016 [202]: Key Discipline Construction Program, China; the Education Department of Guangdong Province: New and Integrated Energy System Theory and Technology Research Group [Project Number 2016KCXTD022]; Brunel University London BRIEF Funding; National Natural Science Foundation of China (51907031).

**Conflicts of Interest:** The authors claim that there are no conflicts of interest involved in publishing this article.

#### **Abbreviations**

Variables and Functions:



#### **Appendix A.**

Define *F*(*λ* b,bid *i* ) = *Q*b.bid *i* · (*φ* −1 (*λ* b,bid *i* ) − *λ* b,bid *i* ) · *P<sup>b</sup>* (*φ* −1 (*λ* b,bid *i* )), and the bidding function is expressed as:

$$\boldsymbol{\lambda}\_{\mathrm{i}}^{\mathrm{b,bid}\*} = \mathrm{argmax}(\boldsymbol{F}(\boldsymbol{\lambda}\_{\mathrm{i}}^{\mathrm{b,bid}})) = \mathrm{argmax}(\boldsymbol{Q}\_{\mathrm{i}}^{\mathrm{b,bid}} \cdot (\boldsymbol{\phi}^{-1}(\boldsymbol{\lambda}\_{\mathrm{i}}^{\mathrm{b,bid}}) - \boldsymbol{\lambda}\_{\mathrm{i}}^{\mathrm{b,bid}}) \cdot \boldsymbol{P}\_{\mathrm{b}}(\boldsymbol{\phi}^{-1}(\boldsymbol{\lambda}\_{\mathrm{i}}^{\mathrm{b,bid}}))).\tag{A1}$$

Then according to the first order optimal condition, the derivative of the objective function with respect to *b<sup>i</sup>* is equal to 0 at the maximum. Hence:

$$0 = Q\_i^{\mathbf{b}, \text{bid}} \cdot [-P\_\mathbf{b}(\boldsymbol{\phi}^{-1}(\boldsymbol{\lambda}\_i^{\mathbf{b}, \text{bid}})) + p\_\mathbf{b}(\boldsymbol{\phi}^{-1}(\boldsymbol{\lambda}\_i^{\mathbf{b}, \text{bid}}))(\boldsymbol{\phi}^{-1}(\boldsymbol{\lambda}\_i^{\mathbf{b}, \text{bid}}))'(\boldsymbol{\phi}^{-1}(\boldsymbol{\lambda}\_i^{\mathbf{b}, \text{bid}}) - \boldsymbol{\lambda}\_i^{\mathbf{b}, \text{bid}})].\tag{A2}$$

Considering (*φ* −1 (*bi*))′ = <sup>1</sup> *φ*′(*φ*−1(*b<sup>i</sup>* )), the following equation can be obtained:

$$p\_{\mathbf{b}}(\lambda\_i^{\mathbf{b}, \text{val}})(\lambda\_i^{\mathbf{b}, \text{val}} - \lambda\_i^{\mathbf{b}, \text{bid}}) - P\_{\mathbf{b}}(\lambda\_i^{\mathbf{b}, \text{val}})\phi'(\lambda\_i^{\mathbf{b}, \text{val}}) = 0. \tag{A3}$$

Equation (A3) simplifies to:

$$\frac{d}{dv\_i}(P\_\mathbf{b}(\lambda\_i^{\text{b,val}})\phi(\lambda\_i^{\text{b,val}})) = \lambda\_i^{\text{b,val}}p\_\mathbf{b}(\lambda\_i^{\text{b,val}}).\tag{A4}$$

The boundary condition is *φ*(0) = 0. By integrating both sides of Equation (A4) from 0 to *v<sup>i</sup>* :

$$P\_{\mathbf{b}}(\lambda\_{\mathbf{i}}^{\mathrm{b,val}})\phi(\lambda\_{\mathbf{i}}^{\mathrm{b,val}}) = \int\_{0}^{\lambda\_{\mathbf{i}}^{\mathrm{b,val}}} \mathbf{x} p\_{\mathbf{b}}(\mathbf{x})d\mathbf{x}.\tag{A5}$$

After simplification, the optimal bidding strategy function is expressed as: *φ*(*λ* b,val *i* ) = b,val *i* − R *λ* b,val *i* 0 *P*b (*x*)*dx P*b (*λ* b,val ) .

#### **Appendix B.**

*i*

*λ*

In Appendix A, the derivative of the objective function is proved to be 0 when bidding price is *φ*(*λ* b,val *i* ). However, the second-order sufficient condition has not yet been proved, so it is not known whether *λ* b,bid *<sup>i</sup>* = *φ*(*λ* b,val *i* ) is a maximum, a minimum, or even not an extremum. Hence, the following is proved for its second order sufficient condition.

The derivative of optimal bidding strategy function is:

$$\phi'(\lambda\_i^{\mathbf{b},\text{val}}) = \frac{p\_\mathbf{b}(\lambda\_i^{\mathbf{b},\text{val}}) \cdot \int\_0^{\lambda\_i^{\mathbf{b},\text{val}}} P\_\mathbf{b}(\mathbf{x})d\mathbf{x}}{P\_\mathbf{b}(\lambda\_i^{\mathbf{b},\text{val}})^2}. \tag{A6}$$

From Equation (A6), it can be seen that *φ* ′ (*λ* b,val *i* ) ≥ 0, because *P<sup>b</sup>* (*λ* b,val *i* ) and its derivative are not negative for any *λ* b,val *i* .

According to Equation (A2), the derivative of the objective function can be expressed as:

$$\begin{split} &F(\lambda\_i^{\mathtt{b},\mathtt{b},\mathtt{b}}) \\ = &Q\_i^{\mathtt{b},\mathtt{b}\text{id}} \cdot [p\_\mathtt{b}(\phi^{-1}(\lambda\_i^{\mathtt{b},\mathtt{b}\text{id}}))(\phi^{-1}(\lambda\_i^{\mathtt{b},\mathtt{b}\text{id}}))'(\phi^{-1}(\lambda\_i^{\mathtt{b},\mathtt{b}\text{id}}) - \lambda\_i^{\mathtt{b},\mathtt{b}\text{id}}) \\ & - \mathcal{P}\_\mathtt{b}(\phi^{-1}(\lambda\_i^{\mathtt{b},\mathtt{b}\text{id}}))] \\ = &Q\_i^{\mathtt{b},\mathtt{b}\text{id}} \cdot [\frac{p\_\mathtt{b}(\phi^{-1}(\lambda\_i^{\mathtt{b},\mathtt{b}\text{id}}))(\phi^{-1}(\lambda\_i^{\mathtt{b},\mathtt{b}\text{id}}) - \lambda\_i^{\mathtt{b},\mathtt{b}\text{id}})}{\phi^{\mathtt{}}(\phi^{-1}(\lambda\_i^{\mathtt{b},\mathtt{b}\text{id}}))} - \mathcal{P}\_\mathtt{b}(\phi^{-1}(\lambda\_i^{\mathtt{b},\mathtt{b}\text{id}}))] \end{split} \tag{A7}$$

So, the second derivative of the objective function can be expressed as:

$$\begin{split} &F'(\lambda\_i^{\text{b,bid}}) / Q\_i^{\text{b,bid}} \\ &= \frac{d}{d\upsilon\_i} (\frac{p\_{\text{b}}(\lambda\_i^{\text{b,val}})}{\phi'(\lambda\_i^{\text{b,val}})}) \cdot [\Phi^{-1}(\lambda\_i^{\text{b,bid}}))' \cdot (\lambda\_i^{\text{b,val}} - \lambda\_i^{\text{b,bid}}) - 2p\_{\text{b}}(\upsilon\_i)(\varPhi^{-1}(\lambda\_i^{\text{b,bid}}))' \\ &= \frac{d}{d\upsilon\_i} (\frac{p\_{\text{b}}(\lambda\_i^{\text{b,val}})}{\phi'(\lambda\_i^{\text{b,val}})}) \cdot \frac{1}{\phi'(\lambda\_i^{\text{b,val}})} \cdot \frac{\int\_0^{\lambda\_i^{\text{b,val}}} P\_{\text{b}}(x) dx}{p\_{\text{b}}(\lambda\_i^{\text{b,val}})} - 2\frac{p\_{\text{b}}(\lambda\_i^{\text{b,val}})}{\phi'(\lambda\_i^{\text{b,val}})} \end{split} \tag{A8}$$

Considering *φ* ′ (*λ* b,val *i* ) ≥ 0 and *P<sup>b</sup>* (*λ* b,val *i* ) ≥ 0, multiply both sides of Equation (A8) by *φ* ′ (*λ* b,val *i* ) · *P*b(*λ* b,val *i* ), the following equation is obtained:

$$\begin{split} &F''(\lambda\_i^{\mathbf{b},\mathbf{b}\text{id}}) \cdot \phi'(\lambda\_i^{\mathbf{b},\text{val}}) \cdot P\_\mathbf{b}(\lambda\_i^{\mathbf{b},\text{val}}) / Q\_i^{\mathbf{b},\text{bid}} \\ &= \frac{d}{d\lambda\_i^{\mathbf{b},\text{val}}} (\frac{p\_\mathbf{b}(\lambda\_i^{\mathbf{b},\text{val}})}{\phi'(\lambda\_i^{\mathbf{b},\text{val}})}) \cdot \int\_0^{\lambda\_i^{\mathbf{b},\text{val}}} P\_\mathbf{b}(\mathbf{x}) d\mathbf{x} - 2p\_\mathbf{b}(\lambda\_i^{\mathbf{b},\text{val}}) \cdot P\_\mathbf{b}(\lambda\_i^{\mathbf{b},\text{val}}) \end{split} \tag{A9}$$

Substituting *φ* ′ (*λ* b,val *i* ) = *<sup>p</sup>*<sup>b</sup> (*λ* b,val *i* )· R *λ* b,val *i* 0 *P*b (*x*)*dx P*b (*λ* b,val *i* ) 2 in Equation (A9), the following equa-

tion could be obtained:

$$\begin{split} &F''(\boldsymbol{b}\_{i}) \cdot \boldsymbol{\Phi}'(\boldsymbol{\lambda}\_{i}^{\mathrm{b},\mathrm{val}}) \cdot \mathrm{P\_{\mathrm{b}}}(\boldsymbol{\lambda}\_{i}^{\mathrm{b},\mathrm{val}}) / \mathrm{Q}\_{i}^{\mathrm{b},\mathrm{val}} \\ &= \frac{d}{d\boldsymbol{\lambda}\_{i}^{\mathrm{b},\mathrm{val}}} (\frac{\mathrm{P\_{\mathrm{b}}(\boldsymbol{\lambda}\_{i}^{\mathrm{b},\mathrm{val}})}{\boldsymbol{\lambda}\_{i}^{\mathrm{b},\mathrm{val}}}) \cdot \int\_{0}^{\mathrm{b}\_{i}^{\mathrm{b},\mathrm{val}}} P\_{\mathrm{b}}(\boldsymbol{x}) d\boldsymbol{x} - 2p\_{\mathrm{b}}(\boldsymbol{\lambda}\_{i}^{\mathrm{b},\mathrm{val}}) \cdot P\_{\mathrm{b}}(\boldsymbol{\lambda}\_{i}^{\mathrm{b},\mathrm{val}}) \\ &= 2p\_{\mathrm{b}}(\boldsymbol{\lambda}\_{i}^{\mathrm{b},\mathrm{val}}) \cdot \mathrm{P\_{\mathrm{b}}}(\boldsymbol{\lambda}\_{i}^{\mathrm{b},\mathrm{val}}) - \frac{\mathrm{P\_{\mathrm{b}}(\boldsymbol{\lambda}\_{i}^{\mathrm{b},\mathrm{val}})}{\boldsymbol{\lambda}\_{i}^{\mathrm{b},\mathrm{val}}} - 2p\_{\mathrm{b}}(\boldsymbol{\lambda}\_{i}^{\mathrm{b},\mathrm{val}}) \cdot \mathrm{P\_{\mathrm{b}}}(\boldsymbol{\lambda}\_{i}^{\mathrm{b},\mathrm{val}}) \\ &= -\frac{\mathrm{P\_{\mathrm{b}}(\boldsymbol{\lambda}\_{i}^{\mathrm{b},\mathrm{val}})}{\boldsymbol{\lambda}\_{i}^{\mathrm{b},\mathrm{val}}} < 0 \end{split} \tag{A10}$$

It is identified that *F* ′′(*λ* b,bid *i* ) < 0. The highest earnings could be obtained when buyer *i* adopts the bidding strategy *λ* b,bid *<sup>i</sup>* = *φ*(*λ* b,val *i* ).

#### **Appendix C.**

Table A1 shows the charging behavior of buyers numbered 1 to 10 out of 140 buyers and buyers numbered 1 to 10 out of 100 buyers in 24 h. Each row represents a time period, each column represents a buyer's/seller's number, and the data in the table represent the charging/discharging quantity in kWh.


**Table A1.** Partial data of buyers' charging/sellers' discharging behavior.

#### **References**


## *Article* **Identifying the Lack of Energy-Conscious Behaviour in Clinical and Non-Clinical Settings: An NHS Case Study**

**Ahmad Taha 1,2,\* ,† , Tim Hopthrow <sup>3</sup> , Ruiheng Wu 4 , Neil Adams 5 , Jessica Brown 5 , Ahmed Zoha 1 , Qammer H. Abbasi 1 , Muhammad Ali Imran <sup>1</sup> and Jan Krabicka 2**


**Abstract:** The race against climate change has been a great challenge for years, and the UK government has taken serious steps towards achieving the net-zero carbon target by 2050. Technology is leading the way and innovation is believed to be a key solution. Nevertheless, tackling the issue, by attempting to limit the waste in energy, due to negative energy usage behaviour, has proven to be a successful approach that is capable of complementing other technology-based initiatives. The first step towards this is to promote energy-conscious behaviour and pinpoint where savings can be made. Thereby, this paper contributes to the existing literature, by presenting a new methodology to identify potential energy waste and negative energy usage behaviour in an NHS hospital. The paper presents an analysis of electricity consumption vs occupancy during minimal consumption periods (i.e, bank holidays and weekends) and it presents a log of equipment left switched on outside of working hours, in order to highlight the level of energy-conscious behaviour. The results revealed that the proposed technique is not only able to identify negative energy usage behaviour amongst the hospital staff but helps identify areas where immediate energy savings can be made, with potential savings of more than 30,000 pounds, if action is taken.

**Keywords:** energy usage behaviour; occupancy monitoring; energy conservation; out-of-hours consumption; energy consumption monitoring

#### **1. Introduction**

Management of energy consumption and carbon emissions has been an ongoing challenge for years and has lead to high energy costs and negative impacts on the environment [1,2]. Presently, excessive energy consumption and carbon emissions pose environmental threats on a domestic and non-domestic level in the United Kingdom (UK); with energy contributing to both economic and social development [3], controlling it is crucial.

The building sector is an active energy consumer [4], accounting for 40% of the energy consumed in the European Union [5] and 34% of the world's total energy consumption [3], with 9% for commercial ones, as per the International Energy Agency (IEA). This translates into 12% of global CO<sup>2</sup> emissions [6]. Efforts have been made, and several studies conducted, to address energy conservation in the building sector. Some research studies rely on achieving energy efficiency, by targeting heating ventilation and air conditioning

**Citation:** Taha, A.; Hopthrow, T.; Wu, R.; Adams, N.; Brown, J.; Zoha, A.; Abbasi, Q.H.; Imran, M.A.; Krabicka, J. Identifying the Lack of Energy-Conscious Behaviour in Clinical and Non-Clinical Settings: An NHS Case Study. *Electronics* **2021**, *10*, 2468. https://doi.org/10.3390/ electronics10202468

Academic Editor: Ahmed Abu-Siada

Received: 13 September 2021 Accepted: 30 September 2021 Published: 11 October 2021

**Publisher's Note:** MDPI stays neutral with regard to jurisdictional claims in published maps and institutional affiliations.

**Copyright:** © 2021 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (https:// creativecommons.org/licenses/by/ 4.0/).

(HVAC) systems, lighting, and office equipment [5,7,8]; other studies focus on energy usage behaviour [9–14]. However, and to the best of the authors' knowledge, relatively little attention has been given, in the literature, to the analysis of energy consumption for identifying where (and how) energy is wasted, i.e., is it due to negative energy usage behaviour?

The attitudes and conduct of individuals towards energy usage, here and after referred to as 'energy usage behaviour', can have a significant impact on overall energy consumption [15]. An often-repeated phrase in this paper is "negative behaviour" or "negative energy usage behaviour", and it refers to actions taken by individuals, resulting in unnecessary consumption of energy. An example of negative energy usage behaviour is leaving equipment/appliances powered on when not in use, resulting in unnecessary high consumption of electricity. Steps toward improving energy usage behaviour can be made, without the need to spend substantial amounts of money on energy-saving measures, if the focus is turned towards behavioural change [16]. One key step in enabling behavioural change is monitoring consumption over prolonged periods of time to establish a strong baseline, which is a crucial stage in building successful energy management plans [17–19]. Baseline data can be further used for waste analysis, identifying behavioural patterns, and comparison with the post interventions' consumption, in order to highlight the impact of the introduced energy-saving measures.

This paper presents an analysis of the data collected during a field study, conducted in Medway NHS Foundation Trust (MWNFT), a hospital in the south-east of England, in order to promote energy-conscious behaviour amongst the members of staff, using persuasive technology [20]. The data collected during the study and analysed in this paper includes half-hourly electricity consumption, occupancy numbers by members of staff and patients, responses to relevant questions from a "Views and Ideas on Energy Usage and Behaviour" questionnaire, and the results of an equipment audit performed outside of working hours. The paper builds on the work in [2], which presented a framework designed to address the energy usage behaviour issue in MWNFT. Moreover, the work in [2] highlighted the main building blocks of the system and the techniques implemented to collect the data during the study period. Nevertheless, the focus in the current paper is on analysing the electricity and occupancy data, collected during the baseline period of the field study, in order to identify the possible presence of negative energy usage behaviour. The idea is to show that by performing basic analysis of electricity consumption patterns outside of working hours, waste can be identified and linked to potential negative energy usage behaviour. Studies in the literature have shown that behavioural interventions can record immediate savings of up to 21.9%, without the need for introducing invasive and expensive energy measures [21].

#### *Research Contribution and Impact*

This section is intended to summarise the contributions made by the work presented in this paper, that is, why they are deemed significant contributions, and the potential impact they can have on the field and particularly, in assisting other research studies that are focused on the behavioural change side of energy management.

1. A novel methodology is proposed, in order to identify where energy is wasted by analysing the electricity consumption of two independent clinical and non-clinical areas in MWNFT. This involves the analysis of electricity consumption patterns, in light of occupancy and the consideration of the member's of staff mindset and behaviour towards energy usage, through a questionnaire and an equipment audit to pinpoint which equipment is left switched on unnecessarily.

*Significance and Impact:* This contribution is believed to be a game changer, when it comes to energy management. Studies, such as [5,22–24], that focus on the high energy consumption problem tend to overlook the "Why?" question and focus on bringing down the numbers by introducing energy-saving measures. However, there are far simpler and cheaper methods to bring down energy, carbon emissions, and costs. The Department for Energy and Climate Change (DECC) have published several energy efficiency guidelines for the community to follow. In [25], the DEEC were providing guidelines to small and medium-sized enterprises (SMEs), in relation to energy efficiency. The main focus of the report was to point out basic and cheap measures to reduce wasted energy, in order to cut down energy costs. Several case studies were reported, including that of the Chinese Contemporary Arts Centre in Manchester, which managed to save 4363 pounds and 17.6 tonnes of CO2*e* a year by installing a 100 pounds timer, after discovering heaters were left switched when the occupancy of the rooms was zero. Thereby, successfully pinpointing where and how energy is wasted would enable energy management personnel to focus their efforts in one place and ensure the maximum effectiveness of the implemented energy conservation techniques.

2. To the best of the authors' knowledge, this study is the first of its kind to address the issue of energy usage behaviour in a hospital environment.

*Significance and Impact:* Although the analysis and methodology presented are applicable to data collected in any environment, this research study invites the question "Why hospitals and not any other type of building?". The answer to this question lies in the fact that hospitals are high consumers of energy when compared to other types of buildings [26]. A study reported that the healthcare sector spends 400 pounds million per year on energy [27], while another reported 750 million pounds [28]. The 24-h operation of hospitals throughout the year makes it the biggest consumer but also creates the high potential to save energy in a society [29]. Thereby, it is hoped that by following the footsteps of this paper, other studies will emerge that tackle the same issue in other hospitals with the sole purpose of making a collective positive impact on the environment.

#### **2. Background**

In recent years, several research studies have been conducted on the impact of occupants' behaviour on energy consumption in the building sector [30–33]. The purpose of the studies was to conduct experiments to show the effectiveness of feedback technology on occupants' behaviour towards energy usage.

In line with the feedback theory, providing an individual with feedback is a performance indicator of a habit that will drive the individual towards associating their behaviour and its consequence [34]. In the context of this study, energy consumption feedback is the provision of visual usage information to the energy users to increase their awareness of their consumption [35].

The problem tackled by the provision of feedback is the invisibility of energy usage information to the end-user [36], especially in non-domestic buildings. The invisibility of usage leads to the lack of consideration of the high energy usage consequences. This turns the individual to a state of ignorance of the impacts of their actions, that is, negative energy usage behaviour. A considerable amount of data and information is required to redirect the individual towards the causes of their actions and make them think about them [35]. Providing feedback to individuals can result in self-awareness of their energy usage, which leads to energy-conscious behaviour and reduced carbon footprint [37].

A sustained energy-conscious behaviour and reduction in energy consumption cannot be promoted by merely providing numerical information, but feedback must be combined with other interventions [35,36], such as goal setting [9,34,38], incentives [11], and energy delegates [10]. However, the interventions did not account for or measure negative behavioural patterns amongst the energy users that participated in the studies [33].

#### *Why Was Medway Hospital Selected for This Study?*

The particular choice of Medway hospital has two main scientific folds, the first is the hospital's status in carbon emissions, compared to other NHS hospitals across the UK (Figure 1). The second is the fact that MWNFT is considered one of the biggest employers

in Medway towns and one of the top five NHS hospitals across Kent, Surrey, and Sussex, with almost 4000 members of staff employed, which made it an ideal location for an energyconscious behaviour study. Moreover, working in close proximity of the hospital premises, during the data collection phase, was an added advantage.

**Figure 1.** Medway hospital's carbon emissions compared to NHS Hospitals across the UK (2009 to 2018).

The data plotted in Figure 1 were obtained from publicly available Estates Return Information Collection (ERIC) reports, and the corresponding carbon emissions were computed using a 0.3516 kgCO<sup>2</sup> per kWh of electricity, conversion factor, as per the hospital's energy team. The carbon emission figures in Figure 1 are shown for electricity only, which was the focus of the pilot study conducted in Medway hospital. The increase in carbon emissions from 2009 to 2018 shows an average of 4%, compared to other trusts that showed a 1.5% drop in the five years preceding 2018 as few energy-saving measures were introduced at Medway hospital during the period.

Previous literature reports on the use of feedback as a performance indicator with a focus on the types [36] and characteristics of feedback. Discussions and studies emerged showing the impact of different types of feedback (direct [39–41], indirect, inadvertent [42], utility-controlled and energy audits [43]), frequency of information provided [35,44,45], presentation medium [46–48], data units [49,50] and location of feedback [43,45,51].

Negative behaviour towards energy usage is directly tied to waste in energy. Studies in the literature, such as [1,9,44,51], go on to tackle the increased energy consumption by targeting behavioural change without identifying that there is, in fact, a behavioural issue. Although the studies yielded positive results, and the findings do show the effectiveness of the approaches taken, they focus on implementing a method to influence positive energy usage behaviour without looking at how and where energy is wasted. The success in such cases is reliant on the presence of the influencer, which, in busy environments and changes in members of staff, can result in losing the positive impact.

With current studies of building energy performance, resulting in errors of up to 300% according to [52,53]. Thereby, the consideration of occupants and their negative behaviour could have potentially shaped the experiments and resulted in more significant savings and sustained pro-environmental behaviour. Furthermore, enabling the creation of informed policies to encourage waste-free energy usage behaviour.

Here, the focus is on the analysis of baseline data to identify potential negative energy usage behaviour and areas where energy is wasted prior to any interventions, which, to the best of the authors' knowledge, is an area that was not previously addressed in the literature. This study presents a methodology to identify negative energy usage behaviour

by correlating the electricity consumption with the occupancy, by members of staff and patients. High consumption periods, with low occupancy, can be flagged as anomalies and could be further investigated to confirm energy waste. Performing this outside of working hours, for example during bank holidays, can be an indication of unused equipment being left switched on, and this is the main focus and contribution in this study.

#### **3. Methodology**

This section intends to outline the methods adopted in the study, including the ward/department selection process, as well as data collection and analyses techniques. Section 3.1 outlines the selected wards/departments and details of the selection process, while Section 3.2 provides information on the data collected and presented in this paper as well as the adopted analysis techniques.

#### *3.1. Selection of the Clinical and Non-Clinical Ward/Department*

The selection process of the areas chosen for this study aimed at reflecting the capability of the system and framework to be applied to clinical and non-clinical domains. Thus, enabling other sectors of the community across the UK to adopt the methodology and tackle energy usage behaviour issues in their buildings. Accordingly, two independent wards/departments, from Medway hospital, participated in this study. One of the selected areas is a clinical ward and the other is a non-clinical department; however, both have fixed operating hours to enable analysing the energy consumption during and outside of working hours. Details of the selected areas are below:


#### *3.2. Data Collection and Analyses Techniques*

Four quantitative data types were collected and are discussed in this subsection. The first is the electricity consumption data, the second is the number of occupants in each ward/department, the third is a log of equipment left switched on outside of working hours, and the fourth is the members of staff's views on energy consumption and saving regimes, through a semi-structured questionnaire.

#### 3.2.1. Electricity Consumption and Occupancy Data

Data on electricity consumption was collected over a period of 15 months, between December 2017 and February 2019, using the wireless electricity data logger (WEDL) presented, in [54] which recorded electricity data from the hospital electricity meters, at a half-hourly rate. It was crucial to collect high resolution electricity data, from individual hospital wards, to enable fine-grain monitoring and analysis of consumption trends and energy-conscious behaviour. The permanently deployed system, previously presented in [2], meets this particular criteria, which is necessary for this type of studies. Other techniques include more invasive approaches, such as installing temporary energy-sensing nodes using smart plugs inside the wards or clamp sensors [1] in the electrical distribution boards, located inside the wards; both can cause a disruption to the wards' operation.

Occupancy data were also collected during this period and was obtained directly from hospital records. The advantage of this was the easy and rapid access to anonymous occupancy figures crucial for the timely progression of the study. Other techniques of people counting involve using technologies such as radio frequency identification (RFID) [55], Wi-Fi [56], and thermal imaging [57]. Although, deploying such technologies in a hospital environment can face several challenges, due to privacy (such as with RFID) and compliance with the health code; those approaches can be considered for future research. The collected data were analysed to calculate:


Consumption per occupant is a critical metric to establish a baseline number that takes into consideration the occupancy of the target place. For instance, a day with consumption recorded above average can be due to an intense operation in the workplace, rather than being an anomaly, and one with low recorded consumption can be the opposite. Thereby, knowledge of occupancy is a step closer to evaluating and explaining the recorded consumption.

The second point to be analysed, that is statistical correlation between energy consumption and occupancy, is to highlight the impact of occupancy on the area's energy consumption.

Lastly, the hourly profiles of weekends and bank holidays are presented to shed some light on a higher resolution of data. The increased consumption, with reference to the average weekly consumption of the ward/department, will flag anomalies that can enable the identification of negative energy usage behaviour. Given the data collected for this study was for a period of 15 months, which, in an hourly resolution, equates to a large number of data points. The hourly profiles presented are of a limited number of weekends and bank holidays to showcase what is believed to be a pattern of behaviour and electricity usage.

#### 3.2.2. Out-of-Hours Log of Switched on Unused Equipment

As part of the long-term aims of the study, to measure the improvement in energy usage behaviour, a log of equipment left switched on, outside of working hours, in each ward/department, was created. The information collected about the equipment was used as a measure of energy-conscious behaviour in the workplace. Although this is not the aim of this paper, this metric would enable quantifying human behaviour in the workplace, hence enabling accurate evaluation of energy usage behaviour.

The data were collected through out-of-hours walkarounds in both of the wards/ departments reported in this paper. The information collected includes:


It was crucial to only consider the impact of the electricity consuming loads that are connected to the WEDL. For instance, the lights were disregarded as they were not fed from the same distribution board feeding the rest of the equipment in the wards/departments.

The equipment involved in the analysis were only those that the working members of staff can access and control. Prior to the study, it was ensured that the selected equipment will encounter no problems or malfunction if switched on and back off every day. This was confirmed with the IT department, medical equipment department, and the wards'/departments' managers, each for the equipment they oversee. A piece of equipment was recorded as "unnecessarily left switched on" based on whether they were left performing an overnight task and were only recorded if they were not. This was to accurately model the behaviour of the members of staff working in the wards. The equipment can be categorised as follows:

	- **–** Both areas, analysed in this paper, were fitted with a wall mount Hydroboil instant water boiler, energy rated 2.4 KW @230 V.

Whilst the individual impact of every piece of equipment varies, depending on power rating and usage, the purpose of this analysis was to assess the behaviour of the members of staff regardless of how big or small the impact on energy usage is. This is because doing so with low power usage equipment will develop a behaviour that will urge the user to perform the same action with everything else as evidenced by the psychology of habit [58].

#### 3.2.3. Views on Energy Consumption Regimes

A semi-structured questionnaire, entitled "Views and Ideas on Energy Usage and Behaviour" was designed to gather information on the views and ideas of individuals working in the hospital. The questionnaire was designed based on recommendations from Carbon Trust [59] and the energy team at MWNFT.

Two categories of participants took part in this survey, the first were 12 individuals from the two pilot wards/departments to reflect the behaviour within each and the second were 89 individuals from across the hospital to enable modelling the overall behaviour of members of staff across the hospital. Qualtrics [60], an experience management company, online survey software was used to develop and send the questionnaires to the participants, after providing informed consent. The following questions were selected from the questionnaire:

	- The responses to this question can help indicate the level of awareness of the members of staff in each ward/department and can be correlated to the recorded consumption and unused equipment left switched on, in order to identify negative energy usage behaviour.

This question complements the previous ones in painting the big picture of individuals' role in the hospital towards energy conservation.

#### **4. Results and Discussion**

This section presents, for each ward/department, three levels of analysis. Firstly, the analysis of the electricity usage and occupancy in the wards/departments selected for this study, where the aim is to enable the identification of negative energy usage behaviour by comparing electricity consumption in weeks with and without bank holidays. Secondly, the hourly profiles for weekends and bank holidays are presented, in order to further support the findings from the weekly data. Lastly, a behavioural measure is presented in Section 4.3, for both wards/departments combined, based on the data collected from the semi-structured questionnaire and the out-of-hours audit of equipment.

#### *4.1. The Clinical Engineering Department*

#### 4.1.1. Weekly Electricity Consumption and Occupancy

Figure 2 shows a plot of the weekly electricity consumption and the number of members of staff in the CE department during the baseline stage. The solid line shows the electricity consumption throughout the baseline period. Moreover, the consumption during the nine bank holiday weeks is represented on the graph of Figure 2 using a dashed line, highlighted in red.

The data recorded during the bank holiday weeks show great variations from one to the other. For example, the recorded consumption in the first two bank holiday weeks (weeks 4 and 5) are 423 and 422 kWh, with 38 and 66 members of staff, respectively. Although the second bank holiday week (week 5) had 74% more members of staff working, the consumption remained nearly the same. Moreover, week 4 had two bank holidays, while week 5 had only one. A similar scenario applies to weeks 23 and 26. Accordingly,

a potential lack of awareness and a negative energy usage behaviour amongst members of staff in the department can be reported.

**Figure 2.** Relationship between electricity consumption and occupancy in the clinical engineering department.

A measure of energy usage behaviour is the recorded consumption per occupant, and the target is to record the lowest possible value for it by reducing unnecessary consumption. Figure 3 was plotted to show the consumption per member of staff across the same period, to enable drawing a more reliable conclusion on the energy usage behaviour within the department.

**Figure 3.** Electricity consumption per member of staff in the clinical engineering department.

The dashed red lines in Figure 3 represent the highest recorded weekly electricity consumption per member of staff (all above the average of 7.2 kWh/staff), in the weeks with bank holidays in them, that is, where it is expected to record lower overall consumption. What is alarming about them all is the very low occupancy recorded during these periods, which is a clear indication of the presence of negative behaviour. It is valid that there can be other reasons, such as the use of high consuming equipment to counter a high or low temperature, and so on. However, it is to be noted that heating is not electricity based in

Medway hospital, and no equipment, foreign to the department, were reported during the data collection stage.

To further highlight the relationship between electricity consumption and occupancy in the CE department, a statistical correlation analysis was performed to highlight the significance of the correlation between both data sets. The reported results indicated a positive but weak correlation (*p*-value < 0.1; *r* = 0.431) between the weekly electricity consumption recorded by the department and the occupancy during the same period. This shows the reality of the situation in the hospital where the consumption can be high with low occupancy. This shows the importance of analysing the consumption patterns, in the context of occupancy, to identify negative energy usage behaviour.

#### 4.1.2. Hourly Profiles of Weekends and Bank Holidays

The analyses presented in Section 4.1.1 showed the potential presence of negative energy usage behaviour in the CE department. To further support this, the hourly profiles of the department on the weekend commencing 7 April 2018 and the bank holiday, on the 7 May 2018, are presented in Figures 4 and 5, respectively. The graphs in Figures 4 and 5 are plots of the hourly electricity consumption in the department, on the designated days, against the average usage of the whole week (MON-SUN).

With the department having zero occupancy over weekends and bank holidays, the profiles seen in the figures raise concerns on the member of staffs' behaviour towards equipment outside of working hours. The data shows electricity consumption being above average for 9 h on Saturday and 7 h on Sunday (see Figure 4) and for another 7 h on bank holiday Monday (see Figure 5). This increased consumption can potentially reflect equipment being left switched on outside of working hours, leading to an unnecessary increase in electricity consumption.

**Figure 4.** Hourly electricity consumption in the weekend 7 April 2018 to 8 April 2018 of week 19 in the clinical engineering department.

**Figure 5.** Hourly electricity consumption on the bank holiday 7 May 2018 of week 23 in the clinical engineering department.

#### *4.2. The Cardiac Catheter Suite*

#### 4.2.1. Weekly Electricity Consumption and Occupancy

A similar approach to the analysis was taken with the clinical ward in the study. However, unlike the department in Section 4.1, only eleven months' worth of data were analysed from December 2017 up to and including October 2018. The four months November 2018 to February 2019 were disregarded, as there was work that involved the installation of a replacement chiller, which caused a large drop in the meter readings recorded by the EFS for the CCS. This was based on information from the operational estates team in Medway hospital.

As a clinical ward, the occupancy can be either by members of staff or patients. However, this analysis excluded the members of staff counts based on their Coefficient of Variation (CV), an evaluating measure of the standard deviation [61]. The CV of the members of staff counts during the eleven months baseline period was found to be 11.17% for an SD = 2.80 and M = 25, indicating that the variability in members of staff counts were not significant throughout the baseline period. Hence, the members of staff counts were assumed to be a fixed factor.

The patient counts over the same period had a CV of 14.58%, which is close to that of the members of staff, with an SD = 74.94 and M = 514. However, the identities of the staff members working in the clinical ward do not change significantly over a period, but with patients they do because of new cases, illnesses, treatments, and others. Therefore, the non-significant variation in the number of patients has a more significant impact on energy consumption than that of the members of staff. Hence, the analysis was performed to identify the impacts of patient numbers on the ward's electricity consumption.

Figure 6 shows a plot of the weekly electricity consumption and the number of patients in the CCS during the baseline stage. The top solid blue line graph shows the electricity consumption, with the consumption during the seven bank holiday weeks dashed and highlighted in red.

**Figure 6.** Relationship between electricity consumption and occupancy in the cardiac catheter suite.

Electricity consumption in the bank holiday weeks varies, with some of them, for example week 26, recording consumption above average (Figure 6). This variation in the data across weeks with at least one bank holiday is an indication of a potential waste in energy that can be attributed to negative energy usage behaviour.

Considering the first bank holiday week (see Figure 6, week 4), the recorded consumption is 1775 kWh with 234 patients admitted to the ward. Comparing this with another bank holiday week 18, which recorded 1947 kWh and 201 more patients, plus the fact that week 4 had two bank holidays, can indicate energy waste outside of working hours.

Similarly, weeks 23 and 26 were compared; week 23 recorded approximately 480 kWh less, with 75 more patients admitted. This shows the importance of considering and analysing high-resolution energy data against occupancy and the information that such analysis can reveal.

A key metric, especially in a clinical ward, is the consumption per patient to evaluate energy usage behaviour and also as a measure of the efficiency of operation and resource utilisation within the ward; although, the introduction of any energy measure must not negatively impact the day to day operation of the ward and the quality of patient treatment. Figure 7 shows the consumption per patient across the same time period to evaluate the ward's energy usage behaviour.

**Figure 7.** Electricity consumption per patient in the cardiac catheter suite.

The dashed red lines in Figure 7 represent the highest recorded weekly electricity consumption per patient, in the weeks with bank holidays in them, most of which are above average (4.44 kWh/Patient).

Bank holiday Weeks 4 and 26 alongside week 13 reported the highest consumption per patient and the lowest number of patients admitted (see Figure 6), compared to the final week in the data set. The fact that fewer patients were admitted means less equipment used, less activity, and potentially, very high waste and the presence of negative behaviour.

To further highlight the relationship between electricity consumption and occupancy in the CCS, a statistical correlation analysis was conducted. The reported results indicated a significant positive correlation (*p*-value < 0.1; *r* = 0.484) between the weekly electricity consumption recorded by the ward and the occupancy, by patients, during the same period. As with the non-clinical ward (Section 4.1), the correlation factor is below 0.5. This further supports the result from the non-clinical area but also adds new insights to the analysis by showing that having fewer patients can still mean high consumption, indicating the potential lack of awareness towards energy usage in the ward.

#### 4.2.2. Hourly Profiles of Weekends and Bank Holidays

The hourly profiles of the CCS during the bank holiday weekend commencing on the 30 March 2018 and the weekend commencing on the 2 June 2018, are presented in Figures 8 and 9, respectively.

The graphs in Figures 8 and 9 are plots of the hourly electricity consumption in the department, on the designated days, against the average usage of the whole week (MON-SUN).

The CCS has a significantly higher hourly consumption profile, compared to the CE department, which makes it a much more impactful area to consider. Looking at the plots of both Figures 8 and 9, the consumption is above average for more than 50% of the time, with zero occupancy by staff and patients. Similar to the CE department, this increased consumption can potentially reflect equipment being left switched on outside of working hours, leading to an unnecessary increase in electricity consumption.

**Figure 8.** Hourly electricity consumption in the bank holiday weekend 30 March 2018 to 2 April 2018 of weeks 17 and 18 in the cardiac catheter suite.

**Figure 9.** Hourly electricity consumption in the weekend 2 June 2018 to 3 June 2018 of week 26 in the cardiac catheter suite.

#### *4.3. Energy Usage Behaviour Measure*

Having presented and analysed the weekly and hourly profiles of the wards' electricity consumption. This section presents the results of the selected questions from the "Views and Ideas on Energy Usage and Behaviour" questionnaire and the out-of-hours equipment audit. The purpose of this section is to accurately evaluate the energy usage behaviour of the members of staff working in the selected wards/departments. The responses to the questionnaire and the results of the out-of-hours equipment audits and the potential savings from switching off unused equipment are reported and discussed in Sections 4.3.1 and 4.3.2, respectively.

4.3.1. Members of Staff Views on Energy Usage and Energy Saving Measures Adopted in the Trust

As mentioned earlier, participation was invited from the two pilot wards/departments and from across the hospital, in order to establish a relationship between both views and identify whether any behavioural issues that might arise would persist across the hospital.

The selected questions aimed at an evaluation of individuals' awareness and behaviour to save energy through efficient usage of equipment. The results showed that participants from the two/pilot wards/departments and the majority (approximately 95%) of the participants from across the hospital are aware of actions that can save energy, as seen in Figure 10a. The second question, which asked about the efficiency of energy usage, showed some positive outcomes as well, with more than 50% of the participants believing they use energy efficiently, see Figure 10b. However, some participants from the CE department and from across the hospital responded that they some times forget to switch off equipment or they do not pay attention and this falls in line with the figures analysed previously in Sections 4.1 and 4.2, indicating a potential negative energy usage behaviour. Lastly, and as per Figure 10c, more than 70% of the participants believe that they have a role to play in improving energy usage in MWNFT. Nevertheless, some participants from the CE department answered "No" (10%) and "I'm not sure" (20%), indicating a lack of awareness.

The following subsection quantifies the normal behaviour of members of staff working in the pilot wards/departments by presenting the quantity of equipment left switched on, unnecessarily, out-of-hours and further discusses the results of the questionnaire.

(**c**)

**Figure 10.** Participants' responses to the selected questions from the "Views and Ideas on Energy Usage and Behaviour" questionnaire; (**a**) Q: "How Many Actions are You Aware of that Can Save Energy?", (**b**) Q: "Do you Think your Use of Energy is Efficient?", (**c**) Q: "Do you Feel that you have a Role to Play in Improving the Way Energy is Used Within the Trust?".

#### 4.3.2. Members of Staff Behaviour towards Equipment Outside of Working Hours

The results of the out-of-hours equipment audit were crucial to paint a picture of the level of energy-conscious behaviour in the selected pilot wards/departments. Table 1 shows a log of the equipment recorded during the out-of-hours walkarounds, how many were left switched on unnecessarily, their power rating, and the resulting waste in electricity consumption per week. The figures in the table represent an average of all the logs recorded over the course of the study; the power rating was found by using a portable power meter, where the equipment can plug into to measure parameters such as power, current, and others.

By looking at each individual type of equipment, there is always more than 50% of them left switched on. By following the reported figures in Table 1 a total of 128.5 kWh can be saved per week from the two wards/departments in this study, which equates to about 551 kWh per month and 6609 kWh per year. So, if the hospital is billed at 0.114 pounds/kWh (the average tariff during 2018, as per the hospital's energy team) then savings of approximately 750 pounds can result from switching-off/unplugging PCs, monitors, screens, and other simple equipment, before leaving the workplace, in two out of at least 50 other wards/departments that operate with limited hours in the hospital. This means the adoption of such behaviour across the hospital can have 30,000 pounds + annual savings.

The recorded figures in Table 1 show a clear lack of energy-conscious behaviour. However, it can also be quite natural, given the individual perception that switchingoff one device will not save the world and the numbers do support this. For instance, an individual PC with one monitor will cost the hospital 12 pounds per year. This is believed to be where the problem lies and it shows the importance of raising awareness that a collective effort from everyone on very simple energy measures can, indeed, make a massive positive impact on the hospital's savings and, consequently, on the environment.


**Table 1.** Electricity waste due to equipment left switched on outside of working hours.

#### *4.4. Limitations of the Study*

The study presented in this paper aimed at identifying the potential presence of negative energy usage behaviour in the workplace. The study relied on the analysis of occupancy, by members of staff and patients, to flag anomalies in the recorded electricity consumption patterns, as well as members of staff's views on energy saving measures, and finally, a log of equipment outside of normal working hours. Although the reported results are sufficient, from a scientific point of view (and with respect to the literature), a few points limited the focus of the study. For instance, the occupancy figures of patients were treated as numbers only, without accounting for what equipment was used per patient and for how long. Similarly, members of staff were assumed to have equal impact on the ward's electricity consumption, regardless of their role and the equipment used. The reason for not considering the above points goes back to the absence of this data for anonymity, as well as the potential disruption to the ward/department's daily operation. Future close collaboration with ward/department managers can be performed, in order to factor in individual equipment used.

#### **5. Conclusions**

This field study presented a framework to enable energy personnel to identify potential negative energy usage behaviour and areas of immediate savings through an analysis of historical energy consumption data. The study was designed to tackle energy usage behaviour, as a solution to energy waste, and is in line with the governmental focus on climate change and the net-zero carbon emission target in the UK.

Based on electricity per staff/patient occupancy, presented earlier in the paper, electricity consumption during bank holiday periods were higher than expected. The CE department consumed 26% more energy than was expected, with a 30% reduction in the number of staff working during the bank holiday weeks. Similarly, the CCS recorded 32% more energy, with a 37% reduction in the number of patients admitted during the bank holiday weeks. The expectation was to see a significant drop in electricity consumption per staff/patient during bank holidays, but on the contrary, an increase was recorded, suggesting that equipment was left switched on unnecessarily. Furthermore, the hourly profiles have revealed the high consumption of electricity for a significant amount of time during the weekends and bank holidays, in areas where minimal, if not zero, consumption was expected. The log of equipment, presented in Table 1, made a strong case of support for the lack of awareness and energy-conscious behaviour in both wards/departments, with nearly 80% of all equipment left switched on unnecessarily, outside of normal working hours, resulting in a monthly waste of approximately 551 kWh.

By identifying the peak consumption periods (Figures 3 and 7), the usage data and department operations during them can be reviewed to limit the waste and avoid it in the future. In wards/department with limited working hours, immediate savings can be guaranteed when actions are taken in such periods. Moreover, acting on high consumption areas will result in higher savings. For instance, the lowest recorded hourly consumption in Figures 8 and 9 (the CCS) were significantly higher than the highest recorded consumption in Figures 4 and 5 (the CE department). Hence, a valid strategy would be to tackle areas of high consumption first, in order to bring the overall consumption down and eventually expand it across the whole hospital.

To conclude the paper, the analyses presented shows the value of the collected data and sets a methodological baseline for other research studies to build on. By analysing consumption, the number of occupants, and tracking down equipment during working and non-working hours, negative behaviour amongst members of staff can be identified, in order to locate areas where immediate savings in consumption can be made. Furthermore, with the advancements in the field of artificial intelligence (AI) and machine learning (ML), the data collected for this study (and similar ones) can be used to develop forecasting models that can predict future consumption and behaviour, based on the recorded patterns and, hence, take early action to avoid unnecessary consumption in the future. Moreover, the data can be useful in analysing the impact of individual high-consuming equipment and evaluate their operating energy efficiency, whilst factoring in the human behaviour element.

**Author Contributions:** Conceptualization, A.T. and J.K.; data curation, A.T.; formal analysis, A.T., J.K. and T.H.; funding acquisition, A.T. and R.W.; investigation, A.T.; methodology, A.T.; project administration, A.T., J.K. and R.W.; resources, N.A. and J.B.; software, A.T.; supervision, J.K., T.H., R.W., N.A. and J.B.; validation, A.T., J.K. and T.H.; visualization, A.T.; writing—original draft, A.T.; writing—review and editing, A.T., J.K., T.H., A.Z., Q.H.A. and M.A.I. All authors have read and agreed to the published version of the manuscript.

**Funding:** This research was funded by the University of Greenwich's Vice-Chancellor PhD Scholarship and by the contributions of the Estates and Facilities Department of Medway NHS Foundation Trust.

**Institutional Review Board Statement:** The data presented in this paper involved electricity consumption data and occupancy by human subjects. However, anonymous occupancy data were collected directly from the hospital where the study was conducted. Nevertheless, the study was conducted in accordance with the Declaration of Helsinki, and ethics approval was obtained from the NHS Health Research Authority (HRA).

**Informed Consent Statement:** Where it was needed, informed consent was obtained from all subjects involved in the study.

**Data Availability Statement:** Restrictions apply to the availability of these data. The data belongs to Medway NHS Foundation Trust but was collected using systems provided by EnergyLogix. Data, however, can be made available with the approval of the corresponding author, Medway NHS Foundation Trust, and energylogix.

**Acknowledgments:** The authors would like to acknowledge the support provided by energylogix during the data collection phase. Energylogix is a Small to Medium Enterprise (SME) that provided the equipment used for collecting the electricity data for this study. This work was supported in parts by, the Engineering and Physical Sciences Research Council (EPSRC) grants, EP/T517896/1.

**Conflicts of Interest:** The authors declare no conflict of interest.

#### **Abbreviations**

The following abbreviations are used in this manuscript:


#### **References**


## *Article* **Video Super-Resolution Based on Generative Adversarial Network and Edge Enhancement**

**Jialu Wang , Guowei Teng \* and Ping An**

Department of Signal and Information Processing, School of Communication and Information Engineering, Shanghai University, Shanghai 200444, China; wangjialu1005@163.com (J.W.); anping@shu.edu.cn (P.A.) **\*** Correspondence: tenggw@shu.edu.cn; Tel.: +86-021-6613-5051

**Abstract:** With the help of deep neural networks, video super-resolution (VSR) has made a huge breakthrough. However, these deep learning-based methods are rarely used in specific situations. In addition, training sets may not be suitable because many methods only assume that under ideal circumstances, low-resolution (LR) datasets are downgraded from high-resolution (HR) datasets in a fixed manner. In this paper, we proposed a model based on Generative Adversarial Network (GAN) and edge enhancement to perform super-resolution (SR) reconstruction for LR and blur videos, such as closed-circuit television (CCTV). The adversarial loss allows discriminators to be trained to distinguish between SR frames and ground truth (GT) frames, which is helpful to produce realistic and highly detailed results. The edge enhancement function uses the Laplacian edge module to perform edge enhancement on the intermediate result, which helps further improve the final results. In addition, we add the perceptual loss to the loss function to obtain a higher visual experience. At the same time, we also tried training network on different datasets. A large number of experiments show that our method has advantages in the Vid4 dataset and other LR videos.

**Keywords:** video super-resolution; generative adversarial networks; edge enhancement

#### **1. Introduction**

Super-resolution (SR) aims to reconstructing high-resolution (HR) images or videos from their low-resolution (LR) versions, which is a classic problem in computer vision. It not only pursues the enlargement of the physical size but also recovers high-frequency details to ensure clarity. Classical algorithms have existed for decades and can be divided into the following categories, methods based on patch [1], edge [2], sparse coding [3], prediction [4], and statistics [5]. These methods have lower computational cost than deep learning methods, but their recovery performance is also very limited. With the popularity of deep learning, convolutional neural networks have been widely applied and led to a dramatic leap in SR.

This field can be divided into two parts, single image super-resolution (SISR) and video super-resolution (VSR). The former exploits the spatial correlation in a single frame, while the latter additionally uses inter-frame temporal correlation. Digital video processing technology includes many fields, such as passive video forgery detection techniques [6–8]. In this article, we will focus on videos with lower resolution and blurry quality. To obtain HR data, the most direct way is to use HR cameras. However, due to the production process and engineering cost considerations, high-resolution cameras will not use for shooting in many cases, such as CCTV. Urban CCTV is helpful to security. However, in order to ensure the long-term stable operation of recording equipment and the appropriate frame rate of dynamic scenes, this product often sacrifices resolution to some extent. 1G of a 1080p video file can only record for less than half an hour at most. If it can only record for a short time, it loses the meaning of monitoring. However, we can improve the quality of CCTV through SR to obtain more information that is useful. In addition, video SR is also used in the HR reconstruction of old movies and TV shows, such as Farewell My Concubine.

**Citation:** Wang, J.; Teng, G.; An, P. Video Super-Resolution Based on Generative Adversarial Network and Edge Enhancement. *Electronics* **2021**, *10*, 459. https://doi.org/10.3390/ electronics10040459

Academic Editors: Chun Sing Lai, Kim-Fung Tsang and Yinhai Wang

Received: 1 January 2021 Accepted: 5 February 2021 Published: 13 February 2021

**Publisher's Note:** MDPI stays neutral with regard to jurisdictional claims in published maps and institutional affiliations.

**Copyright:** © 2021 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (https:// creativecommons.org/licenses/by/ 4.0/).

Similar applications exist in the field of remote sensing and medical imaging. Moreover, SR also helps to improve the performance of other computer vision tasks, such as semantic segmentation [9]. Therefore, obtaining HR data through super-resolution (SR) technology has many practical applications and demands.

On the one hand, choosing the proper VSR algorithm is crucial. VSR was once divided into a large number of single multi-frame SR subtasks [10,11], which resulted in inevitable flicker artifacts and expensive calculations. In our work, as with mainstream algorithms, we use the previously reconstructed high-resolution results to SR the subsequent frames. Since the above methods ignore people's perception, some SR reconstruction results are still unsatisfactory. Therefore, Generative Adversarial Network (GAN) was introduced into the field of SR. GAN, which contains a generator (G) and a discriminator (D), is a popular deep learning-based model. G and D compete with each other during the training process so that the generated data obtained from the generator are as similar to the real data as possible. Goodfellow et al. [12] proposed GAN in 2014. After that, GAN has been applied to various computer vision problems, including SR. For example, a GAN for image SR (SRGAN) [13] uses adversarial loss and perceptual loss to recover photo-realistic textures from LR images. This type of network has excellent performance in reconstructing high-frequency details and can restore textures that are more realistic. However, it also has limitations. GAN will introduce noise and cause some details of the dislocation. Later, the comprehensive consideration of SR combined with other image enhancement methods [14,15] attracted people's attention. SR belongs to the big field of image enhancement. Both of their purpose is to improve people's perception. When SR increases the physical size, it will inevitably cause some discomfort such as blur, which can be improved by combining with other image enhancement methods. After the initial SR, the edge enhancement module is added, which will greatly help the image quality improvement.

On the other hand, methods based on deep learning are data-driven. Specifically, training requires a large amount of paired LR–HR data, which determines the reconstruction ability of the network to a certain extent. Generally, LR frames are degraded from a continuous set of HR frames by linear down-sampling (for example, bi-cubic degradation) or adding other noise on this basis, and formalized as (1) or (2):

$$y = (\mathfrak{x} \otimes k) \downarrow\_{s} + n\_{\prime} \tag{1}$$

$$y = ((x \downarrow\_s) \otimes k) + n \tag{2}$$

where ⊗ represents the convolution operation, *k* represents the blur kernel, ↓ *<sup>s</sup>* represents down-sampled operation, and n represents additive noise [16,17]. Then, the network is used to learn the mapping between low-resolution image *y* and high-resolution image *x*. However, the degradation process is more complicated or even unknown in the real world. Recently, many studies have been conducted on this issue [18–22]. In addition, the dataset may not match the actual LR scene. For example, the dataset is about landscapes, and the characters need to be reconstructed. In this article, we try to train the network on different datasets and test on different testing datasets.

Our main contributions in this paper can be summarized as follows:


Extensive experiments demonstrate the superiority of our method.

#### **2. Related Works**

While SR is a classical task, our review in this section focuses on deep learning-based methods for SISR and VSR.

#### *2.1. Single Image Super-Resolution (SISR)*

Given that *Y* is the low-resolution image, *F*(*Y*) is the reconstructed image, and *X* is the corresponding ground truth HR image, the goal of SISR is to ensure that *F*(*Y*) and *X* are as similar as possible.

Dong et al. [23] proposed a deep convolutional network for image SR (SRCNN), which introduced the convolutional neural network into the SR field for the first time. Subsequently, to accelerate the speed, the same team proposed the fast SR convolutional neural network (FSRCNN) [24], which is a compact hourglass-shape structure. Shi et al. [25] proposed a novel sub-pixel convolutional layer to replace the deconvolutional layer. By doing so, the training complexity is significantly reduced. The above approaches are based on linear networks, and the structure is relatively simple. However, as the depth of networks increased, over-parameterization appeared. To address these difficulties, recursive networks [26,27] behaved well by using weights repeatedly. On the one hand, the network is deeper; thus, the performance is better. On the other hand, deeper networks are also more likely to cause an exploding gradient. To deal with this contradiction, Kim et al. [28] proposed learning residuals only, since the low-frequency information carried by the LR image is similar to the HR images. A very deep residual channel attention network (RCAN) [29] is proposed for high-precision image SR. As a result of the sparsity of residual images, the convergence speed is accelerated. Afterwards, based on residual learning, many frameworks were proposed [30,31].

With the development of deep neural network, excellent networks are constantly being introduced into this field. [32,33] are based on the densely connected convolutional network (DenseNet) [34]. They make full use of low-level features by introducing dense skip connections. GANs are also adapted for SISR in SRGAN [13]. These kinds of methods propose a perceptual loss function in order to recover photo-realistic textures from LR images. Perceptually satisfying in the sense is their main target.

Recently, more categories of SR appeared, such as blind SR [20–22] and unsupervised SR [35]. Moreover, it has been found that the development of SISR tends to be practical. Google announced the Super Res Zoom technology [36], which focused on solving the problem that the images taken by handheld devices are not clear enough. Dong et al. proposed [37,38], which combine the SR with mersisters. Qian et al. proposed the Trinity Enhancement Network (TENet) [15], which can solve multiple problems at the same time. Deng proposed an algorithm, named SR by Neural Texture Transfer (SRNTT) [39], which implemented SR in a referential way. This year, a large number of SR methods for specific objects have emerged, such as hyperspectral SISR [40], face SR [41], and so on.

#### *2.2. Video Super-Resolution (VSR)*

In addition to information in a single frame, VSR has inter-frame temporal correlation. Therefore, both accuracy and consistency need to be considered at the same time. For this purpose, VSR usually has two unavoidable steps: motion compensation and SR restoration.

At the very beginning, VSR was divided into a large number of independent multiframe SR subtasks [10,11]. They focused on obtaining high-quality reconstruction results for each single frame, while the individually generated high-resolution frames lack coherency temporally, resulting in unpleasant flickering artifacts. The above methods did not make full use of time domain information.

Afterwards, adding optical flow networks to the VSR for motion estimation became popular. Taking efficient sub-pixel convolutional neural network (ESPCN) [25] as a reference, Caballero et al. [42] proposed video ESPCN (VESPCN), which consisted of spatiotemporal sub-pixel convolution networks and optical flow networks. Specifically, VESPCN learned the motion compensation by the former and improved the accuracy in real time by the latter. Sajjadi et al. [43] proposed frame-recurrent video super-resolution (FRVSR), which repeatedly using previously estimated SR frames to recover subsequent frames. In addition to reusing the reconstructed HR frames, frame and feature-context video super-resolution (FFCVSR) [44] was proposed to exploit the features of the previous frame

repeatedly. Likewise, Wang et al. [45] proposed learning for video super-resolution through HR optical flow estimation (SOF-VSR), which innovatively reconstructed high-resolution optical flow instead of estimating the optical flow among low-resolution frames to improve the accuracy of motion compensation. Chu et al. proposed Temporally Coherent GAN (TecoGAN) [46], of which the architecture is based on GAN. It not only used optical flow networks, but also suggested novel loss functions to improve time consistency. Furthermore, due to its feature space losses, the proposed approach improved perceptual quality in VSR.

The addition of the optical flow network does improve the experimental results, but it also increases the computational and memory cost as well. Moreover, the final performance heavily depends on the accuracy of the optical flow prediction. Inaccurate optical flow will cause artifacts, which will also propagate to the reconstructed HR video frame. Therefore, several studies have been done to remove explicit motion compensation. Unlike the previous works, video super-resolution via residual learning (EVSR) [47] estimated motion compensation between frames automatically without explicit motion compensation modules. Ganet [48] integrated motion estimation and the frame recovery into one step by utilizing the self-attention network to merge local features into global features. Younghyun et al. [49] introduce a novel framework dynamic upsampling filters (DUF). Instead of explicitly estimating the motion compensation between LR frames, DUF implicitly utilized the motion information to generate suitable up-sampled filters. In [50], a new method to ensure temporal consistency is proposed. Instead of using optical flow, it uses deformable convolution to track the traceable points by a pyramid, cascading and deformable (PCD) module. Tian et al. [51] proposed a time deformable alignment network (TDAN), which aligned adaptively at the feature level.

#### **3. Methods**

In this paper, we aimed at learning non-linear mapping between the input LR frames and the final HR frames. Our main framework is based on GAN, and the main work is to improve the generator. As illustrated in Figure 1, the generator mainly consists of two parts: one for intermediate SR results [46] and the other for edge enhancement [14], which makes the final results clearer. LR videos are usually blurry and accompanied by noise. In addition, GAN will inevitably introduce noise. Therefore, edge enhancement while suppressing noise will greatly improve people's perception. Instead of discriminating the realism of spatial detail only, the generator discriminating temporal changes as well. Moreover, in order to obtain good objective indicators while ensuring people's perception, we added a trained Visual Geometry Group (VGG) to compare the difference between the final results and the GT on several specific feature layers.

‐

‐

‐

‐

‐

‐

‐

‐

‐

‐

*L x*

‐

**Figure 1.** Outline of the generator part in our proposed network.

 

‐

‐

#### *3.1. TecoGAN*

The network is based on the GAN. The generator G is divided into two parts. The first part is the optical flow network F, which obtains the motion compensation *v<sup>t</sup>* from two adjacent low-resolution input frames *x LR t*−1 and *x LR t* . Then, *v<sup>t</sup>* is linearly up-sampled four times to obtain *V<sup>t</sup>* . Afterwards, the previous SR frame *X SR <sup>t</sup>*−<sup>1</sup> warps with the inferred motion *V<sup>t</sup>* to obtain *W*(*V<sup>t</sup>* , *X SR t*−1 ). The second part is the SR reconstruction network. *x LR t*−1 and *W*(*V<sup>t</sup>* , *X SR t*−1 ) are put into this part together for SR reconstruction. The result obtained at this stage is *X SR*<sup>0</sup> *t* . The network only learns the residual part to stabilize the network training; therefore, we add *X SR*<sup>0</sup> *t* to the linear up-sampled result *X LR t* from *x LR t* to obtain the final result *X SR t* .

The following formula can be used to summarize the above steps:

$$V\_t = \mathbb{L}lpSample(F(\mathbf{x}\_{t-1}^{LR}, \mathbf{x}\_t^{LR})),\tag{3}$$

$$X\_t^{SR} = G(\mathbf{x}\_t^{LR}, \mathcal{W}(V\_{t\prime}X\_{t-1}^{SR})) + \mathcal{U}pSample(\mathbf{x}\_t^{LR}),\tag{4}$$

The design of the adversarial network and loss function is the main innovation. The adversarial network, which called a spatio-temporal discriminator, not only discriminates spatial details but also includes information in the temporal. It receives two sets of inputs, which consists of the generated results and the GT. In each set of inputs, in addition to spatial details, it also includes temporal information. In this way, the discriminator can automatically balance space and time information to avoid inconsistent clarity or excessive smooth result. TecoGAN has a novel loss function named ping-pong loss as well. The input of the optical flow network is two low-resolution groups. The first group has *n* continuous frames, and the second group is the reverse sequence of the first group. Therefore, it is possible to get the motion compensation *v<sup>t</sup>* between *x LR t*−1 and *x LR t* as well as the motion compensation *v* ′ *t* between *x LR t* and *x LR t*−1 , which are used to generate the forward result *X SR t* and the reversed *X SR*′ *t* . Theoretically, the two are the same. Therefore, the ping-pong loss is as follows:

$$L\_{pp} = \sum\_{i=1}^{n-1} \left\| X\_t^{SR} - X\_t^{SR} \right\|\_2 \,\prime \tag{5}$$

#### *3.2. EEGAN*

The network is based on the GAN for SISR. The main innovation of this method is in its generator, which divides the results into intermediate result *Ibase* and final result *I* ∗ *edge*. Intermediate result *Ibase* is generated by a topologically shaped network. This dense block D in the topological structure is regarded as the basic module of feature extraction and fusion. Unlike traditional dense blocks, they can share and fuse feature maps extracted from multiple previous convolutional layers in both horizontal and vertical directions. Therefore, the number of link nodes is approximately twice that of the original dense block, thereby achieving a variety of fine feature expressions.

The final result is the edge enhancement of the intermediate result. Taking into account that edge enhancement will also amplify noise, the mask branch is performed to learn the image mask to detect and remove isolated noise, which are false edges generated in edge extraction. Subsequently, the enhanced edge map is projected onto the HR space through a sub-pixel convolution operation. According to [14], the mathematical expression of the edge enhancement can be written as follows:

$$I\_{\text{edge}}^{\*} = \text{PS}(F(D(I\_{\text{edge}})) \otimes M(D(I\_{\text{edge}}))).\tag{6}$$

Among them:

1. *Iedge* means the extracted edge from intermediate super-resolution result *Ibase* by the Laplacian operator.


#### *3.3. Our Method*

Referring to the generator of TecoGAN, we constructed the intermediate SR result *X SR <sup>t</sup>*,*base*, which is the final result of the generator in TecoGAN. As we all know, the picture quality of videos with lower resolution is always blurry. In view of the characteristic above, we perform edge enhancement after *X SR <sup>t</sup>*,*base*, which will significantly improve the edge of the subtitles and the outline of the things, thereby improving the overall picture quality. In the subsequent edge enhancement part, we refer to edge-enhanced GAN (EEGAN) [14]. First, the edge of *X SR <sup>t</sup>*,*base* is extracted with Laplacian operator. The Laplacian operation of the image *X SR <sup>t</sup>*,*base* can be defined as its second derivative. In this article, we used ([−1,−1,−1], [−1,8,−1], [−1,−1,−1]) as the discrete convolution mask to extract the image edge *X SR <sup>t</sup>*,*egde*, and its formula is as follows:

$$X\_{t, \text{edge}}^{SR} = L \otimes X\_{t, \text{base}}^{SR} \tag{7}$$

where ⊗ is the convolution operation, and *X SR <sup>t</sup>*,*egde* represents the extracted edge from *X SR <sup>t</sup>*,*base*.

However, videos with lower resolution, such as CCTV, are accompanied by inevitable noise due to the limitations of shooting and production technology. Therefore, the edge obtained at this stage contains a part of false edges caused by noise. GAN will inevitably introduce noise. In order to extract more pure and effective edges, we learn from EEGAN to refine and strengthen *X SR <sup>t</sup>*,*edge*. The specific structure is shown in Figure 2. *X SR <sup>t</sup>*,*edge* is firstly converted to low-resolution space in order to reduce the computational cost. After a few convolutional layers, the dense block in EEGAN [14] is used for feature extraction to obtain edges that are more refined. Meanwhile, we learn the noise mask through a mask branch to achieve the purpose of eliminating noise and artifacts and obtain refined and enhanced edge *X SR t*,*edge* ∗ . We choose leaky rectified linear unit (LeakyReLU) for the activation function of this part. As a variant of rectified linear unit (ReLU), the response of LeakyReLU to the input less than zero is linearly varying, which reduces the sparsity of ReLU. The final result of our SR is *X SR <sup>t</sup>*, *f inal*. It can be expressed as:

$$X\_{t,final}^{SR} = X\_{t,base}^{SR} + X\_{t,edge}^{SR}{\;\*} - X\_{t,edge}^{SR}.\tag{8}$$

In order to ensure the continuity of the reconstructed video in the temporal, we add ping-pong loss from TecoGAN [46] in our framework. We input two groups of consecutive video frames, each of *n* frames. The second group is the reverse sequence of the first group. In this way, we obtain the forward result *X SR <sup>t</sup>*, *f inal* and the reversed result *X SR t*, *f inal* ′ , and the ping-pong loss is:

$$L\_{pp} = \sum\_{i=1}^{n-1} \left\| X\_{t,final}^{SR} - X\_{t,final}^{SR} \right\|\_2. \tag{9}$$

During network training, the generator returns two results *X SR <sup>t</sup>*,*base* and *X SR <sup>t</sup>*, *f inal*, which are the intermediate result and the final result. To make the generator robust, we assign different loss weights to these two results when designing the content loss function *Lcontent*.

$$L\_{content} = \sum\_{i=1}^{n-1} \left( ||X\_{base}^{SR} - X\_t^{HR}|| \, \right.\\ \left. + a ||X\_{t,final}^{SR} - X\_t^{HR}||\_2 \right) . \tag{10}$$

where *X HR t* is the GT, and *α* is the weight. Specifically, *α* changes according to a certain rule during the training. As the training step increased, the model becomes more and more accurate. Simultaneously, the difference between the intermediate result and the final result is getting bigger and bigger. Based on this, the *α* is set to 10 at the beginning and is increased with the training step. See the experimental part for specific parameters. In addition to the above loss functions, we retain the other loss functions in TecoGAN.

(**b**)

 ‐ **Figure 2.** This is our edge enhancement module and partial results. (**a**) This is our edge enhancement module. We take an image as an example to show its process. The Dense Block and Noise Mask inside refer to the design in edge-enhanced GAN (EEGAN) [14]; (**b**) On the left is ground truth, and on the right is a partial enlarged view of *X SR <sup>t</sup>*,*base*, *X SR <sup>t</sup>*,*edge*, *X SR t*,*edge* ∗ , and *X SR <sup>t</sup>*, *f inal* of the city clip for 4× video super-resolution, where *X SR <sup>t</sup>*,*base* is the intermediate result, *X SR <sup>t</sup>*,*edge* is the edge extraction of *X SR <sup>t</sup>*,*base*, *X SR t*,*edge* ∗ is the enhancement and noise purification of *X SR <sup>t</sup>*,*edge*, and *X SR <sup>t</sup>*, *f inal* is the final result.

‐ In addition, we train the model in two steps. In a word, we firstly train the simplified network and then train the complete network on the basis of the simplified network. In the intermediate model, we only train the generator. In addition, the loss function is simplified. In this step, only the content loss is retained, and the weight remains unchanged. This step is equivalent to an initialization parameter training of the subsequent mode. Since the framework and loss functions here are more complicated, if we train the complete network directly, it is difficult to find accurate network parameters or it takes a long time.

‐

‐

‐

‐

A simplified network that is pre-trained helps find the approximate range of the final parameters of the network. Then, we initialize the complete network with the parameters of the simplified network. Next, we fine-tune the framework. In this step, *α* increases with the training steps as well as the learning rate decays with the training steps.

#### **4. Experiments**

In this chapter, we first give training details. Secondly, we perform a comparative experiment study. Then, the evaluation metrics will be illustrated. Finally, we will provide qualitative analysis and quantitative evaluation of the experimental results.

#### *4.1. Train Details*

We perform the experiment using Python3.6 and Tensorflow-gpu1.10.0 on PyCharm 2019.1.3 (Community Edition). The computer used for the experiment is of 3.6 GHz CPU and NVIDIA GeForce GTX 1080Ti GPU. See Table 1 for more details.

**Table 1.** Components and information of the system used for implementation.


The dataset used for training was downloaded from Vimeo. We got the video download link from TecoGAN [46]. Vimeo Terms of Service are followed, and all used videos are available on Vimeo with the download option. Specifically, we download 25 highresolution videos. In order to learn fine motion compensation, we selected 276 scenes, each of which contains 120 frames without lens switching. The resolution size of each scene is not uniformly specified, but the length or height must be larger than 400. Imitating the characteristics of videos with lower resolution, fuzziness, and noise, we use Gaussian blur kernel for four times down-sampled. See Table 2 for more details.

**Table 2.** Specific parameters of the training dataset.


Training the model is divided into two steps. When training the intermediate model, the batch size is 4, the input LR patch size is 32 <sup>×</sup> 32, the learning rate is fixed at 5 <sup>×</sup> <sup>10</sup>−<sup>5</sup> , and the *α* is fixed at 10. When training the final model, the batch size is 1, the size of the input LR patch is 32 <sup>×</sup> 32, the initial learning rate is 5 <sup>×</sup> <sup>10</sup>−<sup>5</sup> , and the initial *α* is fixed at 10. Moreover, we use the decay function provided in the Tensorflow to dynamically decay the learning rate and *α*. The formula is as follows:

$$decayed = initial \times decay\\_rate^{\wedge} (\frac{global\\_step}{decay\\_step}),\tag{11}$$

For learning rate, the decay\_rate is 0.9 and the decay\_step is 28 K. For α, the decay\_rate is 1.1 and the decay\_step is 50 K. The intermediate model performs 600 K iterations, while the intermediate model performs 1200 K. We use Adam with a momentum of 0.9 and a weight decay of the same as the learning rate for optimization. We also recorded the performance of the model on peak signal-to-noise ratio (PSNR) and structural similarity (SSIM) as the interaction changes when training the final model. See Table 3, Figure 3 for more details. 

 

 

‐

‐


(**a**) (**b**) **Figure 3.** (**a**) Peak Signal to Noise Ratio (PSNR) changes with iterations; (**b**) Structural SIMilarity SSIM changes with iterations.

Table 4 shows the details of the Vid4. During the test, we removed the first and last two frames. Specifically, the final data are the average of 155 frames of images, including 37 frames of calendar, 30 frames of city, 45 frames of foliage, and 43 frames of walk.

**Table 3.** Training parameters.


#### *4.2. Comparative Study*

We tried different decay methods, different loss functions, and different datasets to compare the final results and different edge enhancement modules.

For different α decay methods, we compared two patents. Both of them start from 10; one is exponentially decreasing at a rate of 0.9, while the other is exponentially increasing at a rate of 1.1. Other factors remain the same. The experimental results in Figures 4 and 5 show that the incremental approach is better. The testing samples are the same as above, including 155 frames. As the number of iterations increased, the model becomes more and more accurate, and the gap between *X SR <sup>t</sup>*,*base* and *X SR <sup>t</sup>*, *f inal* becomes larger and larger. Therefore, the larger and larger *α* conforms to this trend.

**Figure 4.** The experimental results of different decay mode: (**a**) Peak Signal to Noise Ratio (PSNR) changes with iterations; (**b**) Structural SIMilarity (SSIM) changes with iterations.

(**a**)

(**b**)

 ‐ ‐ ‐ ‐ ‐ ‐ **Figure 5.** Results of different *α* decay methods, where 'Down' means exponentially decreasing at a rate of 0.9, 'Up' means exponentially increasing at a rate of 1.1: (**a**) Qualitative comparison on the calendar clip for 4× video super-resolution; (**b**) Qualitative comparison on the city clip for 4× video super-resolution.

For the loss function, we tried to calculate the loss in proportion to the two outputs *X SR <sup>t</sup>*,*base* and *X SR <sup>t</sup>*, *f inal* of the generator for all loss functions or to calculate the loss in proportion to the content loss only. The former is loss function A, the latter is loss function B. The latter performs better. In Figure 6, we can find that loss function A will cause a more obvious mosaic phenomenon. Using the two layers of the generator on the content loss and assigning different loss weights helps lock in the final result in a more accurate range at the beginning and keep a relatively reasonable range later. Other loss functions only need to use the final result *X SR <sup>t</sup>*, *f inal*.

(**a**)

(**b**)

 ‐ ‐ ‐ **Figure 6.** Results of different loss functions: (**a**) Qualitative comparison on the calendar clip for 4× video super-resolution; (**b**) Qualitative comparison on the walk clip for 4× video super-resolution.

For the datasets, we tried down-sampling from high-resolution videos downloaded randomly on vimeo or down-sampling from high-resolution repaired versions of film and television dramas around 2000. Models train on different datasets perform differently in different scenes. The former performed better on Vid4, while the latter performed better on the film and television scene, which you can see in Figure 7. The experiment shows that the models trained on different training datasets adapt to different scenarios.

‐

‐

 ‐ ‐ **Figure 7.** Qualitative comparison on the Secret History of Xiaozhuang clip for 4× video super-resolution results of models trained on different training datasets.

‐ ‐

For edge enhancement modules, we tried simple edge enhancement and complex edge enhancement. The final result of the former is only the sum of the intermediate result *X SR <sup>t</sup>*,*base* and the Laplacian edge enhancement *X SR <sup>t</sup>*,*edge* of the intermediate result. It can be expressed as:

$$\left(\left(X\_{t,final}^{SR}\right)\_{simple} = X\_{t,base}^{SR} + X\_{t,edge'}^{SR} \tag{12}$$

The latter is as described in Section 3.3, where experiments proved our theory. As you can see in Figure 8, when performing edge enhancement, if both denoising and strengthening are considered, the result is better. The simple edge enhancement will lead to some noise and blurred edges. ‐ ‐

(**a**)

(**b**)

 ‐ ‐ **Figure 8.** Results of different edge enhancement modules: (**a**) Qualitative comparison on the calendar clip for 4× video super-resolution; (**b**) Qualitative comparison on the walk clip for 4× video super-resolution.

#### *4.3. Evaluation*

According to the mainstream of the SR field, we calculate Peak Signal to Noise Ratio (PSNR) and Structural SIMilarity (SSIM) on the Y channel of YCbCr space, where Y refers to the luminance component, Cb refers to the blue chrominance component and Cr refers to the red chrominance component.

Peak signal-to-noise ratio (PSNR) is an objective standard for evaluating images. The mathematical formula is as follows:

$$PSNR = 10 \times \log\_{10}(\frac{MAX^2}{MSE}) = 20 \times \log\_{10}(\frac{MAX}{\sqrt{MSE}}) \,\tag{13}$$

where MSE is the mean square error between the original image and the SR frame, and MAX indicates the maximum value of the image color. For example, the 8-bit sampling point is expressed as 255.

Structural similarity (SSIM) is an index to measure the similarity of two images. The mathematical formula is as follows:

$$SSIM(\mathbf{x}, \mathbf{y}) = \frac{(2\mu\_x \mu\_\mathbf{y} + c\_1)(2\sigma\_{\mathbf{xy}} + c\_2)}{(\mu\_x^2 + \mu\_\mathbf{y}^2 + c\_1)(\sigma\_\mathbf{x}^2 + \sigma\_\mathbf{y}^2 + c\_2)},\tag{14}$$

where *x* is the SR frame, *y* is the GT, *µ<sup>x</sup>* and *µ<sup>y</sup>* are the mean values; *σ<sup>x</sup>* and *σ<sup>y</sup>* are the standard deviations, and *σxy* is the covariance of *x* and *y*. We use the built-in compare\_ssim function of the skimage module to calculate. SSIM is a number between 0 and 1. The larger it is, the smaller the gap between the result frame and the GT; that is, the image quality is better. When the two images are exactly the same, SSIM is 1. ‐ ‐ 

We compare the proposed method on the Vid4 dataset with some other SR algorithms: video super-resolution with convolutional neural network (VSRNet) [52], VESPCN [42], SOF-VSR [45], FRVSR [43], and TecoGAN [46]. Table 4 shows the details of the Vid4. During the test, we removed the first and last two frames. Table 5 shows that our network has the best average results on PSNR and SSIM on the Vid4 dataset. Figures 9 and 10 also show the superiority of our method in qualitative results. Compared with TecoGAN [46], the results of our method are closer to GT. The results of TecoGAN contain more noise. Meanwhile, distortion is more obvious in some details. ‐ 


**Table 5.** Peak Signal to Noise Ratio (PSNR) and Structural SIMilarity (SSIM) of different methods on the Vid4 dataset. 

VESPCN means video efficient sub-pixel convolutional neural network [42], VSRNet means video super-resolution with convolutional neural network [52], SOF-VSR means learning for video super-resolution through HR optical flow estimation [45], FRVSR means frame-recurrent video super-resolution [43] and TecoGAN means temporally coherent generative adversarial network [46]. The data of VSRNet, VESPCN, and FRVSR are quoted from their paper directly.

 ‐ **Figure 9.** Qualitative comparison on the city clip for 4× video super-resolution results.

 ‐ **Figure 10.** Qualitative comparison on the walk clip for 4× super-resolution results.

**‐** We also tested our method in other low-resolution scenes in our lives. Table 6 shows the details of the data. During the test, we removed the first and last two frames. Table 7 shows that our network has the best average results on PSNR and SSIM on film and television scenes. Figure 11 also shows the superiority of our method in qualitative results.

‐ ‐ ‐

‐

‐

‐

 ‐ **Figure 11.** Qualitative comparison on Create State clip for 4× video super-resolution results.

**Table 6.** The details of film and television scenes.



**Table 7.** Peak Signal to Noise Ratio (PSNR) and Structural SIMilarity (SSIM) of different methods on film and television scenes.

TecoGAN means temporally coherent generative adversarial network [46].

#### **5. Conclusions**

In this article, we proposed an end-to-end SR method for LR video, which can be used to improve the image quality of urban CCTV. A large number of experiments have shown that our method can improve the resolution of the video and meet people's perception. These LR videos are usually blurry and inevitably accompanied by noise. The edge enhancement module we added can successfully enhance the edge but does not amplify the noise. At the same time, we have also done many comparative experiments. These experiments show that models trained on different training datasets perform significantly differently in different scenarios. We have proved that this method is superior to other methods on different test datasets.

In the future, we will consider optimization based on the training dataset. In this article, we down-sample HR frames to obtain the dataset. The down-sampling process simulates the degradation process of LR data as much as possible, but the same effect cannot be guaranteed. Therefore, the trained model is only most suitable for LR scenarios that meet specific degradation conditions. Based on this, we will try to eliminate the process of manually down-sampling HR frames to obtain LR frames. Specifically, we will directly use continuous frames of the original video as inputs and the corresponding continuous frames of the HR repair version as targets.

**Author Contributions:** Investigation, G.T.; Methodology, J.W.; Project administration, P.A.; Software, J.W.; Supervision, P.A.; Writing—original draft, J.W.; Writing—review and editing, J.W. and G.T. All authors have read and agreed to the published version of the manuscript.

**Funding:** This research was funded by the National Natural Science Foundation of China Project (grant number 62020106011) and the Shanghai Science and Technology Commission Project (grant number 20DZ2290100).

**Conflicts of Interest:** The authors declare no conflict of interest.

#### **References**


MDPI St. Alban-Anlage 66 4052 Basel Switzerland Tel. +41 61 683 77 34 Fax +41 61 302 89 18 www.mdpi.com

*Electronics* Editorial Office E-mail: electronics@mdpi.com www.mdpi.com/journal/electronics

MDPI St. Alban-Anlage 66 4052 Basel Switzerland

Tel: +41 61 683 77 34 Fax: +41 61 302 89 18

www.mdpi.com ISBN 978-3-0365-3963-8