# Using Bode plots in Schematic Editor to troubleshoot converter design issues

This user how-to guide is related to C-HIL: Field-oriented control of PMSM using Texas Instruments TMS320F2808 card. All tests in document are done without using the TI card.

## Introduction

In electric drive applications, rectifiers are prone to DC voltage overshoot issues. In this case, we will attempt to test the potential occurance of these issues using an uncontrolled Three-Phase Diode Rectifier, as shown in Figure 1. The input impedance can be calculated and introduced in the model by a Bode diagram. This peak of the DC link voltage can lead to burning of the diodes in the three-phase diode rectifier and burning of the IGBTs in the Three-phase two-level inverter/rectifier if they are not rated for overshoot voltages.

The main purpose of this application note is to show a possibility to include Python-specific libraries to resolve issues with designing the power converter.

This how-to guide is related to C-HIL: Field-oriented control of PMSM using Texas Instruments TMS320F2808 card. All tests in the document are done without using the TI card.

## Model description

The model of the rectifier part of the drive system is presented in image below.

## Simulation

Using the Model Initialization function in the code block below, we can generate a Bode diagram using the scipy and matplotlib python libraries. The most important functions from the scipy library are scipy.signal.TransferFunction and scipy.signal.bode.

The model initilization script is shown below:

# Numpy module is imported as 'np'
# Scipy module is imported as 'sp'
import matplotlib.pyplot as plt

#parameters that chan be changeable
Rprech = 0
Ts = 100e-6
R = 0.1
L = 0.0011
C = 0.0022

#Solution no. 1: fix with inductor
#L = C * R**2 *0.9**2
#mdl.info(L)

#Solution no. 2: fix with capacitor
#fsw = 100
#C = 1/(2*np.pi*0.3*fsw)**2/L
#mdl.info("C = {} F".format(C))

#Solution no. 3: add precharge resistor Q = 0.707
Rprech =np.sqrt(2)*(np.sqrt(L/C)-1/np.sqrt(2)*R)
mdl.info("Rprech = {} ohm".format(Rprech))

#bode diagram analysis
# resonant frequecny
f0 = 1/(2*np.pi*np.sqrt(L*C))
mdl.info("f0 = {} Hz".format(f0))
w0 = 2*np.pi*f0

# absolute Q factor
Qab = 1/(R+Rprech)*np.sqrt(L/C)
mdl.info("Qab = {}".format(Qab))
Qdb = 20 * np.log10(Qab)
# Q factor in db

#bode plot using sp.signal.lti function
s1 = sp.signal.lti(,[1/w0**2,1/(w0*Qab),1])
w, mag, phase = sp.signal.bode(s1)

# Bode magnitude plot
#plt.figure()
plt.semilogx(1/(2*np.pi)*w, mag)
# Bode phase plot
plt.figure(1,1)
plt.semilogx(1/(2*np.pi)*w, phase)
plt.show()        

From this Bode diagram and from calculation, we get . We can see that the switching resonant frequency and the switching frequency of the diode bridge (100Hz) is almost the same. This implies there will be some resonance and overshoot in DC voltages. The switching frequency also cannot be changed because of the use of a diode rectifier. Instead, changing the parameters of input impedance is necessary. Since increasing model resistance (R) will lead to increased losses, it is better to focus on the inductor by decreasing the quality (Q) factor.

In this section we explore two possible solutions for addressing the voltage overshoot on the DC link: decreasing the inductance and increasing the capacitance.

Solving the issue decreasing the inductance

First let’s try to find the input transfer function. The transfer function is defined from the circuit in Figure 1

An alternative standard, normalized form of the transfer function is:

${G}_{\left(s\right)}=\frac{1}{1+\frac{s}{Q{\omega }_{0}}+{\left(\frac{s}{{\omega }_{0}}\right)}^{2}}$

The parameter Q is called the quality factor of the circuit, and is a measure of the dissipation in the system. The parameter represents the resonant angluar frequency.

