rizer.electrical_model.circuit.rlrp_circuit#
Classes#
Solve the following RLR circuit. |
Functions#
|
Load an RLR circuit model from a dictionary. |
Module Contents#
- class rizer.electrical_model.circuit.rlrp_circuit.RLRp_Circuit(R_wire: float, L_wire: float, u_mes: Callable[[float], float], i_0: float = 0.0, R_model: float | Callable[[float], float] | rizer.electrical_model.circuit.base_circuit.ResistanceDerivativeModel | None = None, R_0: float | None = None)#
Bases:
rizer.electrical_model.circuit.base_circuit.BaseCircuitSolve the following RLR circuit.
----- R_wire --- L_wire -----┐ ↑ │ ↑ │ │ │ u_mes R_p(t) │ u_p │ │ │ │ i_p │ │ ----------<------------------┘
The circuit is composed of a wire resistance \(R_{wire}\), a wire inductance \(L_{wire}\), and a plasma resistance \(R_p(t)\) (which can vary in time), in series.
This class provides the following methods:
RLRp_Circuit.solve(): Solve the RLR circuit numerically (self-contained mode: the plasma resistance is either prescribed by R_model or, if R_model is an ODE-based resistance model, driven by its own state).RLRp_Circuit.compute_derivatives_driven(): Externally-driven mode, for use withDrivenCircuitAdapterorStackedReactorCircuit.
- Parameters:
R_wire (
float) – Resistance of the wire [Ohm].L_wire (
float) – Inductance of the wire [Henries].u_mes (
Callable) – Voltage of the source as a function of time [Volts].i_0 (
float, optional) – Initial current through the plasma channel at time t=0 [A]. Default is 0 A.R_model (
float,typing.Callable,ResistanceDerivativeModel, orNone, optional) – The plasma resistance used by the self-containedsolve(): a constant number, a prescribed callableR_p(t)(e.g.TabulatedLoad), or an object withcompute_resistance_derivative(t, y)(e.g. aVariableResistorModel, which then integrates its own resistance derivative). Not needed when the circuit is driven externally (R_p supplied by the caller). Default None.R_0 (
float, optional) – Initial value of the plasma resistance [Ohm]. Required, and only meaningful, when R_model is an ODE-based resistance model. Default None.
See also
- R_wire#
Resistance of the wire in the RLR circuit. This is a fixed value that does not change with time.
- L_wire#
Inductance of the wire in the RLR circuit. This is a fixed value that does not change with time.
- u_mes#
Voltage of the source as a function of time in the RLR circuit.
- i_0 = 0.0#
Initial current through the plasma channel at time t=0 in the RLR circuit.
- initial_state() numpy.ndarray#
Return the initial circuit state
[i_0], for externally-driven mode.
- current(y: numpy.ndarray) float#
Return the current through the plasma,
y[0].
- compute_derivatives_driven(t: float, y: numpy.ndarray, R_p: float) numpy.ndarray#
Time-derivative of the circuit state
[i], withR_psupplied externally.Thin wrapper around
compute_di_dt().
- 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 RLR circuit when R_model is an ODE-based resistance model. It is used by
RLRp_Circuit.solve()to solve the ODE system.- Parameters:
t (
float) – Time at which the circuit is solved.y (
numpy.ndarrayoffloat,float) –Array containing the present values of the system:
y[0]=i (float): The current through the plasma.
y[1]=R_p (float): The plasma resistance.
- Returns:
Array containing the derivatives of the system:
dy[0]=di_dt (float): The derivative of the current through the plasma.
dy[1]=dR_p (float): The derivative of the plasma resistance.
- Return type:
numpy.ndarrayoffloat,float
- solve(time: numpy.ndarray, method: str = 'LSODA', **kwargs) tuple[numpy.ndarray, numpy.ndarray]#
Solve the RLR circuit numerically (self-contained mode: R_model drives R_p).
Internally, the method uses the scipy.integrate.solve_ivp function to solve the ODE system. When R_model is an ODE-based resistance model, R_p is integrated as part of the ODE state; when R_model is a number or a callable, R_p is simply re-evaluated at every right-hand-side call instead.
- Parameters:
time (
numpy.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:
The current i and the plasma resistance R_p, at each time in time.
- Return type:
- Raises:
ValueError – If the numerical solution did not converge, or if the circuit was constructed without an R_model.
See also
- compute_di_dt(t: float, R_p: float, i: float) float#
Compute the time-derivative of the current in the RLR circuit.
- Parameters:
- Returns:
The time-derivative of the current (di/dt) in A/s.
- Return type:
Notes
Electrical ODE:
\[\frac{dI}{dt} = \frac{V_{mes}(t) - (R_p(T) + R_{wire}) I}{L_{wire}}\]where:
\(I\) is the current (A).
\(V_{mes}(t)\) is the voltage of the source at time t (V).
\(R_p(T)\) is the plasma resistance at temperature T (Ohms).
\(R_{wire}\) is the resistance of the wire (Ohms).
\(L_{wire}\) is the inductance of the wire (H).
- compute_U_R_wire(t: numpy.ndarray, R_p: numpy.ndarray, i: numpy.ndarray) numpy.ndarray#
Compute the voltage drop across the wire resistance.
- Parameters:
t (
numpy.ndarray) – Time at which the circuit is solved [s]. Not used in the calculation of the voltage drop across the wire resistance, but included for consistency with other methods.R_p (
numpy.ndarray) – Plasma resistance at time t [Ohm]. Not used in the calculation of the voltage drop across the wire resistance, but included for consistency with other methods.i (
numpy.ndarray) – Current through the plasma channel at time t [A].
- Returns:
Voltage drop across the wire resistance at time t [V].
- Return type:
Notes
Voltage drop across the wire resistance is given by:
\[U_{wire} = I R_{wire}\]where:
\(I\) is the current (A).
\(R_{wire}\) is the resistance of the wire (Ohms).
- compute_U_R_p(t: numpy.ndarray, R_p: numpy.ndarray, i: numpy.ndarray) numpy.ndarray#
Compute the voltage drop across the plasma resistance.
- Parameters:
t (
numpy.ndarray) – Time at which the circuit is solved [s]. Not used in the calculation of the voltage drop across the plasma resistance, but included for consistency with other methods.R_p (
numpy.ndarray) – Plasma resistance at time t [Ohm].i (
numpy.ndarray) – Current through the plasma channel at time t [A].
- Returns:
Voltage drop across the plasma resistance at time t [V].
- Return type:
Notes
Voltage drop across the plasma resistance is given by:
\[U_{plasma} = I R_p\]where:
\(I\) is the current (A).
\(R_p\) is the plasma resistance (Ohms).
- compute_U_L_wire(t: numpy.ndarray, R_p: numpy.ndarray, i: numpy.ndarray) numpy.ndarray#
Compute the voltage drop across the wire inductance.
- Parameters:
t (
numpy.ndarray) – Time at which the circuit is solved [s].R_p (
numpy.ndarray) – Plasma resistance at time t [Ohm]. Not used in the calculation of the voltage drop across the wire inductance, but included for consistency with other methods.i (
numpy.ndarray) – Current through the plasma channel at time t [A].
- Returns:
Voltage drop across the wire inductance at time t [V].
- Return type:
Notes
Voltage drop across the wire inductance is given by:
\[U_{inductance} = L_{wire} \frac{dI}{dt}\]where:
\(L_{wire}\) is the inductance of the wire (H).
\(\frac{dI}{dt}\) is the time-derivative of the current (A/s).
- compute_power_R_wire(t: numpy.ndarray, R_p: numpy.ndarray, i: numpy.ndarray) numpy.ndarray#
Compute the power dissipated in the wire resistance.
- Parameters:
t (
numpy.ndarray) – Time vector corresponding to each time step [s]. Not used in the calculation of the power dissipated in the wire resistance, but included for consistency with other methods.R_p (
numpy.ndarray) – Plasma resistance at each time step [Ohm]. Not used in the calculation of the power dissipated in the wire resistance, but included for consistency with other methods.i (
numpy.ndarray) – Current through the plasma channel at each time step [A].
- Returns:
Power dissipated in the wire resistance at each time step [W].
- Return type:
Notes
Power dissipated in the wire resistance is given by:
\[P_{wire} = I^2 R_{wire}\]where:
\(I\) is the current (A).
\(R_{wire}\) is the resistance of the wire (Ohms).
- compute_power_R_p(t: numpy.ndarray, R_p: numpy.ndarray, i: numpy.ndarray) numpy.ndarray#
Compute the power dissipated in the plasma resistance.
- Parameters:
t (
numpy.ndarray) – Time vector corresponding to each time step [s]. Not used in the calculation of the power dissipated in the plasma resistance, but included for consistency with other methods.R_p (
numpy.ndarray) – Plasma resistance at each time step [Ohm].i (
numpy.ndarray) – Current through the plasma channel at each time step [A].
- Returns:
Power dissipated in the plasma resistance at each time step [W].
- Return type:
Notes
Power dissipated in the plasma resistance is given by:
\[P_{plasma} = I^2 R_p\]where:
\(I\) is the current (A).
\(R_p\) is the plasma resistance (Ohms).
- compute_power_L(t: numpy.ndarray, R_p: numpy.ndarray, i: numpy.ndarray) numpy.ndarray#
Compute the power dissipated in the wire inductance.
- Parameters:
t (
numpy.ndarray) – Time vector corresponding to each time step [s].R_p (
numpy.ndarray) – Plasma resistance at each time step [Ohm]. Not used in the calculation of the power dissipated in the wire inductance, but included for consistency with other methods.i (
numpy.ndarray) – Current through the plasma channel at each time step [A].
- Returns:
Power dissipated in the wire inductance at each time step [W].
- Return type:
Notes
Power dissipated in the wire inductance is given by:
\[P_{inductance} = \frac{1}{2} L_{wire} \frac{dI^2}{dt}\]where:
\(I\) is the current (A).
\(L_{wire}\) is the inductance of the wire (H).
- compute_powers(t: numpy.ndarray, R_p: numpy.ndarray, i: numpy.ndarray) tuple[numpy.ndarray, numpy.ndarray, numpy.ndarray]#
Compute the total power dissipated in the RLR circuit.
- Parameters:
t (
numpy.ndarray) – Time vector corresponding to each time step [s].R_p (
numpy.ndarray) – Plasma resistance at each time step [Ohm].i (
numpy.ndarray) – Current through the plasma channel at each time step [A].
- Returns:
A tuple containing the power dissipated in the wire resistance, plasma resistance, and wire inductance at each time step [W].
- Return type:
- compute_energies(t: numpy.ndarray, R_p: numpy.ndarray, i: numpy.ndarray) tuple[numpy.ndarray, numpy.ndarray, numpy.ndarray]#
Compute the total energy dissipated in the RLR circuit.
- Parameters:
t (
numpy.ndarray) – Time vector corresponding to each time step [s].R_p (
numpy.ndarray) – Plasma resistance at each time step [Ohm].i (
numpy.ndarray) – Current through the plasma channel at each time step [A].
- Returns:
A tuple containing the energy dissipated in the wire resistance, plasma resistance, and wire inductance at each time step [J].
- Return type:
Notes
Energy dissipated in each component is computed by integrating the power over time:
\[E_{component}(t) = \int_0^t P_{component}(t') dt'\]where \(P_{component}(t)\) is the power dissipated in the component at time t (W).
- rizer.electrical_model.circuit.rlrp_circuit.load_RLRp_circuit_from_dict(input_dict: dict) RLRp_Circuit#
Load an RLR circuit model from a dictionary.
- Parameters:
input_dict (
dict) – A dictionary containing the parameters for the RLR circuit model.- Returns:
An instance of the RLRp_Circuit class initialized with the parameters from the input dictionary.
- Return type: