Optimization sampling method of electric power digital power meter, power meter and equipment

By using neural network algorithms to construct a sampling prediction model in the power digital power meter, predicting the optimal sampling point position of the power signal, solving the problem of degradation of measurement accuracy caused by the fixation of sampling points in the prior art, and achieving more efficient power signal sampling and measurement.

CN119691636AActive Publication Date: 2025-03-25NORTHWEST BEARING CO LTD

Patent Information

Application Number
CN202411652066.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-19
Publication Date
2025-03-25
Estimated Expiration
2044-11-19

AI Technical Summary

Technical Problem

The existing power digital power meter uses fixed sampling point positions during sampling, which cannot accurately capture the dynamic changes of the power signal, resulting in a decrease in measurement accuracy.

Method used

A neural network algorithm is used to build and train the sampling prediction model, and the optimal sampling point position in each sampling period is predicted by preprocessing and feature extraction of historical power signal data.

Benefits of technology

It significantly improves the measurement accuracy of the power meter, reduces the demand for high-cost hardware, reduces the complexity of subsequent signal processing, and improves overall efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119691636A_ABST
    Figure CN119691636A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of electric power data measurement, and discloses an optimization sampling method of an electric power digital power meter, the power meter and equipment, and the method comprises the steps: firstly constructing and training a sampling prediction model through employing a neural network algorithm, and enabling the model to predict the optimal sampling point position in each sampling period according to an electric power signal generated by a circuit; the method comprises the following steps: collecting historical power signal data, extracting signal features, preprocessing and standardizing, and then marking an optimal sampling point position to form a training data set; and selecting a long-short term memory (LSTM) network model for training, and evaluating the performance of the model by using the verification set. And after training is completed, model deployment is used for subsequent sampling position prediction. And collecting electric power signal data in a tested circuit in real time, extracting features and inputting the features into a prediction model, obtaining an optimal sampling point position list, and applying the optimal sampling point position list to a sampling strategy of a power meter.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of electric power data measurement, and specifically to an optimal sampling method for an electric power digital power meter, a power meter and a device. Background Art

[0002] In power systems, digital power meters, as a key measurement device, are widely used for accurate measurement and analysis of circuit parameters (such as voltage, current, and power). These measurement data play a vital role in monitoring, fault diagnosis, energy efficiency evaluation, and optimal design of power systems. In order to improve sampling accuracy, some existing power digital power meters try to increase the number of sampling points, but this not only increases the data processing burden, but also significantly increases hardware costs, such as the use of high-speed A / D converters. A large amount of sampled data also increases the complexity of subsequent signal processing and analysis, reducing overall efficiency.

[0003] Moreover, existing electric digital power meters usually use fixed sampling point positions for signal acquisition. This method ignores the dynamic change characteristics of electric power signals in different cycles. Since electric power signals often contain complex waveform characteristics, time domain characteristics, and frequency domain characteristics, fixed sampling point positions may not accurately capture the key characteristics of the signal, resulting in reduced measurement accuracy. To this end, we propose an optimal sampling method, power meter, and device for electric digital power meters. Summary of the invention

[0004] The object of the present invention is to provide an optimal sampling method, a power meter and a device for an electric power digital power meter to solve the problems raised in the above background technology.

[0005] To achieve the above object, the present invention provides the following technical solution: an optimal sampling method for an electric digital power meter, the specific steps of the method comprising:

[0006] Step 1: Use a neural network algorithm to build and train a sampling prediction model. The sampling prediction model is used to predict the optimal sampling point position of the power meter in each sampling period according to the power signal generated by the circuit. The specific steps of building and training the sampling prediction model include:

[0007] Step 1.1, collect historical sampled power signal data, including time series data of voltage and current;

[0008] Step 1.2, preprocess the collected power signal data to extract signal features, the extracted signal features include basic features, waveform features, time domain features and frequency domain features of voltage and current; basic features include frequency, amplitude and phase of the signal; waveform features include waveform shape, waveform symmetry and waveform smoothness of the signal wave; time domain features include mean, variance, skewness, rise rate and fall rate of the signal; frequency domain features include spectrum distribution, spectrum peak and spectrum width of the signal;

[0009] Step 1.3: Clean the extracted feature data to handle missing values ​​and outliers;

[0010] Step 1.4: Standardize the cleaned feature data;

[0011] Step 1.5, mark the optimal sampling point position of each data, and together with the corresponding feature data, form a training data set, and further divide the training data set into a training set and a validation set;

[0012] Step 1.6: Select the long short-term memory network LSTM model to build a sampling prediction model and initialize the parameters of the model;

[0013] Step 1.7: Use the training set data to iteratively train the LSTM model. During the training process, regularly use the validation set to evaluate the model performance until the model performance meets the requirements.

[0014] Step 1.8: After training is completed, save the weights and biases of the LSTM model and deploy the model for subsequent sampling position prediction;

