# An Intelligent Scheduling Access Privacy Protection Model of Electric Vehicle Based on 5G-V2X

Authors: Cheng Xu; Hongjun Wu; Hongzhe Liu; Xuewei Li; Li Liu; Pengfei Wang
Journal: Scientific Programming
 (2021)

---

## Abstract

It is more and more important to optimize electric power system scheduling in the development of the Internet of Vehicles. How to improve the applicability and scientific nature of electric vehicle charging is an urgent problem to be solved. This paper proposes an intelligent scheduling access model for electric vehicles based on blockchain. Firstly, the layout simplification calculation is carried out for the layout of the traditional distributed power grid. Then, a data storage and consensus system is built using blockchain smart contracts to ensure that all historical data are not tampered with and are traceable. Finally, the model forms an electricity price guidance model in the intelligent scheduling and access of electric vehicles, optimizes the multivehicle line congestion in operation, and can dynamically schedule and correct the model. In terms of the experiment, 13 test electric vehicles were dispatched based on 12 real power station nodes and 36 test nodes of Yunnan Power Grid Co. Information Center for verification. The result analysis shows that the model can effectively and quickly solve the blocking and unblocking of the Internet of Vehicles and can develop a scheduling scheme conforming to the safety constraints of electric vehicles in a relatively short time.


---

## Body

## 1. Introduction

Electric vehicles (EVs) replacing traditional fuel cars are of great significance in alleviating urban air pollution. Compared with traditional fuel cars, electric vehicles are expensive, take longer to charge, and have a shorter range. In particular, the lack of charging piles greatly affected the promotion of electric vehicles. All countries are committed to the research and development of new energy vehicle key technologies, but the penetration rate is not high [1]. In the future, the proportion of electric vehicles on the Internet of Vehicles (IoV) or Internet of things (IoT) will be increasingly large, because of its great advantages; for example, logistics enterprises can provide a fixed charging station. Compared with fuel cars, electric trucks are environmentally friendly and cost-saving. At present, EV charging service has problems such as difficulty in finding a pile for charging users, difficulty in information connection between charging stations, and difficulty in charging transaction settlement [2, 3]. For example, the introduction of a central organization to manage charging services and charging transaction information can improve the current situation, but it requires high cost and risks of information leakage [4]. Therefore, we need to seek new charging service mode and transaction information management system. With the increasing level of digitalization and decentralization of energy systems, the need for reliable defense against cyberattacks in the IoV has increased dramatically. If properly applied, blockchain technology can fix vulnerabilities in networking and data communication. It can improve data confidentiality and privacy, so as to effectively defend against various threats from the inside and outside [5]. In terms of data communication vulnerability repair, blockchain technology can integrate the pricing and settlement functions of the wholesale power market into a secure blockchain system. It can greatly reduce the risk of fake data injection and price manipulation. It ensures that the dataset or communication series specified between the trading parties is immutable. At the same time, blockchain can improve data confidentiality and privacy. As digitally distributed systems become the norm in the energy sector and billions of energy-using devices are integrated into power systems, malicious attackers will see more opportunities to break into these systems and attempt to disrupt them [6].Due to the wide network coverage, high data information transmission rate, low end-to-end latency, and support for massive connections, 5G networks are rapidly spreading [7]. As the underlying network communication technology, 5G can deeply empower upper-layer vertical applications. The integration of 5G and blockchain can cause them to empower each other. With its high speed and low latency, 5G helps the blockchain accelerate transactions (full network broadcasting), avoiding stalls and long-term unresponsiveness [8]. Moreover, because 5G drives V2X, it has spawned a lot of data and scenarios, which is conducive to the implementation of blockchain applications.In this context, how to improve the applicability and scientific nature of electric vehicle charging is an urgent problem to be solved. In order to improve the scheduling optimization of EV in the development of IoV in the real environment, this paper proposes an intelligent scheduling access model for EV based on blockchain.The rest of this paper is organized as follows. Section2 explores the latest methods about blockchain, IoV, and intelligent contract. Section 3 presents the access model of intelligent scheduling of EV based on blockchain. Comparisons of experimental results with other works and discussion are provided in Section 4. Section 5 summarizes the paper and offers directions for future research.


## 2. Related Work

### 2.1. Blockchain Security in Power Grid Industry

The decentralization, openness, intelligence, and sharing of blockchain are in line with the ideas of the IoV and the energy Internet. They can be done by means of data encryption, timestamps, distributed consensus, and economic incentives. Point-to-point transaction, coordination, and collaboration can be realized based on decentralized credit in a distributed system where nodes do not need to trust each other [9]. The application of blockchain in IoV will effectively support the open interconnection of multitype systems and the extensive and deep participation of multiple users. It can not only solve network access, long-distance transmission loss, demand-side response, network security, and other problems, but also form some new models for the inherent market mechanism and business model of the power industry [10].At the same time, in terms of power market transactions, blockchain can exist in three decentralized forms with different degrees of the public chain, private chain, and alliance chain. The internal finance of power grid adopts a private chain, which is conducive to the transparency of internal management universities and the improvement of clearing and auditing efficiency. Alliance chain, power plant, power grid, electricity selling company, and other subjects are adopted among the trading subjects in the power market to reach contract agreements, improve efficiency, and facilitate inquiry and statistics. The public link is adopted between the electricity selling company and users, and automatic meter reading, metering, and billing are adopted to improve transparency and credibility [11].Blockchain has a natural network threat defense capability, which benefits from the following characteristics [12, 13]:(1)
Tamper-proof data: after proper application of blockchain, all calculations will be performed in hash form and will be tamper-proof when the data are generated, thus avoiding the risk of being tampered with in transmission.(2)
Complete data availability: blockchain can store data in a decentralized form through multiple nodes. Under such an architecture, even if some nodes or servers are hacked, the user can still get the complete dataset.(3)
Redundancy: the operation of blockchain has no central failure point, so this architecture is inherently highly reliable through redundancy.(4)
Privacy and control: blockchain users can choose which data are permanently transparent and which data are encrypted, so only the designated receiver can view the data content.(5)
Outsourcing calculation: the encrypted data can be sent to a third party for processing, and the data content will not be displayed in the whole process.


