As shown in
Figure 1, the unipolar sinusoidal pulse width modulation (SPWM) technique involves sampling a sinusoidal signal using one positive triangular signal for the positive semi-cycle and one negative triangular signal for the negative semi-cycle of the sinusoidal signal. The sinusoidal signal acts as a reference to obtain the desired sine wave signal, which in many cases is a 60 Hz network signal. The triangular signal, which operates at a considerably higher frequency than the original sine signal, compares and generates pulses that determine the necessary cuts (
β and
βf) in the inverter signal. This process is performed by comparing amplitudes between the sine and triangular signals: when the sine signal exceeds the triangular signal, a pulse representing an α angle is generated, indicating the cutoff points in the inverter signal. These cutoffs (
β and
βf), calculated by this comparison, allow the resulting square waveform to resemble a sine signal in key areas. In this way, the unipolar SPWM effectively modulates the signal using the high-frequency triangular signals’ reference.
2.1. Basic Definitions
The SPWM technique requires several important parameters for its correct application. First, we need a sinusoidal signal with an amplitude designated as
As (see
Figure 1) and a frequency of usually 60 Hz.
Another parameter is the amplitude of the triangular signal, represented by
At, which is the maximum value reached by this signal. From these definitions, we can calculate the modulation index (
M), which is the ratio between the amplitude of the sine signal and the amplitude of the triangular signal, which is expressed by the following equation:
One of the key parameters in the SPWM technique is the modulation index (). It is crucial to keep this value less than 1 to avoid overmodulation, which can negatively affect system performance. Overmodulation can lead to distortion in the output waveform, reducing the efficiency and accuracy of the modulation process.
The ratio between the frequency of the sine signal
fo and the frequency of the triangular signal
fc, also known as the carrier frequency, is the frequency modulation ratio (
mf) shows in Equation (2). Proper tuning of these frequencies is essential for efficient and accurate modulation.
In addition, it is important to know the number of triangular pulses per half-cycle
pt, which the following expression can calculate:
Hence,
pt represents the number of triangular pulses per half-cycle. Since
pt is based on frequency modulation, we can substitute
/
and express it as
To maintain ¼-wave symmetry, pt must be even
Having obtained the number of triangular pulses per half-cycle, it is relevant to calculate the total number of output pulses per half-cycle
p, which is obtained by the following expression:
This expression indicates that the number of pulses equals the number of triangular pulses minus one. By considering
pt to be half of the frequency modulation, we can rewrite the expression as
Also, to maintain ¼ wave symmetry, p must be odd.
These equations are fundamental to understanding and controlling the comparison process between the triangular signal and the sinusoidal signal in the SPWM technique.
Another condition is to have a unipolar signal for each half-cycle with quarter-wave symmetry with the largest pulse centered at . If these conditions are satisfied, it is possible to reduce the harmonics.
Meeting these conditions not only reduces unwanted components but also simplifies the process. With this specific quarter-wave symmetry, it is not necessary to calculate all the pulses but only the angles present in a quarter-wave, since these will be replicated throughout the period.
The number of angles required for a quarter-wave is calculated using the following expression:
is the number of angles for a quarter-wave, and pt is the number of triangular pulses.
2.2. Mathematical Definition of the Triangular Signal
In the unipolar SPWM technique, a triangular signal must be compared with a sinusoidal signal to obtain the required angles to form the output pulses. This comparison can be made analogically or digitally; devices are designed for both modes. However, digital evaluation presents the advantage of reconfiguring in real time the parameters of the SPWM, and it is not necessary to generate the triangular and sinusoidal signals, so it is easy to implement the algorithm in a microcontroller or microcomputer like a Raspberry Pi.
Before calculating the required pulses, the triangular signals must be defined mathematically. These signals are represented as two straight lines: one with a positive slope named “
y” and one with a negative slope named “
y’”, and both lines are shown in
Figure 2.
As shown in
Figure 2, an important aspect is that these lines form a symmetrical triangle, preferably isosceles, with an amplitude
At, and the pulse width of the signal
pt is symmetrical on both sides of the triangle. In addition, the positive and negative lines forming the triangular signal must have the same slope, thus ensuring perfect symmetry. In this context, the midpoint of the pulse width
pt will be located at
, which would be the midpoint of our signal.
Once the amplitude
At and the pulse width
tp of the triangular signal are defined, we can obtain the slope equation, since straight lines form these signals. The slope is calculated as the ratio of the opposite leg to the adjacent leg in the triangle formed. Since the opposite leg is
, the slope equation is expressed as
where
m represents the slope of the positive line; to express the positive line (
y) as a function of time
t, we can use the following equation:
Continuing with the negative line, the slope is negative and is expressed as
From the typical expression of one straight line, by clearing
b to obtain the ordinate to the origin, we obtain the equation for the negative line (
y’):
These mathematical expressions represent the positive and negative lines of the triangular signal. However, these equations are only valid for one triangular pulse. Additional equations that consider repeating patterns over time are necessary to deal with a number “
nt” of pulses, as shown in
Figure 3.
The equations must be simplified to obtain the expressions for the
nt triangle, starting from
nt = 0. We start at a time multiple of the triangle pulse width called
nttp where
nt represents the
nth pulse of a time
tp. The end of this
nt pulse is calculated by summing the pulse width
tp, resulting in
It is important to remember the importance of obtaining the midpoint of the triangular pulse, which is expressed as
Once these points are obtained, we define the amplitude
At, which remains constant, and the slope, which does not vary. Substituting these new equations into the positive slope in Equation (11), we obtain the expression for the nth positive line
ynt:
Similarly, for the equation of the negative line
ynt’,
The triangular signal is compared with the sinusoidal signal using these mathematical expressions for the positive and negative lines for each term “
n”. This comparison with the sine signal and the respective positive and negative lines is shown in
Figure 4.
In
Figure 4, the sine signal is highlighted in red. It appears to be a straight line due to the considerable difference in frequency concerning the triangular signal. Although in more realistic models, the sine signal is not represented as a straight line, for practical purposes, it is simplified to facilitate the identification of the intersection point with the positive line. It is important to note that this intersection point coincides with the equation previously defined for the positive line.
By identifying the point of intersection between the triangular pulse signal and the sinusoidal signal, the start of the pulse is identified and expressed in angles for clarity and simplicity. This time expressed in angles is denoted as , corresponding to the beginning of the first pulse α1 of the inverter signal.
This first angle, where the signal intersects the negative line, is defined in time as
. The mathematical expressions of the sine signal are equated with the equation of the corresponding line, in this case, the equation of the negative line, obtaining the following equation:
Here, for the sinusoidal signal,
As represents the amplitude,
is the carrier frequency (commonly 60 Hz), and
t1 is when the first pulse becomes active, i.e., where the sine and straight line intersect (see
Figure 4). However, solving
t1 directly is complicated, because this equation is a transcendental function in which the variable cannot be explicitly cleared. Therefore, in this work, the use of numerical or graphical methods to obtain
t1 is proposed.
To solve (16) numerically, this equation is equated to zero, and the following expression is obtained:
This can be simplified to
The point at which this equation becomes zero is the time
t1, which corresponds to angle
β1 for the first pulse (upstream pulse). A similar procedure is performed to obtain the downstream pulse, but the sine signal is compared to the positive straight line, as shown in
Figure 5.
Therefore, the following equation is obtained:
where
t1f is the final time of the pulse, and
is the final angle corresponding to the time
t1f. Like the previous equation, it is equated to zero, obtaining the following equations:
2.3. Numerical Evaluation of the Angles
As can be seen in
Figure 4 and
Figure 5, the values of
t1 and
t1f are within the range
. Therefore, it is possible to define a sampling range named
dm.
The solution of Equations (18) and (21) will always be in this sampling range. To find the solution, the sampling range is divided into Ns samples, and Equations (18) and (21) are evaluated for each sample. The value closest to zero will be considered the equation’s solution. The greater the samples’ Ns, the more accurate the solution to the equation will be. The precision is sufficient for this application with Ns = 10, but it is possible to use greater values.
The sampling vector for the positive slope is
The sampling vector for the negative slope is
Once the times
t1 and
t1f are obtained for the first pulse, the angles can be calculated with the following expressions:
where
is the angular frequency and
is the width of the first pulse, which, as seen in the equation, is the subtraction of
minus
. However, this process must be repeated for each triangular pulse signal.
The complete algorithm for angle calculation is detailed in the flowchart of
Figure 6.
In this flowchart, mu represents one of the vector’s M and M′ components. The process is as follows: first, the specifications are defined, and the main variables are calculated after the first angle of the negative slope line is evaluated (β1). For this, the times (tn−) for each component of vector M′ are obtained, and Equation (18) is an assessment for each one, generating the error vector (en−). Then, the minimum value of vector en− is obtained (emin) after the value of time (t1−) corresponding to this emin is obtained with the corresponding angle value β1. Subsequently, the same process is undertaken to assess the final angle of the first pulse (β1f), resolving Equation (21) using the solutions vector M. The process continues for each pulse until the pulse Na. The algorithm assesses the pulse for only one quarter of the wave, since the rest of the angles are evaluated for symmetry.