Cloud edge cooperative tunnel equipment energy consumption abnormality intelligent identification method and system
Technical Field
The invention relates to the technical field of electric data processing of electric equipment of expressway tunnels, in particular to an intelligent recognition method and system for energy consumption abnormality of tunnel equipment based on cloud edge cooperation.
Background
Road tunnels also have unavoidable drawbacks as tubular semi-enclosed structures. If a driver enters a tunnel, the light becomes dark, an illumination system is required to illuminate so as to ensure the driving safety, and after an accident occurs in the tunnel, the tunnel needs to be ventilated and exhausted in time, and the like. The tunnel thus carries out various functions such as lighting, ventilation, smoke evacuation, monitoring, etc., which function is not separated from the stable and reliable power supply and the normal operation of the equipment. Once the power supply is abnormal, equipment faults, short circuits and the like can cause the system failure of illumination, monitoring, ventilation and the like in the tunnel, the occurrence risk of accidents is increased. The tunnel environment is complex, is greatly influenced by factors such as topography, climate and the like, and the power equipment is easy to wet and pollute, which can lead to equipment failure, electrical short circuit and energy consumption increase.
Disclosure of Invention
(One) solving the technical problems
Aiming at the defects of the prior art, the invention provides the intelligent recognition method and the intelligent recognition system for the energy consumption abnormality of the tunnel equipment based on cloud edge cooperation, which have the advantages of reducing the possibility of human error, reducing the energy waste and the like, and solve the technical problems.
(II) technical scheme
In order to achieve the above purpose, the present invention provides the following technical solutions: a cloud edge cooperative tunnel equipment energy consumption abnormality intelligent identification method comprises the following steps:
s1, collecting electricity utilization data of tunnel equipment for arrangement, wherein the electricity utilization data type tau in the tunnel comprises three-phase current Three-phase voltageThree-phase active powerAnd reactive powerT represents the moment of time at which,And A, B, C three phases are represented, and the data expression after finishing is obtained as follows:
wherein, The current at time t 1、t2、...、tn of phase a is shown, The currents at the times t 1、t2、...、tn of the B phase are respectively shown,The currents at the times t 1、t2、...、tn of the C phase are respectively indicated,Reactive power at the moment of the C phase t 1、t2、...、tn is respectively represented;
s2, carrying out normalization processing on the data obtained in the step S1, and taking an A-phase current as an example, describing the formula as follows:
wherein, For the data to be normalized,AndRespectively the maximum and minimum values in the data,The actual electricity consumption data;
s3, setting the length l of an input window and the step length, wherein l is more than or equal to 2 and less than or equal to 12, step is more than or equal to 1 and less than or equal to 5, and establishing an LSTM model, wherein the LSTM model consists of a forgetting gate, an input gate and an output gate;
The expression of the forgetting gate is as follows:
ft=σ(W[ht-1,xt]+b)
Wherein f t represents the output of the forgetting gate at time t, h t-1 represents the hidden state at the previous time, [/x ] represents connecting two vectors into a matrix, x t represents the input at the current time, W and b represent the coefficient and bias coefficient of the linear relationship respectively, and σ (/ x) represents the Sigmoid activation function;
the expression of the input gate is as follows:
it=σ(Wi[ht-1,xt]+bt)
Wherein i t denotes the update information at the output gate t, The method comprises the steps of representing a currently input unit state, h t-1 representing a hidden state at the last moment, x t representing an input at the current moment, W i and b t respectively representing a weight matrix and a bias term of update information i t at the time of outputting a gate t, W c and b c respectively representing tan h (x) representing a hyperbolic tangent function, sigma (x) representing a Sigmoid activation function, C t representing a unit state at the current moment, C t-1 representing a unit state at the last moment, and f t representing an output of a forgetting gate at the time t;
The expression of the output gate is as follows:
ot=σ(Wo[ht-1,xt]+bo)
ht=ot·tanh(Ct)
Wherein h t-1 represents a hidden state at the previous time, x t represents an input at the current time, σ (x) represents a Sigmoid activation function, tanh (x) represents a hyperbolic tangent function, C t represents a unit state at the current time, o t represents a degree of information output at the current time, and h t is an output hidden state vector;
S4, inputting the data in the step S1 into the built LSTM model according to the window length and moving the window step length to obtain an output characteristic space expression as follows:
wherein, Features of tunnel equipment a-phase circuit length 1, length 2 respectively up to length len,Features of tunnel equipment B-phase circuit length 1, length 2 respectively.Respectively represent tunnel devicesPower consumption data length 1, length 2 in phase τ. τ represents the type of electricity data and the superscript len represents the feature space length;
S5, arranging the data in the step S4 in sequence, inputting the data into a BP neural network model to obtain an abnormal electricity utilization result, if the abnormal electricity utilization result is acceptable, finishing model training, and if the abnormal electricity utilization result is unacceptable, adopting a back propagation algorithm to adjust model parameters until the result is acceptable, and finally obtaining an LSTM-BP model;
S6, inputting actual tunnel equipment electricity utilization data, and predicting abnormal electricity utilization data.
As a preferable technical scheme of the invention, the difference between +1 data and the real data y t output in the step S2 exceeds a threshold epsilon, and the power consumption behavior is abnormal, and an alarm is sent.
As a preferred technical scheme of the invention, the model training process in the step S5 adopts an SMOTE algorithm to balance data, and the specific steps are as follows:
S5.1, selecting an abnormal electricity consumption data sample X min,xi∈Xmin,xi as the ith data in an abnormal electricity consumption data sample X min, removing the residual electricity consumption abnormal sample of X i as y i, and calculating the Euclidean distance d (X, y) of an m-dimensional space, wherein the specific expression is as follows:
Where y i denotes the remaining power consumption anomaly samples except X i, d (X, y) denotes the Euclidean distance in m-dimensional space, X i denotes the ith data in the anomaly power consumption data sample X min, Representing summing m data and obtaining sample data in k X min nearest to X i;
S5.2, randomly selecting one sample from sample data in k X min nearest to X i, and combining the selected sample with X i to form a new sample, wherein the specific expression is as follows:
Wherein x new represents the new sample synthesized, Represents randomly selected samples in the sample data in k X min nearest to X i, δ represents the sampling ratio, and δ∈ [0,1].
As the preferable technical scheme of the invention, the number of hidden layers in the BP neural network model is four, the activation function in the hidden layers adopts a tanh function, and the activation function of the output layer in the BP neural network model adopts a softmax function.
The intelligent recognition system based on cloud edge cooperative tunnel equipment energy consumption abnormality comprises a data acquisition module, a storage module, an edge detection module and a communication module, wherein the data acquisition module, the storage module and the edge detection module are all connected through the communication module;
The intelligent cloud data processing center is used for storing the LSTM-BP model constructed based on the cloud edge collaborative tunnel equipment energy consumption abnormality intelligent identification method, the LSTM-BP model is sent to the edge detection module, the edge detection module reads real-time data for detection, and sends alarm data to the tunnel management center if abnormality occurs, and the storage module is used for storing the data in the acquisition module, the intelligent cloud data processing center and the edge detection module.
As a preferable technical scheme of the invention, the data acquisition module acquires electricity data comprising three-phase voltage, three-phase current, three-phase active power and reactive power in tunnel electric equipment, the data acquisition module consists of an IM3332 three-phase electric energy quality monitoring meter and an RS 485-to-TCP/IP module, and the edge detection module adopts an embedded development board customized by Raspberry Pi 5.
Compared with the prior art, the invention provides the intelligent recognition method and the intelligent recognition system for the energy consumption abnormality of the tunnel equipment based on cloud edge cooperation, which have the following beneficial effects:
The invention captures the time sequence and three-phase relation of the power consumption data by adopting the LSTM-BP neural network model method, and can greatly improve the detection accuracy. The intelligent power consumption abnormality recognition system has accurate abnormality detection, good data transmission quality assurance and longer transmission distance conforming to the actual condition of long tunnel mileage, and meanwhile, the hardware cost is low, the realization is convenient, the workload of operation and maintenance personnel is relieved, the working efficiency is improved, the possibility of human error is reduced, and the energy waste is reduced.
Drawings
FIG. 1 is a schematic flow chart of the present invention;
FIG. 2 is a schematic diagram of a tunnel system classification according to the present invention;
FIG. 3 is a schematic diagram of a cloud edge cooperative tunnel electricity utilization abnormality intelligent recognition system;
FIG. 4 is a schematic diagram of the abnormal electricity test model of the present invention.
Detailed Description
The following description of the embodiments of the present invention will be made clearly and completely with reference to the accompanying drawings, in which it is apparent that the embodiments described are only some embodiments of the present invention, but not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
Referring to fig. 1-4, the tunnel power system may be functionally divided into a power supply and distribution system, a lighting system, a ventilation system, a fire alarm system, a traffic control system, an environmental monitoring system, an emergency telephone and broadcasting system, and a monitoring video system, each of which includes one or more tunnel devices, which are specifically classified into categories, as shown in fig. 2
A cloud edge cooperative tunnel equipment energy consumption abnormality intelligent identification method comprises the following steps:
s1, collecting electricity utilization data of tunnel equipment for arrangement, wherein the electricity utilization data type tau in the tunnel comprises three-phase current Three-phase voltageThree-phase active powerAnd reactive powerT represents the moment of time at which,And A, B, C three phases are represented, and the data expression after finishing is obtained as follows:
wherein, The current at time t 1、t2、…、tn of phase a is shown, The currents at the times t 1、t2、…、tn of the B phase are respectively shown,The currents at the times t 1、t2、…、tn of the C phase are respectively indicated,Reactive power at the moment of the C phase t 1、t2、…、tn is respectively represented;
s2, carrying out normalization processing on the data obtained in the step S1;
S3, setting the length l of an input window and the step length step, and establishing an LSTM model, wherein the LSTM model consists of a forgetting gate, an input gate and an output gate;
The expression of the forgetting gate is as follows:
ft=σ(W[ht-1,xt]+b)
Wherein f t represents the output of the forgetting gate at time t, h t-1 represents the hidden state at the previous time, [/x ] represents connecting two vectors into a matrix, x t represents the input at the current time, W and b represent the coefficient and bias coefficient of the linear relationship respectively, and σ (/ x) represents the Sigmoid activation function;
the expression of the input gate is as follows:
it=σ(Wi[ht-1,xt]+bt)
Wherein i t denotes the update information at the output gate t, The state of the cell is indicated and,The method comprises the steps of representing a currently input unit state, h t-1 representing a hidden state at the last moment, x t representing an input at the current moment, W i and b t respectively representing a weight matrix and a bias term of update information i t at the output gate t moment, W c and b c respectively representing an input gate weight matrix and a bias term, tanh representing a hyperbolic tangent function, sigma representing a Sigmoid activation function, C t representing a unit state at the current moment, C t-1 representing a unit state at the last moment, and f t representing an output of a forgetting gate at the t moment;
The expression of the output gate is as follows:
ot=σ(Wo[ht-1,xt]+bo)
ht=ot·tanh(Ct)
Wherein h t-1 represents the hidden state at the previous time, x t represents the input at the current time, σ (x) represents the Sigmoid activation function, tanh (x) represents the hyperbolic tangent function, C t represents the cell state at the current time, o t represents the output degree of the information at the current time, h t is the output hidden state vector, Representing an output;
S4, inputting the data of t 1、t2、...、tn in the step S1 into m LSTM models of the built LSTM 1,LSTM2…LSTM1 according to the window length l and the step moving window, and obtaining an output characteristic space expression as follows:
wherein, Features of tunnel equipment a-phase circuit length 1, length 2 respectively up to length len,Features of tunnel equipment B-phase circuit length 1, length 2 respectively.Respectively represent tunnel devicesPower consumption data length 1, length 2 in phase τ. τ represents the type of electricity data and the superscript len represents the feature space length;
S5, arranging the data in the step S4 in sequence, inputting the data into a BP neural network model to obtain an abnormal electricity utilization result, if the obtained artificial auxiliary judgment result of the abnormal electricity utilization is acceptable, finishing the training of the LSTM-BP model, and if the artificial auxiliary judgment result of the abnormal electricity utilization is unacceptable, adopting a back propagation algorithm to adjust model parameters until the result is acceptable, and finally obtaining the LSTM-BP model; the arrangement in columns is as follows:
Specific examples by column are as follows:
s6, inputting actual tunnel equipment electricity utilization data, judging abnormal electricity utilization data, namely judging that the result is in an abnormal electricity utilization type I, an abnormal electricity utilization type 2 or an abnormal electricity utilization type n through a training completion model, and alarming.
Furthermore, in the step S5, the data is balanced by adopting an SMOTE algorithm, and abnormal electricity consumption data belongs to small sample data, which may cause inaccurate parameter training of the model, so that the data is balanced by adopting the SMOTE algorithm; the SMOTE algorithm does not repeatedly copy samples to achieve the purpose of expanding a sample set, but rather combines a few samples into a new sample based on an interpolation method, and balances a data sample set, and the main construction process is as follows:
S5.1, selecting an abnormal electricity consumption data sample X min,xi∈Xmin,xi as the ith data in an abnormal electricity consumption data sample X min, removing the residual electricity consumption abnormal sample of X i as y i, and calculating the Euclidean distance d (X, y) of an m-dimensional space, wherein the specific expression is as follows:
Where y i denotes the remaining power consumption anomaly samples except x i, d (x, y) denotes the Euclidean distance in m-dimensional space, x i denotes the ith data in the anomaly power consumption data sample x min, Representing summing m data and obtaining sample data in k x min nearest to x i;
S5.2, randomly selecting one sample from sample data in k X min nearest to X i, and combining the selected sample with X i to form a new sample, wherein the specific expression is as follows:
Wherein x new represents the new sample synthesized, Represents randomly selected samples from among the sample data in k X min nearest to X i, δ represents the sampling ratio and δ∈ [0,1].
Further, generally, the more the number of layers of the neural network is, the smaller the error is, but the problem of reverse gradient elimination and gradient explosion may be caused along with the increase of the number of layers, so that the number of hidden layers in the BP neural network model is four for tunnel equipment power consumption data, the activation function in the hidden layers adopts the tanh function, and the activation function of the output layer in the BP neural network model adopts the softmax function.
The intelligent recognition system based on cloud edge cooperative tunnel equipment energy consumption abnormality comprises a data acquisition module, a storage module, an edge detection module and a communication module, wherein the data acquisition module, the storage module and the edge detection module are all connected through the communication module;
The data acquisition module is used for acquiring electricity data, sending the acquired electricity data to the intelligent cloud data processing center and the edge detection module through the communication module, wherein the intelligent cloud data processing center stores the LSTM-BP model constructed based on the cloud edge collaborative tunnel equipment energy consumption abnormality intelligent identification method, the LSTM-BP model is sent to the edge detection module, the edge detection module reads real-time data for detection, and if abnormality occurs, alarm data are sent to the tunnel management center, and the storage module is used for storing the data in the acquisition module, the intelligent cloud data processing center and the edge detection module.
Further, the data acquisition module acquires electricity data including three-phase voltage, three-phase current, three-phase active power and reactive power in tunnel electric equipment, the tunnel electric equipment comprises an IM3332 three-phase electric energy quality monitoring meter and an RS 485-to-TCP/IP module, the edge detection module adopts an embedded development board customized by Raspberry Pi 5, and the tunnel electric equipment further comprises a power supply, a display screen, a memory card, a communication module and the like, operates a Ubuntu 23.10 operating system and loads a PyTorch deep learning framework. The functions are as follows: receiving and temporarily storing the electric quantity data acquired from the bottom communication model; receiving control information transmitted from a cloud, receiving and storing the LSTM-BP model transmitted from the cloud at fixed time, and operating the updated LSTM-BP model; carrying out data preprocessing, standardization and input data reconstruction on the electric quantity data acquired in real time, carrying out real-time energy consumption anomaly detection on the acquired electric quantity data by adopting an updated LSTM-BP model, and storing anomaly results and data; if abnormality is found, sending alarm information to the cloud and tunnel management center; according to the management center and cloud instructions and according to the security level, corresponding operation is performed to ensure the electricity utilization security of the tunnel; providing operation functions and interfaces for field inspection and maintenance of maintenance personnel;
the data acquisition module is arranged in a loop of a power supply and distribution system, a lighting system, a ventilation system, a fire alarm system, a traffic control system, an environment monitoring system, an emergency telephone, a broadcasting system and a monitoring video system, electricity consumption data are acquired in real time through an IM3332 three-phase electric energy quality monitoring meter, an RS485 interface is reserved on the meter, the meter can be directly connected with the RS485, meanwhile, the RS485 is connected with an internal RS485 to TCP/IP module, and the data are output as final output by the module and transmitted to a gateway. And the raspberry in the edge detection module sends out an instruction, and is connected with the gateway through a transmission medium to obtain electricity consumption data in the gateway for detection. Meanwhile, the intelligent cloud data processing center regularly obtains data in the gateway and updates the model, and returns the model to the edge detection module. Optionally, the gateway can poll the data acquisition module in a 'one master and multiple slaves' mode to obtain data, so that communication conflict and delay are reduced.
Although embodiments of the present invention have been shown and described, it will be understood by those skilled in the art that various changes, modifications, substitutions and alterations can be made therein without departing from the principles and spirit of the invention, the scope of which is defined in the appended claims and their equivalents.