### 2.2. IoV in the Grid Intelligent Scheduling Algorithm

Vehicle scheduling problem was first proposed by Dantzig and Ramser [2]. The goal is under certain constraints, such as the limitation of vehicle load and the volume of the goods to seek the best assembly, also called the vehicle scheduling problem (VSP), or seek vehicles’ best path, also called the vehicle routing problem (VRP), which makes the total distribution cost minimum. Therefore, the vehicle scheduling problem is a typical nondeterministic polynomial problem. When the electric vehicle is used for transportation, the problem is more difficult to solve due to the influence of charging and endurance. In recent years, the logistics scheduling problem based on new energy vehicles is collectively known as the green vehicle routing problem (GVRP). As GVRP is relatively new, there is not much classical research literature. Literature [6] summarizes the research status of EVRP before 2014. It summarizes the technical background of electric vehicles, including vehicle type and battery, cost comparison with traditional fuel car, vehicle grouping, route selection, and optimal route, and gives possible research directions.In the past two years, representative research results included the following: vehicle scheduling problems under the constraints of time and charging station are widely concerned [9–11]. Literature [9] adopted a new hybrid heuristic algorithm to solve this problem. The new algorithm combined variable domain search and tabu search algorithm to test on the standard set and achieved good results. Literature [10, 11] studied the hybrid formation problem of different types of electric vehicles. In the model, the improved branch-and-price algorithm based on Adaptive Large Neighborhood Search was adopted to solve the problem with the constraints of transportation time, transportation cost, vehicle load, etc. The experiment showed that the algorithm was effective. Moreover, literature [12] studies the different trolley charging conditions under different scheduling paths under time constraints and uses branch-price-and-cut algorithms to determine whether there are multiple charging stations on each scheduling path and whether each charge must be filled to get 4 combinations. The study shows that in the case of 100 customers and 21 charging stations, all four combinations have solutions. The comparison of the four kinds of path planning reveals that multiple charging piles have more advantages than the other three cases without full charging. Literature [13] proposes a universal EVRP model, which takes minimum transportation time, minimum energy consumption, and minimum transportation vehicle as constraints and passes through each customer only once. Different from previous models, the problem of power consumption under different loads is considered in this modeling. In this model, the feasible solution space is not large, so the computer is used to solve it accurately. However, the above work did not solve the problem of electricity price optimization.


### 2.3. Intelligent Contract for Secure Access

As a new application technology of the new form of IoV, blockchain has the characteristics of weak centralization, distrust, and not being tampered with easily. It can realize the undifferentiated records of multiple nodes and promote the interconnection of information [5, 6]. Intelligent contracts can be widely used in various interconnection scenarios of energy transactions such as power market transactions and energy demand response [9, 10]. Literature [11] proposes to use blockchain technology to realize transparent and trust-based charging of public charging piles. Literature [12] proposed Ethereum EV charging transaction mode, in which EV users choose the best bidding charging station. Literature [13] proposed a charging pile sharing platform based on a lightning network, blockchain, and intelligent contract. Literature [14] proposed electric vehicle charging transaction based on a lightning network, which solved the possible security problems in a lightning network.The above studies generally use the traditional bitcoin or Ethereum blockchain architecture, which requires tokens and public chain, which is not conducive to improving transaction efficiency and reducing transaction cost. Therefore, it is necessary to select a blockchain architecture more suitable for the performance requirements of EV charging transaction business. Many scholars use the weakly centralized alliance chain to improve the efficiency and security of EV transaction. In literature [15], multiple agent nodes are set up to manage the choice and transaction of user charging mode, but the implementation structure of a specific alliance chain is not mentioned. In [16], electric vehicle users and distributed energy operators were set up for the application scenario of microgrid. Literature [17] used an alliance chain to design charging and discharging transactions between electric vehicles and set up local aggregators to act as service nodes, without involving user transactions in different aggregators.The sorting and analysis of the above research status show that blockchain can effectively improve the defects of grid security access and optimize the charging model of electric vehicles.


## 2.1. Blockchain Security in Power Grid Industry

The decentralization, openness, intelligence, and sharing of blockchain are in line with the ideas of the IoV and the energy Internet. They can be done by means of data encryption, timestamps, distributed consensus, and economic incentives. Point-to-point transaction, coordination, and collaboration can be realized based on decentralized credit in a distributed system where nodes do not need to trust each other [9]. The application of blockchain in IoV will effectively support the open interconnection of multitype systems and the extensive and deep participation of multiple users. It can not only solve network access, long-distance transmission loss, demand-side response, network security, and other problems, but also form some new models for the inherent market mechanism and business model of the power industry [10].At the same time, in terms of power market transactions, blockchain can exist in three decentralized forms with different degrees of the public chain, private chain, and alliance chain. The internal finance of power grid adopts a private chain, which is conducive to the transparency of internal management universities and the improvement of clearing and auditing efficiency. Alliance chain, power plant, power grid, electricity selling company, and other subjects are adopted among the trading subjects in the power market to reach contract agreements, improve efficiency, and facilitate inquiry and statistics. The public link is adopted between the electricity selling company and users, and automatic meter reading, metering, and billing are adopted to improve transparency and credibility [11].Blockchain has a natural network threat defense capability, which benefits from the following characteristics [12, 13]:(1)
Tamper-proof data: after proper application of blockchain, all calculations will be performed in hash form and will be tamper-proof when the data are generated, thus avoiding the risk of being tampered with in transmission.(2)
Complete data availability: blockchain can store data in a decentralized form through multiple nodes. Under such an architecture, even if some nodes or servers are hacked, the user can still get the complete dataset.(3)
Redundancy: the operation of blockchain has no central failure point, so this architecture is inherently highly reliable through redundancy.(4)
Privacy and control: blockchain users can choose which data are permanently transparent and which data are encrypted, so only the designated receiver can view the data content.(5)
Outsourcing calculation: the encrypted data can be sent to a third party for processing, and the data content will not be displayed in the whole process.


