Disclosure of Invention
The invention aims to solve the technical problems that in the prior art, the analog circuit is large in area and high in power consumption, and provides a simple SPWM digital generation system and method based on pulse sampling based on the design trend of small size and low power consumption of an underwater communication node.
The technical scheme adopted by the invention for solving the technical problems is as follows:
the invention provides a simple SPWM digital generation system based on pulse sampling, which realizes an SPWM wave generation algorithm based on pulse sampling points through a software control process of a DSP hardware platform, the algorithm samples an analog signal by adopting a sampling pulse with the same frequency as the SPWM wave, calculates the SPWM wave duty ratio by taking the current sampling value as a standard, and realizes the generation of the SPWM wave.
Further, the system of the present invention comprises the following units:
the transmitting signal waveform generating unit is used for generating a discrete form of a required transmitting signal in the DSP and determining a specific format required by transmitting data;
the SPWM duty cycle calculation unit is used for selecting a proper duty cycle range and SPWM wave frequency according to the signal form and the emission performance of the power amplification system, and calculating duty cycle data by adopting an SPWM wave generation algorithm based on pulse sampling points;
the timer polling unit is used for configuring a timer in the DSP into a cycle counting mode, and inquiring the current value of the timer in a polling mode so as to judge whether the SPWM sends a complete cycle;
and the GPIO logic control unit is used for making a GPIO logic judgment criterion according to the difference of the system peripherals and determining the GPIO output level and duration time by comparing the current value of the timer with the amplitude of the duty ratio data.
Further, the method for implementing the SPWM wave generation algorithm based on the pulse sampling points in the system specifically comprises the following steps:
sampling an analog signal through a sampling pulse with the same frequency as the SPWM wave, calculating the SPWM wave duty ratio by taking the current sampling value as a standard, and simply calculating the formula of the duty ratio:
wherein d is the duty cycle, s is the current sampling value of the signal, and p is the SPWM wave period.
The invention provides a simple SPWM digital generation method based on pulse sampling, which comprises the following steps:
s1, generating a transmitting signal waveform: generating a discrete form of a required sending signal in the DSP, and determining a specific format required by sending data;
s2, SPWM duty ratio calculation: selecting a proper duty ratio range and an SPWM wave frequency according to the signal form and the emission performance of the power amplification system, and calculating duty ratio data by adopting a sampling point method;
s3, timer polling: the timer in the DSP is configured into a cycle counting mode, and the current value of the timer is inquired in a polling mode so as to judge whether the SPWM sends a complete cycle;
s4, GPIO logic control: and (4) formulating a GPIO logic judgment criterion according to the difference of the peripheral equipment of the system, and determining the GPIO output level and duration time by comparing the current value of the timer with the amplitude of duty ratio data.
The invention has the following beneficial effects: the simple SPWM digital generation system and method based on pulse sampling have the advantages that the analog circuit is reduced in large area, and the product volume is reduced; optimizing the algorithm, and calculating by adopting a sampling point method, wherein the increase of the calculated amount is within an acceptable range; the requirement on the peripheral of the microprocessor is low, and only one timer and programmable GPIO are needed; the reduction of electronic chips leads to considerable reduction of system cost and power consumption. Compared with the traditional triangular wave interception method, the sampling point method optimizes the algorithm, and meanwhile, the loss of signal frequency components and the loss of energy detected by a matched filter are only about 2%.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more apparent, the present invention is described in further detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
The simple SPWM digital generation system based on pulse sampling realizes an SPWM wave generation algorithm based on pulse sampling points through a software control process of a DSP hardware platform, the algorithm samples an analog signal by adopting sampling pulses with the same frequency as the SPWM waves, calculates the SPWM wave duty ratio by taking the current sampling value as a standard, and realizes the generation of the SPWM waves.
The DSP in the embodiment of the invention adopts TMS320C 6748. The system comprises the following units:
the transmitting signal waveform generating unit is used for generating a discrete form of a required transmitting signal in the DSP and determining a specific format required by transmitting data;
the SPWM duty cycle calculation unit is used for selecting a proper duty cycle range and SPWM wave frequency according to the signal form and the emission performance of the power amplification system, and calculating duty cycle data by adopting an SPWM wave generation algorithm based on pulse sampling points;
the timer polling unit is used for configuring a timer in the DSP into a cycle counting mode, and inquiring the current value of the timer in a polling mode so as to judge whether the SPWM sends a complete cycle;
and the GPIO logic control unit is used for making a GPIO logic judgment criterion according to the difference of the system peripherals and determining the GPIO output level and duration time by comparing the current value of the timer with the amplitude of the duty ratio data.
As shown in fig. 1, a classic SPWM modulation signal generation system is mainly composed of a digital processor, a triangular wave generator, a comparator, and the like.
On the basis of the existing system, in order to reduce the operation link and the operation amount, the existing SPWM generation method is improved and compared, and the schematic diagrams of the method are shown in fig. 2 and fig. 3.
And comparing the performances of two methods before and after improvement, namely an interception method and a sampling point method. As shown in fig. 4, 5 and 6, it can be seen that, in the range of the minimum duty ratio of 0-0.4, after the SPWM waves generated by the two methods are low-pass filtered, the correlation peak can be identified by the matched filter; the energy loss of the sampling point method is about 2 percent relative to the triangular wave interception method, the basic performance is equivalent, and the SPWM wave generated by the sampling point method is feasible. The correlation peak-to-peak value is inversely related to the minimum duty cycle, and when the minimum duty cycle is increased, the correlation peak-to-peak value is decreased proportionally. The more the SPWM wave duty ratio tends to an extreme value, the worse the output waveform of the power amplification circuit is. And selecting a proper minimum duty ratio according to the difference of the power amplifiers, so that the energy loss of the SPWM signal is minimized on the premise that the output waveform of the power amplifier is not distorted. From the results, the SPWM wave generation method based on the pulse sampling values can be practically applied.
The correlation peak of the output of the matched filter can be seen as a function of the SPWM wave frequency and the minimum duty cycle:
Pmatch=F(fp,dmin)
the simulation results are shown in fig. 7. It can be seen from fig. 7 that the matched filter output peak increases with decreasing minimum duty cycle and increases with increasing SPWM frequency. In practical application, the proper minimum duty ratio and the SPWM wave frequency can be selected for parameter calculation according to the minimum duty ratio and the acceptable energy loss range of the power amplifier circuit.
As shown in FIG. 8, the system structure of the invention is based on TMS320C6748 platform, and the SPWM generation work is converted into software control. The software control flow is shown in fig. 9.
The specific working process is as follows:
(1) transmit signal waveform generation
Firstly, a discrete form of a required sending signal is generated in the DSP, and a specific format required by sending data is determined.
(2) SPWM duty cycle calculation
And selecting a proper duty ratio range and SPWM wave frequency according to the signal form and the emission performance of the power amplification system, and calculating duty ratio data by adopting a sampling point method.
(3) Timer polling
The DSP internal timer is configured in a cycle counting mode, and the current value of the timer is inquired in a polling mode so as to judge whether the SPWM sends a whole period.
(4) GPIO logic control
And (4) formulating a GPIO logic judgment criterion according to the difference of the peripheral equipment of the system, and determining the GPIO output level and duration time by comparing the current value of the timer with the amplitude of duty ratio data.
The SPWM wave generation algorithm based on the pulse sampling points is designed as follows:
the sampling method is called as a sampling point method for short, namely, sampling is carried out on an analog signal by using a sampling pulse with the same frequency as the SPWM wave, and the SPWM wave duty ratio is calculated by using the current sampling value as a standard. Duty ratio simple calculation formula:
wherein d is the duty cycle, s is the current sampling value of the signal, and p is the SPWM wave period.
The derivation process of the sampling point method comprises the following steps:
the two methods are compared below by taking a Linear Frequency Modulation (LFM) signal as an example.
General expression for LFM signal:
wherein a (t) is the LFM signal envelope; f. of
0Is the LFM signal starting frequency;
for modulation slope, B is modulation bandwidth, and τ is pulse width.
In the digital processing process, the LFM signal time domain expression is rewritten into a discrete form:
wherein a (n) is the signal envelope; d and a (n) control the amplitude and PWM minimum duty ratio of the LFM signal; f. ofsIs the sampling rate; n ═ fsAnd tau is the total number of sampling points of the signal.
The PWM wave period contains the number of sampling points:
wherein f ispFor SPWM wave frequencies, i.e. fpThe LFM signal is resampled by the pulses of frequency to obtain the sample value.
Calculating the SPWM duty ratio by using the LFM resampling value, wherein the LFM signal amplitude needs to be constrained:
wherein d isminThe minimum duty ratio is determined by the output state of the power amplifier circuit transformer, and generally speaking, the duty ratio of the PWM wave tends to be more extreme and the output waveform of the power amplifier is worse.From this constraint, the values of a (n) and D can be calculated.
Finally obtaining SPWM wave duty ratio data:
wherein n isreFor the original signal passing through a frequency fpThe resample point of the pulse sampling.
After SPWM modulation is respectively carried out on the LFM signals by an interception method and a sampling point method, low-pass filtering and matched filtering are carried out, and matched correlation peak data are compared to obtain the performance difference of the two methods.
The minimum duty cycle is defined as:
duty_spwm∈[dmin,1-dmin]
where duty _ SPWM represents the SPWM output waveform duty cycle range, dminIs the minimum duty cycle.
Based on the method and the process, an actual experiment is carried out in the DSP, a DSP GPIO acquisition waveform is shown in fig. 10, a GPIO SPWM and intercept method spectrum pair is shown in fig. 11, and a matched filter output pair is shown in fig. 12. Experimental results show that the SPWM wave output by the GPIO simulation controlled by the pulse sampling point method and the SPWM wave generated by the triangular wave interception method both contain LFM complete frequency information of 8 k-12 kHz, the frequency spectrums of the SPWM wave and the LFM complete frequency information are basically coincident, and the capacity of reducing LFM signal frequency components is basically equivalent. The correlation peak value output by the matched filter of the two methods reaches 4.8 times of the first sidelobe, and the LFM signal can be well detected by the matched filter. Meanwhile, the two methods are matched, the filtering output peak values are basically coincident, the peak value energy loss of the pulse sampling point method relative to the triangular wave interception method is 1.8%, and the energy loss control is good. It can be concluded that, under the condition that the SPWM frequency is much larger than the signal frequency, the method for generating SPWM based on pulse sampling points can replace the triangular wave interception method, and can be quickly implemented in a digital processor in practical application.
It will be understood that modifications and variations can be made by persons skilled in the art in light of the above teachings and all such modifications and variations are intended to be included within the scope of the invention as defined in the appended claims.