electronic ¤
Electronic components.
Functions:
| Name | Description |
|---|---|
BJT_NPN | NPN BJT using the transport form of the Ebers-Moll DC model. |
BJT_NPN_Dynamic | NPN BJT with the Ebers-Moll DC model and first-order junction charge dynamics. |
CCCS | Current Controlled Current Source: I_out = alpha * i_ctrl, V_in = 0 (short). |
CCVS | Current Controlled Voltage Source: V_out = R * i_ctrl, V_in = 0 (short). |
Capacitor | Q = C * V. |
CoupledInductors | Two magnetically coupled inductors with |
CurrentSource | Constant current source. |
Diode | Ideal diode using the Shockley equation |
IdealOpAmp | Ideal Op Amp. |
IdealTransformer | Ideal transformer with turns ratio |
Inductor | V = L * di/dt formulated via flux: f['i_L'] = V, q['i_L'] = -L*i_L. |
NMOS | N-channel MOSFET with square-law DC model and channel-length modulation. |
NMOSDynamic | NMOS with square-law DC model and Meyer gate capacitance model. |
PMOS | P-channel MOSFET with square-law DC model, formulated in terms of |
PulseVoltageSource | SPICE-compatible PULSE voltage source: PULSE(v1 v2 td tr tf pw per). |
Resistor | Ohm's Law: I = V/R. |
SmoothPulse | Sigmoid-smoothed pulse. |
TransmissionLine | Matched bidirectional transmission line with exact fixed delay. |
VCCS | Voltage Controlled Current Source. |
VCVS | Voltage Controlled Voltage Source. |
VoltageControlledSwitch | Voltage Controlled Switch. |
VoltageSource | Step voltage source. |
VoltageSourceAC | Sinusoidal voltage source. |
WaveformCurrentSource | Independent current source with a DC bias and a SIN, PULSE or PWL transient waveform. |
WaveformVoltageSource | SPICE voltage source with optional DC override and SIN/PULSE/PWL waveform. |
ZenerDiode | Zener diode with forward Shockley conduction and reverse breakdown. |
waveform_value | Evaluate a SPICE transient waveform, including its time-zero value. |
BJT_NPN ¤
BJT_NPN(
signals: Signals,
Is: float = 1e-12,
BetaF: float = 100.0,
BetaR: float = 1.0,
Vt: float = 0.02585,
) -> PhysicsReturn
NPN BJT using the transport form of the Ebers-Moll DC model.
Junction voltages are clipped to [-5, 2] V before exponentiation. For transient simulations with junction charge dynamics use :func:BJT_NPN_Dynamic instead.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
signals | Signals | Port voltages at collector ( | required |
Is | float | Saturation current in amperes. Defaults to | 1e-12 |
BetaF | float | Forward common-emitter current gain. Defaults to | 100.0 |
BetaR | float | Reverse common-emitter current gain. Defaults to | 1.0 |
Vt | float | Thermal voltage in volts. Defaults to | 0.02585 |
Source code in circulax/components/electronic.py
BJT_NPN_Dynamic ¤
BJT_NPN_Dynamic(
signals: Signals,
Is: float = 1e-12,
BetaF: float = 100.0,
BetaR: float = 1.0,
Vt: float = 0.02585,
Cje: float = 1e-12,
Cjc: float = 1e-12,
Vje: float = 0.75,
Vjc: float = 0.75,
Mje: float = 0.33,
Mjc: float = 0.33,
Tf: float = 0.0,
Tr: float = 0.0,
) -> PhysicsReturn
NPN BJT with the Ebers-Moll DC model and first-order junction charge dynamics.
DC currents follow the transport form of the Ebers-Moll equations. Junction voltages are clipped to [-5, 2] V before exponentiation to prevent overflow during transient solver iterations.
Charge dynamics combine two contributions at each junction:
- Depletion charge — modelled as a nonlinear junction capacitance via :func:
_junction_charge, using the standard abrupt/graded junction formula with ideality parametersVjandMj. - Diffusion charge — proportional to the junction current scaled by the transit time (
Tffor BE,Trfor BC``), representing minority carrier storage in the base.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
signals | Signals | Port voltages at collector ( | required |
Is | float | Saturation current in amperes. Defaults to | 1e-12 |
BetaF | float | Forward common-emitter current gain. Defaults to | 100.0 |
BetaR | float | Reverse common-emitter current gain. Defaults to | 1.0 |
Vt | float | Thermal voltage in volts. Defaults to | 0.02585 |
Cje | float | Zero-bias BE junction capacitance in farads. Defaults to | 1e-12 |
Cjc | float | Zero-bias BC junction capacitance in farads. Defaults to | 1e-12 |
Vje | float | BE built-in junction potential in volts. Defaults to | 0.75 |
Vjc | float | BC built-in junction potential in volts. Defaults to | 0.75 |
Mje | float | BE junction grading coefficient. Defaults to | 0.33 |
Mjc | float | BC junction grading coefficient. Defaults to | 0.33 |
Tf | float | Forward transit time in seconds. Defaults to | 0.0 |
Tr | float | Reverse transit time in seconds. Defaults to | 0.0 |
Returns:
| Type | Description |
|---|---|
PhysicsReturn | A two-tuple |
PhysicsReturn |
|
PhysicsReturn |
|
Source code in circulax/components/electronic.py
750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 | |
CCCS ¤
Current Controlled Current Source: I_out = alpha * i_ctrl, V_in = 0 (short).
Source code in circulax/components/electronic.py
CCVS ¤
Current Controlled Voltage Source: V_out = R * i_ctrl, V_in = 0 (short).
Source code in circulax/components/electronic.py
Capacitor ¤
Q = C * V. Returns Charge (q) so the solver computes I = dq/dt.
Source code in circulax/components/electronic.py
CoupledInductors ¤
CoupledInductors(
signals: Signals, L1: float = 1e-09, L2: float = 1e-09, k: float = 0.5
) -> PhysicsReturn
Two magnetically coupled inductors with M = k * sqrt(L1 * L2).
Dots are on p1 and s1; currents are positive into the dotted terminals. The parameters should satisfy L1, L2 > 0 and |k| <= 1. At k = 0 the windings are independent. For |k| = 1 the inductance matrix is singular.
Source code in circulax/components/electronic.py
CurrentSource ¤
Constant current source.
Source code in circulax/components/electronic.py
Diode ¤
Ideal diode using the Shockley equation I = Is * (exp(Vd / n*Vt) - 1).
Junction voltage is clipped to [-5, 5] V for numerical stability.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
signals | Signals | Port voltages at anode ( | required |
Is | float | Saturation current in amperes. Defaults to | 1e-12 |
n | float | Ideality factor. Defaults to | 1.0 |
Vt | float | Thermal voltage in volts. Defaults to | 0.02585 |
Source code in circulax/components/electronic.py
IdealOpAmp ¤
Ideal Op Amp.
Source code in circulax/components/electronic.py
IdealTransformer ¤
Ideal transformer with turns ratio n = N1 / N2 (n > 0).
Dots are on p1 and s1. It passes DC; add a magnetizing inductor across the primary to model low-frequency roll-off.
Source code in circulax/components/electronic.py
Inductor ¤
V = L * di/dt formulated via flux: f['i_L'] = V, q['i_L'] = -L*i_L.
Source code in circulax/components/electronic.py
NMOS ¤
NMOS(
signals: Signals,
Kp: float = 2e-05,
W: float = 1e-05,
L: float = 1e-06,
Vth: float = 1.0,
lam: float = 0.0,
) -> PhysicsReturn
N-channel MOSFET with square-law DC model and channel-length modulation.
Gate current is zero (infinite input impedance).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
signals | Signals | Port voltages at drain ( | required |
Kp | float | Process transconductance parameter in A/V². Defaults to | 2e-05 |
W | float | Gate width in metres. Defaults to | 1e-05 |
L | float | Gate length in metres. Defaults to | 1e-06 |
Vth | float | Threshold voltage in volts. Defaults to | 1.0 |
lam | float | Channel-length modulation coefficient in V⁻¹. Defaults to | 0.0 |
Source code in circulax/components/electronic.py
NMOSDynamic ¤
NMOSDynamic(
signals: Signals,
Kp: float = 2e-05,
W: float = 1e-05,
L: float = 1e-06,
Vth: float = 1.0,
lam: float = 0.0,
Cox: float = 0.001,
Cgd_ov: float = 1e-15,
Cgs_ov: float = 1e-15,
) -> PhysicsReturn
NMOS with square-law DC model and Meyer gate capacitance model.
Gate charge is split into bias-dependent intrinsic charge (Meyer) and linear overlap contributions at the drain and source.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
signals | Signals | Port voltages at drain ( | required |
Kp | float | Process transconductance parameter in A/V². Defaults to | 2e-05 |
W | float | Gate width in metres. Defaults to | 1e-05 |
L | float | Gate length in metres. Defaults to | 1e-06 |
Vth | float | Threshold voltage in volts. Defaults to | 1.0 |
lam | float | Channel-length modulation coefficient in V⁻¹. Defaults to | 0.0 |
Cox | float | Gate oxide capacitance per unit area in F/m². Defaults to | 0.001 |
Cgd_ov | float | Gate-drain overlap capacitance in farads. Defaults to | 1e-15 |
Cgs_ov | float | Gate-source overlap capacitance in farads. Defaults to | 1e-15 |
Source code in circulax/components/electronic.py
PMOS ¤
PMOS(
signals: Signals,
Kp: float = 1e-05,
W: float = 2e-05,
L: float = 1e-06,
Vth: float = -1.0,
lam: float = 0.0,
) -> PhysicsReturn
P-channel MOSFET with square-law DC model, formulated in terms of Vsg and Vsd.
Gate current is zero (infinite input impedance).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
signals | Signals | Port voltages at drain ( | required |
Kp | float | Process transconductance parameter in A/V². Defaults to | 1e-05 |
W | float | Gate width in metres. Defaults to | 2e-05 |
L | float | Gate length in metres. Defaults to | 1e-06 |
Vth | float | Threshold voltage in volts (negative for PMOS). Defaults to | -1.0 |
lam | float | Channel-length modulation coefficient in V⁻¹. Defaults to | 0.0 |
Source code in circulax/components/electronic.py
PulseVoltageSource ¤
PulseVoltageSource(
signals: Signals,
t: float,
v1: float = 0.0,
v2: float = 1.0,
td: float = 0.0,
tr: float = 1e-09,
tf: float = 1e-09,
pw: float = 0.001,
per: float = 0.002,
) -> PhysicsReturn
SPICE-compatible PULSE voltage source: PULSE(v1 v2 td tr tf pw per).
Parameters¤
v1 : initial (low) voltage v2 : pulsed (high) voltage td : delay time before first edge tr : rise time (v1 → v2) tf : fall time (v2 → v1) pw : pulse width (time at v2) per : period (must satisfy per >= td + tr + pw + tf)
Source code in circulax/components/electronic.py
Resistor ¤
Ohm's Law: I = V/R.
Source code in circulax/components/electronic.py
SmoothPulse ¤
SmoothPulse(
signals: Signals, t: float, V: float = 1.0, delay: float = 1e-09, tr: float = 1e-10
) -> PhysicsReturn
Sigmoid-smoothed pulse.
Source code in circulax/components/electronic.py
TransmissionLine ¤
TransmissionLine(
signals: Signals, tau: float = 1e-09, z0: float = 50.0, attenuation: float = 1.0
) -> PhysicsReturn
Matched bidirectional transmission line with exact fixed delay.
a1 and a2 are the incident power-wave amplitudes at the two reference planes. The outgoing waves are the delayed incident wave from the opposite end. This stamp stays finite for an exactly lossless line and therefore avoids the singular S -> Y conversion of an ideal through connection.
The same equations are interpreted by DC, transient, AC, and HB.
Source code in circulax/components/electronic.py
VCCS ¤
Voltage Controlled Current Source.
Source code in circulax/components/electronic.py
VCVS ¤
Voltage Controlled Voltage Source.
Source code in circulax/components/electronic.py
VoltageControlledSwitch ¤
VoltageControlledSwitch(
signals: Signals, Ron: float = 1.0, Roff: float = 1000000.0, Vt: float = 0.0
) -> PhysicsReturn
Voltage Controlled Switch.
Source code in circulax/components/electronic.py
VoltageSource ¤
Step voltage source.
Source code in circulax/components/electronic.py
VoltageSourceAC ¤
VoltageSourceAC(
signals: Signals,
t: float,
V: float = 0.0,
freq: float = 1000000.0,
phase: float = 0.0,
delay: float = 0.0,
) -> PhysicsReturn
Sinusoidal voltage source.
Source code in circulax/components/electronic.py
WaveformCurrentSource ¤
WaveformCurrentSource(
signals: Signals,
t: float,
kind: float = WAVE_DC,
dc: float = 0.0,
dc_given: float = 0.0,
source_mode: float = 0.0,
source_scale: float = 1.0,
tstep: float = 0.0,
tstop: float = 0.0,
delay: float = 0.0,
offset: float = 0.0,
amplitude: float = 0.0,
freq: float = 0.0,
damping: float = 0.0,
phase: float = 0.0,
v1: float = 0.0,
v2: float = 0.0,
tr: float = 0.0,
tf: float = 0.0,
pw: float = 0.0,
per: float = 0.0,
pwl_t: tuple = (0.0, 0.0),
pwl_v: tuple = (0.0, 0.0),
repeat: float = -1.0,
) -> PhysicsReturn
Independent current source with a DC bias and a SIN, PULSE or PWL transient waveform.
Same parameters and contract as :class:WaveformVoltageSource, with the waveform value interpreted as a current (v1/v2/offset/amplitude in amperes). Sign convention matches :func:CurrentSource: the value leaves p1 and enters p2 through the source.
Source code in circulax/components/electronic.py
WaveformVoltageSource ¤
WaveformVoltageSource(
signals: Signals,
t: float,
kind: float = WAVE_DC,
dc: float = 0.0,
dc_given: float = 0.0,
source_mode: float = 0.0,
source_scale: float = 1.0,
tstep: float = 0.0,
tstop: float = 0.0,
delay: float = 0.0,
offset: float = 0.0,
amplitude: float = 0.0,
freq: float = 0.0,
damping: float = 0.0,
phase: float = 0.0,
v1: float = 0.0,
v2: float = 0.0,
tr: float = 0.0,
tf: float = 0.0,
pw: float = 0.0,
per: float = 0.0,
pwl_t: tuple = (0.0, 0.0),
pwl_v: tuple = (0.0, 0.0),
repeat: float = -1.0,
) -> PhysicsReturn
SPICE voltage source with optional DC override and SIN/PULSE/PWL waveform.
An explicit dc overrides the operating point only. Otherwise the DC value is the waveform's time-zero value. Transient and harmonic balance always evaluate the waveform, including at zero. tstep and tstop supply SPICE defaults; the solvers set them from the analysis.
source_mode is 0 for DC and 1 for waveform evaluation. Source stepping scales the complete DC value through source_scale. dc_given records whether dc was supplied, including an explicit zero; constructors and parse_source set it automatically.
Source code in circulax/components/electronic.py
ZenerDiode ¤
ZenerDiode(
signals: Signals,
Vz: float = 5.0,
Is: float = 1e-12,
n: float = 1.0,
Vt: float = 0.02585,
) -> PhysicsReturn
Zener diode with forward Shockley conduction and reverse breakdown.
Breakdown is modelled as a reverse exponential that activates when Vd < -Vz.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
signals | Signals | Port voltages at anode ( | required |
Vz | float | Zener breakdown voltage in volts. Defaults to | 5.0 |
Is | float | Saturation current in amperes. Defaults to | 1e-12 |
n | float | Ideality factor. Defaults to | 1.0 |
Vt | float | Thermal voltage in volts. Defaults to | 0.02585 |
Source code in circulax/components/electronic.py
waveform_value ¤
waveform_value(
t: float,
*,
kind: float,
delay: float,
offset: float,
amplitude: float,
freq: float,
damping: float,
phase: float,
v1: float,
v2: float,
tr: float,
tf: float,
pw: float,
per: float,
pwl_t: Sequence[float],
pwl_v: Sequence[float],
repeat: float,
tstep: float = 1e-09,
tstop: float = 1.0
) -> Array
Evaluate a SPICE transient waveform, including its time-zero value.
Zero or omitted SIN frequency and PULSE edge times, width and period use the supplied analysis settings. DC overrides are handled by the source's analysis mode, independently of this time-domain evaluation.