circuit_simulator.elements package

class circuit_simulator.elements.Capacitor(name: str, node1: int, node2: int, capacitance: float, initial_voltage: float = 0.0)

Bases: Element

Class representing a capacitor.

add_conductance(G, I, x_t, deltaT, method, t)

Add the element’s contribution to the conductance matrix G and current vector I.

to_netlist()

Return a string representation of the element in netlist format.

update(x_t)

Update the element state based on the current solution vector x_t.

class circuit_simulator.elements.CurrentControlledCurrentSource(name: str, node1: int, node2: int, control_node1: int, control_node2: int, gain: float)

Bases: Element

add_conductance(G, I, x_t, deltaT, method, t)

Add the element’s contribution to the conductance matrix G and current vector I.

on_add()

Hook method called when the element is added to a circuit.

to_netlist()

Return a string representation of the element in netlist format.

class circuit_simulator.elements.CurrentControlledVoltageSource(name: str, node1: int, node2: int, control_node1: int, control_node2: int, gain: float)

Bases: Element

Class representing a VoltageControlledVoltageSource element.

add_conductance(G, I, x_t, deltaT, method, t)

Add the element’s contribution to the conductance matrix G and current vector I.

on_add()

Hook method called when the element is added to a circuit.

to_netlist()

Return a string representation of the element in netlist format.

class circuit_simulator.elements.CurrentDCSource(name: str, node1: int, node2: int, source_type: str, current: float)

Bases: Element

Class representing a current source.

add_conductance(G, I, x_t, deltaT, method, t)

Add the element’s contribution to the conductance matrix G and current vector I.

to_netlist()

Return a string representation of the element in netlist format.

class circuit_simulator.elements.CurrentPulseSource(name: str, node1: int, node2: int, source_type: str, current_amplitude_one: float, current_amplitude_two: float, signal_delay: float, rise_time: float, fall_time: float, pulse_time: float, signal_period: float, cycle_number: float)

Bases: Element

Class representing a voltage pulse source.

actual_current_value(actual_time)
add_conductance(G, I, x_t, deltaT, method, t)

Add the element’s contribution to the conductance matrix G and current vector I.

to_netlist()

Return a string representation of the element in netlist format.

class circuit_simulator.elements.CurrentSINSource(name: str, node1: int, node2: int, source_type: str, current: float, signal_amplitude: float, signal_frequency: float, signal_delay: float, signal_damping: float, signal_phase: float, cycle_number: int)

Bases: Element

Class representing a voltage source.

add_conductance(G, I, x_t, deltaT, method, t)

Add the element’s contribution to the conductance matrix G and current vector I.

to_netlist()

Return a string representation of the element in netlist format.

class circuit_simulator.elements.Diode(name: str, node1: int, node2: int)

Bases: Element

Diode using simplified exponential model with linearization.

IS = 3.7751345e-14
VT = 0.025
add_conductance(G, I, x_t, deltaT, method, t)

Add the element’s contribution to the conductance matrix G and current vector I.

to_netlist()

Return a string representation of the element in netlist format.

class circuit_simulator.elements.Inductor(name: str, node1: int, node2: int, inductance: float, initial_current: float = 0.0)

Bases: Element

Class representing an inductor.

add_conductance(G, I, x_t, deltaT, method, t)

Add the element’s contribution to the conductance matrix G and current vector I.

on_add()

Hook method called when the element is added to a circuit.

to_netlist()

Return a string representation of the element in netlist format.

update(x_t)

Update the element state based on the current solution vector x_t.

class circuit_simulator.elements.Mosfet(name: str, drain_node: int, gate_node: int, source_node: int, type: str, w_variable: float, l_variable: float, lambda_variable: float, k_variable: float, vth_variable: float)

Bases: Element

Class representing a MOSFET.

add_conductance(G, I, x_t, deltaT, method, t)

Add the element’s contribution to the conductance matrix G and current vector I.

to_netlist()

Return a string representation of the element in netlist format.

class circuit_simulator.elements.OperationalAmplifier(name: str, node1: int, node2: int, output: int)

Bases: Element

