Discrete random pulse width modulation method, modulation device and computer program product
Generating discrete random pulse position sequences and updating PWM controller parameters through a hash algorithm solves the problem of poor suppression of high-frequency PWM harmonics in the existing technology, and achieves effective dispersion and suppression of high-frequency PWM harmonics.
Patent Information
- Application Number
- CN202410726405.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-05
- Publication Date
- 2024-08-30
AI Technical Summary
The existing random pulse width modulation technology has poor harmonic suppression effect in high-frequency PWM, especially in SiC MOSFET, repetitive sequences are prone to occur, which weakens the harmonic suppression effect.
A hash algorithm is used to generate a discrete random pulse position sequence, through which the pulse position factor and conduction position are determined, the PWM controller parameters are updated to generate a complementary and symmetrical PWM waveform, the switching state of the electronic device is controlled, and the switching state of the electronic device is dispersed. harmonic energy to a wider frequency band.
It enhances the harmonic suppression effect of random PWM technology, extends the iteration cycle, and improves the suppression ability of high-frequency PWM harmonics.
Smart Images

Figure CN118573160A
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of random pulse width modulation, and in particular to a discrete random pulse width modulation method, a modulation device, a computer-readable storage medium and a computer program product. Background Art
[0002] As the requirements for energy efficiency and renewable energy utilization increase, DC-DC converters will continue to develop towards higher efficiency. Compared with traditional silicon devices, silicon carbide power devices have excellent electrical and thermal properties and stability in high temperature and high frequency environments. These advantages make SiC devices an important technical choice for improving the performance and efficiency of DC-DC converters.
[0003] Since silicon carbide devices operate in a high-frequency switching state, the use of traditional pulse width modulation (PWM) modulation technology will generate more PWM harmonics. These harmonic signals are easily propagated in the power supply line and the surrounding environment, interfering with the normal operation of other electronic devices. The use of filters to suppress PWM harmonics increases the cost and size of the DC-DC converter. Therefore, it is crucial to improve system performance by improving PWM modulation technology to suppress harmonics.
[0004] Common PWM harmonic suppression technologies include random pulse width modulation technology, carrier phase shift PWM technology and zero common mode PWM technology. Among these three technologies, the topology of random PWM technology is more versatile, has better control performance on system switching loss and current ripple, and has broader application prospects. In existing random PWM technology, most of them use linear feedback shift registers to construct pseudo-random number generators, but this method has a short iteration cycle and is prone to repeated sequences in SiC MOSFETs with high switching frequencies, which weakens the harmonic suppression effect of random PWM technology. Summary of the invention
[0005] The main purpose of the present application is to provide a discrete random pulse width modulation method, a modulation device, a computer-readable storage medium and a computer program product, so as to at least solve the problem of poor high-frequency PWM harmonic suppression effect in the prior art.
[0006] In order to achieve the above-mentioned purpose, according to one aspect of the present application, a discrete random pulse width modulation method is provided, comprising: generating a discrete random pulse position sequence based on a hash algorithm, wherein the discrete random pulse position sequence is a sequence formed by the output value of the hash algorithm; determining a pulse position factor corresponding to each PWM cycle according to the discrete random pulse position sequence, and calculating a pulse on position of each PWM cycle according to the pulse position factor and a pulse parameter, wherein the pulse on position is the actual delay of the pulse position in the current PWM cycle, the pulse position factor is the delay of the pulse position relative to the initial position in the current PWM cycle, and the pulse parameters include a triangular wave carrier frequency and a duty cycle; updating parameters of a PWM controller according to the pulse on position and the pulse parameters so that the main output and complementary output of the PWM controller generate complementary and symmetrical PWM waveforms to obtain a PWM switching signal, and controlling the switching state of an electronic device according to the PWM switching signal, wherein the main output is the positive polarity output of the PWM controller, and the complementary output is the negative polarity output of the PWM controller.
[0007] Optionally, generating a discrete random pulse position sequence based on a hash algorithm includes: obtaining a seed value and multiple groups of input data, wherein the seed value is used to initialize a hash function in the hash algorithm; filling each group of the input data according to a set filling method to obtain multiple complete data blocks, wherein the set filling method is a method of padding the input data so that the data length of the input data meets the data requirements of the hash algorithm, and the complete data blocks and the input data correspond one to one; a division step, dividing each of the complete data blocks according to a set size, and obtaining multiple single data blocks in a division order; an input-output step, inputting the current single data block and the seed value into the input data according to the division order In the hash function, an intermediate result corresponding to the current single data block is output, and the current single data block is the single data block currently being processed; a repeating step is performed to update the seed value to the intermediate result, and the input and output steps are repeated at least once until all the single data blocks corresponding to the complete data block are processed, and a hash value is obtained, and the hash value is the intermediate result corresponding to the last single data block; the dividing step, the input and output step and the repeating step are repeated in sequence at least once until all the complete data blocks are processed, and the hash values corresponding to all the complete data blocks are obtained; and the discrete random pulse position sequence is formed according to all the hash values.
[0008] Optionally, the discrete random pulse position sequence is formed according to all the hash values, including: converting all the hash values into corresponding decimal integers; performing shift operations on all the decimal integers and mapping them to a set range to obtain mapping values corresponding to each decimal integer; and generating the discrete random pulse position sequence according to all the mapping values.
[0009] Optionally, determining a pulse position factor corresponding to each PWM period according to the discrete random pulse position sequence, and calculating the pulse conduction position of each PWM period according to the pulse position factor and pulse parameters, includes: randomly selecting a sequence value in the discrete random pulse position sequence in each PWM period, and determining the sequence value as the pulse position factor; calculating the pulse conduction position of each PWM period according to a first formula, wherein the first formula is λ k is the pulse position factor of the kth PWM cycle, β k is the pulse conduction position of the kth PWM cycle, f c is the triangle wave carrier frequency, d k is the duty cycle of the kth PWM cycle.
[0010] Optionally, the PWM controller includes a comparison register and a period register, and the parameters of the PWM controller are updated according to the pulse conduction position and the pulse parameters so that the main output and the complementary output of the PWM controller generate complementary and symmetrical PWM waveforms to obtain a PWM switching signal, including: when the count value of the timer reaches the period value of the period register, the count value of the timer is controlled to return to zero and re-time, and the output of the PWM controller is zero; according to the pulse conduction position and the pulse parameters, the upper limit reference value and the lower limit reference value of the comparison register are updated, the upper limit reference value is the upper limit value of the output value of the comparison register, and the lower limit reference value is the lower limit value of the output value of the comparison register; when the count value of the timer is greater than the lower limit reference value or the count value is greater than the lower limit reference value, the main output and the complementary output of the PWM controller are controlled, the output signals of the main output and the complementary output are opposite, and one of the main output and the complementary output is controlled to be output when the other is delayed; the PWM switching signal is obtained according to the main output and the complementary output.
[0011] Optionally, updating the upper limit reference value and the lower limit reference value of the comparison register according to the pulse conduction position and the pulse parameter includes: obtaining the delay time according to the ratio of the clock frequency of the timer to the triangular wave carrier frequency; calculating the upper limit reference value of the comparison register according to a second formula, wherein the second formula is CMr0=PRD / 2+dk ×PRD+β k ×f s +0.5×t dead ×f s , PRD is the delay time, d k is the duty cycle of the kth PWM cycle, β k is the pulse conduction position of the kth PWM cycle, f s is the clock frequency, t dead is the dead time; the lower limit reference value of the comparison register is calculated according to the third formula, the third formula is CMr1 = PRD / 2-d k ×PRD+β k ×f s -0.5×t dead ×f s .
[0012] Optionally, when the count value of the timer is greater than the lower limit reference value or the count value is greater than the lower limit reference value, the main output and the complementary output of the PWM controller are controlled, including: when the count value of the timer is greater than the lower limit reference value, the signal of the complementary output of the PWM controller is controlled to be low level, and the signal of the main output of the PWM controller is high level after the delay time; when the count value of the timer is greater than the upper limit reference value, the signal of the main output of the PWM controller is controlled to be low level, and the signal of the complementary output of the PWM controller is high level after the delay time.
[0013] According to another aspect of the present application, a discrete random pulse width modulation device is provided, the device comprising: a generating unit, for generating a discrete random pulse position sequence based on a hash algorithm, the discrete random pulse position sequence being a sequence formed by the output value of the hash algorithm; a calculating unit, for determining a pulse position factor corresponding to each PWM cycle according to the discrete random pulse position sequence, and calculating a pulse on position of each PWM cycle according to the pulse position factor and a pulse parameter, the pulse on position being the actual delay of the pulse position in the current PWM cycle, the pulse position factor being the delay of the pulse position relative to the initial position in the current PWM cycle, one PWM cycle corresponding to one pulse position factor, the pulse parameters comprising a triangular wave carrier frequency and a duty cycle; an output unit, for updating parameters of a PWM controller according to the pulse on position and the pulse parameters so that the main output and complementary output of the PWM controller generate complementary and symmetrical PWM waveforms, obtain a PWM switching signal, and control the switching state of an electronic device according to the PWM switching signal, the main output being the positive polarity output of the PWM controller, and the complementary output being the negative polarity output of the PWM controller.
[0014] According to another aspect of the present application, a computer-readable storage medium is provided, wherein the computer-readable storage medium includes a stored program, wherein when the program is executed, the device where the computer-readable storage medium is located is controlled to execute any one of the methods described.
[0015] According to another aspect of the present application, a computer program product is provided, comprising computer instructions, wherein when the computer instructions are executed by a processor, any one of the methods described above is implemented.
[0016] By applying the technical solution of the present application, in a discrete random pulse width modulation method, first, a discrete random pulse position sequence is generated based on a hash algorithm, and the discrete random pulse position sequence is a sequence formed by the output value of the hash algorithm; then, a pulse position factor corresponding to each PWM cycle is determined according to the discrete random pulse position sequence, and a pulse conduction position of each PWM cycle is calculated according to the pulse position factor and pulse parameters, the pulse conduction position is the actual delay of the pulse position in the current PWM cycle, the pulse position factor is the delay of the pulse position relative to the initial position in the current PWM cycle, and the pulse parameters include a triangular wave carrier frequency and a duty cycle; finally, the parameters of a PWM controller are updated according to the pulse conduction position and the pulse parameters so that the main output and the complementary output of the PWM controller generate complementary and symmetrical PWM waveforms, and a PWM switching signal is obtained, and the switching state of an electronic device is controlled according to the PWM switching signal, the main output is the positive polarity output of the PWM controller, and the complementary output is the negative polarity output of the PWM controller. The present application generates a pseudo-random number sequence through a hash algorithm to satisfy the cycle-by-cycle switching of electronic devices when switching at high switching frequencies, with a longer iteration cycle, and performs signal output control by randomly modulating the PWM pulse position factor within a set range and updating the sampling position in real time, so that the PWM harmonic energy generated by the high-frequency switching of electronic devices is dispersed into a wider frequency band, thereby enhancing the harmonic suppression effect of the random PWM technology. The present application solves the problem of poor high-frequency PWM harmonic suppression effect in the prior art. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] Figure 1 A hardware structure block diagram of a mobile terminal for executing a discrete random pulse width modulation method provided in an embodiment of the present application is shown;
[0018] Figure 2 A schematic diagram of a discrete random pulse width modulation method provided according to an embodiment of the present application is shown;
[0019] Figure 3 A control logic diagram of base conversion provided according to an embodiment of the present application is shown;
[0020] Figure 4 A schematic diagram of a PWM interrupt response provided according to an embodiment of the present application is shown;
[0021] Figure 5 A topology diagram of a DC-DC converter based on SiC MOSFET provided according to an embodiment of the present application is shown;
[0022] Figure 6 A digital implementation flow chart of a discrete random pulse width modulation technology provided according to an embodiment of the present application is shown;
[0023] Figure 7 The voltage spectrum simulation diagram using the traditional PWM technology is shown;
[0024] Figure 8 A voltage spectrum simulation diagram of a discrete random pulse width modulation technology provided according to an embodiment of the present application is shown;
[0025] Fig. 9 A common simulation diagram of a discrete random pulse width modulation technology provided according to an embodiment of the present application is shown;
[0026] Fig.10 A structural block diagram of a discrete random pulse width modulation device provided according to an embodiment of the present application is shown.
[0027] The above drawings include the following reference numerals:
[0028] 102, processor; 104, memory; 106, transmission device; 108, input and output devices. DETAILED DESCRIPTION
[0029] It should be noted that, in the absence of conflict, the embodiments and features in the embodiments of the present application can be combined with each other. The present application will be described in detail below with reference to the accompanying drawings and in combination with the embodiments.
[0030] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present application.
[0031] It should be noted that the terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequential order. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present application described here. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device comprising a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0032] For the convenience of description, some nouns or terms involved in the embodiments of the present application are explained below:
[0033] The main output of PWM refers to the positive polarity pulse signal output by the PWM controller, which is used to control the main devices or components in the circuit. This output is usually used to control devices such as motors, lights, heaters, etc.
[0034] The complementary output of PWM refers to the reverse polarity pulse signal output by the PWM controller, which complements the main output and is used to control auxiliary devices or components in the circuit. This output is usually used to control the reverse movement of the motor, control relays, etc.
[0035] Period register: used to set the period of the PWM signal, that is, the total time length of the square wave signal;
[0036] Comparison register: used to set the high level time of the PWM signal, that is, the duration of the square wave signal;
[0037] Dead time: During PWM output, a protection period is set to prevent the upper and lower bridge arm IGBTs from being turned on at the same time due to switching speed issues.
[0038] As introduced in the background technology, most of the prior art uses a linear feedback shift register to construct a pseudo-random number generator, but this method has a short iteration cycle, and is prone to repeated sequences when used in SiC MOSFETs with high switching frequencies, which weakens the harmonic suppression effect of the random PWM technology. In order to solve the problem of poor harmonic suppression effect on high-frequency PWM, the embodiments of the present application provide a discrete random pulse width modulation method, a modulation device, a computer-readable storage medium, and a computer program product.
[0039] The technical solutions in the embodiments of the present invention will be described clearly and completely below in conjunction with the accompanying drawings in the embodiments of the present invention.
[0040] The method embodiments provided in the embodiments of the present application can be executed in a mobile terminal, a computer terminal or a similar computing device. Taking running on a mobile terminal as an example, Figure 1 FIG. 1 is a hardware structure block diagram of a mobile terminal of a discrete random pulse width modulation method according to an embodiment of the present invention. Figure 1 As shown, the mobile terminal may include one or more ( Figure 1 Only one is shown in the figure) a processor 102 (the processor 102 may include but is not limited to a processing device such as a microprocessor MCU or a programmable logic device FPGA) and a memory 104 for storing data, wherein the mobile terminal may also include a transmission device 106 and an input / output device 108 for communication functions. It can be understood by those skilled in the art that Figure 1 The structure shown is only for illustration and does not limit the structure of the mobile terminal. Figure 1More or fewer components as shown, or with Figure 1 Different configurations shown.
[0041] The memory 104 can be used to store computer programs, for example, software programs and modules of application software, such as the computer program corresponding to the display method of device information in the embodiment of the present invention. The processor 102 executes various functional applications and data processing by running the computer program stored in the memory 104, that is, the above method is implemented. The memory 104 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some examples, the memory 104 may further include a memory remotely arranged relative to the processor 102, and these remote memories can be connected to the mobile terminal via a network. Examples of the above-mentioned network include but are not limited to the Internet, an intranet, a local area network, a mobile communication network, and a combination thereof. The transmission device 106 is used to receive or send data via a network. The above-mentioned specific examples of the network may include a wireless network provided by a communication provider of the mobile terminal. In one example, the transmission device 106 includes a network adapter (Network Interface Controller, referred to as NIC), which can be connected to other network devices through a base station so as to communicate with the Internet. In one example, the transmission device 106 may be a radio frequency (RF) module, which is used to communicate with the Internet wirelessly.
[0042] In this embodiment, a discrete random pulse width modulation method running on a mobile terminal, a computer terminal or a similar computing device is provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.
[0043] Figure 2 is a flow chart of a discrete random pulse width modulation method according to an embodiment of the present application. Figure 2 As shown, the method comprises the following steps:
[0044] Step S201, generating a discrete random pulse position sequence based on a hash algorithm, wherein the discrete random pulse position sequence is a sequence formed by output values of the hash algorithm;
[0045] Specifically, a sufficient number of hash values are generated using the SHA-1 hash algorithm to be used as discrete random pulse position factors later, and a final discrete random pulse position sequence is obtained based on all the hash values and stored in the flash memory of the digital signal processor.
[0046] Step S202, determining a pulse position factor corresponding to each PWM cycle according to the discrete random pulse position sequence, and calculating a pulse conduction position of each PWM cycle according to the pulse position factor and pulse parameters, wherein the pulse conduction position is an actual delay of the pulse position in the current PWM cycle, the pulse position factor is a delay of the pulse position relative to the initial position in the current PWM cycle, and the pulse parameters include a triangular wave carrier frequency and a duty cycle;
[0047] Specifically, in each PWM cycle, any number in the discrete random pulse position sequence is selected as the pulse position factor, and then the PWM pulse conduction position is calculated according to the pulse position factor and the pulse parameters.
[0048] Step S203, updating the parameters of the PWM controller according to the pulse conduction position and the pulse parameters so that the main output and complementary output of the PWM controller generate complementary and symmetrical PWM waveforms, obtaining a PWM switching signal, and controlling the switching state of the electronic device according to the PWM switching signal, wherein the main output is the positive polarity output of the PWM controller, and the complementary output is the negative polarity output of the PWM controller.
[0049] Specifically, the parameters of the PWM controller are updated according to the above-mentioned pulse conduction position and the above-mentioned pulse parameters, and more specifically, the upper limit reference value and the lower limit reference value of the comparison register in the PWM controller are updated. The upper limit reference value and the lower limit reference value of the comparison register are calculated according to the above-mentioned pulse conduction position and the above-mentioned pulse parameters, and the calculated value is written into the comparison register. The output signal of the PWM controller is controlled according to the upper limit reference value and the lower limit reference value, so that the main output and the complementary output of the PWM controller generate complementary and symmetrical PWM waveforms, and a PWM switching signal is obtained. Finally, the switching state of the electronic device is controlled according to the above-mentioned PWM switching signal.
[0050] In this embodiment, first, a discrete random pulse position sequence is generated based on a hash algorithm, and the discrete random pulse position sequence is a sequence formed by the output value of the hash algorithm; then, a pulse position factor corresponding to each PWM period is determined according to the discrete random pulse position sequence, and a pulse conduction position of each PWM period is calculated according to the pulse position factor and pulse parameters, the pulse conduction position is the actual delay of the pulse position in the current PWM period, the pulse position factor is the delay of the pulse position relative to the initial position in the current PWM period, and the pulse parameters include a triangular wave carrier frequency and a duty cycle; finally, the parameters of the PWM controller are updated according to the pulse conduction position and the pulse parameters so that the main output and the complementary output of the PWM controller generate complementary and symmetrical PWM waveforms to obtain a PWM switching signal, and the switching state of the electronic device is controlled according to the PWM switching signal, the main output is the positive polarity output of the PWM controller, and the complementary output is the negative polarity output of the PWM controller. The present application generates a pseudo-random number sequence through a hash algorithm to satisfy the cycle-by-cycle switching of electronic devices when switching at high switching frequencies, with a longer iteration cycle, and performs signal output control by randomly modulating the PWM pulse position factor within a set range and updating the sampling position in real time, so that the PWM harmonic energy generated by the high-frequency switching of electronic devices is dispersed into a wider frequency band, thereby enhancing the harmonic suppression effect of the random PWM technology. The present application solves the problem of poor high-frequency PWM harmonic suppression effect in the prior art.
[0051] In order to enable those skilled in the art to more clearly understand the technical solution of the present application, the implementation process of the discrete random pulse width modulation method of the present application will be described in detail below in conjunction with specific embodiments.
[0052] In order to enhance the periodicity of data iteration, in an optional implementation manner, the above step S201 includes:
[0053] Step S2011, obtaining a seed value and multiple sets of input data, wherein the seed value is used to initialize the hash function in the hash algorithm;
[0054] Step S2012, padding each group of the input data according to a set padding method to obtain multiple complete data blocks, wherein the set padding method is a method of padding the input data so that the data length of the input data meets the data requirement of the hash algorithm, and the complete data blocks correspond to the input data one by one;
[0055] Step S2013, a division step, dividing each of the above complete data blocks according to a set size, and obtaining multiple single data blocks according to a division order;
[0056] Step S2014, an input-output step, inputting the current single data block and the seed value into the hash function according to the division order, and outputting an intermediate result corresponding to the current single data block, where the current single data block is the single data block currently being processed;
[0057] Step S2015, repeat the steps, update the seed value to the intermediate result, repeat the input and output steps at least once until all the single data blocks corresponding to the complete data block are processed, and a hash value is obtained, and the hash value is the intermediate result corresponding to the last single data block;
[0058] Step S2016, repeating the above division step, the above input and output step and the above repeating step at least once in sequence until all the above complete data blocks are processed, and obtaining the above hash values corresponding to all the above complete data blocks;
[0059] Step S2017, forming the above-mentioned discrete random pulse position sequence according to all the above-mentioned hash values.
[0060] In the above embodiment, the input data is obtained by the microprocessor according to its own random number generation method, for example, by collecting white noise through ADC, collecting random address content, etc. First, each group of input data is padded so that its length meets specific requirements. The padding method is to add a bit "1" after the input data, and then add a sufficient number of 0s until the data length is 448 bits, and finally add a 64-bit data length at the end of the data to form 512-bit data, and the data formed by the final input data M and the padded data is used as the above complete data block; each group of the above complete data blocks is divided into multiple 512-bit single data blocks, and the 512-bit data block is divided into 16 32-bit data in sequence, recorded as M[0]...M
[15] , because the hash algorithm cannot directly process 512-bit data blocks. The SHA-1 algorithm uses five 32-bit seed values (H0, H1, H2, H3, H4) as the initial values of the hash value, and performs 80 steps of iterative operations on each single data block according to the fourth formula. The fourth formula SHA1(M1)=H0+f(t, B, C, D)+ROTATELEFT(A, 5)+E+Wt+Kt, where M1 is a single data block (512 bits, i.e., 64 bytes), H0, H1, H2, H3, H4 are five 32-bit initial variables, That is, the above seed value, A, B, C, D, E are the above intermediate results, corresponding to H0, H1, H2, H3, H4, f(t, B, C, D) is a logical function calculated according to the round number t and the values of B, C, D; ROTATELEFT(A, 5) means shifting A left by 5 bits, Wt is an intermediate variable in the SHA-1 algorithm, indicating the word after the message is expanded, Kt is an intermediate variable in the SHA-1 algorithm, indicating a constant, and + indicates an addition operation modulo 2^32. 80 steps of iteration are performed for each single data block. In each step, a new intermediate result is calculated based on the current single data block and the intermediate result of the previous step until the input data M completes the above calculation to obtain the final intermediate result as the hash value. Repeat the above division step, the above input and output step and the above repetition step at least once for all the above complete data blocks until all the above complete data blocks are processed, and the above hash values corresponding to all the above complete data blocks are obtained. A sequence is formed according to all the hash values, that is, the above random pulse position complete sequence. The SHA-1 algorithm has a longer iteration cycle, and the pseudo-random number sequence it generates can satisfy the cycle-by-cycle update requirements of SiC devices when switching at high switching frequencies.
[0061] To enhance applicability, in an optional implementation, the above includes:
[0062] Step S20171, convert all the above hash values into corresponding decimal integers;
[0063] Step S20172, performing shift operations on all the above decimal integers and mapping them to a set range to obtain mapping values corresponding to each of the above decimal integers;
[0064] Step S20173, generating the above-mentioned discrete random pulse position sequence according to all the above-mentioned mapping values.
[0065] In the above embodiment, the above setting range is a predetermined pulse position factor range [0, 1], and a sufficient number of hash values are generated using the SHA-1 hash algorithm, and the hash value of the hexadecimal string is converted into a corresponding integer, and then the generated integer mapping is shifted so that the value after the shift operation (i.e., the above mapping value) is within the predetermined pulse position factor range, and the final discrete random pulse position sequence is obtained, and the discrete random pulse position sequence is stored in the flash memory of the digital signal processor. The generation process is as follows: Figure 3 The discrete random pulse position sequence is generated based on the hash algorithm, which has the advantages of simple digital implementation, strong PWM harmonic suppression ability and wide application range.
[0066] In order to enhance the randomness of the discrete random pulse width modulation technology, in an optional implementation manner, the above step S202 includes:
[0067] Step S2021, randomly selecting a sequence value in the discrete random pulse position sequence in each of the PWM cycles, and determining the sequence value as the pulse position factor;
[0068] Step S2022, calculating the pulse conduction position of each PWM cycle according to the first formula, the first formula is: λ k is the above pulse position factor of the kth PWM cycle, β k is the pulse conduction position of the kth PWM cycle, f c is the above triangle wave carrier frequency, d k is the duty cycle of the kth PWM cycle.
[0069] In the above embodiment, within each PWM cycle, a random number in the discrete random pulse position sequence is selected and used as the pulse position factor of the pulse width modulation signal. After the pulse position factor is obtained, the pulse on position is calculated according to the above first formula. The time consumption and processor resource occupancy of the random PWM on position modulation based on the SHA-1 algorithm will be significantly less than other algorithms such as linear congruential and Mersenne rotation, and the randomness can be enhanced.
[0070] In order to generate a PWM waveform with a desired duty cycle, in an optional implementation, the above step S203 includes:
[0071] Step S2031, when the count value of the timer reaches the period value of the period register, the count value of the timer is controlled to be reset to zero and to be re-timed, and the output of the PWM controller is zero;
[0072] Step S2032, updating the upper limit reference value and the lower limit reference value of the comparison register according to the pulse conduction position and the pulse parameter, the upper limit reference value is the upper limit value of the output value of the comparison register, and the lower limit reference value is the lower limit value of the output value of the comparison register;
[0073] Step S2033, when the count value of the timer is greater than the lower limit reference value or the count value is greater than the lower limit reference value, controlling the main output and the complementary output of the PWM controller, the output signals of the main output and the complementary output are opposite, and controlling one of the main output and the complementary output to be a delayed output of the other;
[0074] Step S2034, obtaining the PWM switching signal according to the main output and the complementary output.
[0075] In the above embodiment, the time when the timer count value reaches the period value PRD of the period register is tx. When the time tx is reached, the timer count value Cnt returns to zero, and the PWM output is zero. Then, the upper limit reference value CMr0 of the comparison register and the lower limit reference value CMrl of the comparison register are calculated, and the upper limit reference value CMr0 and the lower limit reference value CMrl are written into the comparison register. The timer count value Cnt increases with the clock frequency fs over time. When the timer count value Cnt exceeds the upper limit reference value CMr0 and the lower limit reference value CMr1, the level change of the main output and the complementary output is controlled so that the main output and the complementary output are symmetrical about the sampling position, and a complementary symmetrical PWM waveform with random delay is realized.
[0076] In another embodiment, Figure 4 As shown, after step S2034, the next cycle sampling position i(x) is calculated according to the pulse conduction position, so that sampling is performed at the pulse center position to avoid superposition of current ripple in the sampling information: After calculating the sampling position i(x), the digital signal processor collects voltage / current and other signals at the i(x) position. The collected data is controlled by the closed-loop control algorithm. k+1 Calculate, and then calculate CMr0 and CMr1 to achieve x+1 At this moment, the timer count value Cnt returns to zero, the PWM output is zero, the calculated CMr0 and CMr1 are written into the comparison register, and the above steps S2032, S2033 and S2034 are repeated to perform a new round of calculation.
[0077] In order to ensure the accuracy of the data, in an optional implementation manner, the above step S2032 includes:
[0078] Step S20321, obtaining a delay time according to a ratio of the clock frequency of the timer to the triangular wave carrier frequency;
[0079] Step S20322, calculating the upper limit reference value of the comparison register according to the second formula, the second formula is CMr0 = PRD / 2 + d k ×PRD+β k ×f s +0.5×t dead ×f s , PRD is the above delay time, d k is the above duty cycle of the kth PWM cycle, β k is the pulse conduction position of the kth PWM cycle, f s is the above clock frequency, t dead is the dead time;
[0080] Step S20323, calculate the lower limit reference value of the comparison register according to the third formula, the third formula is CMr1 = PRD / 2-d k ×PRD+β k ×f s -0.5×t dead ×f s .
[0081] In the above embodiment, PRD=fs / fc, fs is the clock frequency of the digital signal processor PWM timer, the upper limit reference value of the above comparison register is calculated according to the second formula, the lower limit reference value of the above comparison register is calculated according to the third formula, and the upper limit reference value and the lower limit reference value are written into the comparison register to update the comparison register.
[0082] In order to enhance the PWM harmonic suppression effect, in an optional implementation manner, the above step S2033 includes:
[0083] Step S20331, when the count value of the timer is greater than the lower limit reference value, the signal of the complementary output of the PWM controller is controlled to be low level, and the signal of the main output of the PWM controller is controlled to be high level after the delay time;
[0084] Step S20332, when the count value of the timer is greater than the upper limit reference value, the signal controlling the main output of the PWM controller is at a low level, and the signal of the complementary output of the PWM controller is at a high level after the delay time.
[0085] In the above embodiment, CMr0 and CMr1 are written into the comparator register. The timer count value Cnt changes with time at the above clock frequency f. s When the timer count value Cnt exceeds the comparator lower limit reference value CMr1, the complementary output of the PWM controller immediately becomes low level, and the main output of the PWM controller is turned on through t dead After a delay, it becomes a high level. When the timer count value Cnt exceeds the comparator upper limit reference value CMr0, the main output of the PWM controller immediately becomes a low level, and the complementary output of the PWM controller is dead After the delay, it becomes a high level. At this time, the main output and complementary output of the PWM controller are symmetrical about the sampling position, realizing a complementary symmetrical PWM waveform with random delay.
[0086] In another embodiment, a DC-DC converter topology based on Sic MOSFET is taken as an example. Figure 5 As shown, S1 is a switch tube, U dc represents input power, D1 represents diode, L1 represents inductor, R1 represents load, C1 represents output filter capacitor, and the execution Figure 6 The digital implementation flow chart of the discrete random pulse width modulation technology shown in the figure generates a PWM switch signal and outputs it to S1, which controls the circuit according to the PWM switch signal. Figure 7 The voltage spectrum simulation diagram of the traditional PWM technology is shown in the figure. Figure 8 This is a voltage spectrum simulation diagram using discrete random pulse width modulation technology. Fig. 9 This is a simulation diagram of the common simulation using discrete random pulse width modulation technology. It can be seen that after using discrete random pulse width modulation technology, the voltage spectrum peak is significantly improved. The concentrated PWM harmonic energy is dispersed into a wider frequency band, improving the PWM harmonic suppression capability of the DC-DC converter.
[0087] It should be noted that the steps shown in the flowcharts of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and that, although a logical order is shown in the flowcharts, in some cases, the steps shown or described can be executed in an order different from that shown here.
[0088] The embodiment of the present application also provides a discrete random pulse width modulation device. It should be noted that the discrete random pulse width modulation device of the embodiment of the present application can be used to execute the discrete random pulse width modulation method provided by the embodiment of the present application. The device is used to implement the above-mentioned embodiments and preferred implementation modes, and the descriptions that have been made will not be repeated. As used below, the term "module" can implement a combination of software and / or hardware of a predetermined function. Although the device described in the following embodiments is preferably implemented in software, the implementation of hardware, or a combination of software and hardware, is also possible and conceived.
[0089] The discrete random pulse width modulation device provided in the embodiment of the present application is introduced below.
[0090] Fig.10 is a structural block diagram of a discrete random pulse width modulation device according to an embodiment of the present application. Fig.10 As shown, the device comprises:
[0091] A generating unit 10, configured to generate a discrete random pulse position sequence based on a hash algorithm, wherein the discrete random pulse position sequence is a sequence formed by output values of the hash algorithm;
[0092] Specifically, a sufficient number of hash values are generated using the SHA-1 hash algorithm to be used as discrete random pulse position factors later, and a final discrete random pulse position sequence is obtained based on all the hash values and stored in the flash memory of the digital signal processor.
[0093] A calculation unit 20, used to determine a pulse position factor corresponding to each PWM period according to the discrete random pulse position sequence, and calculate a pulse conduction position of each PWM period according to the pulse position factor and pulse parameters, wherein the pulse conduction position is an actual delay of the pulse position in the current PWM period, the pulse position factor is a delay of the pulse position relative to an initial position in the current PWM period, and the pulse parameters include a triangular wave carrier frequency and a duty cycle;
[0094] Specifically, in each PWM cycle, any number in the discrete random pulse position sequence is selected as the pulse position factor, and then the PWM pulse conduction position is calculated according to the pulse position factor and the pulse parameters.
[0095] The output unit 30 is used to update the parameters of the PWM controller according to the above-mentioned pulse conduction position and the above-mentioned pulse parameters so that the main output and the complementary output of the above-mentioned PWM controller generate complementary and symmetrical PWM waveforms, obtain a PWM switching signal, and control the switching state of the electronic device according to the above-mentioned PWM switching signal. The above-mentioned main output is the positive polarity output of the above-mentioned PWM controller, and the above-mentioned complementary output is the negative polarity output of the above-mentioned PWM controller.
[0096] Specifically, the parameters of the PWM controller are updated according to the above-mentioned pulse conduction position and the above-mentioned pulse parameters, and more specifically, the upper limit reference value and the lower limit reference value of the comparison register in the PWM controller are updated. The upper limit reference value and the lower limit reference value of the comparison register are calculated according to the above-mentioned pulse conduction position and the above-mentioned pulse parameters, and the calculated value is written into the comparison register. The output signal of the PWM controller is controlled according to the upper limit reference value and the lower limit reference value, so that the main output and the complementary output of the PWM controller generate complementary and symmetrical PWM waveforms, and a PWM switching signal is obtained. Finally, the switching state of the electronic device is controlled according to the above-mentioned PWM switching signal.
[0097] In this embodiment, the generating unit is used to generate a discrete random pulse position sequence based on a hash algorithm, and the discrete random pulse position sequence is a sequence formed by the output value of the hash algorithm; the calculating unit is used to determine the pulse position factor corresponding to each PWM cycle according to the discrete random pulse position sequence, and calculate the pulse conduction position of each PWM cycle according to the pulse position factor and the pulse parameter, the pulse conduction position is the actual delay of the pulse position in the current PWM cycle, the pulse position factor is the delay of the pulse position relative to the initial position in the current PWM cycle, one PWM cycle corresponds to one pulse position factor, and the pulse parameters include a triangular wave carrier frequency and a duty cycle; the output unit is used to update the parameters of the PWM controller according to the pulse conduction position and the pulse parameters so that the main output and the complementary output of the PWM controller generate complementary and symmetrical PWM waveforms, obtain a PWM switching signal, and control the switching state of the electronic device according to the PWM switching signal, the main output is the positive polarity output of the PWM controller, and the complementary output is the negative polarity output of the PWM controller. The present application generates a pseudo-random number sequence through a hash algorithm to satisfy the cycle-by-cycle switching of electronic devices when switching at high switching frequencies, with a longer iteration cycle, and performs signal output control by randomly modulating the PWM pulse position factor within a set range and updating the sampling position in real time, so that the PWM harmonic energy generated by the high-frequency switching of electronic devices is dispersed into a wider frequency band, thereby enhancing the harmonic suppression effect of the random PWM technology. The present application solves the problem of poor high-frequency PWM harmonic suppression effect in the prior art.
[0098] In order to enhance the periodicity of data iteration, in an optional implementation manner, the generation unit includes:
[0099] An acquisition module is used to acquire a seed value and multiple sets of input data, wherein the seed value is used to initialize a hash function in the hash algorithm;
[0100] A filling module, which fills each group of the input data according to a set filling method to obtain multiple complete data blocks, wherein the set filling method is a method of padding the input data so that the data length of the input data meets the data requirement of the hash algorithm, and the complete data blocks correspond to the input data one by one;
[0101] A partitioning module, used to execute the partitioning step, partition each of the above complete data blocks according to a set size, and obtain multiple single data blocks according to the partitioning order;
[0102] An input-output module, used to execute the input-output step, input the current single data block and the seed value into the hash function according to the division order, and output an intermediate result corresponding to the current single data block, where the current single data block is the single data block currently being processed;
[0103] A first repeating module is used to execute the repeating step, update the seed value to the intermediate result, repeat the input and output steps at least once until all the single data blocks corresponding to the complete data block are processed, and obtain a hash value, where the hash value is the intermediate result corresponding to the last single data block;
[0104] A second repetition module repeats the division step, the input / output step and the repetition step at least once in sequence until all the complete data blocks are processed, thereby obtaining the hash values corresponding to all the complete data blocks;
[0105] A forming module is used to form the above-mentioned discrete random pulse position sequence according to all the above-mentioned hash values.
[0106] In the above embodiment, the input data is obtained by the microprocessor according to its own random number generation method, for example, by collecting white noise through ADC, collecting random address content, etc. First, each group of input data is padded so that its length meets specific requirements. The padding method is to add a bit "1" after the input data, and then add a sufficient number of 0s until the data length is 448 bits, and finally add a 64-bit data length at the end of the data to form 512-bit data, and the data formed by the final input data M and the padded data is used as the above complete data block; each group of the above complete data blocks is divided into multiple 512-bit single data blocks, and the 512-bit data block is divided into 16 32-bit data in sequence, recorded as M[0]...M
[15] , because the hash algorithm cannot directly process 512-bit data blocks. The SHA-1 algorithm uses five 32-bit seed values (H0, H1, H2, H3, H4) as the initial values of the hash value, and performs 80 steps of iterative operations on each single data block according to the fourth formula. The fourth formula is SHA1(M1)=H0+f(t, B, C, D)++ROTATELEFT(A, 5)+E+Wt+Kt, where M1 is a single data block (512 bits, i.e., 64 bytes), H0, H1, H2, H3, H4 are five 32-bit initial variables, That is, the above seed value, A, B, C, D, E are the above intermediate results, corresponding to H0, H1, H2, H3, H4, f(t, B, C, D) is a logical function calculated according to the round number t and the values of B, C, D; ROTATELEFT(A, 5) means shifting A left by 5 bits, Wt is an intermediate variable in the SHA-1 algorithm, indicating the word after the message is expanded, Kt is an intermediate variable in the SHA-1 algorithm, indicating a constant, and + indicates an addition operation modulo 2^32. 80 steps of iteration are performed for each single data block. In each step, a new intermediate result is calculated based on the current single data block and the intermediate result of the previous step until the input data M completes the above calculation to obtain the final intermediate result as the hash value. Repeat the above division step, the above input and output step and the above repetition step at least once for all the above complete data blocks until all the above complete data blocks are processed, and the above hash values corresponding to all the above complete data blocks are obtained. A sequence is formed according to all the hash values, that is, the above random pulse position complete sequence. The SHA-1 algorithm has a longer iteration cycle, and the pseudo-random number sequence it generates can satisfy the cycle-by-cycle update requirements of SiC devices when switching at high switching frequencies.
[0107] In order to enhance applicability, in an optional implementation, the above-mentioned forming module includes:
[0108] The conversion submodule converts all the above hash values into corresponding decimal integers;
[0109] A mapping submodule performs shift operations on all the above decimal integers and maps them into a set range to obtain mapping values corresponding to each of the above decimal integers;
[0110] A generation submodule generates the above discrete random pulse position sequence according to all the above mapping values.
[0111] In the above embodiment, the above setting range is a predetermined pulse position factor range [0, 1], and a sufficient number of hash values are generated using the SHA-1 hash algorithm, and the hash value of the hexadecimal string is converted into a corresponding integer, and then the generated integer mapping is shifted so that the value after the shift operation (i.e., the above mapping value) is within the predetermined pulse position factor range, and the final discrete random pulse position sequence is obtained, and the discrete random pulse position sequence is stored in the flash memory of the digital signal processor. The generation process is as follows: Figure 3 The discrete random pulse position sequence is generated based on the hash algorithm, which has the advantages of simple digital implementation, strong PWM harmonic suppression ability and wide application range.
[0112] In order to enhance the randomness of the discrete random pulse width modulation technology, in an optional implementation manner, the above-mentioned calculation unit includes:
[0113] A selection module randomly selects a sequence value in the discrete random pulse position sequence in each of the PWM cycles, and determines the sequence value as the pulse position factor;
[0114] A calculation module calculates the pulse conduction position of each PWM cycle according to a first formula, wherein the first formula is: λ k is the above pulse position factor of the kth PWM cycle, β k is the pulse conduction position of the kth PWM cycle, f c is the above triangle wave carrier frequency, d k is the duty cycle of the kth PWM cycle.
[0115] In the above embodiment, within each PWM cycle, a random number in the discrete random pulse position sequence is selected and used as the pulse position factor of the pulse width modulation signal. After the pulse position factor is obtained, the pulse on position is calculated according to the above first formula. The time consumption and processor resource occupancy of the random PWM on position modulation based on the SHA-1 algorithm will be significantly less than other algorithms such as linear congruential and Mersenne rotation, and the randomness can be enhanced.
[0116] In order to generate a PWM waveform with a desired duty cycle, in an optional implementation, the output unit includes:
[0117] A first control module controls the count value of the timer to be reset to zero and restart the timing when the count value of the timer reaches the period value of the period register, and the output of the PWM controller is zero;
[0118] An updating module, which updates an upper limit reference value and a lower limit reference value of the comparison register according to the pulse conduction position and the pulse parameter, wherein the upper limit reference value is an upper limit value of an output value of the comparison register, and the lower limit reference value is a lower limit value of the output value of the comparison register;
[0119] A second control module, when the count value of the timer is greater than the lower limit reference value or the count value is greater than the lower limit reference value, controls the main output and the complementary output of the PWM controller, the output signals of the main output and the complementary output are opposite, and controls one of the main output and the complementary output to be a delayed output of the other;
[0120] The output module obtains the PWM switching signal according to the main output and the complementary output.
[0121] In the above embodiment, the time when the timer count value reaches the period value PRD of the period register is tx. When the time tx is reached, the timer count value Cnt returns to zero, and the PWM output is zero. Then, the upper limit reference value CMr0 of the comparison register and the lower limit reference value CMr1 of the comparison register are calculated, and the upper limit reference value CMr0 and the lower limit reference value CMr1 are written into the comparison register. The timer count value Cnt increases with the clock frequency fs over time. When the timer count value Cnt exceeds the upper limit reference value CMr0 and the lower limit reference value CMr1, the level change of the main output and the complementary output is controlled so that the main output and the complementary output are symmetrical about the sampling position, and a complementary symmetrical PWM waveform with random delay is realized.
[0122] In another embodiment, Figure 4 As shown, after the output module, the sampling position i(x) of the next cycle is calculated according to the pulse conduction position, so that sampling is performed at the center of the pulse to avoid superposition of current ripple in the sampling information: After calculating the sampling position i(x), the digital signal processor collects voltage / current and other signals at the i(x) position. The collected data is controlled by the closed-loop control algorithm. k+1 Calculate, and then calculate CMr0 and CMr1 to achieve x+1 At this moment, the timer count value Cnt returns to zero, the PWM output is zero, the calculated CMr0 and CMr1 are written into the comparison register, and the update module, the second control module and the output module are repeatedly entered to perform a new round of calculation.
[0123] In order to ensure the accuracy of the data, in an optional implementation manner, the first control module includes:
[0124] A first calculation submodule, obtaining a delay time according to a ratio of a clock frequency of the timer to a frequency of the triangular wave carrier wave;
[0125] The second calculation submodule calculates the upper limit reference value of the comparison register according to the second formula. The second formula is CMr0=PRD / 2+d k ×PRD+β k ×f s +0.5×t dead ×f s , PRD is the above delay time, d k is the above duty cycle of the kth PWM cycle, β k is the pulse conduction position of the kth PWM cycle, f s is the above clock frequency, t dead is the dead time;
[0126] The third calculation submodule calculates the lower limit reference value of the comparison register according to the third formula. The third formula is CMr1 = PRD / 2-d k ×PRD+β k ×f s -0.5×t dead ×f s .
[0127] In the above embodiment, PRD=fs / fc, fs is the clock frequency of the digital signal processor PWM timer, the upper limit reference value of the above comparison register is calculated according to the second formula, the lower limit reference value of the above comparison register is calculated according to the third formula, and the upper limit reference value and the lower limit reference value are written into the comparison register to update the comparison register.
[0128] In order to enhance the PWM harmonic suppression effect, in an optional implementation manner, the above step S2033 includes:
[0129] Step S20331, when the count value of the timer is greater than the lower limit reference value, the signal of the complementary output of the PWM controller is controlled to be low level, and the signal of the main output of the PWM controller is controlled to be high level after the delay time;
[0130] Step S20332, when the count value of the timer is greater than the upper limit reference value, the signal controlling the main output of the PWM controller is at a low level, and the signal of the complementary output of the PWM controller is at a high level after the delay time.
[0131] In the above embodiment, CMr0 and CMr1 are written into the comparator register. The timer count value Cnt changes with time at the above clock frequency f. s When the timer count value Cnt exceeds the comparator lower limit reference value CMr1, the complementary output of the PWM controller immediately becomes low level, and the main output of the PWM controller is turned on through t dead After a delay, it becomes a high level. When the timer count value Cnt exceeds the comparator upper limit reference value CMr0, the main output of the PWM controller immediately becomes a low level, and the complementary output of the PWM controller is dead After the delay, it becomes a high level. At this time, the main output and complementary output of the PWM controller are symmetrical about the sampling position, realizing a complementary symmetrical PWM waveform with random delay.
[0132] In another embodiment, a DC-DC converter topology based on Sic MOSFET is taken as an example. Figure 5 As shown, S1 is a switch tube, U dc represents input power, D1 represents diode, L1 represents inductor, R1 represents load, C1 represents output filter capacitor, and the execution Figure 6 The digital implementation flow chart of the discrete random pulse width modulation technology shown in the figure generates a PWM switch signal and outputs it to S1, which controls the circuit according to the PWM switch signal. Figure 7 The voltage spectrum simulation diagram of the traditional PWM technology is shown in the figure. Figure 8 This is a voltage spectrum simulation diagram using discrete random pulse width modulation technology. Fig. 9 This is a simulation diagram of the common simulation using discrete random pulse width modulation technology. It can be seen that after using discrete random pulse width modulation technology, the voltage spectrum peak is significantly improved. The concentrated PWM harmonic energy is dispersed into a wider frequency band, improving the PWM harmonic suppression capability of the DC-DC converter.
[0133] The discrete random pulse width modulation device includes a processor and a memory. The generation unit, calculation unit and output unit are stored in the memory as program units, and the processor executes the program units stored in the memory to realize the corresponding functions. The modules are all located in the same processor; or, the modules are located in different processors in any combination.
[0134] The processor includes a kernel, which calls the corresponding program unit from the memory. One or more kernels can be set, and the problem of poor high-frequency PWM harmonic suppression effect in the prior art can be solved by adjusting kernel parameters.
[0135] The memory may include non-permanent memory in a computer-readable medium, random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM, and the memory includes at least one memory chip.
[0136] An embodiment of the present invention provides a computer-readable storage medium, wherein the computer-readable storage medium includes a stored program, wherein when the program is executed, the device where the computer-readable storage medium is located is controlled to execute the discrete random pulse width modulation method.
[0137] Specifically, the discrete random pulse width modulation method includes:
[0138] Step S201, generating a discrete random pulse position sequence based on a hash algorithm, wherein the discrete random pulse position sequence is a sequence formed by output values of the hash algorithm;
[0139] Step S202, determining a pulse position factor corresponding to each PWM cycle according to the discrete random pulse position sequence, and calculating a pulse conduction position of each PWM cycle according to the pulse position factor and pulse parameters, wherein the pulse conduction position is an actual delay of the pulse position in the current PWM cycle, the pulse position factor is a delay of the pulse position relative to the initial position in the current PWM cycle, and the pulse parameters include a triangular wave carrier frequency and a duty cycle;
[0140] Step S203, updating the parameters of the PWM controller according to the pulse conduction position and the pulse parameters so that the main output and complementary output of the PWM controller generate complementary and symmetrical PWM waveforms, obtaining a PWM switching signal, and controlling the switching state of the electronic device according to the PWM switching signal, wherein the main output is the positive polarity output of the PWM controller, and the complementary output is the negative polarity output of the PWM controller.
[0141] An embodiment of the present invention provides a processor, and the processor is used to run a program, wherein the discrete random pulse width modulation method is executed when the program is run.
[0142] Specifically, the discrete random pulse width modulation method includes:
[0143] Step S201, generating a discrete random pulse position sequence based on a hash algorithm, wherein the discrete random pulse position sequence is a sequence formed by output values of the hash algorithm;
[0144] Step S202, determining a pulse position factor corresponding to each PWM cycle according to the discrete random pulse position sequence, and calculating a pulse conduction position of each PWM cycle according to the pulse position factor and pulse parameters, wherein the pulse conduction position is an actual delay of the pulse position in the current PWM cycle, the pulse position factor is a delay of the pulse position relative to the initial position in the current PWM cycle, and the pulse parameters include a triangular wave carrier frequency and a duty cycle;
[0145] Step S203, updating the parameters of the PWM controller according to the pulse conduction position and the pulse parameters so that the main output and complementary output of the PWM controller generate complementary and symmetrical PWM waveforms, obtaining a PWM switching signal, and controlling the switching state of the electronic device according to the PWM switching signal, wherein the main output is the positive polarity output of the PWM controller, and the complementary output is the negative polarity output of the PWM controller.
[0146] An embodiment of the present invention provides a discrete random pulse width modulation system, the discrete random pulse width modulation system comprising a processor, a memory, and a program stored in the memory and executable on the processor, and when the processor executes the program, at least the following steps are implemented:
[0147] Step S201, generating a discrete random pulse position sequence based on a hash algorithm, wherein the discrete random pulse position sequence is a sequence formed by output values of the hash algorithm;
[0148] Step S202, determining a pulse position factor corresponding to each PWM cycle according to the discrete random pulse position sequence, and calculating a pulse conduction position of each PWM cycle according to the pulse position factor and pulse parameters, wherein the pulse conduction position is an actual delay of the pulse position in the current PWM cycle, the pulse position factor is a delay of the pulse position relative to the initial position in the current PWM cycle, and the pulse parameters include a triangular wave carrier frequency and a duty cycle;
[0149] Step S203, updating the parameters of the PWM controller according to the pulse conduction position and the pulse parameters so that the main output and complementary output of the PWM controller generate complementary and symmetrical PWM waveforms, obtaining a PWM switching signal, and controlling the switching state of the electronic device according to the PWM switching signal, wherein the main output is the positive polarity output of the PWM controller, and the complementary output is the negative polarity output of the PWM controller.
[0150] The present application also provides a computer program product, which, when executed on a data processing device, is suitable for executing a program for initializing at least the following method steps:
[0151] Step S201, generating a discrete random pulse position sequence based on a hash algorithm, wherein the discrete random pulse position sequence is a sequence formed by output values of the hash algorithm;
[0152] Step S202, determining a pulse position factor corresponding to each PWM cycle according to the discrete random pulse position sequence, and calculating a pulse conduction position of each PWM cycle according to the pulse position factor and pulse parameters, wherein the pulse conduction position is an actual delay of the pulse position in the current PWM cycle, the pulse position factor is a delay of the pulse position relative to the initial position in the current PWM cycle, and the pulse parameters include a triangular wave carrier frequency and a duty cycle;
[0153] Step S203, updating the parameters of the PWM controller according to the pulse conduction position and the pulse parameters so that the main output and complementary output of the PWM controller generate complementary and symmetrical PWM waveforms, obtaining a PWM switching signal, and controlling the switching state of the electronic device according to the PWM switching signal, wherein the main output is the positive polarity output of the PWM controller, and the complementary output is the negative polarity output of the PWM controller.
[0154] Obviously, those skilled in the art should understand that the above modules or steps of the present invention can be implemented by a general computing device, they can be concentrated on a single computing device, or distributed on a network composed of multiple computing devices, they can be implemented by a program code executable by a computing device, so that they can be stored in a storage device and executed by the computing device, and in some cases, the steps shown or described can be executed in a different order than here, or they can be made into individual integrated circuit modules, or multiple modules or steps therein can be made into a single integrated circuit module for implementation. Thus, the present invention is not limited to any specific combination of hardware and software.
[0155] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented in one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that include computer-usable program code.
[0156] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0157] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0158] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 A step that specifies a function in one or more boxes.
[0159] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.
[0160] The memory may include non-permanent memory in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. The memory is an example of a computer-readable medium.
[0161] Computer readable media include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. Information can be computer readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include temporary computer readable media (transitory media), such as modulated data signals and carrier waves.
[0162] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, commodity or device including the elements.
[0163] From the above description, it can be seen that the above embodiments of the present application achieve the following technical effects:
[0164] 1) The discrete random pulse width modulation method of the present application first generates a discrete random pulse position sequence based on a hash algorithm, wherein the discrete random pulse position sequence is a sequence formed by the output value of the hash algorithm; then, the pulse position factor corresponding to each PWM cycle is determined according to the discrete random pulse position sequence, and the pulse conduction position of each PWM cycle is calculated according to the pulse position factor and pulse parameters, wherein the pulse conduction position is the actual delay of the pulse position in the current PWM cycle, the pulse position factor is the delay of the pulse position relative to the initial position in the current PWM cycle, and the pulse parameters include a triangular wave carrier frequency and a duty cycle; finally, the parameters of the PWM controller are updated according to the pulse conduction position and the pulse parameters so that the main output and the complementary output of the PWM controller generate complementary and symmetrical PWM waveforms to obtain a PWM switching signal, and the switching state of the electronic device is controlled according to the PWM switching signal, wherein the main output is the positive polarity output of the PWM controller, and the complementary output is the negative polarity output of the PWM controller. The present application generates a pseudo-random number sequence through a hash algorithm to satisfy the cycle-by-cycle switching of electronic devices when switching at high switching frequencies, with a longer iteration cycle, and performs signal output control by randomly modulating the PWM pulse position factor within a set range and updating the sampling position in real time, so that the PWM harmonic energy generated by the high-frequency switching of electronic devices is dispersed into a wider frequency band, thereby enhancing the harmonic suppression effect of the random PWM technology. The present application solves the problem of poor high-frequency PWM harmonic suppression effect in the prior art.
[0165] 2) The discrete random pulse width modulation device of the present application comprises a generating unit, which is used to generate a discrete random pulse position sequence based on a hash algorithm, wherein the discrete random pulse position sequence is a sequence formed by the output value of the hash algorithm; a calculating unit, which is used to determine the pulse position factor corresponding to each PWM cycle according to the discrete random pulse position sequence, and calculate the pulse conduction position of each PWM cycle according to the pulse position factor and the pulse parameter, wherein the pulse conduction position is the actual delay of the pulse position in the current PWM cycle, the pulse position factor is the delay of the pulse position relative to the initial position in the current PWM cycle, one PWM cycle corresponds to one pulse position factor, and the pulse parameters include a triangular wave carrier frequency and a duty cycle; an output unit, which is used to update the parameters of the PWM controller according to the pulse conduction position and the pulse parameter so that the main output and the complementary output of the PWM controller generate complementary and symmetrical PWM waveforms, obtain a PWM switching signal, and control the switching state of the electronic device according to the PWM switching signal, wherein the main output is the positive polarity output of the PWM controller, and the complementary output is the negative polarity output of the PWM controller. The present application generates a pseudo-random number sequence through a hash algorithm to satisfy the cycle-by-cycle switching of electronic devices when switching at high switching frequencies, with a longer iteration cycle, and performs signal output control by randomly modulating the PWM pulse position factor within a set range and updating the sampling position in real time, so that the PWM harmonic energy generated by the high-frequency switching of electronic devices is dispersed into a wider frequency band, thereby enhancing the harmonic suppression effect of the random PWM technology. The present application solves the problem of poor high-frequency PWM harmonic suppression effect in the prior art.
[0166] The above description is only the preferred embodiment of the present application and is not intended to limit the present application. For those skilled in the art, the present application may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application shall be included in the protection scope of the present application.
Claims
1. A discrete random pulse width modulation method, characterized in that: include: Generate a discrete random pulse position sequence based on a hash algorithm, wherein the discrete random pulse position sequence is a sequence formed by output values of the hash algorithm; Determine a pulse position factor corresponding to each PWM cycle according to the discrete random pulse position sequence, and calculate a pulse conduction position of each PWM cycle according to the pulse position factor and pulse parameters, wherein the pulse conduction position is an actual delay of a pulse position in a current PWM cycle, the pulse position factor is a delay of the pulse position relative to an initial position in the current PWM cycle, and the pulse parameters include a triangular wave carrier frequency and a duty cycle; The parameters of the PWM controller are updated according to the pulse conduction position and the pulse parameters so that the main output and complementary output of the PWM controller generate complementary and symmetrical PWM waveforms, a PWM switching signal is obtained, and the switching state of the electronic device is controlled according to the PWM switching signal, the main output is the positive polarity output of the PWM controller, and the complementary output is the negative polarity output of the PWM controller.
2. The method according to claim 1, characterized in that Generates a discrete random pulse position sequence based on a hash algorithm, including: Obtaining a seed value and multiple sets of input data, wherein the seed value is used to initialize a hash function in the hash algorithm; Fill each group of the input data according to a set filling method to obtain multiple complete data blocks, wherein the set filling method is a method of padding the input data so that the data length of the input data meets the data requirement of the hash algorithm, and the complete data blocks correspond to the input data one by one; a division step, dividing each of the complete data blocks according to a set size, and obtaining a plurality of single data blocks according to a division order; An input-output step, inputting the current single data block and the seed value into the hash function according to the division order, and outputting an intermediate result corresponding to the current single data block, wherein the current single data block is the single data block currently being processed; Repeating the step, updating the seed value to the intermediate result, repeating the input and output steps at least once until all the single data blocks corresponding to the complete data block are processed, and obtaining a hash value, wherein the hash value is the intermediate result corresponding to the last single data block; Repeating the dividing step, the inputting and outputting step, and the repeating step at least once in sequence until all the complete data blocks are processed, and obtaining the hash values corresponding to all the complete data blocks; The discrete random pulse position sequence is formed according to all of the hash values.
3. The method according to claim 2, characterized in that Forming the discrete random pulse position sequence according to all the hash values comprises: Convert all of the hash values into corresponding decimal integers; Perform shift operations on all the decimal integers and map them into a set range to obtain mapping values corresponding to each decimal integer; The discrete random pulse position sequence is generated according to all of the mapped values.
4. The method according to claim 1, characterized in that: Determining a pulse position factor corresponding to each PWM period according to the discrete random pulse position sequence, and calculating a pulse conduction position of each PWM period according to the pulse position factor and a pulse parameter, including: Randomly selecting a sequence value in the discrete random pulse position sequence in each PWM period, and determining the sequence value as the pulse position factor; The pulse conduction position of each PWM cycle is calculated according to a first formula, wherein the first formula is: λ k is the pulse position factor of the kth PWM cycle, β k is the pulse conduction position of the kth PWM cycle, f c is the triangle wave carrier frequency, d k is the duty cycle of the kth PWM cycle.
5. The method according to claim 1, characterized in that The PWM controller includes a comparison register and a cycle register, and updates the parameters of the PWM controller according to the pulse conduction position and the pulse parameters so that the main output and the complementary output of the PWM controller generate complementary and symmetrical PWM waveforms to obtain a PWM switching signal, including: When the count value of the timer reaches the period value of the period register, the count value of the timer is controlled to return to zero and restart timing, and the output of the PWM controller is zero; updating an upper limit reference value and a lower limit reference value of the comparison register according to the pulse conduction position and the pulse parameter, wherein the upper limit reference value is an upper limit value of an output value of the comparison register, and the lower limit reference value is a lower limit value of the output value of the comparison register; When the count value of the timer is greater than the lower limit reference value or the count value is greater than the lower limit reference value, the main output and the complementary output of the PWM controller are controlled, the output signals of the main output and the complementary output are opposite, and one of the main output and the complementary output is controlled to be output when the other is delayed; The PWM switching signal is obtained according to the main output and the complementary output.
6. The method according to claim 5, characterized in that Updating the upper limit reference value and the lower limit reference value of the comparison register according to the pulse conduction position and the pulse parameter, including: Obtaining a delay time according to a ratio of a clock frequency of the timer to a frequency of the triangular wave carrier wave; The upper limit reference value of the comparison register is calculated according to the second formula, wherein the second formula is CMr0=PRD / 2+d k ×PRD+β k ×f s +0.5×t dead ×f s , PRD is the delay time, d k is the duty cycle of the kth PWM cycle, β k is the pulse conduction position of the kth PWM cycle, f s is the clock frequency, t dead is the dead time; The lower limit reference value of the comparison register is calculated according to the third formula, and the third formula is CMr1=PRD / 2-d k ×PRD+β k ×f s -0.5×t dead ×f s .
7. The method according to claim 6, characterized in that In a case where the count value of the timer is greater than the lower limit reference value or the count value is greater than the lower limit reference value, controlling the main output and the complementary output of the PWM controller comprises: When the count value of the timer is greater than the lower limit reference value, the signal of the complementary output of the PWM controller is controlled to be at a low level, and the signal of the main output of the PWM controller is controlled to be at a high level after the delay time; When the count value of the timer is greater than the upper limit reference value, the signal controlling the main output of the PWM controller is at a low level, and the signal of the complementary output of the PWM controller is at a high level after the delay time.
8. A discrete random pulse width modulation device, characterized in that: The device comprises: A generating unit, configured to generate a discrete random pulse position sequence based on a hash algorithm, wherein the discrete random pulse position sequence is a sequence formed by output values of the hash algorithm; a calculation unit, configured to determine a pulse position factor corresponding to each PWM cycle according to the discrete random pulse position sequence, and calculate a pulse conduction position of each PWM cycle according to the pulse position factor and pulse parameters, wherein the pulse conduction position is an actual delay of a pulse position in a current PWM cycle, the pulse position factor is a delay of the pulse position relative to an initial position in the current PWM cycle, one PWM cycle corresponds to one pulse position factor, and the pulse parameters include a triangular wave carrier frequency and a duty cycle; An output unit is used to update the parameters of the PWM controller according to the pulse conduction position and the pulse parameters so that the main output and complementary output of the PWM controller generate complementary and symmetrical PWM waveforms, obtain a PWM switching signal, and control the switching state of the electronic device according to the PWM switching signal, wherein the main output is the positive polarity output of the PWM controller, and the complementary output is the negative polarity output of the PWM controller.
9. A computer-readable storage medium, characterized in that: The computer-readable storage medium includes a stored program, wherein when the program is executed, the device where the computer-readable storage medium is located is controlled to execute the method according to any one of claims 1 to 7.
10. A computer program product comprising computer instructions, characterized in that: When the computer instructions are executed by a processor, the method according to any one of claims 1 to 7 is implemented.
Citation Information
Cited By
Low common mode PWM (Pulse Width Modulation) method of electric energy conversion module
CN119727329A