## 2.2. IoV in the Grid Intelligent Scheduling Algorithm

Vehicle scheduling problem was first proposed by Dantzig and Ramser [2]. The goal is under certain constraints, such as the limitation of vehicle load and the volume of the goods to seek the best assembly, also called the vehicle scheduling problem (VSP), or seek vehicles’ best path, also called the vehicle routing problem (VRP), which makes the total distribution cost minimum. Therefore, the vehicle scheduling problem is a typical nondeterministic polynomial problem. When the electric vehicle is used for transportation, the problem is more difficult to solve due to the influence of charging and endurance. In recent years, the logistics scheduling problem based on new energy vehicles is collectively known as the green vehicle routing problem (GVRP). As GVRP is relatively new, there is not much classical research literature. Literature [6] summarizes the research status of EVRP before 2014. It summarizes the technical background of electric vehicles, including vehicle type and battery, cost comparison with traditional fuel car, vehicle grouping, route selection, and optimal route, and gives possible research directions.In the past two years, representative research results included the following: vehicle scheduling problems under the constraints of time and charging station are widely concerned [9–11]. Literature [9] adopted a new hybrid heuristic algorithm to solve this problem. The new algorithm combined variable domain search and tabu search algorithm to test on the standard set and achieved good results. Literature [10, 11] studied the hybrid formation problem of different types of electric vehicles. In the model, the improved branch-and-price algorithm based on Adaptive Large Neighborhood Search was adopted to solve the problem with the constraints of transportation time, transportation cost, vehicle load, etc. The experiment showed that the algorithm was effective. Moreover, literature [12] studies the different trolley charging conditions under different scheduling paths under time constraints and uses branch-price-and-cut algorithms to determine whether there are multiple charging stations on each scheduling path and whether each charge must be filled to get 4 combinations. The study shows that in the case of 100 customers and 21 charging stations, all four combinations have solutions. The comparison of the four kinds of path planning reveals that multiple charging piles have more advantages than the other three cases without full charging. Literature [13] proposes a universal EVRP model, which takes minimum transportation time, minimum energy consumption, and minimum transportation vehicle as constraints and passes through each customer only once. Different from previous models, the problem of power consumption under different loads is considered in this modeling. In this model, the feasible solution space is not large, so the computer is used to solve it accurately. However, the above work did not solve the problem of electricity price optimization.


## 2.3. Intelligent Contract for Secure Access

As a new application technology of the new form of IoV, blockchain has the characteristics of weak centralization, distrust, and not being tampered with easily. It can realize the undifferentiated records of multiple nodes and promote the interconnection of information [5, 6]. Intelligent contracts can be widely used in various interconnection scenarios of energy transactions such as power market transactions and energy demand response [9, 10]. Literature [11] proposes to use blockchain technology to realize transparent and trust-based charging of public charging piles. Literature [12] proposed Ethereum EV charging transaction mode, in which EV users choose the best bidding charging station. Literature [13] proposed a charging pile sharing platform based on a lightning network, blockchain, and intelligent contract. Literature [14] proposed electric vehicle charging transaction based on a lightning network, which solved the possible security problems in a lightning network.The above studies generally use the traditional bitcoin or Ethereum blockchain architecture, which requires tokens and public chain, which is not conducive to improving transaction efficiency and reducing transaction cost. Therefore, it is necessary to select a blockchain architecture more suitable for the performance requirements of EV charging transaction business. Many scholars use the weakly centralized alliance chain to improve the efficiency and security of EV transaction. In literature [15], multiple agent nodes are set up to manage the choice and transaction of user charging mode, but the implementation structure of a specific alliance chain is not mentioned. In [16], electric vehicle users and distributed energy operators were set up for the application scenario of microgrid. Literature [17] used an alliance chain to design charging and discharging transactions between electric vehicles and set up local aggregators to act as service nodes, without involving user transactions in different aggregators.The sorting and analysis of the above research status show that blockchain can effectively improve the defects of grid security access and optimize the charging model of electric vehicles.


## 3. Intelligent Scheduling Access Model of EV

### 3.1. Electric Vehicle Charging Security Access Trading Design