[0015] Step 2: collect time series data of voltage and current in the circuit under test in real time, and extract basic characteristics, waveform characteristics, time domain characteristics and frequency domain characteristics of voltage and current;

[0016] Step 3: Input the signal features extracted in step 2 into the sampling prediction model trained in step 1 to obtain the optimal sampling point position list of the power meter in each sampling period;

[0017] Step 4: Apply the position list of the optimal sampling points in each sampling period obtained in step 3 to the sampling strategy of the power meter, and the power meter performs real-time sampling according to the predicted optimal sampling point positions.

[0018] Preferably, for the basic features, the frequency is obtained by calculating the number of cycles of the signal in a unit time; the amplitude is obtained by calculating the maximum value of the signal; and the phase is obtained by calculating the initial offset of the signal;

[0019] For the waveform characteristics, the waveform shape is obtained by calculating the peak and valley values ​​of the signal and the change period between the two; the waveform symmetry is obtained by comparing the similarity between the positive half-cycle and the negative half-cycle of the signal. The calculation formula is: The waveform smoothness is obtained by calculating the degree of change of the first-order or second-order derivative of the signal, and the smoothness represents the average value of the rate of change of the derivative;

[0020] For time domain features, the mean is obtained by calculating the average value of all sample points of the signal. The calculation formula is: where x i is the i-th sample point of the signal, N is the total number of samples; the variance is obtained by calculating the average of the squares of the differences between all sample points of the signal and its mean, and the calculation formula is: Skewness is used to measure the skew direction and degree of the signal distribution pattern. The calculation formula is: The rising rate is obtained by calculating the average slope of all rising segments in the signal. For each rising segment, the slope is where x start and x end are the starting and ending sample points of the rising segment, respectively. start and end are the serial numbers corresponding to the starting and ending sample points, respectively. The falling rate is obtained by calculating the average slope of all falling segments in the signal. For each falling segment, the calculation of the slope is the same as the rising rate, but in the opposite direction.

[0021] For frequency domain features, the spectrum distribution converts the signal from time domain to frequency domain through Fourier transform to obtain the spectrum of the signal. The calculation formula is: Where x(t) is the time domain signal, X(f) is its corresponding frequency representation, and f is the frequency; the spectrum peak is the frequency of the maximum amplitude point in the signal spectrum, and the calculation formula is: spectrum peak = max f |X(f)|; Spectrum width is used to measure the distribution width of the signal spectrum on the frequency axis. The calculation formula is: Spectrum width = f 2 -f 1 , where f 1 and f 2 are respectively the lowest and highest frequency points in the spectrum where the amplitude exceeds the threshold.

[0022] Preferably, in step 1.3, for missing values, a linear interpolation algorithm is used to fill them; for outliers, a threshold judgment method is used to regard data points that exceed a preset threshold range as outliers and replace them with the mean of their neighboring points.

[0023] Preferably, in step 1.4, the Z-score standardization method is used to subtract the mean of each eigenvalue and divide it by its standard deviation so that the processed data conforms to the standard normal distribution. The formula for standardization is: Among them, X is the original data, μ is the mean of the original data, σ is the standard deviation of the original data, and Z is the standardized data.

[0024] Preferably, the parameters for initializing the LSTM model in step 1.6 specifically include:

[0025] i) Initializing the structural parameters of the LSTM model, including the feature dimension of the input layer, the number of hidden layers and the number of hidden units in each layer, and the number of nodes in the output layer, wherein the feature dimension of the input layer matches the number of extracted power signal features, and the number of nodes in the output layer is equal to the number of predicted optimal sampling point positions;

[0026] ii) Initialize the model weights and biases using small random numbers;

[0027] iii) Setting the activation function of the LSTM model, including setting the Sigmoid function for the gating mechanism and setting the Tanh function for the calculation of candidate memory cells and hidden states;

[0028] iv) Configure the optimization algorithm and set the learning rate parameters.

[0029] Preferably, in step 1.7, the LSTM model is iteratively trained using the training set data. In each iteration, a batch of input data is sent to the LSTM model, and the memory unit and hidden state are updated by calculating the values ​​of the input gate, the forget gate and the output gate, and finally the predicted output sequence is obtained; the loss function value is calculated according to the predicted output and the true label; the gradient of the loss function with respect to the model parameters is calculated by the back propagation algorithm; the model weights and biases are updated according to the gradient using the optimization algorithm; during the training process, the validation set is regularly used to evaluate the model performance, and the learning rate is adjusted or the training is stopped early as needed to prevent overfitting.

[0030] Preferably, a power meter comprises:

[0031] A sampling prediction module, in which the sampling prediction model pre-trained in the above-mentioned optimal sampling method is deployed;

[0032] A real-time data acquisition module is used to collect the time series data of the voltage and current in the circuit under test in real time, and extract the basic characteristics, waveform characteristics, time domain characteristics and frequency domain characteristics of the voltage and current;

