rizer.electric_circuit.castera_circuit#
Mimic the electric circuit from Philippe Castera’s thesis [Castera2015].
Classes#
Solve the following circuit, inspired by Philippe Castera's thesis [Castera2015]. |
Module Contents#
- class rizer.electric_circuit.castera_circuit.CasteraCircuit(C: float | int, L: float | int, L_p: float | int, R_b: float | int, R_sg: 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 circuit, inspired by Philippe Castera’s thesis [Castera2015].
┌-------------------(L-L_p)------┐ │ ↑ │ │ ↑ │ u_c C L_p │ R_b │ │ │ u_mes │ R_sg R_p │ │ │ │ │ ┖--------------------------------┘
The circuit is composed of:
a capacitor C,
an inductor L,
a second inductor L_p (plasma inductor),
a resistor R_p (plasma resistance),
a resistor R_b (ballast resistor),
a resistor R_sg (spark gap resistance, assumed to be constant).
Models require the initial values of:
the plasma resistance R_0,
the initial current trough the plasma I_0,
the initial voltage across the capacitor U_c_0.
This class provides the following methods:
CasteraCircuit.solve(): Solve the RLLC circuit numerically, given a time varying resistor.
- Parameters:
C (
float | int) – Capacitance value in Farads.L (
float | int) – Inductance value in Henry.L_p (
float | int) – Plasma inductance value in Henry.R_b (
float | int) – Ballast resistance in Ohms.R_sg (
float | int) – Spark gap resistance in Ohms.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.
- di: numpy.ndarray | None = None#
Derivative of the current.
- u_c: numpy.ndarray | None = None#
Voltage across the capacitor.
- R_p: numpy.ndarray | None = None#
Resistance of the plasma.
- u_mes: numpy.ndarray | None = None#
Voltage across R_p and L_p.
- 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.
- 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
CasteraCircuit.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{R_b}{(R_b + R_{sg}) L} u_c - \left(\frac{R_{sg} R_b}{R_b + R_{sg}} + R_p\right) \frac{i_p}{L} \\ \frac{du_c}{dt} &= -\frac{u_c}{(R_b + R_{sg}) C} - \frac{R_b}{R_b + R_{sg}} \frac{i_p}{C} \\ \frac{dR_p}{dt} &= \text{compute_resistance_derivative}(t, [i_p, R_p]) \end{cases}\end{split}\]