EV charging trading system architecture can be divided into application layer, intelligent contract layer, consensus layer, network layer, and data layer [18]. The data layer stores the transaction data in LevelDB or CouchDB in the data structure of Merkle Bucket tree and blockchain list [19]. The network layer selects HTTP/2-based P2P protocol as the network transmission protocol and makes the node listen to verify whether the new block or new transaction of the broadcast is valid. The consensus layer adopts a practical Byzantine fault-tolerant algorithm. The intelligent contract layer encapsulates the electric vehicle charging trading intelligent contract written in Go language. The application layer supports EV charging applications with query charging stations and transfer transaction functions [20–24].Figure1 shows the network structure of EV charging transaction model. Participants include application, charging station nodes of charging operators and utility companies, sorting service nodes, and regulatory authorities of charging transaction market.Figure 1
Network structure of EV charging transaction model.Each charging operator or utility serves as an organization in the transaction network structure, with multiple charging station nodes per organization. All nodes are accounting nodes, responsible for validating transactions and writing them into the books. On this basis, a node can also act as master node, anchor node, and endorsement node. The master node is the node responsible for communicating with the sorting service node, which receives the transaction containing the endorsement signature. It sorts unpackaged transactions, generates blocks, and broadcasts them to the billing node. Anchor nodes are nodes that can communicate with the nodes of other organizations. By running its installed smart contract, the endorsement node can sign and endorse the charging transaction proposal put forward by the client and feed back the result. The transaction model calculates the endorsement experience valueM according to the endorsement times of the nodes and refers to this index in service evaluation, so as to encourage each charging station node to act as the endorsement node and maintain the stable operation of the blockchain platform. The expression of endorsement experience value M is(1)M=βlc,nLn,where lc,n is the number of account updates of the charging station node as the endorsement node up to this transaction. Ln is the total number of ledger updates. β is the weight of the adjusted endorsement experience value.Data exchange is realized by establishing a trading channel, which is a virtual channel of atomic broadcasting. The design of the trading channel makes it impossible for the nodes outside the channel to access the data inside the channel, which provides safe and efficient data exchange. The channel is managed by the regulatory department of the EV charging trading market and connects charging station nodes and sequencing service nodes of multiple companies. Users who register with any charging operator or utility can have the account authentication of the trading platform and deposit their wallet address, account balance, current credibility, certificate, and public/private key pair. Through the application, users can access all endorsement nodes in the channel and select charging services provided by multiple charging operators and utility companies.


### 3.2. The Process of Trading Electric Cars in IoV

The operational process of EV charging transaction model is based on practical Byzantine fault tolerance (PBFT) algorithm [25, 26]. PBFT is a copy replication algorithm for state machines that replicate on different nodes. The client sends a request to the master node to invoke the service operation, and upon receiving the request information, the master node enters the preparatory stage to broadcast to other nodes. After receiving the broadcast, other nodes simulate the transaction, generate the transaction result, generate the hash value of the new block according to the result information, and enter the preparation stage to carry out the broadcast within its scope.As shown in Figure2, the operation of EV charging trading mode is the process of transaction initiation, contract execution, and transaction verification by the trading subject under the consensus mechanism. Firstly, EV users select charging stations according to service rating and use the charging clients to send a request to the endorsement node in the channel and invoke charging service operation. After receiving the request message, the endorsement node verifies the client's identity, performs intelligent contract simulation transactions, and evaluates the charging service. The endorsement node outputs the result of the intelligent contract, that is, a set of key values read or written in the intelligent contract. The transaction request response with the endorsement signature is sent back to the client. The client broadcasts it to the sorting service node. The sorting service node passes ordered transactions as blocks to all nodes on the channel. Each node verifies that the execution result can be written to the ledger status database and notifies the client.Figure 2
Operation process of EV charging transaction model.


### 3.3. Smart Contract for EV Charging Trading Model

Smart contracts are programs that run on a ledger of blockchain data and are automatically executed by computers [27]. The main functions of the intelligent contract for EV charging transactions include EV charging charge settlement, charging service, user credit evaluation, and transaction order query from users, charging operators, utility companies, and other institutions.Every time the owner completes the transaction settlement of electric vehicle, the credibility of the owner is evaluated,Rv, according to it transaction behavior, and the formula is(2)Rv=1J∑j=0JCvj,where Cvj is the integral reward that EV account v obtains or deducts after the j-th charging transaction is completed, and its value is set. Let its value meet the set Cvj∈−1,+1. When the user completes the correct payment of the previous charging service, it can get a bonus point. Otherwise, it can deduct a credit point. If the credit is lower than the minimum threshold set by the system, that is, Rv<Rv,min, the user will not be able to use charging service normally. In this model, the initial value of credit and the threshold value are 0.The transaction model recommends charging stations with high evaluation of nearby charging services to users with normal credibility for charging transactions. The charging service evaluationRcs,n of the charging station node is constantly updated with the increase of n times of transactions. The following equation calculates the charging service evaluation of the charging station according to the score given by users with different credibility and the endorsement experience value of the charging station node.(3)Rcs,n=Rcs,n−1+1α1+MϕRcs,n−1RvWn−En,ϕRcs,n−1=1−11+e−Rcs,n−1−D/σ,En=Rcs,n−1D,where Rcs,n−1 represents the n−1 transaction service evaluation of charging station node, and the adjustment parameter α>1 determines the speed of change of service evaluation after each transaction score. The value of α can be adjusted so that after the service capacity of charging station nodes with low evaluation is improved, the evaluation will not always be affected by the previous bad evaluation. M is the calculated endorsement experience value. Wn is the score made by users whose credit rating is higher than the minimum threshold, and in this paper Wn=1,2,3,4,5. The En is the expected score of the charging station node. The D is the highest level in service evaluation, and this model takes D=6. The ϕRcs,n−1 is the damping function that makes the change of charging service evaluation value tend to be gentle. The σ is the acceleration factor in the damping function, and σ=0.7.In the calculation of charging service evaluation, the credibility of EV users and endorsement of charging station nodes are considered to make the evaluation value more reasonable. Moreover, they can stimulate charging station nodes to improve charging service level, contribute computing power, and maintain stable and efficient operation of the trading platform. A charging station is set up to provide charging service for EV. The charges that EV users need to pay to charging operators and utility power companies include electricity fee and service fee, and the formula is(4)Fchargingv=fchargingvEe−Es,Fsercicev=fservicevEe−Es,where Es is the initial electric quantity of the electric vehicle. Ee is the power after charging. fchargingv is the unit price of electricity charge. fservicev is the service fee unit price. The total cost of charging an electric car v is(5)Fv=Fchargingv+Fservicev=fchargingvPvt+fservicevPvt,where Pv is the charging power. t is the charging time.The specific steps of the transaction fee settlement function are as follows. The first step is to receive the parameters including charging amountEchargingv; The second step is to apply the API of querying the ledger to get the balance of the charging station and EV account, as well as the unit electricity price corresponding to the period number. The third step is to complete the calculation of the charging transaction amount payment function according to the formula and transfer the corresponding amount in the EV account to the charging station account. If the balance of the electric vehicle account is lower than the threshold value, the credit points will be deducted and the bonus points will be increased. The fourth step is to write deals into the blocks.Administrators of electric vehicle users and charging operators can query various data of charging bills through intelligent contracts, taking the function of bill inquiry by users as an example. The first step is to receive the EV number (EVID) from the client’s SDK. The second step constructs the query string based on the EVID, sends the query string proposal to the ledger, and retrieves the query result. Query results include transaction time, charging cost, unit electricity price, charging station number, organization number of the user, and organization number of the charging station. The third step is to aggregate all query results and return them. Unlike other functions that need to be written into the ledger, such as invoking the transaction ledger function, the node runs the intelligent contract to access the status data and directly outputs the running results to the client without consensus.