[0033] The optimal sampling point prediction module is used to input the signal features extracted by the real-time data acquisition module into the sampling prediction model trained in the sampling prediction module to obtain the optimal sampling point position list of the power meter in each sampling period;

[0034] The sampling strategy application module is used to apply the position list of the optimal sampling points in each sampling period obtained by the optimal sampling point prediction module to the sampling strategy of the power meter, so that the power meter performs real-time sampling according to the predicted optimal sampling point positions.

[0035] Preferably, an electronic device comprises a memory and a processor, wherein the memory is used to store one or more computer instructions, wherein the one or more computer instructions are executed by the processor to implement the above-mentioned power meter optimal sampling method.

[0036] Compared with the prior art, the present invention has the following beneficial effects:

[0037] By building and training a sampling prediction model through a neural network algorithm, it is possible to predict the optimal sampling point position within each sampling cycle, thereby more accurately capturing the key features of the power signal and significantly improving the measurement accuracy of the power meter.

[0038] Since this method can optimize the sampling point location and reduce unnecessary sampling points, it can reduce the demand for high-cost hardware such as high-speed A / D converters, thereby reducing the overall hardware cost. By reducing the number of sampling points, this method can significantly reduce the complexity of subsequent signal processing and analysis, reduce the data processing burden, and improve overall efficiency. BRIEF DESCRIPTION OF THE DRAWINGS

[0039] Figure 1 A diagram showing the processing steps of the method of the present invention;

[0040] Figure 2 Flowchart for optimizing training and validation of a sampled prediction model. DETAILED DESCRIPTION

[0041] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0042] See also Figure 1-2 The present invention provides a technical solution: an optimal sampling method for an electric digital power meter, the specific steps of the method include:

[0043] Step 1: Build and train a sampling prediction model

[0044] Step 1.1 Data collection: First, collect historical sampled power signal data, including time series data of voltage and current. The data should cover different power system operating states to ensure the generalization ability of the model.

[0045] Step 1.2 Data preprocessing: Preprocess the collected power signal data to extract signal features. The extracted signal features include basic features of voltage and current, waveform features, time domain features, and frequency domain features. Specifically, the basic features include the frequency, amplitude, and phase of the signal; the waveform features include the waveform shape, waveform symmetry, and waveform smoothness of the signal wave; the time domain features include the mean, variance, skewness, rise rate, and fall rate of the signal; the frequency domain features include the spectrum distribution, spectrum peak, and spectrum width of the signal.

[0046] Step 1.3 Data cleaning: Clean the extracted feature data to handle missing values ​​and outliers, including filling missing values, smoothing outliers, etc., to ensure the integrity and consistency of the data.

[0047] For outliers, the threshold judgment method is used to regard data points that exceed the preset threshold range as outliers and replace them with the mean of their neighboring points.

[0048] Step 1.4 Data standardization: Standardize the cleaned feature data to eliminate the dimensional differences between different features and improve the training efficiency of the model.

[0049] Using the Z-score standardization method, each feature value is subtracted from its mean and divided by its standard deviation, so that the processed data conforms to the standard normal distribution. The formula for standardization is: Among them, X is the original data, μ is the mean of the original data, σ is the standard deviation of the original data, and Z is the standardized data.

[0050] Step 1.5: Construct a training data set: mark the optimal sampling point position of each data, and together with the corresponding feature data, form a training data set. The training data set is further divided into a training set and a validation set for model training and validation.

[0051] Step 1.6 Model selection and initialization: Select the long short-term memory network (LSTM) model to build a sampling prediction model and initialize the parameters of the model. The LSTM model is selected as the preferred model of the present invention because it can handle the long-term dependency of time series data.

[0052] Step 1.7 Model training: Use the training set data to iteratively train the LSTM model. During the training process, the validation set is used regularly to evaluate the model performance until the model performance meets the requirements, including reducing the prediction error and improving the accuracy of the sampling point location prediction.

[0053] Step 1.8 Model deployment: After training is completed, save the weights and biases of the LSTM model and deploy the model for subsequent sampling position prediction.

[0054] Step 2: Real-time signal feature extraction

[0055] The time series data of voltage and current in the circuit under test are collected in real time, and the basic characteristics, waveform characteristics, time domain characteristics and frequency domain characteristics of voltage and current are extracted.

[0056] Step 3: Sampling point location prediction

[0057] The signal features extracted in step 2 are input into the sampling prediction model trained in step 1 to obtain the optimal sampling point location list of the power meter in each sampling cycle. These locations are dynamically predicted based on the current power signal characteristics and can accurately capture the key features of the signal.

[0058] Step 4: Apply the optimal sampling strategy

[0059] The position list of the optimal sampling points in each sampling period obtained in step 3 is applied to the sampling strategy of the power meter. The power meter performs real-time sampling according to the predicted optimal sampling point positions, thereby improving sampling accuracy and reducing sampling costs.

