rizer.electric_circuit.rllc_circuit#
Solve the following RLLC circuit.
┌-------------L1--------------┐
↑ │ │ ↑
│ │ L2 │
u_c C │ u_mes
│ │ R │
│ │ │ │
┖-----------------------------┘
The circuit is composed of a capacitor C, two inductors L1 and L2 in series, and a resistor R. The resistor R can vary in time.
Models require the initial value of the plasma resistance R_0, the initial current I_0 in the circuit, and the initial voltage U_c_0 across the capacitor.
The resistance model can be one of the following (see
rizer.electric_circuit.variable_resistance_models for more details):
- A constant resistance.
- A resistance model based on Rompe and Weizel.
- A resistance model based on Vlastos.
- A resistance model based on Braginskii.
Some comments refer to “the documentation”. The documentation is available in the repository in the file “resistance_models.pdf”.
Classes#
Solve the following RLLC circuit. |
Module Contents#
- class rizer.electric_circuit.rllc_circuit.RLLC_Circuit(C: float | int, L1: float | int, L2: float | int, R_0: float | int, I_0: float | int, U_c_0: float | int, R_model: rizer.electric_circuit.variable_resistance_models.VariableResistorModel)#
Solve the following RLLC circuit.
┌-------------L1--------------┐ ↑ │ │ ↑ │ │ L2 │ u_c C │ u_mes │ │ R_p │ │ │ │ │ ┖-----------------------------┘The circuit is composed of a capacitor C, two inductors L1 and L2 in series, and a resistor R. The resistor R can vary in time.
Models require the initial value of the plasma resistance R_0, the initial current I_0 in the circuit, and the initial voltage U_c_0 across the capacitor.
This class provides the following methods:
RLLC_Circuit.solve(): Solve the RLLC circuit numerically, given a time varying resistor.RLLC_Circuit.get_powers(): Compute the power dissipated in the circuit.RLLC_Circuit.get_energies(): Compute the energy dissipated in the circuit.
- Parameters:
C (
float | int) – Capacitance value in Farads.L1 (
float | int) – Inductance value in Henry.L2 (
float | int) – Inductance value in Henry.R_0 (
float | int) – Initial value of the plasma resistance in Ohms.I_0 (
float | int) – Initial current through the plasma in the circuit in Amperes.U_c_0 (
float | int) – Initial voltage across the capacitor in Volts.R_model (
VariableResistorModel) – The resistance model used in the circuit.
See also
- time: numpy.ndarray | None = None#
Time at which the circuit is solved.
- i: numpy.ndarray | None = None#
Current in the circuit.
- u_c: numpy.ndarray | None = None#
Voltage across the capacitor.
- R_p: numpy.ndarray | None = None#
Resistance of the plasma.
- solve(time: numpy.ndarray, method: str = 'LSODA', **kwargs) tuple[numpy.ndarray, numpy.ndarray, numpy.ndarray, numpy.ndarray]#
Solve the RLLC circuit numerically, given a time varying resistor.
Internally, the method uses the scipy.integrate.solve_ivp function to solve the ODE system.
- Parameters:
time (
np.ndarray) – Time at which the circuit is solved.method (
str) – The numerical method used to solve the ODE. Default is “LSODA”.**kwargs – Additional arguments to pass to the ODE solver. See the documentation of scipy.integrate.solve_ivp.
- Returns:
Tuple containing the following arrays:
i (np.ndarray): Current in the circuit.
didt (np.ndarray): Derivative of the current.
u_mes (np.ndarray): Voltage across R_p and L_p.
R_p (np.ndarray): Resistance of the plasma.
- Return type:
tuple[np.ndarray,np.ndarray,np.ndarray,np.ndarray]- Raises:
ValueError – If the numerical solution did not converge.
See also
- compute_derivatives(t: float, y: numpy.ndarray) numpy.ndarray#
Right-hand side of the system: \(\frac{dy}{dt} = f(t, y)\).
This method computes the derivatives of the system of ODEs that describe the Castera circuit. It is used by the
RLLC_Circuit.solve()method to solve the ODE system.- Parameters:
t (
float) – Time at which the circuit is solved.y (
np.ndarray[float,float,float]) –Array containing the present values of the system:
y[0]=i_p (float): The current through the plasma.
y[1]=u_c (float): The voltage across the capacitor.
y[2]=R_p (float): The plasma resistance.
- Returns:
Array containing the derivatives of the system:
dy[0]=di_p (float): The derivative of the current through the plasma.
dy[1]=du_c (float): The derivative of the voltage across the capacitor.
dy[2]=dR_p (float): The derivative of the plasma resistance.
- Return type:
np.ndarray[float,float,float]
Notes
The system of ODEs is given by:
\[\begin{split}\begin{cases} \frac{di_p}{dt} &= \frac{u_c - R_p i_p}{L_1 + L_2} \\ \frac{du_c}{dt} &= -\frac{1}{C} i_p \\ \frac{dR_p}{dt} &= \text{compute_resistance_derivative}(t, [i_p, R_p]) \end{cases}\end{split}\]
- get_powers() tuple[numpy.ndarray, Ellipsis]#
Compute the power dissipated in the circuit.
- Returns:
The power dissipated in the resistor, the inductors and the capacitor.
- Return type:
tuple[np.ndarray]
- compute_resistance_power() numpy.ndarray#
Compute the power dissipated in the resistor.
- Returns:
The power dissipated in the resistor.
- Return type:
np.ndarray- Raises:
ValueError – If the circuit has not been solved yet.
Notes
The power dissipated in the resistor is given by:
\[P_R(t) = R_p(t) i(t)^2\]
- compute_inductance_power() numpy.ndarray#
Compute the power dissipated in the inductors.
- Returns:
The power dissipated in the inductors.
- Return type:
np.ndarray- Raises:
ValueError – If the circuit has not been solved yet.
Notes
The power dissipated in the inductors is given by:
\[P_L(t) = \frac{1}{2} (L_1 + L_2) \frac{di^2}{dt}(t)\]
- compute_capacitance_power() numpy.ndarray#
Compute the power dissipated in the capacitor.
- Returns:
The power dissipated in the capacitor.
- Return type:
np.ndarray- Raises:
ValueError – If the circuit has not been solved yet.
Notes
The power dissipated in the capacitor is given by:
\[P_C(t) = \frac{1}{2} C \frac{du_c^2}{dt}(t)\]
- get_energies() tuple[numpy.ndarray, Ellipsis]#
Compute the energy dissipated in the circuit.
- Returns:
The energy dissipated in the resistor, the inductors and the capacitor.
- Return type:
tuple[np.ndarray]
- compute_resistance_energy() numpy.ndarray#
Compute the cumulated energy dissipated in the resistor.
- Returns:
The energy dissipated in the resistor.
- Return type:
np.ndarray- Raises:
ValueError – If the circuit has not been solved yet.
Notes
The energy dissipated in the resistor is given by:
\[E_R(t) = \int_0^t P_R(\tau) d\tau = \int_0^t R_p(\tau) i(\tau)^2 d\tau\]
- compute_inductance_energy() numpy.ndarray#
Compute the energy dissipated in the inductors.
- Returns:
The energy dissipated in the inductors.
- Return type:
np.ndarray- Raises:
ValueError – If the circuit has not been solved yet.
Notes
The energy dissipated in the inductors is given by:
\[E_L(t) = \int_0^t P_L(\tau) d\tau = \frac{1}{2} (L_1 + L_2) (i(t)^2 - i(0)^2)\]
- compute_capacitance_energy() numpy.ndarray#
Compute the energy dissipated in the capacitor.
- Returns:
The energy dissipated in the capacitor.
- Return type:
np.ndarray- Raises:
ValueError – If the circuit has not been solved yet.
Notes
The energy dissipated in the capacitor is given by:
\[E_C(t) = \int_0^t P_C(\tau) d\tau = \frac{1}{2} C (u_c(t)^2 - u_c(0)^2)\]
- compute_parameters_analytic() tuple[float, float, float]#
Compute the natural frequency and the damping ratio of the circuit.
- Returns:
The natural frequency, the damping ratio and the angular frequency.
- Return type:
tuple[float,float,float]- Raises:
ValueError – If the circuit is overdamped.
Notes
The natural frequency, the damping ratio and the angular frequency are given by:
\[\begin{split}\begin{align*} \omega_0 &= \frac{1}{\sqrt{(L_1 + L_2) C}} \\ \lambda &= \frac{R_0}{2 (L_1 + L_2)} \\ \omega &= \sqrt{\omega_0^2 - \lambda^2} \end{align*}\end{split}\]
- i_analytic(time: numpy.ndarray) numpy.ndarray#
Analytic solution of the current in the circuit, given a constant resistor.
It is assumed that the circuit is underdamped and the initial current is 0. For the details of the solution, see the documentation.
- Parameters:
time (
np.ndarray) – Time at which the current is calculated.- Returns:
The current in the circuit.
- Return type:
np.ndarray- Raises:
ValueError – If the initial current is not 0. If the circuit is overdamped. If the parameters _lambda, _omega and _omega_0 are not yet computed.
Notes
The current in the circuit is given by (assuming I_0 = 0):
\[i(t) = \frac{U_{c0}}{(L_1 + L_2) \omega} e^{-\lambda t} \sin(\omega t)\]
- didt_analytic(time: numpy.ndarray) numpy.ndarray#
Analytic solution of the derivative of the current in the circuit, given a constant resistor.
It is assumed that the circuit is underdamped and the initial current is 0. For the details of the solution, see the documentation.
- Parameters:
time (
np.ndarray) – Time at which the derivative of the current is calculated.- Returns:
The derivative of the current in the circuit.
- Return type:
np.ndarray- Raises:
ValueError – If the initial current is not 0. If the circuit is overdamped. If the parameters _lambda, _omega and _omega_0 are not yet computed.
Notes
The derivative of the current in the circuit is given by (assuming I_0 = 0):
\[\frac{di}{dt}(t) = \frac{U_{c0}}{(L_1 + L_2) \omega} e^{-\lambda t} (\omega \cos(\omega t) - \lambda \sin(\omega t))\]
- u_mes_analytic(time: numpy.ndarray) numpy.ndarray#
Analytic solution of the voltage across R and L2, given a constant resistor.
It is assumed that the circuit is underdamped and the initial current is 0. For the details of the solution, see the documentation.
- Parameters:
time (
np.ndarray) – Time at which the voltage across the resistor and the inductance L2 is calculated.- Returns:
The voltage across the resistor and the inductance L2.
- Return type:
np.ndarray- Raises:
ValueError – If the initial current is not 0. If the circuit is overdamped. If the parameters _lambda, _omega and _omega_0 are not yet computed.
Notes
The voltage across the resistor and the inductance L2 is given by (assuming I_0 = 0):
\[u_{\text{mes}}(t) = R_p i(t) + L_1 \frac{di}{dt}(t)\]