## 3.1. Electric Vehicle Charging Security Access Trading Design

EV charging trading system architecture can be divided into application layer, intelligent contract layer, consensus layer, network layer, and data layer [18]. The data layer stores the transaction data in LevelDB or CouchDB in the data structure of Merkle Bucket tree and blockchain list [19]. The network layer selects HTTP/2-based P2P protocol as the network transmission protocol and makes the node listen to verify whether the new block or new transaction of the broadcast is valid. The consensus layer adopts a practical Byzantine fault-tolerant algorithm. The intelligent contract layer encapsulates the electric vehicle charging trading intelligent contract written in Go language. The application layer supports EV charging applications with query charging stations and transfer transaction functions [20–24].Figure1 shows the network structure of EV charging transaction model. Participants include application, charging station nodes of charging operators and utility companies, sorting service nodes, and regulatory authorities of charging transaction market.Figure 1
Network structure of EV charging transaction model.Each charging operator or utility serves as an organization in the transaction network structure, with multiple charging station nodes per organization. All nodes are accounting nodes, responsible for validating transactions and writing them into the books. On this basis, a node can also act as master node, anchor node, and endorsement node. The master node is the node responsible for communicating with the sorting service node, which receives the transaction containing the endorsement signature. It sorts unpackaged transactions, generates blocks, and broadcasts them to the billing node. Anchor nodes are nodes that can communicate with the nodes of other organizations. By running its installed smart contract, the endorsement node can sign and endorse the charging transaction proposal put forward by the client and feed back the result. The transaction model calculates the endorsement experience valueM according to the endorsement times of the nodes and refers to this index in service evaluation, so as to encourage each charging station node to act as the endorsement node and maintain the stable operation of the blockchain platform. The expression of endorsement experience value M is(1)M=βlc,nLn,where lc,n is the number of account updates of the charging station node as the endorsement node up to this transaction. Ln is the total number of ledger updates. β is the weight of the adjusted endorsement experience value.Data exchange is realized by establishing a trading channel, which is a virtual channel of atomic broadcasting. The design of the trading channel makes it impossible for the nodes outside the channel to access the data inside the channel, which provides safe and efficient data exchange. The channel is managed by the regulatory department of the EV charging trading market and connects charging station nodes and sequencing service nodes of multiple companies. Users who register with any charging operator or utility can have the account authentication of the trading platform and deposit their wallet address, account balance, current credibility, certificate, and public/private key pair. Through the application, users can access all endorsement nodes in the channel and select charging services provided by multiple charging operators and utility companies.


## 3.2. The Process of Trading Electric Cars in IoV

The operational process of EV charging transaction model is based on practical Byzantine fault tolerance (PBFT) algorithm [25, 26]. PBFT is a copy replication algorithm for state machines that replicate on different nodes. The client sends a request to the master node to invoke the service operation, and upon receiving the request information, the master node enters the preparatory stage to broadcast to other nodes. After receiving the broadcast, other nodes simulate the transaction, generate the transaction result, generate the hash value of the new block according to the result information, and enter the preparation stage to carry out the broadcast within its scope.As shown in Figure2, the operation of EV charging trading mode is the process of transaction initiation, contract execution, and transaction verification by the trading subject under the consensus mechanism. Firstly, EV users select charging stations according to service rating and use the charging clients to send a request to the endorsement node in the channel and invoke charging service operation. After receiving the request message, the endorsement node verifies the client's identity, performs intelligent contract simulation transactions, and evaluates the charging service. The endorsement node outputs the result of the intelligent contract, that is, a set of key values read or written in the intelligent contract. The transaction request response with the endorsement signature is sent back to the client. The client broadcasts it to the sorting service node. The sorting service node passes ordered transactions as blocks to all nodes on the channel. Each node verifies that the execution result can be written to the ledger status database and notifies the client.Figure 2
Operation process of EV charging transaction model.


## 3.3. Smart Contract for EV Charging Trading Model

