Lightning current waveform curve modeling method and device, terminal equipment and storage medium
By identifying the characteristic points of the lightning current waveform and adopting the B-spline algorithm and gray wolf optimization, the accuracy and efficiency problems of traditional lightning current waveform modeling on complex waveforms are solved, and high-precision fitting of complex lightning current waveforms is achieved.
Patent Information
- Application Number
- CN202510743402.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-05
- Publication Date
- 2025-09-16
AI Technical Summary
Traditional lightning current waveform modeling methods are difficult to meet the modeling requirements of complex lightning current waveforms, especially in the high-frequency part, where the accuracy is insufficient, parameter adjustment is difficult, and it cannot adapt to complex waveforms such as multi-peak or asymmetric waveforms.
By obtaining the lightning current waveform curve, identifying the crease points, curvature extreme points and inflection points as feature points, using the B-spline algorithm to generate the initial node vector, combined with the Grey Wolf algorithm for iterative optimization, and dynamically adjusting the feature points to generate the target fitting curve.
The accuracy and applicability of lightning current waveform modeling are improved, and it can accurately fit complex lightning current waveforms that are asymmetric, multi-peak, or have local oscillations without the need to adjust multiple parameters at the same time.
Smart Images

Figure CN120654401A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of lightning current waveform modeling, and in particular to a lightning current waveform curve modeling method, device, terminal equipment and storage medium. Background Art
[0002] Lightning is a highly destructive electrical discharge phenomenon in nature. Lightning current waveform modeling involves describing, analyzing, and simulating the current waveform generated during lightning discharge using mathematical methods and physical models. Its core goal is to establish a mathematical model that accurately reflects lightning current characteristics. Accurate modeling of current waveforms is crucial for lightning protection design in power systems, electromagnetic compatibility analysis of electronic equipment, and research into the physical properties of lightning.
[0003] At present, lightning current waveform modeling is usually carried out using double exponential functions, Heidler functions, pulse functions, etc. Although the double exponential function is simple in form, it describes the waveform through exponential decay, which makes it impossible to accurately match the measured data in the high-frequency part, and ultimately causes modeling distortion. Secondly, the parameters of the double exponential function cannot be dynamically adjusted after being fixed, making it difficult to simulate the randomness of the lightning waveform. Therefore, the lightning current waveform model constructed by this method is not very accurate. The Heidler function improves the problem of high-frequency oscillation, but introduces oscillation terms and multiple parameters. During the fitting process, multiple parameters need to be optimized simultaneously, resulting in a time-consuming nonlinear optimization process and difficult optimization. The lightning current waveform model constructed by this method is less efficient. The pulse function is only applicable to simple waveforms (such as standard lightning impulses) and cannot describe complex waveforms such as multi-peak or asymmetric waveforms. Therefore, the lightning current waveform model constructed by this method has poor applicability.
[0004] With the rapid development of smart grids and precision electronic equipment, traditional lightning current waveform modeling methods can no longer meet the modeling requirements of complex lightning current waveforms. Summary of the Invention
[0005] The present invention provides a lightning current waveform curve modeling method, apparatus, terminal equipment and storage medium, which can overcome the defect that traditional lightning current waveform modeling methods are difficult to meet the modeling requirements of complex lightning current waveforms.
[0006] An embodiment of the present invention provides a lightning current waveform curve modeling method, comprising:
[0007] Obtaining the lightning current waveform curve to be modeled;
[0008] Determine a number of characteristic points based on the lightning current waveform curve; wherein the characteristic points include: crease points, curvature extreme points, and inflection points;
[0009] According to the characteristic points, a number of initial node vectors are constructed, and a B-spline algorithm is used to generate a fitting curve corresponding to each initial node vector;
[0010] Calculating a fitting error between the fitting curve and the lightning current waveform curve according to the lightning current waveform curve;
[0011] Using the initial node vectors as initial populations, and performing iterative optimization operations on the initial populations according to the fitting errors, and generating new optimized populations by deleting, adding, or merging characteristic points in various populations in each round of iterative optimization operations, until it is determined that the fitting error between a target fitting curve generated by a target population and the lightning current waveform curve is less than a preset error threshold, and then terminating the iterative optimization operation;
[0012] A target model of the lightning current waveform curve is constructed according to the characteristic points in the target population.
[0013] Furthermore, the step of determining a plurality of characteristic points based on the lightning current waveform curve includes:
[0014] Calculating a data point curvature of each first data point in the lightning current waveform curve according to the lightning current waveform curve;
[0015] According to the curvature of the data points, several characteristic points of the lightning current waveform curve are determined.
[0016] Furthermore, calculating the data point curvature of each first data point in the lightning current waveform curve according to the lightning current waveform curve includes:
[0017] The data point curvature of each first data point in the lightning current waveform curve is calculated according to the following formula:
[0018]
[0019] Among them, K i is the first data point P i The curvature of the data point, sgn() is the sign function, ΔP i-1 P i P i+1 The first data point P of the i-1th i-1 , the first data point P i , the first data point P of the i+1th i+1 The triangular area, l i is the first data point P i-1 With the first data point P i+1 The chord length between i The triangular area at the first data point P i of the outside angle.
[0020] Furthermore, performing iterative optimization operations on the plurality of initial populations according to the fitting error includes:
[0021] The fitting error is used as the fitness value, and the initial population corresponding to the smallest fitness value is used as the first initial population, the initial population corresponding to the second smallest fitness value is used as the second initial population, the initial population corresponding to the third smallest fitness value is used as the third initial population, and the other initial populations are used as the remaining initial populations;
[0022] A grey wolf algorithm is used to perform iterative optimization operations on the first initial population, the second initial population, the third initial population, and the remaining initial populations according to the fitness value.
[0023] Furthermore, the iterative optimization operation includes:
[0024] Obtaining a population to be optimized; wherein the population to be optimized includes: a first population, a second population, a third population, and a remaining population; initially, the first population, the second population, the third population, and the remaining population are the first initial population, the second initial population, the third initial population, and the remaining initial population, respectively;
[0025] Constructing a virtual solution space according to the fitness values of the population to be optimized, and determining the position of each population to be optimized in the virtual solution space according to the fitness values;
[0026] Calculating, based on the positions, a first distance between the remaining population and the first population, a second distance between the second population, and a third distance between the remaining population and the third population;
[0027] According to the first distance, the second distance, and the third distance, randomly optimizing the corresponding remaining populations by deleting feature points, adding feature points, or merging feature points to generate an optimized population;
[0028] generating a fitting curve to be evaluated according to the optimized population, and calculating a fitting error between the fitting curve to be evaluated and the lightning current waveform curve as a fitness value to be evaluated of each of the optimized populations;
[0029] Determine whether there is a fitness value to be evaluated that is less than a preset error threshold;
[0030] If yes, the optimized population corresponding to the fitness value to be evaluated that is less than the preset error threshold is used as the target population, and the iterative optimization operation is terminated;
[0031] If not, then based on the fitness value to be evaluated, the fitness value of the first population, the fitness value of the second population, and the fitness value of the third population, determine the first population, second population, third population and remaining populations required for the next round of iterative optimization operation from the first population, second population, third population and optimized population.
[0032] Furthermore, generating a fitting curve to be evaluated based on the optimized population includes:
[0033] Calculating the basis function and parameterized value corresponding to each feature point to be evaluated in the optimized population according to the optimized population;
[0034] Generating an initial fitting curve according to the basis function and parameterized value of each feature point to be evaluated;
[0035] Calculating the optimization weight of the basis function of each feature point to be evaluated with the goal of minimizing the distance between each first data point on the lightning current waveform curve and the corresponding second data point on the initial fitting curve;
[0036] The initial fitting curve is optimized according to the optimization weight to generate the fitting curve to be evaluated.
[0037] Furthermore, the target model of the lightning current waveform curve is:
[0038]
[0039] Where I(t) is the target model, t is the parameterized value of the i-th feature point in the target population, and N i,k (t) is the k-order basis function of the i-th feature point in the target population, Q i The optimization weight corresponding to the i-th feature point in the target population, and n is the total number of feature points in the target population.
[0040] Another embodiment of the present invention further provides a lightning current waveform curve modeling device, comprising:
[0041] A curve acquisition module is used to obtain the lightning current waveform curve to be modeled;
[0042] A feature point identification module is used to determine a number of feature points based on the lightning current waveform curve; wherein the feature points include: crease points, curvature extreme value points and inflection points;
[0043] A curve fitting module is used to construct a number of initial node vectors based on the characteristic points, and generate a fitting curve corresponding to each initial node vector using a B-spline algorithm;
[0044] an error calculation module, configured to calculate a fitting error between the fitting curve and the lightning current waveform curve according to the lightning current waveform curve;
[0045] a node optimization module, configured to use the initial node vectors as initial populations, and perform iterative optimization operations on the initial populations according to the fitting errors, and in each round of iterative optimization operations, generate new optimized populations by deleting, adding, or merging characteristic points in various populations, until it is determined that the fitting error between a target fitting curve generated by a target population and the lightning current waveform curve is less than a preset error threshold, thereby terminating the iterative optimization operations;
[0046] A model building module is used to build a target model of the lightning current waveform curve according to the characteristic points in the target population.
[0047] Another embodiment of the present invention also provides a terminal device, comprising: a processor, a memory, and a computer program stored in the memory and configured to be executed by the processor. When the processor executes the computer program, it implements the steps of a method for modeling a lightning current waveform curve as described in any one of the above embodiments of the present invention.
[0048] Another embodiment of the present invention further provides a computer-readable storage medium item, comprising: a stored computer program, which, when the computer program is running, controls the device where the computer-readable storage medium is located to execute the steps of a lightning current waveform curve modeling method as described in any one of the above embodiments of the present invention.
[0049] The following beneficial effects are achieved by implementing the present invention:
[0050] The present invention provides a modeling method, device, terminal device and storage medium for a lightning current waveform curve. The method constructs a plurality of initial node vectors by taking the crease points, curvature extreme points and inflection points of the lightning current waveform curve to be modeled as feature points, so that in the subsequent fitting process, the changing characteristics of various waveforms in the lightning current waveform curve can be accurately identified, thereby improving the fitting accuracy. Secondly, the B-spline function is a piecewise polynomial function that adjusts the fitting accuracy of local segments by changing the feature points. Therefore, by adopting the B-spline algorithm, a fitting curve of each initial node vector is generated; the fitting error of the fitting curve is calculated according to the lightning current waveform curve; the plurality of initial node vectors are used as a plurality of initial populations, and according to the fitting error, the plurality of initial populations are iteratively optimized. In each round of iterative optimization operation, the populations are dynamically optimized by deleting, adding or merging feature points, without the need to adjust multiple parameters at the same time. By adjusting specific feature points, the local waveform can be accurately fitted. The method can be used to fit complex lightning current waveforms such as asymmetric, multi-peak or with local oscillations, and has high applicability. BRIEF DESCRIPTION OF THE DRAWINGS
[0051] In order to more clearly illustrate the technical solution of the present application, the following is a brief introduction to the drawings required for use in the implementation. Obviously, the drawings described below are only some implementation methods of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.
[0052] Figure 1 This is a flow chart of a lightning current waveform curve modeling method provided by one embodiment of the present invention;
[0053] Figure 2 1 is a schematic structural diagram of a lightning current waveform curve modeling device provided by an embodiment of the present invention;
[0054] Figure 3 Schematic diagram of characteristic points of a lightning current waveform curve provided by an embodiment of the present invention;
[0055] Figure 4 Schematic diagram of calculating the curvature of data points of a lightning current waveform curve provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0056] To make the objectives, technical solutions, and advantages of this application more clear, the technical solutions in this application will be clearly and completely described below in conjunction with the accompanying drawings in the embodiments of this application. Obviously, the described embodiments are only part of the embodiments of this application, not all of them. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without making any creative efforts are within the scope of protection of this application.
[0057] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by those skilled in the art to which this application belongs; the terms used herein are only for the purpose of describing specific embodiments and are not intended to limit this application; the terms "including" and "having" and any variations thereof in the specification and claims of this application and the above-mentioned figure descriptions are intended to cover non-exclusive inclusions.
[0058] In the description of the embodiments of this application, the technical terms "first" and "second" are used only to distinguish different objects and should not be understood to indicate or imply relative importance or implicitly specify the quantity, specific order, or primary and secondary relationship of the indicated technical features. In the description of the embodiments of this application, the meaning of "plurality" is more than two, unless otherwise clearly and specifically defined.
[0059] References herein to "embodiments" mean that a particular feature, structure, or characteristic described in connection with the embodiments may be included in at least one embodiment of the present application. The appearance of this phrase in various places in the specification does not necessarily refer to the same embodiment, nor does it constitute an independent or alternative embodiment that is mutually exclusive of other embodiments. It is understood, both explicitly and implicitly, by those skilled in the art that the embodiments described herein may be combined with other embodiments.
[0060] In the description of the embodiments of this application, the term "and / or" is simply a description of the association relationship between associated objects, indicating that three relationships can exist. For example, A and / or B can represent the following three situations: A exists alone, A and B exist simultaneously, and B exists alone. In addition, the character " / " in this document generally indicates that the associated objects are in an "or" relationship.
[0061] In the description of the embodiments of the present application, the terms "multiple" and "several" refer to more than two (including two). Similarly, "multiple groups" refer to more than two groups (including two groups), and "multiple pieces" refer to more than two pieces (including two pieces).
[0062] In the description of the embodiments of the present application, unless otherwise expressly specified or limited, technical terms such as "installed," "connected," "connected," and "fixed" should be understood in a broad sense. For example, they can refer to fixed connections, detachable connections, or integration; mechanical connections or electrical connections; direct connections or indirect connections through an intermediate medium; internal connections between two components or interactions between two components. Those skilled in the art can understand the specific meanings of the above terms in the embodiments of the present application based on specific circumstances.
[0063] See also Figure 1 To solve the problem that traditional lightning current waveform modeling methods are unable to meet the modeling requirements of complex lightning current waveforms, an embodiment of the present invention provides a lightning current waveform curve modeling method, including:
[0064] S1. Obtaining a lightning current waveform curve to be modeled;
[0065] In a preferred embodiment of the present invention, natural observation and artificial lightning current waveform data are collected, and high-frequency noise in the waveform is removed through data preprocessing to generate a lightning current waveform curve.
[0066] S2. Determine a number of characteristic points based on the lightning current waveform curve; wherein the characteristic points include: crease points, curvature extreme points, and inflection points;
[0067] Preferably, the step of determining a plurality of characteristic points based on the lightning current waveform curve includes:
[0068] S21. Calculating a data point curvature of each first data point in the lightning current waveform curve according to the lightning current waveform curve;
[0069] Preferably, calculating the data point curvature of each first data point in the lightning current waveform curve according to the lightning current waveform curve includes:
[0070] The data point curvature of each first data point in the lightning current waveform curve is calculated according to the following formula:
[0071]
[0072] Among them, K i is the first data point P i The curvature of the data point, sgn() is the sign function, ΔP i-1 P i P i+1 The first data point P of the i-1th i-1 , the first data point P i , the first data point P of the i+1th i+1 The triangular area, l i is the first data point P i-1 With the first data point P i+1 The chord length between i The triangular area at the first data point P i of the outside angle.
[0073] S22. Determine several characteristic points of the lightning current waveform curve according to the curvature of the data points.
[0074] In a preferred embodiment of the present invention, after obtaining the curvature of each first data point, it is started to search for the lightning current waveform curve. Figure 3 The characteristic points shown.
[0075] First, the method for determining the extreme point of curvature is to be considered. Since lightning current waveforms may contain errors and noise, directly using the extreme curvature point as the curvature extreme point is likely to be affected by noise. Therefore, a random extreme point is first determined as a candidate point. Then, with this candidate point as the center, a comprehensive assessment is performed within a certain interval, typically the three points before and after the candidate point.
[0076] If the curvature signs of all the first data points in the interval are the same, the candidate point is taken as the extreme point. Otherwise, the curvatures of all the first data points in the interval are averaged, and the first data point close to the average is taken as the extreme point.
[0077] Then the inflection point is determined. Starting from the third first data point, all the first data points are traversed. Let the first data point currently traversed be P i, then when P i and the next adjacent first data point P i+1 , the curvature of the two satisfies K i K i+1 <0, and P i The curvature K of the first two data points i-2 , K i-1 With K i Same sign, and P i The curvature K of the first three data points after i+1 , K i+2 , K i+3 Same sign, at this time, P i and P i+1 The point with greater curvature is taken as the inflection point.
[0078] Finally, the crease point is reached. Starting from the fourth first data point, all first data points are traversed. Let the first data point currently traversed be P i , when P i The curvature K of the first three data points i-3 , K i-2 , K i-1 Same sign, and P i The curvature K of the first three data points after i+1 , K i+2 , K i+3 The same sign, and the absolute values of its six curvatures are all greater than K i When K i As a crease point.
[0079] S3. Constructing a number of initial node vectors based on the characteristic points, and using a B-spline algorithm to generate a fitting curve corresponding to each initial node vector;
[0080] In a preferred embodiment of the present invention, the B-spline curve modeling method is a parametric modeling method based on piecewise polynomial functions, which divides the curve into nodes. The complexity of the lightning current waveform determines the number of nodes in the B-spline curve. Each node has its corresponding B-spline basis function. The B-spline basis function is the most basic unit of the B-spline, and the node vector is a non-decreasing sequence, which is determined by the parameter u. i On the interval [0,1], u0≤u1≤……≤u n+k+1 It is composed of a non-decreasing sequence, which can determine the distribution of the basis function and the segmentation interval of the curve:
[0081] Furthermore, a B-spline algorithm is used to generate fitting curves corresponding to each initial node vector. First, each feature point in the initial node vector is parameterized, that is, the position corresponding to the feature point on the fitting curve is determined. In this embodiment, the following formula is used to parameterize the feature points:
[0082]
[0083] Wherein, L is the total chord length of the lightning current waveform curve; X i Represents the vector corresponding to the i-th feature point; t i represents the parameterized value of the i-th feature point, and m is the number of feature points in the initial node vector.
[0084] Secondly, according to the parameterized values of the feature points and the basis functions, a fitting curve is constructed:
[0085]
[0086] Where, I'(t) is the fitting curve, N' i,k (t i ) is the k-th basis function of the i-th feature point in the initial node vector, Q' i It should be noted that the weight of each feature point is calculated with the goal of minimizing the distance between each first data point on the lightning current waveform curve and the corresponding data point on the fitting curve.
[0087] S4. Calculating a fitting error between the fitting curve and the lightning current waveform curve according to the lightning current waveform curve;
[0088] In a preferred embodiment of the present invention, the fitting error between the fitting curve and the lightning current waveform curve is calculated according to the following formula:
[0089]
[0090] Where E is the fitting error, y is the total amount of the first data point on the lightning current waveform curve, P j is the jth first data point, t j P is the value of the fitting curve j The corresponding second data point.
[0091] S5. Using the initial node vectors as initial populations, and performing iterative optimization operations on the initial populations based on the fitting errors, and generating new optimized populations in each round of iterative optimization operations by deleting, adding, or merging feature points in various populations, until it is determined that the fitting error between a target fitting curve generated by a target population and the lightning current waveform curve is less than a preset error threshold, and then terminating the iterative optimization operation;
[0092] Preferably, performing iterative optimization operations on the plurality of initial populations according to the fitting error includes:
[0093] S51, taking the fitting error as the fitness value, and taking the initial population corresponding to the smallest fitness value as the first initial population, taking the initial population corresponding to the second smallest fitness value as the second initial population, taking the initial population corresponding to the third smallest fitness value as the third initial population, and taking the other initial populations as the remaining initial populations;
[0094] S52: Using the grey wolf algorithm, perform an iterative optimization operation on the first initial population, the second initial population, the third initial population, and the remaining initial populations according to the fitness value.
[0095] In a preferred embodiment of the present invention, the Grey Wolf Optimizer (GWO) is a swarm intelligence optimization algorithm inspired by the hunting behavior of gray wolf groups in nature. This algorithm simulates the social hierarchy and hunting strategies of gray wolves to find the optimal solution in the solution space of complex problems. It has the characteristics of simple structure, few parameters, and strong global search capabilities. Among them, the social hierarchy is defined as follows: α wolf (Alpha): leader, representing the current optimal solution. β wolf (Beta): suboptimal solution, assisting α wolf in decision-making. δ wolf (Delta): third optimal solution, participating in group decision-making. ω wolf (Omega): ordinary member, following α, β, and δ wolves in search.
[0096] First, a number of gray wolves are randomly generated (an initial population). Next, the fitness value (fitting error) of each individual gray wolf is calculated to determine the α wolves (the first initial population), β wolves (the second initial population), δ wolves (the third initial population), and ω wolves (the remaining initial populations). During the hunting phase (an iterative optimization operation), the ω wolves search the solution space for potential optimal solutions based on the positions of the α, β, and δ wolves. By adjusting their positions, they gradually narrow the search range and approach the optimal solution. When the search approaches the optimal solution, the wolf pack concentrates its efforts and conducts a more refined search.
[0097] Preferably, the iterative optimization operation includes:
[0098] S521. Obtain a population to be optimized; wherein the population to be optimized includes: a first population, a second population, a third population, and a remaining population; initially, the first population, the second population, the third population, and the remaining population are the first initial population, the second initial population, the third initial population, and the remaining initial population, respectively;
[0099] S522: constructing a virtual solution space according to the fitness values of the populations to be optimized, and determining the position of each population to be optimized in the virtual solution space according to the fitness values;
[0100] S523. Calculate, based on the positions, a first distance between the remaining population and the first population, a second distance between the second population, and a third distance between the third population;
[0101] S524: Optimize the corresponding remaining populations by randomly deleting, adding, or merging feature points based on the first distance, the second distance, and the third distance to generate an optimized population.
[0102] In a preferred embodiment of the present invention, wolf α is determined as prey, and wolf ω is guided to surround the prey under the leadership of wolf β and wolf γ. Specifically, the position of wolf ω is updated according to the positions of wolf α, β, and γ:
[0103]
[0104] Among them, D α 、D β and D γ Respectively represent the distance between the position X of α, β, γ wolf and ω wolf, X α 、X β and X γ Represent the current positions of α, β, and γ wolves respectively. C1, C2, and C3 are random vectors. X is the current position of ω wolf. X1, X2, and X3 represent the direction and step length of ω wolf approaching α, β, and γ wolf respectively. A1, A2, and A3 are coefficients that control the step length of ω wolf's movement. The calculation formula is:
[0105] A=2a·r1-a
[0106] a is a linearly decreasing parameter that gradually decreases from an initial value of a=2 to a=0, controlling the algorithm's exploration and development capabilities. r1 is a random number in the range [0,1], introducing randomness to enhance search diversity. When |A|>1, the wolf pack tends to explore globally (expand the search range); when |A|<1, the wolf pack tends to explore locally (fine-tune the current area). During the exploration process, the remaining population adds or deletes a node, or merges adjacent nodes with a certain probability, and the latest position X of the remaining population is finally obtained. new as follows:
[0107]
[0108] S525. Generate a fitting curve to be evaluated based on the optimized population, and calculate a fitting error between the fitting curve to be evaluated and the lightning current waveform curve as a fitness value to be evaluated of each of the optimized populations;
[0109] Preferably, generating a fitting curve to be evaluated based on the optimized population includes:
[0110] S5251. Calculate, based on the optimized population, a basis function and a parameterized value corresponding to each feature point to be evaluated in the optimized population;
[0111] S5252: Generate an initial fitting curve based on the basis function and parameterized value of each feature point to be evaluated;
[0112] S5253, calculating the optimization weight of the basis function of each feature point to be evaluated with the goal of minimizing the distance between each first data point on the lightning current waveform curve and the corresponding second data point on the initial fitting curve;
[0113] S5254: Optimize the initial fitting curve according to the optimization weight to generate the fitting curve to be evaluated.
[0114] In a preferred embodiment of the present invention, as described in step S3, a B-spline algorithm is used to generate the fitting curve to be evaluated. First, each characteristic point in the optimized population is parameterized, that is, the corresponding position of the characteristic point on the fitting curve is determined. Second, an initial fitting curve is constructed based on the parameterized value of the characteristic point and the basis function. With the goal of minimizing the distance between each first data point on the lightning current waveform curve and the corresponding second data point on the initial fitting curve, the optimization weight of the basis function of each characteristic point to be evaluated is calculated. Based on the optimization weight, the initial fitting curve is optimized to generate the fitting curve to be evaluated. Finally, the formula in step S4 is used to calculate the fitting error between the fitting curve to be evaluated and the lightning current waveform curve as the fitness value to be evaluated of each optimized population.
[0115] S526, determining whether there is a fitness value to be evaluated that is less than a preset error threshold;
[0116] S527: If yes, the optimized population corresponding to the fitness value to be evaluated that is less than the preset error threshold is used as the target population, and the iterative optimization operation is terminated;
[0117] S528. If not, determine the first population, second population, third population and remaining populations required for the next round of iterative optimization operation from the first population, second population, third population and optimized population based on the fitness value to be evaluated, the fitness value of the first population, the fitness value of the second population, and the fitness value of the third population.
[0118] In a preferred embodiment of the present invention, similarly, according to the fitness value to be evaluated, the fitness value of the first population, the fitness value of the second population, and the fitness value of the third population, the optimized population, the first population, the second population, and the third population in this round of iterative operation are sorted from small to large according to the numerical value, and the first three populations are used as the first population, second population, and third population required for the next round of iterative optimization operation, and the subsequent populations are used as the remaining populations required for the next round of iterative optimization operation.
[0119] S6. Constructing a target model of the lightning current waveform curve according to the characteristic points in the target population.
[0120] Preferably, the target model of the lightning current waveform curve is:
[0121]
[0122] Where I(t) is the target model, t is the parameterized value of the i-th feature point in the target population, and N i,k (t) is the k-order basis function of the i-th feature point in the target population, Q i The optimization weight corresponding to the i-th feature point in the target population, and n is the total number of feature points in the target population.
[0123] In summary, this embodiment provides a modeling method for a lightning current waveform curve. By taking the crease points, curvature extreme points, and inflection points of the lightning current waveform curve to be modeled as feature points, a number of initial node vectors are constructed, so that in the subsequent fitting process, the changing characteristics of various waveforms in the lightning current waveform curve can be accurately identified, thereby improving the fitting accuracy. Secondly, the B-spline function is a piecewise polynomial function that adjusts the fitting accuracy of local segments by changing the feature points. Therefore, by adopting the B-spline algorithm, a fitting curve for each initial node vector is generated; the fitting error of the fitting curve is calculated according to the lightning current waveform curve; the initial node vectors are used as a number of initial populations, and according to the fitting error, the initial populations are iteratively optimized. In each round of iterative optimization operation, the populations are dynamically optimized by deleting, adding, or merging feature points. There is no need to adjust multiple parameters at the same time. By adjusting specific feature points, the local waveform can be accurately fitted. It can be used to fit complex lightning current waveforms such as asymmetric, multi-peak, or with local oscillations, and has high applicability.
[0124] like Figure 2 As shown, based on the above method embodiment, a corresponding device embodiment is provided;
[0125] An embodiment of the present invention provides a lightning current waveform curve modeling device, comprising:
[0126] A curve acquisition module is used to obtain the lightning current waveform curve to be modeled;
[0127] A feature point identification module is used to determine a number of feature points based on the lightning current waveform curve; wherein the feature points include: crease points, curvature extreme value points and inflection points;
[0128] A curve fitting module is used to construct a number of initial node vectors based on the characteristic points, and generate a fitting curve corresponding to each initial node vector using a B-spline algorithm;
[0129] an error calculation module, configured to calculate a fitting error between the fitting curve and the lightning current waveform curve according to the lightning current waveform curve;
[0130] a node optimization module, configured to use the initial node vectors as initial populations, and perform iterative optimization operations on the initial populations according to the fitting errors, and in each round of iterative optimization operations, generate new optimized populations by deleting, adding, or merging characteristic points in various populations, until it is determined that the fitting error between a target fitting curve generated by a target population and the lightning current waveform curve is less than a preset error threshold, thereby terminating the iterative optimization operations;
[0131] A model building module is used to build a target model of the lightning current waveform curve according to the characteristic points in the target population.
[0132] It can be understood that the above-mentioned device embodiment corresponds to the method embodiment of the present invention, which can implement any one of the above-mentioned method embodiments of the present invention to provide a modeling method for a lightning current waveform curve.
[0133] It should be noted that the device embodiments described above are merely illustrative, and some or all of the modules may be selected according to actual needs to achieve the purpose of the present embodiment. Furthermore, in the drawings of the device embodiments provided by the present invention, the connection relationship between modules indicates that they have a communication connection, which may be implemented as one or more communication buses or signal lines. Those skilled in the art can understand and implement the present invention without inventive effort.
[0134] Based on the above-mentioned embodiment of a method for modeling a lightning current waveform curve, another embodiment of the present invention provides a terminal device, which includes a processor, a memory, and a computer program stored in the memory and configured to be executed by the processor. When the processor executes the computer program, it implements a method for modeling a lightning current waveform curve according to any embodiment of the present invention.
[0135] For example, in this embodiment, the computer program may be divided into one or more modules, which are stored in the memory and executed by the processor to implement the present invention. The one or more module elements may be a series of computer program instruction segments capable of performing specific functions, and the instruction segments are used to describe the execution process of the computer program in the terminal device.
[0136] The terminal device may be a computing device such as a desktop computer, a notebook computer, a PDA, a cloud server, etc. The terminal device may include, but is not limited to, a processor and a memory.
[0137] The processor may be a central processing unit (CPU), other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor may be a microprocessor or any conventional processor, etc. The processor is the control center of the terminal device, connecting various parts of the entire terminal device using various interfaces and lines.
[0138] Based on the above method embodiments, another embodiment of the present invention provides a computer-readable storage medium, including a stored computer program, wherein when the computer program is running, the device where the computer-readable storage medium is located is controlled to execute a lightning current waveform curve modeling method described in any one of the above method embodiments of the present invention.
[0139] Wherein, the module / unit integrated in the device / terminal equipment, if implemented in the form of a software functional unit and sold or used as an independent product, can be stored in a computer-readable storage medium. Based on this understanding, the present invention implements all or part of the process in the above-mentioned embodiment method, and can also be completed by instructing the relevant hardware through a computer program. The computer program can be stored in a computer-readable storage medium, and when the computer program is executed by the processor, it can implement the steps of the above-mentioned various method embodiments. Wherein, the computer program includes computer program code, and the computer program code can be in source code form, object code form, executable file or some intermediate form. The computer-readable medium may include: any entity or device that can carry the computer program code, recording medium, USB flash drive, mobile hard disk, magnetic disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), electric carrier signal, telecommunication signal and software distribution medium, etc.
[0140] The above is a preferred embodiment of the present invention. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present invention. These improvements and modifications are also considered to be within the scope of protection of the present invention.
Claims
1. A lightning current waveform curve modeling method, characterized in that: include: Obtaining the lightning current waveform curve to be modeled; Determine a number of characteristic points based on the lightning current waveform curve; wherein the characteristic points include: crease points, curvature extreme points, and inflection points; According to the characteristic points, a number of initial node vectors are constructed, and a B-spline algorithm is used to generate a fitting curve corresponding to each initial node vector; Calculating a fitting error between the fitting curve and the lightning current waveform curve according to the lightning current waveform curve; Using the initial node vectors as initial populations, and performing iterative optimization operations on the initial populations according to the fitting errors, and generating new optimized populations by deleting, adding, or merging characteristic points in various populations in each round of iterative optimization operations, until it is determined that the fitting error between a target fitting curve generated by a target population and the lightning current waveform curve is less than a preset error threshold, and then terminating the iterative optimization operation; A target model of the lightning current waveform curve is constructed according to the characteristic points in the target population.
2. A lightning current waveform curve modeling method according to claim 1, characterized in that: The step of determining a plurality of characteristic points based on the lightning current waveform curve includes: Calculating a data point curvature of each first data point in the lightning current waveform curve according to the lightning current waveform curve; According to the curvature of the data points, several characteristic points of the lightning current waveform curve are determined.
3. A lightning current waveform curve modeling method according to claim 2, characterized in that: Calculating the data point curvature of each first data point in the lightning current waveform curve according to the lightning current waveform curve includes: The data point curvature of each first data point in the lightning current waveform curve is calculated according to the following formula: Among them, K i is the first data point P i The curvature of the data point, sgn() is the sign function, ΔP i-1 P i P i+1 The first data point P of the i-1th i-1 , the first data point P i , the first data point P of the i+1th i+1 The triangular area, l i is the first data point P i-1 With the first data point P i+1 The chord length between i The triangular area at the first data point P i of the outside angle.
4. A lightning current waveform curve modeling method according to claim 3, characterized in that: The iterative optimization operation is performed on the plurality of initial populations according to the fitting error, comprising: The fitting error is used as the fitness value, and the initial population corresponding to the smallest fitness value is used as the first initial population, the initial population corresponding to the second smallest fitness value is used as the second initial population, the initial population corresponding to the third smallest fitness value is used as the third initial population, and the other initial populations are used as the remaining initial populations; A grey wolf algorithm is used to perform iterative optimization operations on the first initial population, the second initial population, the third initial population, and the remaining initial populations according to the fitness value.
5. A lightning current waveform curve modeling method according to claim 4, characterized in that: The iterative optimization operation includes: Obtaining a population to be optimized; wherein the population to be optimized includes: a first population, a second population, a third population, and a remaining population; initially, the first population, the second population, the third population, and the remaining population are the first initial population, the second initial population, the third initial population, and the remaining initial population, respectively; Constructing a virtual solution space according to the fitness values of the population to be optimized, and determining the position of each population to be optimized in the virtual solution space according to the fitness values; Calculating, based on the positions, a first distance between the remaining population and the first population, a second distance between the second population, and a third distance between the remaining population and the third population; According to the first distance, the second distance, and the third distance, randomly optimizing the corresponding remaining populations by deleting feature points, adding feature points, or merging feature points to generate an optimized population; generating a fitting curve to be evaluated according to the optimized population, and calculating a fitting error between the fitting curve to be evaluated and the lightning current waveform curve as a fitness value to be evaluated of each of the optimized populations; Determine whether there is a fitness value to be evaluated that is less than a preset error threshold; If yes, the optimized population corresponding to the fitness value to be evaluated that is less than the preset error threshold is used as the target population, and the iterative optimization operation is terminated; If not, then based on the fitness value to be evaluated, the fitness value of the first population, the fitness value of the second population, and the fitness value of the third population, determine the first population, second population, third population and remaining populations required for the next round of iterative optimization operation from the first population, second population, third population and optimized population.
6. A lightning current waveform curve modeling method according to claim 5, characterized in that: The step of generating a fitting curve to be evaluated based on the optimized population includes: Calculating the basis function and parameterized value corresponding to each feature point to be evaluated in the optimized population according to the optimized population; Generating an initial fitting curve according to the basis function and parameterized value of each feature point to be evaluated; Calculating the optimization weight of the basis function of each feature point to be evaluated with the goal of minimizing the distance between each first data point on the lightning current waveform curve and the corresponding second data point on the initial fitting curve; The initial fitting curve is optimized according to the optimization weight to generate the fitting curve to be evaluated.
7. A lightning current waveform curve modeling method according to claim 6, characterized in that: The target model of the lightning current waveform curve is: Where I(t) is the target model, t is the parameterized value of the i-th feature point in the target population, and N i,k (t) is the k-order basis function of the i-th feature point in the target population, Q i The optimization weight corresponding to the i-th feature point in the target population, and n is the total number of feature points in the target population.
8. A lightning current waveform curve modeling device, characterized in that: include: A curve acquisition module is used to obtain the lightning current waveform curve to be modeled; A feature point identification module is used to determine a number of feature points based on the lightning current waveform curve; wherein the feature points include: crease points, curvature extreme value points and inflection points; A curve fitting module is used to construct a number of initial node vectors based on the characteristic points, and generate a fitting curve corresponding to each initial node vector using a B-spline algorithm; an error calculation module, configured to calculate a fitting error between the fitting curve and the lightning current waveform curve according to the lightning current waveform curve; a node optimization module, configured to use the initial node vectors as initial populations, and perform iterative optimization operations on the initial populations according to the fitting errors, and in each round of iterative optimization operations, generate new optimized populations by deleting, adding, or merging characteristic points in various populations, until it is determined that the fitting error between a target fitting curve generated by a target population and the lightning current waveform curve is less than a preset error threshold, thereby terminating the iterative optimization operations; A model building module is used to build a target model of the lightning current waveform curve according to the characteristic points in the target population.
9. A terminal device, characterized in that: The method comprises a processor, a memory, and a computer program stored in the memory and configured to be executed by the processor. When the processor executes the computer program, the method for modeling a lightning current waveform curve according to any one of claims 1 to 7 is implemented.
10. A computer-readable storage medium, characterized in that include: A stored computer program, wherein when the computer program is run, the device where the computer-readable storage medium is located is controlled to execute the lightning current waveform curve modeling method according to any one of claims 1 to 7.
Citation Information
Cited By
Closed-loop adaptive editable group wave generation method based on algorithm driving
CN121522222A