Class representing an ideal operational amplifier.

add_conductance(G, I, x_t, deltaT, method, t)

Add the element’s contribution to the conductance matrix G and current vector I.

on_add()

Hook method called when the element is added to a circuit.

to_netlist()

Return a string representation of the element in netlist format.

class circuit_simulator.elements.Resistor(name: str, node1: int, node2: int, resistance: float)

Bases: Element

Class representing a resistor.

add_conductance(G, I, x_t, deltaT, method, t)

Add the element’s contribution to the conductance matrix G and current vector I.

to_netlist()

Return a string representation of the element in netlist format.

class circuit_simulator.elements.ResistorNonLinear(name: str, node1: int, node2: int, v1: float, i1: float, v2: float, i2: float, v3: float, i3: float, v4: float, i4: float)

Bases: Element

Class representing a nonlinear resistor.

add_conductance(G, I, x_t, deltaT, method, t)

Add the element’s contribution to the conductance matrix G and current vector I.

to_netlist()

Return a string representation of the element in netlist format.

class circuit_simulator.elements.VoltageControlledCurrentSource(name: str, node1: int, node2: int, control_node1: int, control_node2: int, gain: float)

Bases: Element

Class representing a current controlled current source.

add_conductance(G, I, x_t, deltaT, method, t)

Add the element’s contribution to the conductance matrix G and current vector I.

to_netlist()

Return a string representation of the element in netlist format.

class circuit_simulator.elements.VoltageControlledVoltageSource(name: str, node1: int, node2: int, control_node1: int, control_node2: int, gain: float)

Bases: Element

Class representing a VoltageControlledVoltageSource element.

add_conductance(G, I, x_t, deltaT, method, t)

Add the element’s contribution to the conductance matrix G and current vector I.

on_add()

Hook method called when the element is added to a circuit.

to_netlist()

Return a string representation of the element in netlist format.

class circuit_simulator.elements.VoltageDCSource(name: str, node1: int, node2: int, source_type: str, voltage: float)

Bases: Element

Class representing a voltage source.

add_conductance(G, I, x_t, deltaT, method, t)

Add the element’s contribution to the conductance matrix G and current vector I.

on_add()

Hook method called when the element is added to a circuit.

to_netlist()

Return a string representation of the element in netlist format.

class circuit_simulator.elements.VoltagePulseSource(name: str, node1: int, node2: int, source_type: str, voltage_amplitude_one: float, voltage_amplitude_two: float, signal_delay: float, rise_time: float, fall_time: float, pulse_time: float, signal_period: float, cycle_number: float)

Bases: Element

Class representing a voltage pulse source.

actual_voltage_value(actual_time)
add_conductance(G, I, x_t, deltaT, method, t)

Add the element’s contribution to the conductance matrix G and current vector I.

on_add()

Hook method called when the element is added to a circuit.

to_netlist()

Return a string representation of the element in netlist format.

class circuit_simulator.elements.VoltageSINSource(name: str, node1: int, node2: int, source_type: str, voltage: float, signal_amplitude: float, signal_frequency: float, signal_delay: float, signal_damping: float, signal_phase: float, cycle_number: int)

Bases: Element

Class representing a voltage source.

add_conductance(G, I, x_t, deltaT, method, t)

Add the element’s contribution to the conductance matrix G and current vector I.

on_add()

Hook method called when the element is added to a circuit.

to_netlist()

Return a string representation of the element in netlist format.

Submodules

circuit_simulator.elements.AmpOp module

class circuit_simulator.elements.AmpOp.OperationalAmplifier(name: str, node1: int, node2: int, output: int)

Bases: Element

Class representing an ideal operational amplifier.

add_conductance(G, I, x_t, deltaT, method, t)

Add the element’s contribution to the conductance matrix G and current vector I.

on_add()

Hook method called when the element is added to a circuit.

to_netlist()

Return a string representation of the element in netlist format.

circuit_simulator.elements.Capacitor module

class circuit_simulator.elements.Capacitor.Capacitor(name: str, node1: int, node2: int, capacitance: float, initial_voltage: float = 0.0)