Smart contracts are programs that run on a ledger of blockchain data and are automatically executed by computers [27]. The main functions of the intelligent contract for EV charging transactions include EV charging charge settlement, charging service, user credit evaluation, and transaction order query from users, charging operators, utility companies, and other institutions.Every time the owner completes the transaction settlement of electric vehicle, the credibility of the owner is evaluated,Rv, according to it transaction behavior, and the formula is(2)Rv=1J∑j=0JCvj,where Cvj is the integral reward that EV account v obtains or deducts after the j-th charging transaction is completed, and its value is set. Let its value meet the set Cvj∈−1,+1. When the user completes the correct payment of the previous charging service, it can get a bonus point. Otherwise, it can deduct a credit point. If the credit is lower than the minimum threshold set by the system, that is, Rv<Rv,min, the user will not be able to use charging service normally. In this model, the initial value of credit and the threshold value are 0.The transaction model recommends charging stations with high evaluation of nearby charging services to users with normal credibility for charging transactions. The charging service evaluationRcs,n of the charging station node is constantly updated with the increase of n times of transactions. The following equation calculates the charging service evaluation of the charging station according to the score given by users with different credibility and the endorsement experience value of the charging station node.(3)Rcs,n=Rcs,n−1+1α1+MϕRcs,n−1RvWn−En,ϕRcs,n−1=1−11+e−Rcs,n−1−D/σ,En=Rcs,n−1D,where Rcs,n−1 represents the n−1 transaction service evaluation of charging station node, and the adjustment parameter α>1 determines the speed of change of service evaluation after each transaction score. The value of α can be adjusted so that after the service capacity of charging station nodes with low evaluation is improved, the evaluation will not always be affected by the previous bad evaluation. M is the calculated endorsement experience value. Wn is the score made by users whose credit rating is higher than the minimum threshold, and in this paper Wn=1,2,3,4,5. The En is the expected score of the charging station node. The D is the highest level in service evaluation, and this model takes D=6. The ϕRcs,n−1 is the damping function that makes the change of charging service evaluation value tend to be gentle. The σ is the acceleration factor in the damping function, and σ=0.7.In the calculation of charging service evaluation, the credibility of EV users and endorsement of charging station nodes are considered to make the evaluation value more reasonable. Moreover, they can stimulate charging station nodes to improve charging service level, contribute computing power, and maintain stable and efficient operation of the trading platform. A charging station is set up to provide charging service for EV. The charges that EV users need to pay to charging operators and utility power companies include electricity fee and service fee, and the formula is(4)Fchargingv=fchargingvEe−Es,Fsercicev=fservicevEe−Es,where Es is the initial electric quantity of the electric vehicle. Ee is the power after charging. fchargingv is the unit price of electricity charge. fservicev is the service fee unit price. The total cost of charging an electric car v is(5)Fv=Fchargingv+Fservicev=fchargingvPvt+fservicevPvt,where Pv is the charging power. t is the charging time.The specific steps of the transaction fee settlement function are as follows. The first step is to receive the parameters including charging amountEchargingv; The second step is to apply the API of querying the ledger to get the balance of the charging station and EV account, as well as the unit electricity price corresponding to the period number. The third step is to complete the calculation of the charging transaction amount payment function according to the formula and transfer the corresponding amount in the EV account to the charging station account. If the balance of the electric vehicle account is lower than the threshold value, the credit points will be deducted and the bonus points will be increased. The fourth step is to write deals into the blocks.Administrators of electric vehicle users and charging operators can query various data of charging bills through intelligent contracts, taking the function of bill inquiry by users as an example. The first step is to receive the EV number (EVID) from the client’s SDK. The second step constructs the query string based on the EVID, sends the query string proposal to the ledger, and retrieves the query result. Query results include transaction time, charging cost, unit electricity price, charging station number, organization number of the user, and organization number of the charging station. The third step is to aggregate all query results and return them. Unlike other functions that need to be written into the ledger, such as invoking the transaction ledger function, the node runs the intelligent contract to access the status data and directly outputs the running results to the client without consensus.


## 4. Experiment and Analysis

### 4.1. The Experiment Platform

In terms of the experiment, the hardware platform includes 13 unmanned logistics vehicles, as shown in Figure3, 12 charging nodes, laptop computers, and servers. The software platform includes 36 test nodes and blockchain based on alliance chain.Figure 3
Unmanned logistics vehicles.


### 4.2. The Experiment Design

