Scanning method and system of digital control loop, electronic equipment and storage medium
By determining the sweep parameters and generating the sinusoidal sweep signal, and calibrating the transfer function in combination with the least squares algorithm, the problem of digital control loop sweep depends on hardware equipment in the prior art, and a low-cost and efficient scanning method is realized.
Patent Information
- Application Number
- CN202411543215.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-31
- Publication Date
- 2025-03-07
AI Technical Summary
In the prior art, the frequency sweeping method of the digital control loop relies on hardware equipment, and is complex in operation and high in equipment costs, making it difficult to popularize.
A scanning method for digital control loop is proposed. By determining the sweep parameters, a sine sweep signal is generated, and the transfer function is determined based on the response signal, the least squares algorithm is used for calibration, and finally the Bird diagram is drawn.
It realizes digital control loop scanning without relying on hardware equipment, reducing equipment costs and simplifying operational processes.
Smart Images

Figure CN119575794A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of power electronics technology, and in particular to a scanning method and system for a digital control loop, an electronic device and a storage medium. Background Art
[0002] In the related technology, there are existing power electronics dedicated frequency sweeper devices that can obtain the transfer function of the digital control loop by scanning the digital control loop, and use it to design controller parameters. However, this method relies on hardware equipment, and is complex to operate and has high equipment costs, which is not conducive to popularization. Summary of the invention
[0003] The present invention aims to solve at least one of the technical problems existing in the prior art or related art.
[0004] To this end, a first aspect of the present invention proposes a scanning method for a digital control loop.
[0005] A second aspect of the present invention provides a scanning system for a digital control loop.
[0006] A third aspect of the present invention provides an electronic device.
[0007] A fourth aspect of the present invention provides a storage medium.
[0008] In view of this, according to a first aspect of the present invention, a scanning method for a digital control loop is proposed, comprising: determining sweep parameters, wherein the sweep parameters include: a starting frequency, an ending frequency, a zero order, and a pole order; determining a plurality of sinusoidal sweep signals according to the starting frequency and the ending frequency; determining a response signal corresponding to each sinusoidal sweep signal according to the digital control loop; determining amplitude information and phase information of a transfer function according to the plurality of sinusoidal sweep signals and the plurality of response signals; determining the transfer function using a least squares algorithm according to the zero order, the pole order, the amplitude information, and the phase information; and drawing a Bode diagram according to the transfer function.
[0009] The scanning method of the digital control loop provided by the present invention mainly includes: first determining the sweep frequency parameters, wherein the sweep frequency parameters include the starting frequency, the ending frequency, the zero order and the pole order. The sweep frequency parameters can be set on the host computer by the user according to daily experience, and the host computer is connected to the controller in the digital control loop through the 485 serial port communication, so when the user inputs the sweep frequency parameters on the host computer, the controller in the digital control loop receives the sweep frequency parameters through the 485 serial port communication. After determining the sweep frequency parameters, multiple sinusoidal sweep frequency signals are determined according to the starting frequency and the ending frequency, that is, after obtaining the starting frequency and the ending frequency, multiple specific frequencies can be selected between the starting frequency and the ending frequency according to the preset rules, and then multiple sinusoidal sweep frequency signals are generated according to the interference signal amplitude in the multiple specific frequencies and the sweep frequency parameters. After obtaining the sinusoidal sweep frequency signal, multiple sinusoidal sweep frequency signals are sequentially input into the digital control loop to obtain multiple corresponding response signals, wherein each sinusoidal sweep frequency signal corresponds to a response signal, that is, the sinusoidal sweep frequency signal and the response signal are in a one-to-one correspondence relationship. Then, according to multiple sinusoidal sweep signals and multiple response signals, the amplitude information and phase information of multiple transfer functions at specific frequencies are obtained. After the amplitude information and phase information of the transfer function at a specific frequency are obtained, the transfer function is determined by the least squares algorithm according to the zero order, pole order, amplitude information and phase information, wherein the transfer function refers to the transfer function of the digital control loop, the zero order describes the rate at which the transfer function approaches zero at a certain zero point, the pole order describes the behavior characteristics of the transfer function at the pole, and the zero order and pole order can be set by the user according to common sense. The least squares algorithm mainly finds the best function match for the data by minimizing the sum of squares of the error. By using the least squares algorithm to determine the transfer function, the accuracy of the transfer function is guaranteed. After the transfer function is obtained, the transfer function is verified. Specifically, the phase-frequency data can be used to verify whether the output phase meets the requirements, and the requirement can be that the error is within a preset range. If the verification is successful, that is, the output phase meets the requirements, a Bode diagram is drawn according to the obtained transfer function. If the verification is unsuccessful, that is, the output phase does not meet the requirements, the scanning parameters are re-determined, and then the above method is repeated until the verification is successful. In the present invention, the scanning parameters are first determined, and then the sine frequency sweep signal is determined according to the starting frequency and the ending frequency in the scanning parameters, and then the corresponding response signal is determined according to the sine frequency sweep signal and the digital control loop, and then the phase information and amplitude information at a specific frequency are determined, and finally the transfer function of the digital control loop is calculated using the amplitude information and the phase information, and then the Bode diagram is drawn according to the transfer function, thereby achieving the technical effect of realizing digital control loop scanning without relying on hardware equipment.
[0010] The scanning method of the digital control loop according to the present invention may also have the following technical features:
[0011] In some technical schemes, optionally, the step of determining multiple sinusoidal swept frequency signals based on the starting frequency and the ending frequency includes: determining the number of preset frequency points and the preset frequency point interval; determining multiple frequency points between the starting frequency and the ending frequency according to the preset frequency point number and the preset frequency point interval; generating multiple sinusoidal swept frequency signals according to the frequency corresponding to each frequency point and the interference signal amplitude, wherein the sweep frequency parameters include the interference signal amplitude.
[0012] In the technical solution, the step of determining multiple sinusoidal frequency sweep signals according to the starting frequency and the ending frequency includes: first determining the number of preset frequency points and the preset frequency point interval, wherein the number of preset frequency points and the preset frequency point interval can be pre-set, specifically, the number of preset frequency points and the preset frequency point interval can be 30 frequency points selected for every ten times of the frequency. Then, multiple frequency points are determined between the starting frequency and the ending frequency according to the preset number of frequency points and the preset frequency point interval. For example, when the number of preset frequency points and the preset frequency point interval are 30 frequency points selected for every ten times of the frequency, the starting frequency and the ending frequency can be first segmented according to the ten times of the frequency. For example, when the starting frequency is 10 Hz and the ending frequency is 1000 Hz, it can be divided into two sections of 10 Hz to 100 Hz and 100 Hz to 1000 Hz, and then 30 frequency points are selected in these two sections respectively. Finally, multiple sinusoidal frequency sweep signals are generated according to the frequency corresponding to each frequency point and the interference signal amplitude in the scanning parameters, that is, according to the frequency point, a sinusoidal frequency sweep signal with a frequency corresponding to the frequency point and an amplitude of the interference signal amplitude is generated, wherein the interference signal amplitude is one of the previously determined frequency sweep parameters. The present invention determines multiple frequency points between the starting frequency and the ending frequency according to the preset frequency point number and the preset frequency point interval, and then generates a sinusoidal interference signal according to the frequency points, so that the subsequent determination of the transfer function using the least squares algorithm can be more accurate.
[0013] In some technical solutions, optionally, the step of determining a response signal corresponding to each sinusoidal swept frequency signal according to a digital control loop includes: inputting the sinusoidal swept frequency signal to a specified starting position of the digital control loop; and collecting the response signal at the output side of the digital control loop.
[0014] In the technical solution, the step of determining the response signal corresponding to each sine sweep signal according to the digital control loop includes: first, inputting the sine sweep signal to the specified starting position of the digital control loop, where the specified starting position refers to the starting position to be scanned in the digital control loop. Then, the response signal corresponding to the sine sweep signal is collected on the output side of the digital control loop. The corresponding response signal is obtained by inputting the sine sweep signal into the digital control loop, thereby ensuring the accuracy of the response signal.
[0015] In some technical solutions, before the step of determining the amplitude information and phase information of the transfer function according to the multiple sine sweep signals and the multiple response signals, it includes: constructing a Goetzer digital filter according to the Goetzer algorithm and the discrete Fourier algorithm.
[0016] In the technical solution, before the step of determining the amplitude information and phase information of the transfer function according to multiple sinusoidal swept frequency signals and multiple response signals, it includes: constructing a Goertzel digital filter according to the Goertzel algorithm and the discrete Fourier algorithm. Among them, the Goertzel algorithm regards the discrete Fourier transform as a group of filters, and performs convolution operation on the input signal and the impulse response in the filter to obtain the output of the filter, that is, the frequency of a certain point in the frequency domain. Specifically, the Goertzel algorithm gradually approaches the required frequency point through iterative operations. During the iteration process, it uses real number multiplication and addition operations to avoid the complexity of negative number operations, thereby providing efficiency. Therefore, by constructing the Goertzel digital filter according to the Goertzel algorithm and the discrete Fourier algorithm, the Goertzel digital filter can calculate the amplitude information and phase information of a specific frequency in discrete data.
[0017] In some technical schemes, optionally, the step of determining the amplitude information and phase information of the transfer function based on multiple sinusoidal swept frequency signals and multiple response signals includes: inputting the multiple sinusoidal swept frequency signals into the Goetzer digital filter respectively to obtain the corresponding multiple first amplitude information and multiple first phase information; inputting the multiple response signals into the Goetzer digital filter respectively to obtain the corresponding multiple second amplitude information and multiple second phase information; determining multiple amplitude ratios based on the multiple first amplitude information and the multiple second amplitude information; determining multiple phase differences based on the multiple first phase information and the multiple second phase information; determining the amplitude information of the transfer function based on the multiple amplitude ratios; and determining the phase information of the transfer function based on the multiple phase differences.
[0018] In the technical solution, the step of determining the amplitude information and phase information of the transfer function according to the multiple sine sweep signals and the multiple response signals includes: firstly, the multiple sine sweep signals are respectively input into the Goetzer digital filter to obtain multiple first amplitude information and multiple first phase information, and the Goetzer digital filter can calculate the amplitude information and phase information of the specific frequency in the discrete data, so after the sine sweep signal is input into the Goetzer digital filter, the corresponding first amplitude information and first phase information can be obtained. At the same time, the multiple response signals are respectively input into the Goetzer digital filter to obtain multiple second amplitude information and multiple second phase information, and the Goetzer digital filter can calculate the amplitude information and phase information of the specific frequency in the discrete data, so after the response signal is input into the Goetzer digital filter, the corresponding second amplitude information and second phase information can be obtained. Finally, the amplitude ratio between the sine swept frequency signal and the response signal is determined according to the first amplitude information and the second amplitude information, and then the amplitude ratio between the sine swept frequency signal and the response signal is used as the amplitude information of the transfer function at this frequency, and the phase difference between the sine swept frequency signal and the response signal is determined according to the first phase information and the second phase information, and the phase difference between the sine swept frequency signal and the response signal is used as the phase information of the transfer function at this frequency.
[0019] In some technical schemes, optionally, the step of determining the transfer function using a least squares algorithm based on the zero order, the pole order, the amplitude information and the phase information includes: setting a first transfer function based on the zero order, the pole order and the least squares algorithm, wherein the first transfer function includes a plurality of setting parameters; normalizing the first transfer function to obtain a second transfer function; calculating values of a plurality of setting parameters based on the second transfer function, the amplitude information and the phase information; and determining the transfer function based on the values of the plurality of setting parameters.
[0020] In the technical solution, the step of determining the transfer function by using the least squares algorithm according to the zero order, the pole order, the amplitude information and the phase information includes: firstly, setting the first transfer function according to the zero order, the pole order and the least squares algorithm, wherein the first transfer function is assumed, and thus the first transfer function includes a plurality of setting parameters. Then, the first transfer function is normalized to obtain the second transfer function, that is, the first transfer function is sorted and the same terms are removed, thereby obtaining the second transfer function. Then, the amplitude information and the phase information are introduced into the second transfer function to form a plurality of equation groups, and the equation groups are solved, thereby obtaining the values of the setting parameters in the second transfer function. Finally, the values of the setting parameters are introduced into the first transfer function, thereby obtaining the final transfer function. By using the least squares algorithm to determine the transfer function, the accuracy of the transfer function is improved.
[0021] In some technical solutions, optionally, after the step of drawing a Bode diagram according to the transfer function, the method further includes: calculating an amplitude margin and a phase margin of the digital control loop according to the Bode diagram.
[0022] In the technical solution, after the step of drawing the Bode diagram according to the transfer function, the method includes: after obtaining the Bode diagram, determining the amplitude-frequency characteristic curve and the phase-frequency characteristic curve according to the Bode diagram, then determining the gain crossing frequency and other data information such as the phase angle, and finally calculating the amplitude margin and phase margin of the digital control loop according to the gain crossing frequency and other data information such as the phase angle. By calculating the amplitude margin and the phase margin, the stability of the digital control loop can be determined.
[0023] According to a second aspect of the present invention, a scanning system for a digital control loop is proposed, comprising: a first determination module, the first determination module is used to determine sweep parameters, wherein the sweep parameters include: a starting frequency, an ending frequency, a zero order and a pole order; a second determination module, the second determination module is used to determine a plurality of sinusoidal sweep signals according to the starting frequency and the ending frequency; a third determination module, the third determination module is used to determine a response signal corresponding to each sinusoidal sweep signal according to the digital control loop; a first calculation module, the first calculation module is used to determine amplitude information and phase information of a transfer function according to the plurality of sinusoidal sweep signals and the plurality of response signals; a second calculation module, the second calculation module is used to determine the transfer function using a least squares algorithm according to the zero order, the pole order, the amplitude information and the phase information; and a drawing module, the drawing module is used to draw a Bode diagram according to the transfer function.
[0024] The scanning system of the digital control loop provided by the present invention mainly includes: a first determining module, a second determining module, a third determining module, a first calculating module, a second calculating module and a drawing module. Among them, the first determining module can determine the sweep frequency parameters, wherein the sweep frequency parameters include the starting frequency, the ending frequency, the interference signal amplitude, the zero order and the pole order. The sweep frequency parameters can be set on the host computer by the user according to daily experience, and the host computer is connected to the controller in the digital control loop through a 485 serial port communication. Therefore, when the user inputs the sweep frequency parameters on the host computer, the controller in the digital control loop will receive the sweep frequency parameters through the 485 serial port communication. After determining the sweep frequency parameters, the second determining module can determine multiple sinusoidal sweep frequency signals according to the starting frequency and the ending frequency, that is, after obtaining the starting frequency and the ending frequency, multiple specific frequencies can be selected between the starting frequency and the ending frequency according to a preset rule, and then multiple sinusoidal sweep frequency signals are generated according to the interference signal amplitude in the multiple specific frequencies and the sweep frequency parameters. After obtaining the sine sweep signal, the third determination module can sequentially input multiple sine sweep signals into the digital control loop to obtain multiple corresponding response signals, wherein each sine sweep signal corresponds to a response signal, that is, the sine sweep signal and the response signal are in a one-to-one correspondence. Then the first calculation module obtains the amplitude information and phase information of multiple transfer functions at a specific frequency according to the multiple sine sweep signals and the multiple response signals. After obtaining the amplitude information and phase information of the transfer function at a specific frequency, the second calculation module uses the least squares algorithm to determine the transfer function according to the zero order, the pole order, the amplitude information and the phase information, wherein the transfer function refers to the transfer function of the digital control loop, the zero order describes the rate at which the transfer function approaches zero at a certain zero point, the pole order describes the behavior characteristics of the transfer function at the pole, and the zero order and the pole order can be set by the user according to common sense. The least squares algorithm mainly finds the best function match for the data by minimizing the sum of squares of the error, and the accuracy of the transfer function is guaranteed by determining the transfer function using the least squares algorithm. After the transfer function is obtained, the transfer function is verified. Specifically, the phase-frequency data can be used to verify whether the output phase meets the requirements, and the requirement can be that the error is within a preset range. If the verification is successful, that is, the output phase meets the requirements, the drawing module draws the Bode diagram according to the obtained transfer function. If the verification is unsuccessful, that is, the output phase does not meet the requirements, the scanning parameters are re-determined, and then the above method is repeated until the verification is successful.In the present invention, the scanning parameters are first determined, and then the sinusoidal frequency sweep signal is determined according to the starting frequency and the ending frequency in the scanning parameters, and then the corresponding response signal is determined according to the sinusoidal frequency sweep signal and the digital control loop, and then the phase information and amplitude information between the response signal and the sinusoidal frequency sweep signal are determined, and finally the transfer function of the digital control loop is calculated using the amplitude information and the phase information, and then the Bode diagram is drawn according to the transfer function, thereby achieving the technical effect of realizing digital control loop scanning without relying on hardware equipment.
[0025] According to a third aspect of the present invention, an electronic device is proposed, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the steps of a scanning method for a digital control loop as described above are implemented.
[0026] The electronic device provided by the present invention, in which the processor implements the steps of the scanning method of the above-mentioned digital control loop when executing the computer program, can achieve the technical effect of any of the above-mentioned technical solutions, which will not be repeated here.
[0027] According to a fourth aspect of the present invention, a storage medium is provided, on which a computer program is stored, and when the computer program is executed by a processor, the steps of the scanning method of the digital control loop as described above are implemented.
[0028] The storage medium provided by the present invention implements the steps of the scanning method of the above-mentioned digital control loop when the computer program is executed by the processor, and can achieve the technical effects of any of the above-mentioned technical solutions, which will not be repeated here.
[0029] Additional aspects and advantages of the present invention will become apparent from the following description or may be learned by practice of the present invention. BRIEF DESCRIPTION OF THE DRAWINGS
[0030] The above and / or additional aspects and advantages of the present invention will become apparent and easily understood from the description of the embodiments in conjunction with the following drawings, in which:
[0031] Figure 1 One of the flow charts of a scanning method of a digital control loop according to an embodiment of the present invention is shown;
[0032] Figure 2 A schematic flow chart showing the steps of determining a plurality of sinusoidal frequency sweep signals according to a start frequency and an end frequency in a scanning method of a digital control loop according to an embodiment of the present invention;
[0033] Figure 3 A schematic flow chart showing the steps of determining a response signal corresponding to each sinusoidal frequency sweep signal according to a digital control loop in a scanning method of a digital control loop according to an embodiment of the present invention;
[0034] Figure 4 A schematic flow chart showing the steps of determining the amplitude information and phase information of a transfer function according to a plurality of sinusoidal frequency sweep signals and a plurality of response signals in a scanning method of a digital control loop according to an embodiment of the present invention;
[0035] Figure 5 A schematic flow chart showing the steps of determining a transfer function using a least squares algorithm according to zero order, pole order, amplitude information and phase information in a scanning method of a digital control loop according to an embodiment of the present invention;
[0036] Figure 6 A second flow chart of a scanning method of a digital control loop according to an embodiment of the present invention is shown;
[0037] Figure 7 A logic block diagram of a Goetzer digital filter in a scanning method of a digital control loop according to an embodiment of the present invention is shown;
[0038] Figure 8 One of the principle schematic diagrams of a scanning method of a digital control loop according to an embodiment of the present invention is shown;
[0039] Fig. 9 A second schematic diagram showing the principle of a scanning method of a digital control loop according to an embodiment of the present invention;
[0040] Fig.10 A schematic block diagram of a scanning system of a digital control loop according to an embodiment of the present invention is shown;
[0041] Fig.11 A schematic block diagram of an electronic device according to an embodiment of the present invention is shown. DETAILED DESCRIPTION
[0042] In order to more clearly understand the above-mentioned purpose, features and advantages of the present invention, the present invention is further described in detail below in conjunction with the accompanying drawings and specific embodiments. It should be noted that the embodiments of the present invention and the features in the embodiments can be combined with each other without conflict.
[0043] In the following description, many specific details are set forth to facilitate a full understanding of the present invention. However, the present invention may also be implemented in other ways different from those described herein. Therefore, the protection scope of the present invention is not limited to the specific embodiments disclosed below.
[0044] Figure 1 One of the flow charts of a scanning method of a digital control loop according to an embodiment of the present invention is shown. The method comprises:
[0045] Step 102: determining frequency sweep parameters, wherein the frequency sweep parameters include: a starting frequency, an ending frequency, a zero order, and a pole order;
[0046] Step 104: determining a plurality of sine frequency sweep signals according to the starting frequency and the ending frequency;
[0047] Step 106: determining a response signal corresponding to each sine frequency sweep signal according to the digital control loop;
[0048] Step 108: determining amplitude information and phase information of a transfer function according to the multiple sinusoidal frequency sweep signals and the multiple response signals;
[0049] Step 110: Determine the transfer function using a least squares algorithm according to the zero order, the pole order, the amplitude information, and the phase information;
[0050] Step 112: Draw a Bode diagram based on the transfer function.
[0051] The scanning method of the digital control loop provided by the present invention mainly includes: first determining the sweep frequency parameters, wherein the sweep frequency parameters include the starting frequency, the ending frequency, the zero order and the pole order. The sweep frequency parameters can be set on the host computer by the user according to daily experience, and the host computer is connected to the controller in the digital control loop through the 485 serial port communication, so when the user inputs the sweep frequency parameters on the host computer, the controller in the digital control loop receives the sweep frequency parameters through the 485 serial port communication. After determining the sweep frequency parameters, multiple sinusoidal sweep frequency signals are determined according to the starting frequency and the ending frequency, that is, after obtaining the starting frequency and the ending frequency, multiple specific frequencies can be selected between the starting frequency and the ending frequency according to the preset rules, and then multiple sinusoidal sweep frequency signals are generated according to the interference signal amplitude in the multiple specific frequencies and the sweep frequency parameters. After obtaining the sinusoidal sweep frequency signal, multiple sinusoidal sweep frequency signals are sequentially input into the digital control loop to obtain multiple corresponding response signals, wherein each sinusoidal sweep frequency signal corresponds to a response signal, that is, the sinusoidal sweep frequency signal and the response signal are in a one-to-one correspondence relationship. Then, according to multiple sinusoidal sweep signals and multiple response signals, the amplitude information and phase information of multiple transfer functions at specific frequencies are obtained. After the amplitude information and phase information of the transfer function at a specific frequency are obtained, the transfer function is determined by the least squares algorithm according to the zero order, pole order, amplitude information and phase information, wherein the transfer function refers to the transfer function of the digital control loop, the zero order describes the rate at which the transfer function approaches zero at a certain zero point, the pole order describes the behavior characteristics of the transfer function at the pole, and the zero order and pole order can be set by the user according to common sense. The least squares algorithm mainly finds the best function match for the data by minimizing the sum of squares of the error. By using the least squares algorithm to determine the transfer function, the accuracy of the transfer function is guaranteed. After the transfer function is obtained, the transfer function is verified. Specifically, the phase-frequency data can be used to verify whether the output phase meets the requirements, and the requirement can be that the error is within a preset range. If the verification is successful, that is, the output phase meets the requirements, a Bode diagram is drawn according to the obtained transfer function. If the verification is unsuccessful, that is, the output phase does not meet the requirements, the scanning parameters are re-determined, and then the above method is repeated until the verification is successful. In the present invention, the scanning parameters are first determined, and then the sine frequency sweep signal is determined according to the starting frequency and the ending frequency in the scanning parameters, and then the corresponding response signal is determined according to the sine frequency sweep signal and the digital control loop, and then the phase information and amplitude information at a specific frequency are determined, and finally the transfer function of the digital control loop is calculated using the amplitude information and the phase information, and then the Bode diagram is drawn according to the transfer function, thereby achieving the technical effect of realizing digital control loop scanning without relying on hardware equipment.
[0052] Figure 2A flow chart showing the steps of determining a plurality of sinusoidal frequency sweep signals according to a starting frequency and an ending frequency in a scanning method of a digital control loop according to an embodiment of the present invention is shown; wherein the steps of determining a plurality of sinusoidal frequency sweep signals according to a starting frequency and an ending frequency include:
[0053] Step 202: Determine the number of preset frequency points and the preset frequency point interval;
[0054] Step 204: determining a plurality of frequency points between the start frequency and the end frequency according to the preset frequency point quantity and the preset frequency point interval;
[0055] Step 206: Generate multiple sinusoidal frequency sweep signals according to the frequency corresponding to each frequency point and the interference signal amplitude, wherein the frequency sweep parameter includes the interference signal amplitude.
[0056] In this embodiment, the step of determining a plurality of sinusoidal frequency sweep signals according to the starting frequency and the ending frequency comprises: first determining the number of preset frequency points and the interval of preset frequency points, wherein the number of preset frequency points and the interval of preset frequency points may be pre-set, specifically, the number of preset frequency points and the interval of preset frequency points may be 30 frequency points selected for every ten times of the frequency. Then, according to the number of preset frequency points and the interval of preset frequency points, a plurality of frequency points are determined between the starting frequency and the ending frequency, such as when the number of preset frequency points and the interval of preset frequency points are 30 frequency points selected for every ten times of the frequency, the starting frequency and the ending frequency may be first segmented according to the ten times of the frequency, such as when the starting frequency is 10 Hz and the ending frequency is 1000 Hz, it may be divided into two segments of 10 Hz to 100 Hz and 100 Hz to 1000 Hz, and then 30 frequency points are selected in each of the two segments. Finally, multiple sinusoidal frequency sweep signals are generated according to the frequency corresponding to each frequency point and the interference signal amplitude in the scanning parameters, that is, according to the frequency point, a sinusoidal frequency sweep signal with a frequency corresponding to the frequency point and an amplitude of the interference signal amplitude is generated, wherein the interference signal amplitude is one of the previously determined frequency sweep parameters. The present invention determines multiple frequency points between the starting frequency and the ending frequency according to the preset frequency point number and the preset frequency point interval, and then generates a sinusoidal interference signal according to the frequency points, so that the subsequent determination of the transfer function using the least squares algorithm can be more accurate.
[0057] Figure 3 A schematic flow chart of a step of determining a response signal corresponding to each sine frequency sweep signal according to a digital control loop in a scanning method of a digital control loop according to an embodiment of the present invention is shown; wherein the step of determining a response signal corresponding to each sine frequency sweep signal according to a digital control loop includes:
[0058] Step 302: Inputting a sine frequency sweep signal to a specified starting position of a digital control loop;
[0059] Step 304: Collect response signals at the output side of the digital control loop.
[0060] In this embodiment, the step of determining the response signal corresponding to each sine sweep signal according to the digital control loop includes: first, inputting the sine sweep signal to a specified starting position of the digital control loop, where the specified starting position refers to the starting position to be scanned in the digital control loop. Then, the response signal corresponding to the sine sweep signal is collected at the output side of the digital control loop. The corresponding response signal is obtained by inputting the sine sweep signal to the digital control loop, thereby ensuring the accuracy of the response signal.
[0061] In some embodiments, before the step of determining the amplitude information and phase information of the transfer function according to the multiple sine sweep signals and the multiple response signals, the method includes: constructing a Goetzel digital filter according to the Goetzel algorithm and the discrete Fourier algorithm.
[0062] In this embodiment, before the step of determining the amplitude information and phase information of the transfer function according to multiple sine sweep signals and multiple response signals, it includes: constructing a Goertzel digital filter according to the Goertzel algorithm and the discrete Fourier algorithm. Among them, the Goertzel algorithm regards the discrete Fourier transform as a group of filters, and performs convolution operation on the input signal and the impulse response in the filter to obtain the output of the filter, that is, the frequency of a certain point in the frequency domain. Specifically, the Goertzel algorithm gradually approaches the required frequency point through iterative operations. In the iterative process, it uses real number multiplication and addition operations to avoid the complexity of negative number operations, thereby providing efficiency. Therefore, by constructing the Goertzel digital filter according to the Goertzel algorithm and the discrete Fourier algorithm, the Goertzel digital filter can calculate the amplitude information and phase information of a specific frequency in discrete data.
[0063] Figure 4 A flow chart showing the steps of determining the amplitude information and phase information of a transfer function according to a plurality of sine frequency sweep signals and a plurality of response signals in a scanning method of a digital control loop according to an embodiment of the present invention is shown; wherein the steps of determining the amplitude information and phase information of a transfer function according to a plurality of sine frequency sweep signals and a plurality of response signals include:
[0064] Step 402: inputting a plurality of sinusoidal swept frequency signals into a Goetzel digital filter respectively to obtain a plurality of corresponding first amplitude information and a plurality of first phase information;
[0065] Step 404: inputting the plurality of response signals into the Goetzer digital filter respectively to obtain corresponding plurality of second amplitude information and plurality of second phase information;
[0066] Step 406: determining a plurality of amplitude ratios according to the plurality of first amplitude information and the plurality of second amplitude information;
[0067] Step 408: determining a plurality of phase differences according to the plurality of first phase information and the plurality of second phase information;
[0068] Step 410: determining amplitude information of a transfer function according to a plurality of amplitude ratios;
[0069] Step 412: Determine phase information of the transfer function according to the multiple phase differences.
[0070] In this embodiment, the step of determining the amplitude information and phase information of the transfer function according to the multiple sine sweep signals and the multiple response signals includes: firstly, the multiple sine sweep signals are respectively input into the Goetzer digital filter to obtain multiple first amplitude information and multiple first phase information, and the Goetzer digital filter can calculate the amplitude information and phase information of the specific frequency in the discrete data, so after the sine sweep signal is input into the Goetzer digital filter, the corresponding first amplitude information and first phase information can be obtained. At the same time, the multiple response signals are respectively input into the Goetzer digital filter to obtain multiple second amplitude information and multiple second phase information, and the Goetzer digital filter can calculate the amplitude information and phase information of the specific frequency in the discrete data, so after the response signal is input into the Goetzer digital filter, the corresponding second amplitude information and second phase information can be obtained. Finally, the amplitude ratio between the sine swept frequency signal and the response signal is determined according to the first amplitude information and the second amplitude information, and then the amplitude ratio between the sine swept frequency signal and the response signal is used as the amplitude information of the transfer function at this frequency, and the phase difference between the sine swept frequency signal and the response signal is determined according to the first phase information and the second phase information, and the phase difference between the sine swept frequency signal and the response signal is used as the phase information of the transfer function at this frequency.
[0071] Figure 5 A flow chart of the steps of determining a transfer function using a least squares algorithm according to zero order, pole order, amplitude information and phase information in a scanning method of a digital control loop according to an embodiment of the present invention is shown; wherein the steps of determining a transfer function using a least squares algorithm according to zero order, pole order, amplitude information and phase information include:
[0072] Step 502: setting a first transfer function according to the zero order, the pole order and the least squares algorithm, wherein the first transfer function includes a plurality of setting parameters;
[0073] Step 504: normalizing the first transfer function to obtain a second transfer function;
[0074] Step 506: Calculate values of multiple setting parameters according to the second transfer function, the amplitude information and the phase information;
[0075] Step 508: Determine a transfer function according to values of a plurality of setting parameters.
[0076] In this embodiment, the step of determining the transfer function using the least squares algorithm according to the zero order, the pole order, the amplitude information and the phase information includes: firstly, setting the first transfer function according to the zero order, the pole order and the least squares algorithm, wherein the first transfer function is assumed, and thus the first transfer function includes a plurality of setting parameters. Then, the first transfer function is normalized to obtain the second transfer function, that is, the first transfer function is sorted and the same terms are removed, thereby obtaining the second transfer function. Then, the amplitude information and the phase information are introduced into the second transfer function to form a plurality of equation groups, and the equation groups are solved, thereby obtaining the values of the setting parameters in the second transfer function. Finally, the values of the setting parameters are introduced into the first transfer function, thereby obtaining the final transfer function. By using the least squares algorithm to determine the transfer function, the accuracy of the transfer function is improved.
[0077] In some embodiments, optionally, after the step of drawing a Bode diagram according to the transfer function, the step further includes: calculating an amplitude margin and a phase margin of the digital control loop according to the Bode diagram.
[0078] In this embodiment, after the step of drawing the Bode diagram according to the transfer function, the method includes: after obtaining the Bode diagram, determining the amplitude-frequency characteristic curve and the phase-frequency characteristic curve according to the Bode diagram, then determining the gain crossing frequency and other data information such as the phase angle, and finally calculating the amplitude margin and phase margin of the digital control loop according to the gain crossing frequency and other data information such as the phase angle. By calculating the amplitude margin and the phase margin, the stability of the digital control loop can be determined.
[0079] Figure 6 A second flow chart of a scanning method for a digital control loop according to an embodiment of the present invention is shown; wherein the scanning method for a digital control loop includes:
[0080] Step 602: The host computer sets loop frequency sweep parameters;
[0081] Step 604: The controller receives the frequency sweep parameters and enables serial communication;
[0082] Step 606: Generate a fixed frequency sinusoidal interference signal and inject it into the starting point of the digital loop;
[0083] Step 608: The host computer collects interference signals;
[0084] Step 610: Digital loop endpoint test response signal;
[0085] Step 612: The host computer collects the response signal;
[0086] Step 614: Goertzel operation;
[0087] Step 616: Determine the amplitude ratio and phase difference of the interference signal and the response signal;
[0088] Step 618: Recursively identify the transfer function using least squares;
[0089] Step 620: Determine whether the transfer function fit is high; if the result is yes, then end directly; if the result is no, then execute step 602.
[0090] In this embodiment, the present invention uses the system identification method to develop a digital control loop scanning host computer software applied to power electronic converter equipment, calculates the amplitude information and phase information at a specific frequency through the efficient Goertzel algorithm, and then quickly calculates the transfer function of the digital control loop based on the least squares method, and draws the Bode diagram, so that the loop scanning can be realized without relying on hardware equipment. The specific process is: first, as Figure 7 As shown, a Goertzel digital filter is designed. According to the principle of the Goertzel algorithm, a filter suitable for a digital controller is designed to calculate the amplitude and phase information of a specific frequency in the time domain discrete data. Specifically, assuming the sampling rate is N, the discrete Fourier operation of the discrete signal x(n) at frequency k is as follows:
[0091]
[0092] Among them, N represents the number of samples, x(n) represents the value of the signal at the nth sampling point, k represents the frequency, j is the imaginary unit, w is the rotation factor, n represents the current acquisition point, and e represents the base of the natural logarithm.
[0093] Well-known The right side of the above equation can be multiplied by this value to become:
[0094]
[0095] Expand the above formula to get:
[0096]
[0097] From the above formula, we can find that the right side of the equal sign can be written in iterative form, so the difference equation can be designed:
[0098]
[0099] Among them, y(n) represents the output value of the signal at the nth sampling point, x(n) represents the value of the signal at the nth sampling point, y(n-1) represents the output value of the signal at the n-1th sampling point, N represents the number of samples, k represents the frequency, w is the rotation factor, and n represents the current acquisition point.
[0100] The transfer function of this difference equation can be expressed as:
[0101]
[0102] Among them, H(z) represents the system function of the discrete system, z represents the variable, N represents the number of samples, k represents the frequency, and w is the rotation factor.
[0103] After the above changes, the denominator of H(z) contains only real numbers, and the denominator can be designed as a second-order filter:
[0104]
[0105] Among them, v(n) represents the input signal at the nth sampling point, x(n) represents the value of the signal at the nth sampling point, v(n-1) represents the input signal at the n-1th sampling point, v(n-2) represents the input signal at the n-2th sampling point, N represents the number of samples, k represents the frequency, and n represents the current acquisition point.
[0106] Furthermore, after simple calculations, the result of the discrete Fourier transform of the nth point can be obtained:
[0107]
[0108] Among them, y(n) represents the output value of the signal at the nth sampling point, v(n) represents the input signal at the nth sampling point, v(n-1) represents the input signal at the n-1th sampling point, N represents the number of samples, k represents the frequency, n represents the current acquisition point, j is the imaginary unit, w is the rotation factor, A1(k) represents the amplitude of the input signal when the frequency is k, and A2(k) represents the amplitude of the output signal when the frequency is k.
[0109] After passing through this filter, the complex frequency domain data of the time domain discrete signal at frequency k can be obtained:
[0110]
[0111] Among them, A(k) represents the amplitude information at frequency k, It represents the phase angle information at frequency k, A1 represents the amplitude of the input signal, and A2 represents the amplitude of the output signal.
[0112] After designing the Goetzel digital filter, the loop frequency sweep parameters are set. The host computer is connected to the controller of the digital control circuit through a serial port. The host computer can set the loop frequency sweep parameters and send the parameters to the controller. The parameter types include the starting frequency, the ending frequency, the interference signal amplitude, the transfer function system zero and pole order, and the serial port can be a 485 serial port. The controller receives the frequency sweep parameters through the 485 serial port communication to generate a sinusoidal signal of a specific frequency and amplitude. Specifically, Figure 8 As shown, after receiving the frequency sweep parameters, the controller selects 30 frequency points between each decade of frequency to generate a sine frequency sweep signal. Figure 8 The frequency range of 1Hz to 10kHz is shown as an example. Fig. 9 As shown, the first frequency point k1 is selected, a sinusoidal interference signal with a frequency of k1 and an amplitude v is generated, and it is injected into the specified starting position of the loop. While injecting the sinusoidal sweep signal, the controller collects the response signal on the output side and sends it to the host computer through the serial port. The host computer receives this signal in time. Fig. 9 As shown, Fig. 9 The dotted box in the middle is the digital control loop that needs to be scanned, x in (t) is the input sinusoidal interference signal, x out (t) is the corresponding response signal.
[0113] Then, after the host computer collects the discrete time domain data of the sinusoidal interference signal and the response signal, the amplitude information and phase information of the sinusoidal swept frequency signal and the response signal at the frequency k1 are calculated by the Goertzel digital filter:
[0114]
[0115] Among them, A Bn (k1) represents the amplitude information of the sine sweep signal at frequency k1. It represents the phase information of the sine sweep signal at frequency k1, A CDE (k1) represents the amplitude information of the response signal at frequency k1. It represents the phase information of the response signal at frequency k1.
[0116] Then the phase difference and amplitude ratio between the two are calculated, and the amplitude and phase information of the transfer function at frequency k1 can be obtained:
[0117]
[0118] Among them, A(k1) represents the amplitude information of the transfer function at frequency k1, The phase information of the transfer function at frequency k1, A Bn(k1) represents the amplitude information of the sine sweep signal at frequency k1. It represents the phase information of the sine sweep signal at frequency k1, A CDE (k1) represents the amplitude information of the response signal at frequency k1. It represents the phase information of the response signal at frequency k1.
[0119] Then continue to generate a sinusoidal signal according to the next frequency point k2, repeat the above steps until all frequency points are scanned, and the amplitude-frequency data and phase-frequency data of the transfer function corresponding to all frequency points can be obtained;
[0120]
[0121] Among them, A(k1) represents the amplitude information of the transfer function at frequency k1, represents the phase information of the transfer function at frequency k1, A(k2) represents the amplitude information of the transfer function at frequency k2, The phase information of the transfer function at frequency k2, A(k n ) represents the transfer function at frequency k n The amplitude information at The transfer function represented by n The phase information at .
[0122] Then, the system transfer function is obtained through least squares system identification. First, according to the zero-pole order m and n specified by the user, the transfer function is assumed to be:
[0123]
[0124] Where G(s) represents the transfer function, a1, a2…, a S ,b U ,b1…b n are parameters, m is the zero order, n is the pole order, and s is the complex frequency.
[0125] Substituting s into jω and normalizing the calculation to eliminate j, we can get the expressions of amplitude and phase with respect to ω:
[0126]
[0127] Among them, ω represents the real part of the frequency, j is the imaginary unit, k is the frequency, m is the zero point order, and f b1 ,f b2 ,…,f bc and It's all about a1, a2..., a c ,b U ,b1…bg The expression of a1, a2…, a S ,b U ,b1…b n as a parameter.
[0128] After substituting the amplitude information of all frequency points into the above formula, we can get:
[0129]
[0130] Among them, A1, A2, ...A k It represents the amplitude information of all frequency points, ω represents the part where the frequency is a real number, k is the frequency, and n is the pole order.
[0131] Then make Then we have: Ax = T, and the following transformation can be obtained:
[0132] A T Ax=A T T=>(A T A) -1 A T Ax=(A T A) -1 A T T=>x=(A T A) -1 A T T;
[0133] Therefore, it can be deduced that:
[0134]
[0135] Finally, we calculate f b1 ,f b2 ,…,f bg Then we can easily calculate a1, a2…, a c ,b U ,b1…b g Substituting the value of into the transfer function expression, we can get the complete transfer function.
[0136] Next, verify the accuracy of the transfer function: set a1, a2…, a c ,b U ,b1…b g Substitute the value of Then use the phase-frequency data to verify whether the output phase meets the requirements (within 10% error); if the transfer function meets the requirements, the host computer calculates the amplitude margin and phase margin based on the calculated transfer function expression and draws the Bode diagram. If it does not meet the requirements, reset the loop parameters and scan the loop.
[0137] Fig.10A schematic block diagram of a scanning system for a digital control loop according to an embodiment of the present invention is shown; wherein the scanning system 100 for a digital control loop comprises:
[0138] The first determination module 1002 is used to determine the frequency sweep parameters, wherein the frequency sweep parameters include: starting frequency, ending frequency, interference signal amplitude, zero order and pole order;
[0139] A second determination module 1004 is used to determine a plurality of sine frequency sweep signals according to a start frequency and an end frequency;
[0140] A third determination module 1006, configured to determine a response signal corresponding to each sine frequency sweep signal according to a digital control loop;
[0141] A first calculation module 1008, configured to determine amplitude information and phase information of a transfer function according to a plurality of sine frequency sweep signals and a plurality of response signals;
[0142] A second calculation module 1010 is used to determine the transfer function using a least squares algorithm according to the zero order, the pole order, the amplitude information and the phase information;
[0143] The drawing module 1012 is used to draw a Bode diagram according to the transfer function.
[0144] The scanning system 100 of the digital control loop provided by the present invention mainly includes: a first determination module 1002, a second determination module 1004, a third determination module 1006, a first calculation module 1008, a second calculation module 1010 and a drawing module 1012. Among them, the first determination module 1002 can determine the sweep frequency parameters, wherein the sweep frequency parameters include the starting frequency, the ending frequency, the interference signal amplitude, the zero point order and the pole order. The sweep frequency parameters can be set on the host computer by the user according to daily experience. The host computer is connected to the controller in the digital control loop through a 485 serial port communication. Therefore, when the user inputs the sweep frequency parameters on the host computer, the controller in the digital control loop will receive the sweep frequency parameters through the 485 serial port communication. After determining the sweep frequency parameters, the second determination module 1004 can determine multiple sine sweep frequency signals according to the starting frequency and the ending frequency, that is, after obtaining the starting frequency and the ending frequency, multiple specific frequencies can be selected between the starting frequency and the ending frequency according to the preset rules, and then multiple sine sweep frequency signals are generated according to the multiple specific frequencies and the interference signal amplitude in the sweep frequency parameters. After obtaining the sine sweep frequency signal, the third determination module 1006 can input the multiple sine sweep frequency signals into the digital control loop in sequence to obtain multiple corresponding response signals, wherein each sine sweep frequency signal corresponds to a response signal, that is, the sine sweep frequency signal and the response signal are in a one-to-one correspondence. Then the first calculation module 1008 obtains the amplitude information and phase information of multiple transfer functions at specific frequencies based on the multiple sine sweep frequency signals and the multiple response signals. After obtaining the amplitude information and phase information of the transfer function at a specific frequency, the second calculation module 1010 uses the least squares algorithm to determine the transfer function according to the zero order, the pole order, the amplitude information and the phase information, wherein the transfer function refers to the transfer function of the digital control loop, the zero order describes the rate at which the transfer function approaches zero at a certain zero point, the pole order describes the behavior characteristics of the transfer function at the pole, and the zero order and the pole order can be set by the user according to common sense. The least squares algorithm mainly finds the best function match for the data by minimizing the square sum of the errors. By using the least squares algorithm to determine the transfer function, the accuracy of the transfer function is guaranteed. After obtaining the transfer function, the transfer function is verified. Specifically, the phase-frequency data can be used to verify whether the output phase meets the requirements, and the requirement can be that the error is within a preset range. If the verification is successful, that is, the output phase meets the requirements, then the drawing module 1012 draws the Bode diagram according to the obtained transfer function. If the verification is unsuccessful, that is, the output phase does not meet the requirements, the scanning parameters are re-determined, and then the above method is repeated until the verification is successful.In the present invention, the scanning parameters are first determined, and then the sinusoidal frequency sweep signal is determined according to the starting frequency and the ending frequency in the scanning parameters, and then the corresponding response signal is determined according to the sinusoidal frequency sweep signal and the digital control loop, and then the phase information and amplitude information between the response signal and the sinusoidal frequency sweep signal are determined, and finally the transfer function of the digital control loop is calculated using the amplitude information and the phase information, and then the Bode diagram is drawn according to the transfer function, thereby achieving the technical effect of realizing digital control loop scanning without relying on hardware equipment.
[0145] In some embodiments, optionally, the second determination module 1004 is specifically used to determine the number of preset frequency points and the preset frequency point interval; determine multiple frequency points between the start frequency and the end frequency according to the preset frequency point number and the preset frequency point interval; generate multiple sinusoidal swept frequency signals according to the frequency corresponding to each frequency point and the interference signal amplitude, wherein the swept frequency parameters include the interference signal amplitude.
[0146] In this embodiment, the second determination module 1004 is specifically used to determine the number of preset frequency points and the preset frequency point interval, wherein the number of preset frequency points and the preset frequency point interval can be pre-set, and specifically, the number of preset frequency points and the preset frequency point interval can select 30 frequency points for every ten times of frequency. Then, multiple frequency points are determined between the starting frequency and the ending frequency according to the preset number of frequency points and the preset frequency point interval. For example, when the number of preset frequency points and the preset frequency point interval select 30 frequency points for every ten times of frequency, the starting frequency and the ending frequency can be first segmented according to ten times of frequency, such as when the starting frequency is 10 Hz and the ending frequency is 1000 Hz, it can be divided into two sections of 10 Hz to 100 Hz and 100 Hz to 1000 Hz, and then 30 frequency points are selected in these two sections respectively. Finally, multiple sinusoidal frequency sweep signals are generated according to the frequency corresponding to each frequency point and the interference signal amplitude in the scanning parameters, that is, according to the frequency point, a sinusoidal frequency sweep signal with a frequency corresponding to the frequency point and an amplitude of the interference signal amplitude is generated, wherein the interference signal amplitude is one of the previously determined frequency sweep parameters. The present invention determines multiple frequency points between the starting frequency and the ending frequency according to the preset frequency point number and the preset frequency point interval, and then generates a sinusoidal interference signal according to the frequency points, so that the subsequent determination of the transfer function using the least squares algorithm can be more accurate.
[0147] In some embodiments, optionally, the third determination module 1006 is specifically configured to input the sine frequency sweep signal to a specified starting position of the digital control loop; and collect a response signal at the output side of the digital control loop.
[0148] In this embodiment, the third determination module 1006 is specifically used to input the sine sweep signal to the specified starting position of the digital control loop, and the specified starting position refers to the starting position that needs to be scanned in the digital control loop. Then, the response signal corresponding to the sine sweep signal is collected on the output side of the digital control loop. The corresponding response signal is obtained by inputting the sine sweep signal into the digital control loop, thereby ensuring the accuracy of the response signal.
[0149] In some embodiments, the scanning system 100 for a digital control loop further includes a building module for building a Goetzer digital filter according to the Goetzer algorithm and the discrete Fourier algorithm.
[0150] In this embodiment, the scanning system 100 of the digital control loop also includes a building block, wherein the building block can construct a Goertzel digital filter according to the Goertzel algorithm and the discrete Fourier algorithm. Wherein, the Goertzel algorithm regards the discrete Fourier transform as a group of filters, and performs a convolution operation on the input signal and the impulse response in the filter to obtain the output of the filter, that is, the frequency of a certain point in the frequency domain. Specifically, the Goertzel algorithm gradually approaches the required frequency point through iterative operations. During the iterative process, it uses real number multiplication and addition operations to avoid the complexity of negative number operations, thereby providing efficiency. Therefore, by constructing the Goertzel digital filter according to the Goertzel algorithm and the discrete Fourier algorithm, the Goertzel digital filter can calculate the amplitude information and phase information of a specific frequency in discrete data.
[0151] In some embodiments, optionally, the first calculation module 1008 is specifically used to input multiple sinusoidal swept frequency signals into the Goetzer digital filter respectively to obtain corresponding multiple first amplitude information and multiple first phase information; input multiple response signals into the Goetzer digital filter respectively to obtain corresponding multiple second amplitude information and multiple second phase information; determine multiple amplitude ratios according to the multiple first amplitude information and the multiple second amplitude information; determine multiple phase differences according to the multiple first phase information and the multiple second phase information; determine the amplitude information of the transfer function according to the multiple amplitude ratios; and determine the phase information of the transfer function according to the multiple phase differences.
[0152] In this embodiment, the first calculation module 1008 is specifically used to input multiple sine sweep signals into the Goetzer digital filter to obtain multiple first amplitude information and multiple first phase information. The Goetzer digital filter can calculate the amplitude information and phase information of a specific frequency in discrete data, so after the sine sweep signal is input into the Goetzer digital filter, the corresponding first amplitude information and first phase information can be obtained. At the same time, multiple response signals are input into the Goetzer digital filter to obtain multiple second amplitude information and multiple second phase information. The Goetzer digital filter can calculate the amplitude information and phase information of a specific frequency in discrete data, so after the response signal is input into the Goetzer digital filter, the corresponding second amplitude information and second phase information can be obtained. Finally, the amplitude ratio between the sine swept frequency signal and the response signal is determined according to the first amplitude information and the second amplitude information, and then the amplitude ratio between the sine swept frequency signal and the response signal is used as the amplitude information of the transfer function at this frequency, and the phase difference between the sine swept frequency signal and the response signal is determined according to the first phase information and the second phase information, and the phase difference between the sine swept frequency signal and the response signal is used as the phase information of the transfer function at this frequency.
[0153] In some embodiments, optionally, the second calculation module 1010 is specifically used to set a first transfer function according to the zero order, the pole order and the least squares algorithm, wherein the first transfer function includes multiple setting parameters; normalize the first transfer function to obtain the second transfer function; calculate the values of the multiple setting parameters according to the second transfer function, amplitude information and phase information; and determine the transfer function according to the values of the multiple setting parameters.
[0154] In this embodiment, the second calculation module 1010 is specifically used to set the first transfer function according to the zero order, the pole order and the least squares algorithm, wherein the first transfer function is assumed, and therefore the first transfer function includes a plurality of setting parameters. Then the first transfer function is normalized to obtain the second transfer function, that is, the first transfer function is sorted and the same terms are removed to obtain the second transfer function. Then the amplitude information and the phase information are brought into the second transfer function to form a plurality of equation groups, and the equation groups are solved to obtain the values of the setting parameters in the second transfer function. Finally, the values of the setting parameters are brought into the first transfer function to obtain the final transfer function. By adopting the least squares algorithm to determine the transfer function, the accuracy of the transfer function is improved.
[0155] In some embodiments, optionally, the scanning system 100 for a digital control loop further includes a third calculation module, configured to calculate an amplitude margin and a phase margin of the digital control loop according to the Bode diagram.
[0156] In this embodiment, the scanning system 100 of the digital control loop further includes a third calculation module, wherein the third calculation module can determine the amplitude-frequency characteristic curve and the phase-frequency characteristic curve according to the Bode diagram after obtaining the Bode diagram, and then determine the gain crossing frequency and other data information such as the phase angle, and finally calculate the amplitude margin and phase margin of the digital control loop according to the gain crossing frequency and other data information such as the phase angle. By calculating the amplitude margin and the phase margin, the stability of the digital control loop can be determined.
[0157] Fig.11 A schematic block diagram of an electronic device according to an embodiment of the present invention is shown; wherein the electronic device 110 includes a memory 1102, a processor 1104, and a computer program stored in the memory 1102 and executable on the processor 1104, and when the processor 1104 executes the computer program, the steps of the scanning method of the digital control loop as described above are implemented.
[0158] The electronic device 110 provided by the present invention, in which the processor 1104 implements the steps of the scanning method of the above-mentioned digital control loop when executing the computer program, can achieve the technical effect of any of the above-mentioned embodiments, and will not be described in detail.
[0159] An embodiment of the present invention provides a storage medium on which a computer program is stored. When the computer program is executed by a processor, the steps of the scanning method of the digital control loop as described above are implemented.
[0160] The storage medium provided by the present invention, when the computer program is executed by the processor, implements the steps of the scanning method of the above-mentioned digital control loop, which can achieve the technical effect of any of the above-mentioned embodiments and will not be repeated.
[0161] In the description of this specification, the terms "first" and "second" are used for descriptive purposes only and cannot be understood as indicating or implying relative importance unless otherwise clearly specified and limited; the terms "connection", "installation", "fixation" and the like should be understood in a broad sense, for example, "connection" can be a fixed connection, a detachable connection, or an integral connection; it can be directly connected or indirectly connected through an intermediate medium. For ordinary technicians in this field, the specific meanings of the above terms in the present invention can be understood according to specific circumstances.
[0162] In the description of this specification, the description of the terms "one embodiment", "some embodiments", "specific embodiments", etc. means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present invention. In this specification, the schematic representation of the above terms does not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described can be combined in any one or more embodiments or examples in a suitable manner.
[0163] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. For those skilled in the art, the present invention may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.
Claims
1. A scanning method for a digital control loop, characterized in that: include: Determine frequency sweep parameters, wherein the frequency sweep parameters include: a starting frequency, an ending frequency, a zero order, and a pole order; Determine a plurality of sinusoidal frequency sweep signals according to the starting frequency and the ending frequency; Determining a response signal corresponding to each of the sinusoidal swept frequency signals according to a digital control loop; Determine the amplitude information and phase information of the transfer function according to the plurality of the sine sweep signals and the plurality of the response signals; Determine the transfer function using a least squares algorithm according to the zero order, the pole order, the amplitude information and the phase information; A Bode plot is plotted based on the transfer function.
2. The scanning method of the digital control loop according to claim 1, characterized in that: The step of determining a plurality of sinusoidal frequency sweep signals according to the starting frequency and the ending frequency comprises: Determine the number of preset frequency points and the preset frequency point intervals; Determine a plurality of frequency points between the start frequency and the end frequency according to the number of preset frequency points and the preset frequency point interval; A plurality of the sinusoidal frequency sweep signals are generated according to the frequency corresponding to each of the frequency points and the amplitude of the interference signal, wherein the frequency sweep parameter includes the amplitude of the interference signal.
3. The scanning method of the digital control loop according to claim 1, characterized in that: The step of determining the response signal corresponding to each of the sinusoidal swept frequency signals according to the digital control loop comprises: Inputting the sine sweep signal to a specified starting position of the digital control loop; The response signal is collected at an output side of the digital control loop.
4. The scanning method of the digital control loop according to claim 1, characterized in that: Before the step of determining the amplitude information and phase information of the transfer function according to the plurality of the sinusoidal sweep signals and the plurality of the response signals, the scanning method of the digital control loop includes: The Goetzel digital filter is constructed based on the Goetzel algorithm and discrete Fourier algorithm.
5. The scanning method of the digital control loop according to claim 4, characterized in that: The step of determining the amplitude information and phase information of the transfer function according to the plurality of the sinusoidal swept frequency signals and the plurality of the response signals comprises: Inputting the plurality of sinusoidal swept frequency signals into the Goetzer digital filter respectively to obtain corresponding plurality of first amplitude information and plurality of first phase information; Inputting the plurality of response signals into the Goetzer digital filter respectively to obtain corresponding plurality of second amplitude information and plurality of second phase information; determining a plurality of amplitude ratios according to a plurality of first amplitude information and a plurality of second amplitude information; Determine a plurality of phase differences according to a plurality of the first phase information and a plurality of the second phase information; determining the amplitude information of the transfer function according to a plurality of the amplitude ratios; The phase information of the transfer function is determined according to a plurality of the phase differences.
6. The scanning method of a digital control loop according to claim 1, characterized in that: The step of determining the transfer function by using a least squares algorithm according to the zero order, the pole order, the amplitude information and the phase information comprises: Setting a first transfer function according to the zero order, the pole order and the least squares algorithm, wherein the first transfer function includes a plurality of setting parameters; Normalizing the first transfer function to obtain a second transfer function; Calculate the values of the plurality of setting parameters according to the second transfer function, the amplitude information and the phase information; The transfer function is determined according to the values of the plurality of setting parameters.
7. The scanning method of a digital control loop according to any one of claims 1 to 5, characterized in that: After the step of drawing a Bode diagram according to the transfer function, the scanning method of the digital control loop includes: A magnitude margin and a phase margin of the digital control loop are calculated according to the Bode diagram.
8. A scanning system for a digital control loop, characterized in that: include: A first determination module, the first determination module is used to determine frequency sweep parameters, wherein the frequency sweep parameters include: a starting frequency, an ending frequency, a zero order, and a pole order; A second determination module, the second determination module is used to determine a plurality of sinusoidal swept frequency signals according to the starting frequency and the ending frequency; A third determination module, the third determination module is used to determine a response signal corresponding to each of the sinusoidal swept frequency signals according to a digital control loop; A first calculation module, the first calculation module is used to determine the amplitude information and phase information of the transfer function according to the plurality of the sine sweep signals and the plurality of the response signals; A second calculation module, the second calculation module is used to determine the transfer function by using a least squares algorithm according to the zero order, the pole order, the amplitude information and the phase information; A drawing module is used to draw a Bode diagram according to the transfer function.
9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the computer program, the processor implements the steps of the scanning method of the digital control loop according to any one of claims 1 to 7.
10. A storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the scanning method of the digital control loop according to any one of claims 1 to 7 are implemented.