Bases: Element

Class representing a capacitor.

add_conductance(G, I, x_t, deltaT, method, t)

Add the element’s contribution to the conductance matrix G and current vector I.

to_netlist()

Return a string representation of the element in netlist format.

update(x_t)

Update the element state based on the current solution vector x_t.

circuit_simulator.elements.CurrentControlledCurrentSource module

class circuit_simulator.elements.CurrentControlledCurrentSource.CurrentControlledCurrentSource(name: str, node1: int, node2: int, control_node1: int, control_node2: int, gain: float)

Bases: Element

add_conductance(G, I, x_t, deltaT, method, t)

Add the element’s contribution to the conductance matrix G and current vector I.

on_add()

Hook method called when the element is added to a circuit.

to_netlist()

Return a string representation of the element in netlist format.

circuit_simulator.elements.CurrentControlledVoltageSource module

class circuit_simulator.elements.CurrentControlledVoltageSource.CurrentControlledVoltageSource(name: str, node1: int, node2: int, control_node1: int, control_node2: int, gain: float)

Bases: Element

Class representing a VoltageControlledVoltageSource element.

add_conductance(G, I, x_t, deltaT, method, t)

Add the element’s contribution to the conductance matrix G and current vector I.

on_add()

Hook method called when the element is added to a circuit.

to_netlist()

Return a string representation of the element in netlist format.

circuit_simulator.elements.CurrentDCSource module

class circuit_simulator.elements.CurrentDCSource.CurrentDCSource(name: str, node1: int, node2: int, source_type: str, current: float)

Bases: Element

Class representing a current source.

add_conductance(G, I, x_t, deltaT, method, t)

Add the element’s contribution to the conductance matrix G and current vector I.

to_netlist()

Return a string representation of the element in netlist format.

circuit_simulator.elements.CurrentPulseSource module

class circuit_simulator.elements.CurrentPulseSource.CurrentPulseSource(name: str, node1: int, node2: int, source_type: str, current_amplitude_one: float, current_amplitude_two: float, signal_delay: float, rise_time: float, fall_time: float, pulse_time: float, signal_period: float, cycle_number: float)

Bases: Element

Class representing a voltage pulse source.

actual_current_value(actual_time)
add_conductance(G, I, x_t, deltaT, method, t)

Add the element’s contribution to the conductance matrix G and current vector I.

to_netlist()

Return a string representation of the element in netlist format.

circuit_simulator.elements.CurrentSINSource module

class circuit_simulator.elements.CurrentSINSource.CurrentSINSource(name: str, node1: int, node2: int, source_type: str, current: float, signal_amplitude: float, signal_frequency: float, signal_delay: float, signal_damping: float, signal_phase: float, cycle_number: int)

Bases: Element

Class representing a voltage source.

add_conductance(G, I, x_t, deltaT, method, t)

Add the element’s contribution to the conductance matrix G and current vector I.

to_netlist()

Return a string representation of the element in netlist format.

circuit_simulator.elements.Diode module

class circuit_simulator.elements.Diode.Diode(name: str, node1: int, node2: int)

Bases: Element

Diode using simplified exponential model with linearization.

IS = 3.7751345e-14
VT = 0.025
add_conductance(G, I, x_t, deltaT, method, t)

Add the element’s contribution to the conductance matrix G and current vector I.

parent_circuit: Circuit | None
to_netlist()

Return a string representation of the element in netlist format.

circuit_simulator.elements.Inductor module

class circuit_simulator.elements.Inductor.Inductor(name: str, node1: int, node2: int, inductance: float, initial_current: float = 0.0)

Bases: Element

Class representing an inductor.

add_conductance(G, I, x_t, deltaT, method, t)

Add the element’s contribution to the conductance matrix G and current vector I.

on_add()

Hook method called when the element is added to a circuit.

to_netlist()

Return a string representation of the element in netlist format.

update(x_t)

Update the element state based on the current solution vector x_t.

circuit_simulator.elements.Mosfet module