The experiment evaluates the computational efficiency of the model by using performance indicators of data throughput, response time, and latency. As shown in Figure4, under the same node, when using the model in this article, it has better throughput and response time than the traditional model. Compared with the traditional model, the proposed model has more data throughput, shorter response time, and lower delay time under the same node. As shown in Figure 5, with the same number of vehicles, the number of nodes is gradually increased, and the performance of the model in this paper is better than the traditional model.Figure 4
Throughput (a) and response time (b) for the same number of nodes.
(a)(b)Figure 5
Throughput (a) and response time (b) for the same number of vehicles.
(a)(b)Under large-scale scheduling, the ratio of the warehouse’s storage capacity to the vehicle's transportation capacity is an important index affecting scheduling. In this article, it is called theα coefficient, which is(6)α=∑i=1nWi∑j=1mVj,where Wi stands for storage capacity and Vi stands for vehicle transportation capacity.In this experiment, 13 vehicles are dispatched using 36 nodes. The proposed algorithm and the traditional scheduling algorithm are run 150 times each with different number of vehicles, and the average of the running results was applied for the comparison. As shown in Figure6, under the same number of vehicles, the model in this paper has better data than traditional algorithms, which increases vehicle scheduling efficiency.Figure 6
Scheduling evaluation index varying with number of vehicles.In order to test the safety of this model, the illegal vehicle ID packet was synthesized with the correct vehicle ID packet to try to link the charging device. When a blockchain-based charging device identifies an illegal data packet, it will give alarm and detect the average alarm time. As shown in Figure7, the conventional model does not identify the illegal vehicle ID data packet several times; thus, the charging device starts to work. When using this experimental model, all illegal vehicle ID data packets are detected and an alarm is issued successfully. As shown in Figure 7, the detection time was significantly lower than the traditional model.Figure 7
Number of alarms (a) and average alarm time (b) with the same vehicle number.
(a)(b)The transmission network includes load L1 and two large units G1 and G2. The distribution network is divided into two active distribution networks, ADN1 and ADN2. According to the line and geographical location, the ADN1 includes 1 wind turbine (W2), 2 tram stations (EV2 and EV3), 1 set (DG3), and 1 load node (L3). The ADN2 consists of 1 wind turbine (W1), 1 tram station (EV1), 2 units (DG1 and DG2), and 1 load node (L2). The unit information is shown in Table1, where a, b, and c are the constant, primary, and secondary coefficients of the generation cost, respectively. The Pmin and Pmax are the minima and maxima of output, respectively. The optimal regulation of generating set is shown in Table 2.Table 1
Generator information.
Pmin/MWPmax/MWa/yuanb/yuan ∗ MW^−1c/yuan ∗ MW^−2G1201604502815G2101303302025DG10454502315DG20303602920DG30453601715Table 2
Optimal generating.
TimeDG1/MWDG2/MWDG3/MWG1/MWG2/MW125.629.831.242.134.5224.129.130.840.233.2323.329.529.540.332.4422.729.929.637.433.5522.430.228.337.130.7623.830.028.238.732.3723.530.028.636.930.8824.330.327.740.232.5923.428.929.838.531.11020.129.128.533.127.81125.829.024.141.434.31229.128.730.141.838.91330.130.135.547.544.81420.830.236.451.537.91531.130.235.345.239.81620.930.126.544.338.11723.829.729.350.945.81830.129.828.557.439.21930.430.236.350.340.22029.630.240.543.645.62130.130.037.845.340.12230.829.837.549.640.32330.130.035.239.339.82423.530.129.040.135.6


### 4.3. The Experimental Analysis

In the experiment, a common algorithm without model optimization is firstly used to conduct vehicle scheduling and charging as a comparison item. After that, the distributed optimization algorithm and the dynamic adjustment model based on blockchain were adopted to conduct V2G optimization of the power grid, distribution network, and vehicle charging schedule; meanwhile, the dynamic constraint counting method was adopted for blocking management.In the scheduling process, as shown in Table3, power flow overload occurs in some nodes such as 15, 16, and 17. By adding the 3 modulation constraints into the constraint set, the traditional algorithm presents large information blocking, which makes the vehicle scheduling appear sluggish, and the charging efficiency is greatly reduced. After that, the proposed model was used for optimization. After the optimization, there was no longer the case of charging overload in statistics, so the results were in line with the optimal solution of security constraints. In the test, the traditional algorithm presented information blocking. Under the optimization of the proposed model, the interference is quickly eliminated, and the charging of multiple vehicles is not disturbed. Moreover, under the optimization model, the electricity price of charging is lower than that without optimization.Table 3
Branch information.
Branch numberOutflow nodeInjection nodeCurrent limit/MW1136021106032218043267054256565266573346581130659123165101635651122270126217013620701479701598701613670171527018191601923236020222860212827602226318023263180242934752534357526332565273622652830106529169653018965311176032345603330260343117603529156036281160As shown in Figure8, when blockchain is used in scheduling and charging transactions, the delay is greatly reduced. The increase of information throughput strengthens the optimization effect of the model and achieves a good experimental result.Figure 8
Sum generating of distribution and transmission grid.The running time and cost after optimization are less than those without model optimization. The optimized optimal power flow distribution and the data are better than the data obtained without model optimization. It can be seen from the above results that when vehicle scheduling is carried out by using the proposed model, the charging efficiency of the vehicle is higher, the cost is lower, there is no information blocking, and it is safer and more efficient. The optimal scheduling scheme is developed in a short time to make the vehicle running and charging more reasonable. The proposed model enables logistics enterprises to make better profits and achieve higher logistics efficiency.


## 4.1. The Experiment Platform

In terms of the experiment, the hardware platform includes 13 unmanned logistics vehicles, as shown in Figure3, 12 charging nodes, laptop computers, and servers. The software platform includes 36 test nodes and blockchain based on alliance chain.Figure 3
Unmanned logistics vehicles.


## 4.2. The Experiment Design

