Need to analyze switching frequencies and Pulse Width Modulated (PWM) signal in Simcenter Testlab?
This article covers how to use Simcenter Testlab to analyze PWM signals and resulting switching frequency phenomenon. 1. Pulse Width Modulation Background 1.1 Pulse Width 1.2 Carrier Frequency 1.3 Duty Cycle 1.4 Switching Frequencies 2. Simcenter Testlab and PWM Signals 2.1 Getting Started 2.2 Calculate Carrier Frequency from PWM Signal 2.3 Calculate Duty Cycle from PWM Signal 3. Colormaps and Switching Frequencies
1. Pulse Width Modulation Background
Pulse Width Modulation (PWM) chops up electrical voltage signals into discrete parts. This is done by turning the signal on and off at a fast rate. Some examples are shown in Figure 1.
Figure 1: By modulating the width of the pulses, a PWM signal can approximate a smoothly transitioning signal, such as a sine wave.
Pulse Width Modulated signals are used for a wide variety of applications. Applications include control valves, pumps, hydraulics, and heating elements. Sometimes a PWM signal is used as a sensor, where the width of the pulse is proportional to the amplitude a measured signal.
Another application for PWM signals is with power inverters. An inverter is a device that converts DC power to the AC power used to turn an electric motor as shown in Figure 2.
Figure 2: An inverter in power electronics uses PWM signals to convert DC power to AC power.
For example, in an electric vehicle, the power inverter switches the connection between the battery and the electric motor on and off. Each switching event is a pulse. The inverter changes the speed at which the motor rotates by adjusting the timing between pulses and the width of the pulses as shown in Figure 3.
Figure 3: Electrical pulses (top, blue) are used to run an AC electric motor (lower right). The pulses synthesize a sine wave (red) at a specific frequency. The rotating inertia of the motor smooths the motor output to a constant RPM.
The pulses are varied to create a sine wave. Because the electric motor has inertia.
A PWM signal consists of three main components that define its behavior: pulse width, carrier frequency and duty cycle.
1.1 Pulse Width
The pulse width describes the amount time the digital output signal is “on”, or at the maximum value. Some examples are shown in Figure 4.
Figure 4: Pulse widths with varying "on" times.
Pulse width is measured in a unit of time and does not relate directly to the duty cycle or carrier frequency that will be discussed next. However, as it will be shown, for a given carrier frequency the duty cycle and pulse width are directly related.
Note that in these examples, the timing of the “on” event is the same, while the timing of the “off” is changed to vary the width.
1.2 Carrier Frequency
The carrier frequency determines how fast the PWM completes a cycle (i.e. how fast it turns on and off). The period of the cycle (inverse of the frequency) is illustrated in Figure 5.
Figure 5: The carrier frequency of a PWM cycle is the inverse of the cycle time.
The frequency that the PWM signal needs to be set at will be dependent on the application and the response time of the system that is being powered.
Below are a few applications and some typical PWM frequencies.
Heating elements or systems with slow response times: 100 Hz
Inverters in electric motor: 2.5 kHz, 5 kHz, 10 kHz
Power supplies or audio amplifiers: 200 kHz (above audible range)
1.3 Duty Cycle
The duty cycle describes the amount of time the signal is in an on state as a percentage of the total time of it takes to complete one cycle (see Equation 1 below).
Equation 1: Duty cycle as a percentage.
Signals with the same period but differing duty cycles are shown in Figure 6.
Figure 6: Different duty cycles. The wider the pulse (top) the higher higher the duty cycle.
By cycling a digital signal off and on at a fast enough rate, and with a certain duty cycle, the output will appear to behave like a constant voltage analog signal when providing power to devices.
Example: To create a three volt signal given a digital source that can be either high (on) at five volts, or low (off) at zero volts, a PWM signal with a duty cycle of 60% can be used. The PWM signal outputs five volts for 60% of the time. When the digital signal is cycled fast enough, the voltage seen at the output appears to be the average voltage. If the digital low is zero Volts then the average voltage can be calculated by taking the digital high voltage multiplied by the duty cycle: 5V x 0.6 = 3V
1.4 Switching Frequencies
When analyzing the noise and vibration behavior of a product that uses PWM signals, spectral content called "switching frequencies" are generated by the square wave pulses (Figure 7).
Figure 7: Switching frequency vibration induced by the use of PWM in a product.
The switching frequencies generated noise or vibrations are centered around the carrier frequency of the PWM signal. They have several orders (the diverging lines in the picture above) around the carrier frequency. These diverging (or converging) orders are caused by the changing of the pulse width.
2. Simcenter Testlab and PWM Signals
The use of Simcenter Testlab to analyze Pulse Width Modulation (PWM) signals is covered in the next. Getting started and the calculation of duty cycle and carrier frequency are covered.
Postprocessing with Time Signal Calculator will be covered here, but the procedure is similar for virtual channels and online data:
Start Desktop module ( Windows 10 : Start -> all programs -> Simcenter Testlab 2021.2 -> Desktop Standard & Advanced).
Open Time Data Editor add-in ( Tools -> Add-Ins -> Time Signal Calculator -> ) check box on left side of screen then press “OK” to close.
Go to Navigator worksheet and right click on PWM signal to be analyzed and then select “Replace Input Basket”.
Go to Time Data Selection worksheet and press the “Add” button (above channel list).
Below Data Set check box in “View” column to visualize the data.
The signal is now ready to be analyzed for carrier frequency and/or duty cycle.
2.2 Calculate Carrier Frequency from PWM Signal
To analyze the carrier frequency:
Open function editor by selecting (*fx) icon in first row of Time Signal calculator
Select “PWM_PULSE_TO_CARRIER” function then press “OK” button.
Edit formula arguments using dialog box : function1 (channel identification) and cross level (on a 0 to 1 volt square wave, cross of 0.5 is good) then press “OK” button.
Next press the “Calculate” button to perform the calculation.
Now save the time data inside the project by pressing the “Save As” button located at lower right hand side of Dataset box. After entering a file name press the “OK” button to save new calculated channels.
Using the “Navigator” tab, the carrier frequency and original PWM signal time histories can be visualized with an UpperLower display.
2.3 Calculate Duty Cycle from PWM Signal
Calculating the duty cycle of a PWM signal is very similar to calculating the carrier frequency:
Open function editor again by selecting (*fx) icon in fist row of Time Signal calculator.
Select “PWM_PULSE_TO_DUTY” function then press “OK” button.
Edit formula arguments using dialog box : (channel identification) and cross level (on a 0 to 1 volt square wave, cross of 0.5 is good) and press the OK button.
Next press the “Calculate” button to perform the calculation.
After saving the data (see previous section), the “Navigator” tab, can be used to visualize the duty cycle and original PWM signal time histories with an UpperLower display.