[0060] As a special form of recurrent neural network (RNN), the LSTM model effectively solves the gradient vanishing or gradient exploding problems of traditional RNN in long sequence data processing by introducing three gating mechanisms: forget gate, input gate, and output gate. This enables the LSTM model to capture long-term dependencies in power signals and has stronger modeling capabilities for complex dynamic changes in time series data such as voltage and current in power systems. Since the LSTM model can process long sequence data and retain key information, it can more accurately predict the optimal sampling point position in each sampling cycle, which is crucial to improving the measurement accuracy of electric digital power meters, especially when the power signal fluctuates greatly or there are complex nonlinear relationships.

[0061] The LSTM model has strong adaptability and can process power signal data of different lengths and characteristics, which makes the constructed sampling prediction model applicable to a variety of power system environments and operating conditions, improving the generalization and practicality of the model. Compared with the traditional fixed sampling point location method, the LSTM-based sampling prediction model can dynamically adjust the sampling point location according to the real-time collected power signal characteristics. This dynamic adjustment capability enables the power meter to respond more flexibly to emergencies and changes in the power system, improving the real-time and accuracy of the measurement.

[0062] The present invention will be further described below in conjunction with Examples 1 to 3:

[0063] Embodiment 1:

[0064] Before starting the training of the sampling prediction model, the LSTM model needs to be initialized, including:

[0065] i) LSTM model structure parameter initialization

[0066] Input layer feature dimension setting: According to the number of extracted power signal features, the feature dimension of the LSTM model input layer is set to ensure that the input layer can receive and process all key power signal features.

[0067] Hidden layer configuration: Determine the number of hidden layers and the number of hidden units in each layer. The design of the hidden layer should be able to fully capture the temporal dependencies and nonlinear characteristics in the power signal.

[0068] Setting the number of nodes in the output layer: According to the number of predicted optimal sampling point positions, set the number of nodes in the output layer of the LSTM model to ensure that the output layer can generate prediction results corresponding to the sampling point positions.

[0069] ii) Model weight and bias initialization

[0070] Small random numbers are used to initialize the weights and biases of the LSTM model. This initialization method helps the model maintain a small deviation at the beginning of training and improves the stability of training.

[0071] iii) Activation function setting

[0072] Gating mechanism activation function: Set the Sigmoid function as the activation function of the LSTM model gating mechanism. The Sigmoid function can output a value between 0 and 1, which is suitable for controlling the flow and forgetting of information.

[0073] Memory unit and hidden state activation function: Set the Tanh function as the activation function for the candidate memory unit and hidden state of the LSTM model. The Tanh function can output a value between -1 and 1, provide nonlinear transformation and maintain gradient stability.

[0074] iv) Optimize algorithm configuration and learning rate settings

[0075] Configure an optimization algorithm suitable for the LSTM model, such as Adam or RMSprop. The Adam or RMSprop optimization algorithm can update model parameters based on gradient information and accelerate the training process.

[0076] Set an appropriate learning rate parameter. The learning rate determines the update speed of the model during the training process. Too high a learning rate may cause the model to be unstable, while too low a learning rate may cause the training process to be too slow.

[0077] After the LSTM model is initialized, the model training begins. The iterative training process is as follows:

[0078] i) Use the training set data to iteratively train the LSTM model.

[0079] ii) In each iteration, a batch of input data is selected from the training set and fed into the LSTM model.

[0080] iii) The LSTM model calculates the values ​​of the input gate, forget gate, and output gate, updates the memory unit and hidden state, and finally obtains the predicted output sequence.

[0081] iv) Calculate the loss function value based on the predicted output and the true label to evaluate the prediction accuracy of the model in the current iteration.

[0082] v) Calculate the gradient of the loss function with respect to the model parameters through the back-propagation algorithm.

[0083] vi) Update the weights and biases of the LSTM model based on the gradients using the configured optimization algorithm such as Adam or RMSprop.

[0084] vii) Repeat the above iterative process until the predetermined number of iterations is reached or other stopping conditions are met

[0085] During the training process, the validation set is used regularly to evaluate the performance of the LSTM model, the loss function value on the validation set is calculated, and its changing trend during the training process is observed. If the performance on the validation set begins to decline, it indicates that overfitting may have occurred. At this time, the learning rate should be adjusted or the training should be stopped early.

[0086] Adjust the learning rate according to the performance results on the validation set. If the loss function value on the validation set continues to decrease, it means that the model is learning, and the learning rate can be maintained or appropriately increased. If the loss function value on the validation set starts to rise, it means that overfitting may have occurred, and the learning rate should be reduced.

[0087] When the LSTM model achieves satisfactory performance on the validation set, save the model's weights and biases.

[0088] Embodiment 2:

[0089] The extracted signal features include basic features of voltage and current, waveform features, time domain features and frequency domain features. Specifically, the basic features include the frequency, amplitude and phase of the signal.

