implementations.problem_classes.BuckConverter module

class buck_converter(duty=0.5, fsw=1000.0, Vs=10.0, Rs=0.5, C1=0.001, Rp=0.01, L1=0.001, C2=0.001, Rl=10)[source]

Bases: ptype

Example implementing the model of a buck converter, which is also called a step-down converter. The converter has two different states and each of this state can be expressed as a nonhomogeneous linear system of ordinary differential equations (ODEs)

\[\frac{d u(t)}{dt} = A_k u(t) + f_k (t)\]

for \(k=1,2\). The two states are the following. Define \(T_{sw}:=\frac{1}{f_{sw}}\) as the switching period with switching frequency \(f_{sw}\). The duty cycle \(d\) defines the period of how long the switches are in one state until they switch to the other state. Roughly saying, the duty cycle can be seen as a percentage [1]. A duty cycle of one means that the switches are always in only one state. If \(0 \leq \frac{t}{T_{sw}} \bmod 1 \leq d\) [2]:

\[\frac{d v_{C_1} (t)}{dt} = -\frac{1}{R_s C_1}v_{C_1} (t) - \frac{1}{C_1} i_{L_1} (t) + \frac{V_s}{R_s C_1},\]
\[\frac{d v_{C_2} (t)}{dt} = -\frac{1}{R_\ell C_2}v_{C_2} (t) + \frac{1}{C_2} i_{L_1} (t),\]
\[\frac{d i_{L_1} (t)}{dt} = \frac{1}{L_1} v_{C_1} (t) - \frac{1}{L_1} v_{C_2} (t) - \frac{R_\pi}{L_1} i_{L_1} (t),\]

Otherwise, the equations are

\[\frac{d v_{C_1} (t)}{dt} = -\frac{1}{R_s C_1}v_{C_1} (t) + \frac{V_s}{R_s C_1},\]
\[\frac{d v_{C_2} (t)}{dt} = -\frac{1}{R_\ell C_2}v_{C_2} (t) + \frac{1}{C_2} i_{L_1} (t),\]
\[\frac{d i_{L_1} (t)}{dt} = \frac{R_\pi}{R_s L_1} v_{C_1} (t) - \frac{1}{L_1} v_{C_2} (t) - \frac{R_\pi V_s}{L_1 R_s}.\]

using an initial condition.

Parameters:
  • duty (float, optional) – Duty cycle \(d\) between zero and one indicates the time period how long the converter stays on one switching state until it switches to the other state.

  • fsw (int, optional) – Switching frequency, it is used to determine the number of time steps after the switching state is changed.

  • Vs (float, optional) – Voltage at the voltage source \(V_s\).

  • Rs (float, optional) – Resistance of the resistor \(R_s\) at the voltage source.

  • C1 (float, optional) – Capacitance of the capacitor \(C_1\).

  • Rp (float, optional) – Resistance of the resistor in front of the inductor \(R_\pi\).

  • L1 (float, optional) – Inductance of the inductor \(L_1\).

  • C2 (float, optional) – Capacitance of the capacitor \(C_2\).

  • Rl (float, optional) – Resistance of the resistor \(R_\pi\)

A

Coefficient matrix of the ODE system.

Type:

np.2darray

Note

The duty cycle needs to be a value in \([0,1]\).

References

dtype_f

alias of imex_mesh

dtype_u

alias of mesh

eval_f(u, t)[source]

Routine to evaluate the right-hand side of the problem.

Parameters:
  • u (dtype_u) – Current values of the numerical solution.

  • t (float) – Current time of the numerical solution is computed.

Returns:

f – The right-hand side of the problem.

Return type:

dtype_f

solve_system(rhs, factor, u0, t)[source]

Simple linear solver for \((I-factor\cdot A)\vec{u}=\vec{rhs}\).

Parameters:
  • rhs (dtype_f) – Right-hand side for the linear system.

  • factor (float) – Abbrev. for the local stepsize (or any other factor required).

  • u0 (dtype_u) – Initial guess for the iterative solver.

  • t (float) – Current time (e.g. for time-dependent BCs).

Returns:

me – The solution as mesh.

Return type:

dtype_u

u_exact(t)[source]

Routine to compute the exact solution at time \(t\).

Parameters:

t (float) – Time of the exact solution.

Returns:

me – The exact solution.

Return type:

dtype_u