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

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 scientiﬁc 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 simpliﬁcation 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 veriﬁcation. The result analysis shows that the model can eﬀectively 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.


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]. erefore, 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. e 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. e rest of this paper is organized as follows. Section 2 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.

Blockchain Security in Power Grid Industry.
e decentralization, openness, intelligence, and sharing of blockchain are in line with the ideas of the IoV and the energy Internet. ey 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]. e 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. e 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. e 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.

IoV in the Grid Intelligent Scheduling Algorithm.
Vehicle scheduling problem was first proposed by Dantzig and Ramser [2]. e 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. erefore, 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][10][11]. Literature [9] adopted a new hybrid heuristic algorithm to solve this problem. e 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. e 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. e study shows that in the case of 100 customers and 21 charging stations, all four combinations have solutions. e 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.

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. e 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. erefore, 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.
e 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.

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]. e data layer stores the transaction data in LevelDB or CouchDB in the data structure of Merkle Bucket tree and blockchain list [19]. e 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. e consensus layer adopts a practical Byzantine fault-tolerant algorithm. e intelligent contract layer encapsulates the electric vehicle charging trading intelligent contract written in Go language. e application layer supports EV charging applications with query charging stations and transfer transaction functions [20][21][22][23][24]. Figure 1 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.
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. e 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. e transaction model calculates the endorsement experience value M 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. e expression of endorsement experience value M is Scientific Programming where l c,n is the number of account updates of the charging station node as the endorsement node up to this transaction. L n 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. e 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. e 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. rough the application, users can access all endorsement nodes in the channel and select charging services provided by multiple charging operators and utility companies.

e Process of Trading Electric Cars in IoV.
e 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. e 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 Figure 2, 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. e endorsement node outputs the result of the intelligent contract, that is, a set of key values read or written in the intelligent contract. e transaction request response with the endorsement signature is sent back to the client. e client broadcasts it to the sorting service node. e 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.

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]. e 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, R v , according to it transaction behavior, and the formula is where C vj 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 C vj ∈ −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, R v < R v, 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. e transaction model recommends charging stations with high evaluation of nearby charging services to users with normal credibility for charging transactions. e charging service evaluation R cs,n of the charging station node is constantly updated with the increase of n times of transactions. e 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. R cs,n � R cs,n−1 where R cs,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. e 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. W n is the score made by users whose credit rating is higher than the minimum threshold, and in this paper W n � 1, 2, 3, 4, 5 { }. e E n is the expected score of the charging station node. e D is the highest level in service evaluation, and this model takes D � 6. e ϕ(R cs,n−1 ) is the damping function that makes the change of charging service evaluation value tend to be gentle. e σ 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. e charges that EV users need to pay to charging operators and utility power companies include electricity fee and service fee, and the formula is where E s is the initial electric quantity of the electric vehicle. E e is the power after charging. f charging(v) is the unit price of electricity charge. f service(v) is the service fee unit price. e total cost of charging an electric car v is where P v is the charging power. t is the charging time.
e specific steps of the transaction fee settlement function are as follows. e first step is to receive the parameters including charging amount E charging(v) ; e 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. e 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. e 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. e first step is to receive the EV number (EVID) from the client's SDK. e 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. e 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.

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

e Experiment Design.
e experiment evaluates the computational efficiency of the model by using performance indicators of data throughput, response time, and latency. As shown in Figure 4, 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.
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 where Wi stands for storage capacity and Vi stands for vehicle transportation capacity. In this experiment, 13 vehicles are dispatched using 36 nodes. e 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 Figure 6, under the same number of vehicles, the model in this paper has better data than traditional algorithms, which increases vehicle scheduling efficiency.
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 Figure 7, 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. e transmission network includes load L1 and two large units G1 and G2. e 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). e ADN2 consists of 1 wind turbine (W1), 1 tram station (EV1), 2 units (DG1 and DG2), and 1 load node (L2). e unit information is shown in Table 1, where a, b, and c are the constant, primary, and secondary coefficients of the generation cost, respectively. e P min and P max are the minima and maxima of output, respectively. e optimal regulation of generating set is shown in Table 2.

4.3.
e 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 Table 3, 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.
As shown in Figure 8, when blockchain is used in scheduling and charging transactions, the delay is greatly reduced. e increase of information throughput strengthens the optimization effect of the model and achieves a good experimental result. e running time and cost after optimization are less than those without model optimization. e 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. e optimal scheduling scheme is developed in a short time to make the vehicle running and charging more reasonable. e proposed model enables logistics enterprises to make better profits and achieve higher logistics efficiency.

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. e 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. e future research will discuss the blockchain in more power nodes and multivehicle collaborative optimization problems.
Data Availability e datasets used and/or analyzed during the current study are available from the corresponding author on reasonable request.

Conflicts of Interest
e authors declare that they have no conflicts of interest.   Scientific Programming