The experiment evaluates the computational efficiency of the model by using performance indicators of data throughput, response time, and latency. As shown in Figure4, under the same node, when using the model in this article, it has better throughput and response time than the traditional model. Compared with the traditional model, the proposed model has more data throughput, shorter response time, and lower delay time under the same node. As shown in Figure 5, with the same number of vehicles, the number of nodes is gradually increased, and the performance of the model in this paper is better than the traditional model.Figure 4
Throughput (a) and response time (b) for the same number of nodes.
(a)(b)Figure 5
Throughput (a) and response time (b) for the same number of vehicles.
(a)(b)Under large-scale scheduling, the ratio of the warehouse’s storage capacity to the vehicle's transportation capacity is an important index affecting scheduling. In this article, it is called theα coefficient, which is(6)α=∑i=1nWi∑j=1mVj,where Wi stands for storage capacity and Vi stands for vehicle transportation capacity.In this experiment, 13 vehicles are dispatched using 36 nodes. The proposed algorithm and the traditional scheduling algorithm are run 150 times each with different number of vehicles, and the average of the running results was applied for the comparison. As shown in Figure6, under the same number of vehicles, the model in this paper has better data than traditional algorithms, which increases vehicle scheduling efficiency.Figure 6
Scheduling evaluation index varying with number of vehicles.In order to test the safety of this model, the illegal vehicle ID packet was synthesized with the correct vehicle ID packet to try to link the charging device. When a blockchain-based charging device identifies an illegal data packet, it will give alarm and detect the average alarm time. As shown in Figure7, the conventional model does not identify the illegal vehicle ID data packet several times; thus, the charging device starts to work. When using this experimental model, all illegal vehicle ID data packets are detected and an alarm is issued successfully. As shown in Figure 7, the detection time was significantly lower than the traditional model.Figure 7
Number of alarms (a) and average alarm time (b) with the same vehicle number.
(a)(b)The transmission network includes load L1 and two large units G1 and G2. The distribution network is divided into two active distribution networks, ADN1 and ADN2. According to the line and geographical location, the ADN1 includes 1 wind turbine (W2), 2 tram stations (EV2 and EV3), 1 set (DG3), and 1 load node (L3). The ADN2 consists of 1 wind turbine (W1), 1 tram station (EV1), 2 units (DG1 and DG2), and 1 load node (L2). The unit information is shown in Table1, where a, b, and c are the constant, primary, and secondary coefficients of the generation cost, respectively. The Pmin and Pmax are the minima and maxima of output, respectively. The optimal regulation of generating set is shown in Table 2.Table 1
Generator information.
Pmin/MWPmax/MWa/yuanb/yuan ∗ MW^−1c/yuan ∗ MW^−2G1201604502815G2101303302025DG10454502315DG20303602920DG30453601715Table 2
Optimal generating.
TimeDG1/MWDG2/MWDG3/MWG1/MWG2/MW125.629.831.242.134.5224.129.130.840.233.2323.329.529.540.332.4422.729.929.637.433.5522.430.228.337.130.7623.830.028.238.732.3723.530.028.636.930.8824.330.327.740.232.5923.428.929.838.531.11020.129.128.533.127.81125.829.024.141.434.31229.128.730.141.838.91330.130.135.547.544.81420.830.236.451.537.91531.130.235.345.239.81620.930.126.544.338.11723.829.729.350.945.81830.129.828.557.439.21930.430.236.350.340.22029.630.240.543.645.62130.130.037.845.340.12230.829.837.549.640.32330.130.035.239.339.82423.530.129.040.135.6


## 4.3. The Experimental Analysis

In the experiment, a common algorithm without model optimization is firstly used to conduct vehicle scheduling and charging as a comparison item. After that, the distributed optimization algorithm and the dynamic adjustment model based on blockchain were adopted to conduct V2G optimization of the power grid, distribution network, and vehicle charging schedule; meanwhile, the dynamic constraint counting method was adopted for blocking management.In the scheduling process, as shown in Table3, power flow overload occurs in some nodes such as 15, 16, and 17. By adding the 3 modulation constraints into the constraint set, the traditional algorithm presents large information blocking, which makes the vehicle scheduling appear sluggish, and the charging efficiency is greatly reduced. After that, the proposed model was used for optimization. After the optimization, there was no longer the case of charging overload in statistics, so the results were in line with the optimal solution of security constraints. In the test, the traditional algorithm presented information blocking. Under the optimization of the proposed model, the interference is quickly eliminated, and the charging of multiple vehicles is not disturbed. Moreover, under the optimization model, the electricity price of charging is lower than that without optimization.Table 3
Branch information.
Branch numberOutflow nodeInjection nodeCurrent limit/MW1136021106032218043267054256565266573346581130659123165101635651122270126217013620701479701598701613670171527018191601923236020222860212827602226318023263180242934752534357526332565273622652830106529169653018965311176032345603330260343117603529156036281160As shown in Figure8, when blockchain is used in scheduling and charging transactions, the delay is greatly reduced. The increase of information throughput strengthens the optimization effect of the model and achieves a good experimental result.Figure 8
Sum generating of distribution and transmission grid.The running time and cost after optimization are less than those without model optimization. The optimized optimal power flow distribution and the data are better than the data obtained without model optimization. It can be seen from the above results that when vehicle scheduling is carried out by using the proposed model, the charging efficiency of the vehicle is higher, the cost is lower, there is no information blocking, and it is safer and more efficient. The optimal scheduling scheme is developed in a short time to make the vehicle running and charging more reasonable. The proposed model enables logistics enterprises to make better profits and achieve higher logistics efficiency.


## 5. Conclusion

In view of the fact that the current electric vehicle dispatching is mostly manual dispatching and its efficiency is low, we investigate how to improve the applicability and scientific problem of electric vehicle charging in the existing distributed grid layout. Based on blockchain and 5G technologies, the proposed intelligent vehicle dispatching model realizes the simplified calculation of the layout of the traditional distributed power grid. It uses smart contracts to build data storage and consensus systems to ensure that all historical data are not tampered with and is traceable. It forms the electricity price guidance model in the electric vehicle intelligent dispatching and access, optimizes the multivehicle line blocking in the operation, and dynamically adjusts the model scheduling. It has achieved good results in application, such as optimizing charging running time, saving power, and controlling cost. The simulation and actual test show that the model is feasible and correct. Compared with the traditional scheduling algorithm, the proposed intelligent vehicle dispatching model realizes the dynamic adjustment and correction and better optimizes the distributed power system to make up for the current electric vehicle. The future research will discuss the blockchain in more power nodes and multivehicle collaborative optimization problems.



---

*Source: 1198794-2021-11-09.xml*