[0090] Frequency extraction: In order to calculate the number of cycles of a signal per unit time, the signal must first be sampled, ensuring that the sampling frequency is high enough to capture all important features of the signal. The period of the signal is then determined by analyzing the periodic changes in the signal, such as finding the signal's repetitive pattern or zero crossing point. Finally, the frequency of the signal is obtained by dividing the unit time (such as 1 second) by the period of the signal.

[0091] Amplitude extraction: Extracting the amplitude of a signal is relatively simple. During the entire sampling period of the signal, all sample points are traversed and the maximum value is recorded. This maximum value is the amplitude of the signal, which indicates the maximum amplitude of the signal during the sampling period.

[0092] Phase extraction: Phase extraction usually involves comparison with a reference signal. First, a reference signal is selected, which should be a standard signal with the same frequency and waveform as the signal to be measured. Then, the phase is determined by comparing the initial offset of the signal to be measured with the reference signal, which can be achieved by calculating the time delay or sample point offset between the two signals. Once the time delay is determined, it can be converted to a phase angle, expressed in degrees or radians.

[0093] The waveform characteristics include the waveform shape, waveform symmetry and waveform smoothness of the signal wave.

[0094] Waveform shape extraction: In order to extract the waveform shape of the signal, the signal must first be sampled, ensuring that the sampling frequency is high enough to capture all the important features of the signal. Then, the overall trend and changes of the signal are analyzed, including the peaks and valleys of the signal and the changes between them. By marking these key points and connecting them, the waveform shape of the signal can be depicted.

[0095] Waveform symmetry extraction: Waveform symmetry extraction involves comparing the positive half-cycle and negative half-cycle of the signal. First, find the positive and negative peaks of the signal and determine the time interval between them, i.e., the positive half-cycle and the negative half-cycle, respectively. Then calculate the areas of the two half-cycles and compare their similarities. The similarity can be evaluated by calculating the ratio of the absolute value of the difference between the areas of the two half-cycles and their sum, and the calculation formula is: The closer this ratio is to 0, the better the waveform symmetry.

[0096] Extraction of waveform smoothness: Extraction of waveform smoothness involves analyzing the rate of change of the signal. First, the signal is differentiated in the first or second order to obtain its derivative. Then, the degree of change of the derivative within a certain time window is calculated, which can be achieved by calculating the variance or mean of the derivative. The smaller the degree of change, the smoother the waveform; the larger the degree of change, the rougher the waveform. By comparing the degree of change in different time windows, the overall smoothness of the waveform can be evaluated.

[0097] The time domain features include the mean, variance, skewness, rise rate and fall rate of the signal.

[0098] For time domain features, the mean is the average level of the signal in the time domain, indicating the central trend of the signal. First, the signal is sampled to obtain a series of discrete data points, and then the arithmetic mean of these data points is calculated, that is, the sum of all data points divided by the total number of data points. The calculation formula is: where x i is the i-th sample point of the signal, and N is the total number of samples; the variance is obtained by calculating the average of the squares of the differences between all sample points of the signal and its mean. On the basis of extracting the mean, the difference between each data point and the mean is calculated, and then the squares of these differences are calculated, and finally the average of these square differences is calculated. The calculation formula is: Skewness is an indicator that measures the direction and degree of skewness of the signal distribution. First, the mean and standard deviation (square root of variance) of the signal are calculated. Then the skewness is calculated by dividing the third-order central moment (the average of the cube of the difference between all data points and the mean) by the cube of the standard deviation. The calculation formula is: The rise rate is used to describe the slope of the rising section in the signal. First, the rising section in the signal is identified by comparing the sizes of adjacent data points. Then, for each rising section, its slope is calculated, that is, the ordinate difference between the end point and the starting point of the section divided by the abscissa difference (for discrete signals, the abscissa difference is usually an integer multiple of the sampling interval). Finally, the average value of the slopes of all rising sections is calculated as the overall rise rate. The slope can be expressed as where x start and x end are the starting and ending sample points of the rising paragraph, respectively. Start and end are the serial numbers corresponding to the starting and ending sample points, respectively. The method of extracting the decline rate is similar to that of the rising rate, but it is aimed at the declining paragraphs in the signal. First, the declining paragraphs in the signal are identified, and then for each declining paragraph, its slope is calculated. Finally, the average of the slopes of all declining paragraphs is calculated as the overall decline rate.

[0099] Frequency domain features include the signal's spectrum distribution, spectrum peak, and spectrum width.