From the input transfer function, we can find the resonant frequency which is:

${f}_{0}=\frac{1}{2\pi \sqrt{\left({L}_{a}{C}_{dc}\right)}}$

Now it is easy to find the Q factor with the following formula:

$Q=\frac{1}{{R}_{1}}\sqrt{\frac{{L}_{a}}{{C}_{dc}}}$

The result of this analysis will give us the value of the inductor to reduce the Q factor. Let’s try to decrease value of the inductor by half. In Figure 4, we can see that we manage to decrease the overshoot of the DC voltage.

Now, let’s try to decrease inductance to one third. In Figure 5, we can see that we manage to decrease the DC voltage (Cdc) below our 400V target.

A second-order Butterworth filter (i.e., continuous-time filter with the flattest passband frequency response) has an underdamped quality factor of 0.707. Therefore, to reduce overshoot in the voltage of the DC capacitor you need to set the Q factor to 0.707. Now, let’s try to calculate the inductor. The equation is ${L}_{ac}={C}_{dc}{R}_{1}^{2}{Q}^{2}$ where we can calculate .

In Figure 6, we can see that we manage to fix this issue.

In the Bode diagram in Figure 7, we can see that we manage to decrease the Q factor.

Solving the issue with increasing the capacitor

While in theory decreasing the inductance solves the problem, it is often not practical, since inductors are much more expensive then capacitors. Additionally, if the inductance in the model is due to the source inductance (i.e. grid impedance), it is impossible to change it. In these cases, we can instead change the value of the capacitor. This is done by moving the resonant frequency far from the switching frequency. For example, by setting ${f}_{0}={0.3f}_{sw}$ :

With this new capacitor, we get attenuation to the switching frequency. In Figure 8, you can find the new Bode diagram:

In Figure 9, we can see the new response of voltage on the DC link. By increasing the DC capacitor, we can see that response is a little bit slower than when we changed the inductance.

Pre-charge circuit

Overvoltage on DC-link can be resolved using pre-charge circuit. As is showed in Figure 10 you can see implementation of pre-charge circuit.

In this case, the pre-charge resistor can be calculated by setting the Q factor:

$Q=\frac{1}{\sqrt{2}}$

The following is the calculation for ${R}_{prech}:$

$Q=\frac{1}{{R}_{1}+{R}_{prech}}\sqrt{\frac{{L}_{a}}{{C}_{dc}}}=\frac{1}{\sqrt{2}}$

The Figure 11shows the pre-charge resistor effects caused by reducing the Q factor. The Figure 12 shows the response of voltage on DC-link. It is important to note that in this case there is a reduced peak of incoming current on the AC side of rectifier.

Using this approach, we manage to troubleshoot issues in the design of the various converters and applications in power electronics, and specifically to avoid voltage overshoot on the DC link. In Figure 12, you can see a high peak of the inductor current. To reduce this current, we need to define a different value of the pre-charge resistor. The resistance of the pre-charge circuit is chosen based on the capacity of the load and the desired pre-charge time. The pre-charge surge current reaches 1/e of its initial value after a time of:

The current is reduced to a manageable value after approximately a time of 5 * T.

${R}_{prech}=\frac{T}{5C}$

Here we can see how we manage to decrease inrush current.

In practice, if the design allows, having the option to solve overvoltage by placing a larger capacitor, would likely be a cheaper option than adding the pre-charge circuit. Based on these results, we can envision a way that this would be possible.

Table 1. Minimum requirements
Files
Typhoon HIL files

examples\models\hardware in the loop\ti pmsm sensored foc

ti pmsm sensored foc.tse,

ti pmsm sensored foc.cus,

20140220_pmsm3_1_TMS3202808.out,

settings.runx

Minimum hardware requirements
No. of HIL devices 1
HIL device model HIL402
Device configuration* 1

## Test Automation

We don’t have a test automation for this example yet. Let us know if you wish to contribute and we will gladly have you signed on the application note!

 Simisa Simic