class circuit_simulator.elements.Mosfet.Mosfet(name: str, drain_node: int, gate_node: int, source_node: int, type: str, w_variable: float, l_variable: float, lambda_variable: float, k_variable: float, vth_variable: float)

Bases: Element

Class representing a MOSFET.

add_conductance(G, I, x_t, deltaT, method, t)

Add the element’s contribution to the conductance matrix G and current vector I.

to_netlist()

Return a string representation of the element in netlist format.

circuit_simulator.elements.Resistor module

class circuit_simulator.elements.Resistor.Resistor(name: str, node1: int, node2: int, resistance: float)

Bases: Element

Class representing a resistor.

add_conductance(G, I, x_t, deltaT, method, t)

Add the element’s contribution to the conductance matrix G and current vector I.

to_netlist()

Return a string representation of the element in netlist format.

circuit_simulator.elements.ResistorNonLinear module

class circuit_simulator.elements.ResistorNonLinear.ResistorNonLinear(name: str, node1: int, node2: int, v1: float, i1: float, v2: float, i2: float, v3: float, i3: float, v4: float, i4: float)

Bases: Element

Class representing a nonlinear resistor.

add_conductance(G, I, x_t, deltaT, method, t)

Add the element’s contribution to the conductance matrix G and current vector I.

to_netlist()

Return a string representation of the element in netlist format.

circuit_simulator.elements.VoltageControlledCurrentSource module

class circuit_simulator.elements.VoltageControlledCurrentSource.VoltageControlledCurrentSource(name: str, node1: int, node2: int, control_node1: int, control_node2: int, gain: float)

Bases: Element

Class representing a current controlled current source.

add_conductance(G, I, x_t, deltaT, method, t)

Add the element’s contribution to the conductance matrix G and current vector I.

to_netlist()

Return a string representation of the element in netlist format.

circuit_simulator.elements.VoltageControlledVoltageSource module

class circuit_simulator.elements.VoltageControlledVoltageSource.VoltageControlledVoltageSource(name: str, node1: int, node2: int, control_node1: int, control_node2: int, gain: float)

Bases: Element

Class representing a VoltageControlledVoltageSource element.

add_conductance(G, I, x_t, deltaT, method, t)

Add the element’s contribution to the conductance matrix G and current vector I.

on_add()

Hook method called when the element is added to a circuit.

to_netlist()

Return a string representation of the element in netlist format.

circuit_simulator.elements.VoltageDCSource module

class circuit_simulator.elements.VoltageDCSource.VoltageDCSource(name: str, node1: int, node2: int, source_type: str, voltage: float)

Bases: Element

Class representing a voltage source.

add_conductance(G, I, x_t, deltaT, method, t)

Add the element’s contribution to the conductance matrix G and current vector I.

on_add()

Hook method called when the element is added to a circuit.

to_netlist()

Return a string representation of the element in netlist format.

circuit_simulator.elements.VoltagePulseSource module

class circuit_simulator.elements.VoltagePulseSource.VoltagePulseSource(name: str, node1: int, node2: int, source_type: str, voltage_amplitude_one: float, voltage_amplitude_two: float, signal_delay: float, rise_time: float, fall_time: float, pulse_time: float, signal_period: float, cycle_number: float)

Bases: Element

Class representing a voltage pulse source.

actual_voltage_value(actual_time)
add_conductance(G, I, x_t, deltaT, method, t)

Add the element’s contribution to the conductance matrix G and current vector I.

on_add()

Hook method called when the element is added to a circuit.

to_netlist()

Return a string representation of the element in netlist format.

circuit_simulator.elements.VoltageSINSource module

class circuit_simulator.elements.VoltageSINSource.VoltageSINSource(name: str, node1: int, node2: int, source_type: str, voltage: float, signal_amplitude: float, signal_frequency: float, signal_delay: float, signal_damping: float, signal_phase: float, cycle_number: int)

Bases: Element

Class representing a voltage source.

add_conductance(G, I, x_t, deltaT, method, t)

Add the element’s contribution to the conductance matrix G and current vector I.

on_add()

Hook method called when the element is added to a circuit.

to_netlist()

Return a string representation of the element in netlist format.