[0100] For frequency domain features, the spectrum distribution describes the energy distribution of the signal at different frequencies. In order to extract the spectrum distribution, the signal must first be Fourier transformed to convert the signal from the time domain to the frequency domain. The Fourier transform decomposes the signal into a superposition of sine and cosine components of different frequencies, thereby obtaining the spectrum representation of the signal. The spectrum distribution is usually displayed by drawing a spectrum graph, where the horizontal axis represents the frequency and the vertical axis represents the energy (or amplitude) at the corresponding frequency. The calculation formula is: Where x(t) is the time domain signal, X(f) is its corresponding frequency representation, and f is the frequency; the spectrum peak is the point with the largest energy (or amplitude) in the spectrum, which corresponds to the main frequency component of the signal. In order to extract the spectrum peak, you first need to perform Fourier transform on the signal to get the spectrum. Then traverse all the frequency points in the spectrum to find the point with the largest amplitude. The frequency of this point is the spectrum peak. When extracting, directly search for the maximum value in the spectrum array and its corresponding index (i.e. frequency) through programming. The calculation formula is: Spectrum peak = max f |X(f)|; Spectral width is an indicator to measure the distribution range of the signal spectrum on the frequency axis. There are many ways to define and calculate the spectrum width. A common method is based on the width of the amplitude threshold. First, set an amplitude threshold (usually determined according to the specific situation and needs of the signal), and then find the lowest and highest frequency points in the spectrum whose amplitude exceeds the threshold. The difference between these two frequency points is the spectrum width based on the amplitude threshold, and the calculation formula is: Spectral width = f 2 -f 1 , where f 1 and f 2 are respectively the lowest and highest frequency points in the spectrum where the amplitude exceeds the threshold.

[0101] Below is a code example for extracting frequency domain features using the Python programming language:

[0102] import numpy as np

[0103] import matplotlib.pyplot as plt

[0104] #Generate synthetic signal

[0105] fs=1000#sampling frequency

[0106] t = np.arange(0,1,1 / fs) # time vector

[0107] f1,f2=50,120#Two frequency components of the signal

[0108] signal=0.6*np.sin(2*np.pi*f1*t)+2*np.sin(2*np.pi*f2*t)

[0109] # Calculate the spectrum

[0110] signal_fft=np.fft.fft(signal)

[0111] freqs=np.fft.fftfreq(len(signal),1 / fs)

[0112] #Extract spectrum distribution

[0113] magnitude_spectrum=np.abs(signal_fft)

[0114] # Extract spectrum peaks

[0115] peak_freq=freqs[np.argmax(magnitude_spectrum)]

[0116] #Extract spectrum width (based on amplitude threshold)

[0117] threshold=0.5*np.max(magnitude_spectrum)

[0118] above_threshold=magnitude_spectrum>threshold

[0119] width_freqs=freqs[above_threshold]

[0120] spectral_width=np.max(width_freqs)-np.min(width_freqs)

[0121] #Draw the spectrum

[0122] plt.figure()

[0123] plt.plot(freqs[:len(freqs) / / 2],

[0124] magnitude_spectrum[:len(freqs) / / 2])#Draw only the positive frequency part

[0125] plt.title('Magnitude Spectrum')

[0126] plt.xlabel('Frequency(Hz)')

[0127] plt.ylabel('Magnitude')

[0128] plt.grid()

[0129] plt.axvline(x=peak_freq,color='r',linestyle='--',label='PeakFrequency')

[0130] plt.axvspan(np.min(width_freqs),np.max(width_freqs), color='y',alpha=0.3,label='Spectral Width')

[0131] plt.legend()

[0132] plt.show()

[0133] # Output results

[0134] print(f"The frequency corresponding to the spectrum peak is: {peak_freq:.2f}Hz")

[0135] print(f"The spectrum width based on the amplitude threshold is: {spectral_width:.2f}Hz")

[0136] The above code describes how to use the Python programming language and the NumPy library to extract the three frequency domain features of the signal: spectrum distribution, spectrum peak, and spectrum width based on amplitude threshold. The specific steps are:

[0137] Step 1: Generate a synthetic signal

[0138] First, a synthetic signal containing two sine wave components is generated. This signal can be constructed by setting the sampling frequency, time vector, and two sine wave components with different frequencies.

[0139] Step 2: Calculate the spectrum

[0140] Next, the fast Fourier transform (FFT) function in the NumPy library is used to calculate the spectrum of the signal. The FFT function converts the signal from the time domain to the frequency domain, obtains the complex representation of the spectrum, and calculates the corresponding frequency vector for subsequent analysis.

[0141] Step 3: Extract spectrum distribution

[0142] Then, the spectrum distribution feature is extracted. By calculating the amplitude of the spectrum (ie, the modulus of the complex number), the spectrum distribution can be obtained, which describes the energy distribution of the signal at different frequencies.

[0143] Step 4: Extract spectrum peaks

[0144] Next, extract the spectrum peak feature. The spectrum peak is the point with the largest amplitude in the spectrum, which corresponds to the main frequency component of the signal. By traversing the spectrum amplitude array and finding the maximum value and its corresponding frequency, the spectrum peak can be obtained.

[0145] Step 5: Extract spectrum width (based on amplitude threshold)

[0146] Finally, the spectrum width feature based on the amplitude threshold is extracted. First, an amplitude threshold is set, and then the lowest and highest frequency points in the spectrum whose amplitude exceeds the threshold are found. The difference between these two frequency points is the spectrum width based on the amplitude threshold.

[0147] Embodiment 3:

[0148] The power meter described in the present invention is mainly composed of the following modules:

