rizer.electrical_model.circuit.base_circuit#
Shared numerical infrastructure for electrical circuit models.
Circuits solved by this package come in two flavors:
Standalone, self-contained circuits (
CLLRp_Circuit,CasteraCircuit) that own the plasma resistance as part of their own ODE state, solved end-to-end by their ownsolvemethod.Externally-driven circuits, where the plasma resistance
R_pis supplied from outside (a reactor), either throughDrivenCircuitAdapter(windowed, for a Cantera-ReactorNet-driven reactor) or throughStackedReactorCircuit(exact, for a scipy.integrate.solve_ivp-driven reactor).
BaseCircuit collects the interface both driven mechanisms need
(initial_state(), current(),
compute_derivatives_driven()), the windowed-solve helper used only by
the adapter (solve_window()), shared power/energy diagnostic
helpers, and shared helpers for the “any kind of resistance” standalone-mode input
accepted by RLRp_Circuit,
CLLRp_Circuit, and
CasteraCircuit.
Classes#
Structural interface for an ODE-based resistance model. |
|
Structural interface for anything a reactor's electric_circuit= can be. |
|
Abstract base class for electrical circuit models coupled to a plasma reactor. |
Module Contents#
- class rizer.electrical_model.circuit.base_circuit.ResistanceDerivativeModel#
Bases:
ProtocolStructural interface for an ODE-based resistance model.
Any object with this method satisfies this Protocol – no inheritance from
VariableResistorModelrequired. Used to accept “any kind of resistance” (see_validate_resistance_spec()) without narrowing standalone-mode circuits to that one class hierarchy.- compute_resistance_derivative(t: float, y: numpy.ndarray) numpy.ndarray#
Return \(dR_p/dt\), given the current state
y = [i_p, R_p].Return type is numpy.ndarray, matching
compute_resistance_derivative()’s actual annotation exactly (even though it is always scalar-valued at runtime) – a narrower-> floathere would make every concrete VariableResistorModel subclass structurally fail this Protocol under mypy (return-type covariance), breaking make type-check for existing code.
- class rizer.electrical_model.circuit.base_circuit.PlasmaVoltageCircuit#
Bases:
ProtocolStructural interface for anything a reactor’s electric_circuit= can be.
Any object with this one method satisfies it – TransmissionLineResistiveCircuit, TransmissionLineRCLoadCircuit, DirectResistiveCircuit, DirectRCLoadCircuit, GeneratorVoltageCircuit, and a DrivenCircuitAdapter-wrapped circuit all qualify, without a shared base class – a reactive load or a bypassed source changes the solving strategy entirely, not just a parameter, so there is nothing else meaningful to make abstract here.
- class rizer.electrical_model.circuit.base_circuit.BaseCircuit#
Bases:
abc.ABCAbstract base class for electrical circuit models coupled to a plasma reactor.
See also
- abstractmethod initial_state() numpy.ndarray#
Return the initial value of the circuit’s own ODE state, in externally-driven mode.
- Returns:
Initial state vector.
- Return type:
- abstractmethod current(y: numpy.ndarray) float#
Return the current flowing through the plasma, from the circuit’s own state
y.Only implemented by circuits whose plasma current is a pure function of their own state (needed by
StackedReactorCircuit). Some circuits’ current also depends on the externally-suppliedR_por ont(e.g.RC_Rp_Circuit) and do not override this.- Parameters:
y (
numpy.ndarray) – Circuit state vector, as returned byinitial_state()or produced bycompute_derivatives_driven().- Returns:
Current through the plasma, in Amperes.
- Return type:
- Raises:
NotImplementedError – If not overridden by the subclass.
- abstractmethod compute_derivatives_driven(t: float, y: numpy.ndarray, R_p: float) numpy.ndarray#
Time-derivative of the circuit’s own state, with the plasma resistance supplied externally.
- Parameters:
t (
float) – Time, in seconds.y (
numpy.ndarray) – Circuit state vector.R_p (
float) – Plasma resistance at timet, in Ohm.
- Returns:
Time-derivative of the circuit state.
- Return type:
- abstractmethod compute_derivatives(t: float, y: numpy.ndarray) numpy.ndarray#
Time-derivative of the circuit’s own state, in standalone (self-contained) mode.
Only implemented by circuits that also own the plasma resistance as part of their own ODE state (used by their self-contained
solvemethod) –CLLRp_CircuitandCasteraCircuit. Circuits that are only ever externally driven (e.g.RC_Rp_Circuit) do not override this.- Raises:
NotImplementedError – If not overridden by the subclass.
- solve_window(time: numpy.ndarray, y0: numpy.ndarray, R_p: float, method: str = 'LSODA', dense_output: bool = True, **kwargs) Any#
Solve the circuit over one window, with the plasma resistance frozen at
R_p.Used only by
DrivenCircuitAdapter. Distinct from the self-containedsolvemethod thatCLLRp_CircuitandCasteraCircuitalready define (noy0, builds its own initial state, returns a 4-tuple) – this method is never overridden and never collides with it.- Parameters:
time (
numpy.ndarray) – Two-element array[t0, t1]spanning the window.y0 (
numpy.ndarray) – Circuit state attime[0].R_p (
float) – Plasma resistance, frozen over the window.method (
str, optional) – Integrator passed to scipy.integrate.solve_ivp. Default “LSODA”.dense_output (
bool, optional) – Whether to build a continuous interpolant (.sol). Default True.**kwargs – Additional arguments passed to scipy.integrate.solve_ivp.
- Returns:
The solution object (scipy.integrate.OdeResult, a Bunch-like object) returned by scipy.integrate.solve_ivp.
- Return type:
Any