[0149] Sampling prediction module: This module deploys a sampling prediction model that is pre-trained using the power meter optimal sampling method. The model is trained based on historical data or simulation data and can predict the optimal sampling point location under different circuit conditions.

[0150] Real-time data acquisition module: This module is responsible for real-time acquisition of the time series data of voltage and current in the circuit under test. It further extracts the basic characteristics (such as mean, peak, etc.), waveform characteristics (such as waveform shape, distortion, etc.), time domain characteristics (such as rate of change in the time domain, etc.) and frequency domain characteristics (such as spectrum distribution, etc.) of these data.

[0151] Optimal sampling point prediction module: This module inputs the signal features extracted by the real-time data acquisition module into the trained sampling prediction model in the sampling prediction module. Through model calculation, the optimal sampling point position list of the power meter in each sampling period is obtained.

[0152] Sampling strategy application module: This module applies the position list of the optimal sampling points in each sampling period output by the optimal sampling point prediction module to the sampling strategy of the power meter, so that the power meter can perform real-time sampling according to the predicted optimal sampling point positions, thereby improving the accuracy and efficiency of the measurement.

[0153] The present invention also provides an electronic device, which includes a memory and a processor, and is specifically implemented as follows:

[0154] Memory: used to store one or more computer instructions. These instructions are necessary to implement the above-mentioned power meter optimal sampling method.

[0155] Processor: executes one or more computer instructions stored in the memory. By executing these instructions, the processor can realize the functions of sampling prediction, data collection, optimal sampling point prediction and sampling strategy application of the above-mentioned power meter.

[0156] It should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device.

[0157] Although embodiments of the present invention have been shown and described, it will be appreciated by those skilled in the art that various changes, modifications, substitutions and variations may be made to the embodiments without departing from the principles and spirit of the present invention, and that the scope of the present invention is defined by the appended claims and their equivalents.

Claims

1. An optimal sampling method for an electric power digital power meter, characterized in that: The method specifically comprises the following steps: Step 1: Use a neural network algorithm to build and train a sampling prediction model. The sampling prediction model is used to predict the optimal sampling point position of the power meter in each sampling period according to the power signal generated by the circuit. The specific steps of building and training the sampling prediction model include: Step 1.1, collect historical sampled power signal data, including time series data of voltage and current; Step 1.2, preprocess the collected power signal data to extract signal features, the extracted signal features include basic features, waveform features, time domain features and frequency domain features of voltage and current; basic features include frequency, amplitude and phase of the signal; waveform features include waveform shape, waveform symmetry and waveform smoothness of the signal wave; time domain features include mean, variance, skewness, rise rate and fall rate of the signal; frequency domain features include spectrum distribution, spectrum peak and spectrum width of the signal; Step 1.3: Clean the extracted feature data to handle missing values ​​and outliers; Step 1.4: Standardize the cleaned feature data; Step 1.5, mark the optimal sampling point position of each data, and together with the corresponding feature data, form a training data set, and further divide the training data set into a training set and a validation set; Step 1.6: Select the long short-term memory network LSTM model to build a sampling prediction model and initialize the parameters of the model; Step 1.7: Use the training set data to iteratively train the LSTM model. During the training process, regularly use the validation set to evaluate the model performance until the model performance meets the requirements. Step 1.8: After training is completed, save the weights and biases of the LSTM model and deploy the model for subsequent sampling position prediction; Step 2: collect time series data of voltage and current in the circuit under test in real time, and extract basic characteristics, waveform characteristics, time domain characteristics and frequency domain characteristics of voltage and current; Step 3, input the signal features extracted in step 2 into the sampling prediction model trained in step 1 to obtain the optimal sampling point position list of the power meter in each sampling period; Step 4: Apply the position list of the optimal sampling points in each sampling period obtained in step 3 to the sampling strategy of the power meter, and the power meter performs real-time sampling according to the predicted optimal sampling point positions.

2. The optimal sampling method for an electric power digital power meter according to claim 1, characterized in that: For basic features, the frequency is obtained by calculating the number of cycles of the signal in unit time; the amplitude is obtained by calculating the maximum value of the signal; the phase is obtained by calculating the initial offset of the signal; For the waveform characteristics, the waveform shape is obtained by calculating the peak and valley values ​​of the signal and the change period between the two; the waveform symmetry is obtained by comparing the similarity between the positive half-cycle and the negative half-cycle of the signal. The calculation formula is: The waveform smoothness is obtained by calculating the degree of change of the first-order or second-order derivative of the signal, and the smoothness represents the average value of the rate of change of the derivative; For time domain features, the mean is obtained by calculating the average value of all sample points of the signal. The calculation formula is: where x i is the i-th sample point of the signal, and N is the total number of samples; The variance is obtained by calculating the average of the squares of the differences between all sample points of the signal and its mean. The calculation formula is: Skewness is used to measure the skew direction and degree of the signal distribution pattern. The calculation formula is: The rising rate is obtained by calculating the average slope of all rising segments in the signal. For each rising segment, the slope is where x start and x end are the starting and ending sample points of the rising segment, respectively. start and end are the serial numbers corresponding to the starting and ending sample points, respectively. The falling rate is obtained by calculating the average slope of all falling segments in the signal. For each falling segment, the calculation of the slope is the same as the rising rate, but in the opposite direction. For frequency domain features, the spectrum distribution converts the signal from time domain to frequency domain through Fourier transform to obtain the spectrum of the signal. The calculation formula is: Where x(t) is the time domain signal, X(f) is its corresponding frequency representation, and f is the frequency; the spectrum peak is the frequency of the maximum amplitude point in the signal spectrum, and the calculation formula is: spectrum peak = max f |X(f)|; Spectrum width is used to measure the distribution width of the signal spectrum on the frequency axis. The calculation formula is: Spectrum width = f2-f1, where f1 and f2 are the lowest and highest frequency points in the spectrum where the amplitude exceeds the threshold.

3. The optimal sampling method for an electric power digital power meter according to claim 2, characterized in that: In step 1.3, for missing values, linear interpolation algorithm is used to fill them; for outliers, threshold judgment method is used to regard data points beyond the preset threshold range as outliers and replace them with the mean of their neighboring points.

4. The optimal sampling method for an electric power digital power meter according to claim 3 is characterized in that: In step 1.4, the Z-score standardization method is used to subtract the mean of each feature value and divide it by its standard deviation so that the processed data conforms to the standard normal distribution. The formula for standardization is: Among them, X is the original data, μ is the mean of the original data, σ is the standard deviation of the original data, and Z is the standardized data.

5. The optimal sampling method for an electric power digital power meter according to claim 4, characterized in that: The parameters for initializing the LSTM model in step 1.6 include: i) Initializing the structural parameters of the LSTM model, including the feature dimension of the input layer, the number of hidden layers and the number of hidden units in each layer, and the number of nodes in the output layer, wherein the feature dimension of the input layer matches the number of extracted power signal features, and the number of nodes in the output layer is equal to the number of predicted optimal sampling point positions; ii) Initialize the model weights and biases using small random numbers; iii) Setting the activation function of the LSTM model, including setting the Sigmoid function for the gating mechanism and setting the Tanh function for the calculation of candidate memory cells and hidden states; iv) Configure the optimization algorithm and set the learning rate parameters.

6. The optimal sampling method for an electric power digital power meter according to claim 5, characterized in that: In step 1.7, the training set data is used to iteratively train the LSTM model. In each iteration, a batch of input data is sent to the LSTM model, and the memory cells and hidden states are updated by calculating the values ​​of the input gate, forget gate, and output gate to finally obtain the predicted output sequence; the loss function value is calculated based on the predicted output and the true label; the gradient of the loss function with respect to the model parameters is calculated through the back propagation algorithm; the model weights and biases are updated according to the gradient using the optimization algorithm; during the training process, the validation set is regularly used to evaluate the model performance, and the learning rate is adjusted or the training is stopped early as needed to prevent overfitting.

7. A power meter, characterized in that: The power meter comprises: A sampling prediction module, in which a sampling prediction model pre-trained using the method described in any one of claims 1 to 6 is deployed; A real-time data acquisition module is used to collect the time series data of the voltage and current in the circuit under test in real time, and extract the basic characteristics, waveform characteristics, time domain characteristics and frequency domain characteristics of the voltage and current; The optimal sampling point prediction module is used to input the signal features extracted by the real-time data acquisition module into the sampling prediction model trained in the sampling prediction module to obtain the optimal sampling point position list of the power meter in each sampling period; The sampling strategy application module is used to apply the position list of the optimal sampling points in each sampling period obtained by the optimal sampling point prediction module to the sampling strategy of the power meter, so that the power meter performs real-time sampling according to the predicted optimal sampling point positions.

8. An electronic device, characterized in that: The electronic device includes a memory and a processor, wherein the memory is used to store one or more computer instructions, wherein the one or more computer instructions are executed by the processor to implement the power meter optimal sampling method according to any one of claims 1 to 6.

Citation Information

Patent Citations

  • Method and device for sampling electric monitoring signal

    CN102809679A

  • Broadband high-precision digital power meter and rapid optimization sampling method

    CN112557747A

  • Sampling rate converter using line frequency and phase-locked loop for metering electric energy

    CN118251599A

  • Sampling period setting method of a / d converter and digital wattmeter

    JP2005318088A

  • Multichannel electronic device with dynamic sampling and integrated auxiliary system

    WO2024052932A1

Cited By

  • Demand determination method and device of electric energy meter, readable storage medium and electric energy meter

    CN120507709A

  • Multi-feature and integrated optimization saline-alkali soil conductivity prediction method

    CN120524463A

  • A multi-feature and integrated optimization method for predicting soil salinity conductivity

    CN120524463B