@ferret/physics-electric
circuits of sources, wires, lamps, motors, inductors and capacitors solved each step.
Read the guide: how to use it →
Classes
Base class
abstract class Base implements Elementextra: number | extra unknowns this element needs (ideal voltage sources and transformers) |
k: number | first extra index, set by the circuit |
nonlinear: boolean | |
kind: Element['kind'] | |
power: number | power the element takes from the circuit now, W (negative = delivers) |
v: number | last voltage across it and last current through it |
i: number | |
constructor(readonly name: string, readonly a: string, readonly b: string) | |
abstract stamp(s: Stamper, h: number, t: number): void | put the element into the matrix for a step of h ending at time t |
commit(va: number, vb: number, _h: number, _t: number, _c: Circuit): void | after the step is accepted: voltages across a→b and the current a→b through the element |
abstract current(va: number, vb: number, x: number[]): number | current a → b through the element for the solution (to read it) |
packages/physics-electric/src/circuit.ts:65
Battery class
class Battery extends BaseA battery: an open-circuit voltage that falls with the state of charge behind an internal resistance; Ah of capacity.
kind: "source" | |
soc: number | |
heat: number | |
empty: boolean | |
drawn: number | |
constructor(name: string, a: string, b: string, public capacityAh: number, public rInt = 0.05, public vFull = 12.6, public vEmpty = 10.5, public soc0 = 1) | |
get open() | |
stamp(s: Stamper) | put the element into the matrix for a step of h ending at time t |
current(va: number, vb: number) | current a → b through the element for the solution (to read it) |
commit(va: number, vb: number, h: number, t: number, c: Circuit) | after the step is accepted: voltages across a→b and the current a→b through the element |
packages/physics-electric/src/circuit.ts:198
Breaker class
class Breaker extends BaseThermal–magnetic breaker: θ' = (I²/In² − θ)/τ trips at θ = 1, and a current above magnetic·In trips at once.
theta: number | |
tripped: boolean | |
constructor(name: string, a: string, b: string, public rated: number, public tau = 10, public magnetic = 8, public R = 1e-3) | |
stamp(s: Stamper) | put the element into the matrix for a step of h ending at time t |
current(va: number, vb: number) | current a → b through the element for the solution (to read it) |
reset() | |
commit(va: number, vb: number, h: number, t: number, c: Circuit) | after the step is accepted: voltages across a→b and the current a→b through the element |
phasor(s: PhasorStamper) |
packages/physics-electric/src/circuit.ts:180
Capacitor class
class Capacitor extends Basekind: "storage" | |
constructor(name: string, a: string, b: string, public C: number, v0 = 0, public leak = 0) | |
stamp(s: Stamper, h: number) | put the element into the matrix for a step of h ending at time t |
current(_va: number, _vb: number) | current a → b through the element for the solution (to read it) |
commit(va: number, vb: number, h: number, _t: number, c: Circuit) | after the step is accepted: voltages across a→b and the current a→b through the element |
stored() | |
phasor(s: PhasorStamper, w: number) |
packages/physics-electric/src/circuit.ts:80
Circuit class
class Circuitreadonly elements: Element[] | |
readonly byName: Map<string, Element> | |
time: number | |
euler: boolean | the step in hand is a backward-Euler step |
x: number[] | extras and node voltages of the last solution |
voltages: Map<string, number> | |
events: CircuitEvent[] | |
onEvent: ((e: CircuitEvent) => void) | null | |
delivered: number | cumulative energy given by the sources and taken by the elements, J |
dissipated: number | |
add<T extends Element>(e: T): T | |
get<T extends Element = Element>(name: string): T | |
transformer(name: string, p1: string, p2: string, s1: string, s2: string, spec: TransformerSpec) | A real transformer: winding resistances, magnetising inductance and core loss around an ideal one. Returns its parts. |
restart() | A discontinuity (a switch thrown) is coming: take the next step with backward Euler so the trapezoid does not ring. |
emit(type: CircuitEventType, element: string) | |
get size() | |
step(h: number) | Advance h seconds. |
balance() | Energy bookkeeping: delivered by sources against dissipated plus stored, J. |
voltage(node: string) | |
phasor(w: number): Map<string, [number, number]> | AC steady state at angular frequency w: complex node voltages (re, im) by node name. |
packages/physics-electric/src/circuit.ts:383
Coil class
class Coil extends BaseAn electromagnet as a circuit element: a coil of N turns on a core with a pole area A and an air gap, so its inductance follows the gap,
L = L_leak + μ0 N² A / (gaps · g), and falls off as the iron saturates (B = B_sat tanh(B_lin / B_sat)). The state is the flux linkage λ, integrated
by the trapezoid rule, so moving the armature (changing gap) makes a motional EMF by itself: v = R i + dλ/dt. force is the pull on the armature,
gaps · B² A / (2 μ0), and work the mechanical work done on it while the gap closed.
kind: "storage" | |
gap: number | air gap per pole, m; set by whoever moves the armature |
lambda: number | flux linkage, Wb |
work: number | |
constructor( name: string, a: string, b: string, public turns: number, public area: number, gap: number, public Rw = 0, public gaps = 2, public Bsat = 1.6, public leakage = 0, ) | |
L(i = this.i): number | the secant inductance at the present current (the unsaturated one at zero), H |
get B() | flux density in the gap, T |
get force() | pull on the armature toward the core, N |
stamp(s: Stamper, h: number) | put the element into the matrix for a step of h ending at time t |
current(_va: number, _vb: number) | current a → b through the element for the solution (to read it) |
commit(va: number, vb: number, h: number, _t: number, c: Circuit) | after the step is accepted: voltages across a→b and the current a→b through the element |
stored() |
packages/physics-electric/src/elements.ts:11
DCMachine class
class DCMachine extends BaseA DC machine: V = E + R·i + L·di/dt with E = k·ω from the shaft, and the torque on the shaft T = k·i. Run as a motor (current into the a terminal) it drives the shaft; turned by the shaft it makes E, delivers current and loads the shaft with k·i < 0.
kind: "machine" | |
omega: number | shaft speed, rad/s, set by whoever owns the shaft (the capability, or a test) |
field: number | field excitation 0..1 for a wound-field machine (k scales with it) |
electrical: number | electrical work taken, mechanical work given (motor) or taken (generator), J |
mechanical: number | |
copper: number | |
constructor(name: string, a: string, b: string, public k_: number, public Ra: number, public La = 0) | |
get kEff() | |
get torque() | torque on the shaft, N·m (positive drives it) |
stamp(s: Stamper, h: number) | put the element into the matrix for a step of h ending at time t |
current(_va: number, _vb: number) | current a → b through the element for the solution (to read it) |
commit(va: number, vb: number, h: number, _t: number, c: Circuit) | after the step is accepted: voltages across a→b and the current a→b through the element |
stored() |
packages/physics-electric/src/circuit.ts:336
Diode class
class Diode extends BaseA diode with a forward drop and an on-resistance (piecewise linear) or the exponential law; an LED is a diode with a larger drop.
nonlinear: boolean | |
constructor(name: string, a: string, b: string, public Vf = 0.7, public Ron = 0.05, public exponential = false, public Is = 1e-12, public n = 1.8) | |
stamp(s: Stamper) | put the element into the matrix for a step of h ending at time t |
current(va: number, vb: number) | current a → b through the element for the solution (to read it) |
packages/physics-electric/src/circuit.ts:147
Fuse class
class Fuse extends BaseThe element melts when ∫I²dt passes its limit (A²·s).
integral: number | |
blown: boolean | |
constructor(name: string, a: string, b: string, public i2t: number, public R = 1e-3) | |
stamp(s: Stamper) | put the element into the matrix for a step of h ending at time t |
current(va: number, vb: number) | current a → b through the element for the solution (to read it) |
commit(va: number, vb: number, h: number, t: number, c: Circuit) | after the step is accepted: voltages across a→b and the current a→b through the element |
phasor(s: PhasorStamper) |
packages/physics-electric/src/circuit.ts:167
Heater class
class Heater extends ResistorA heater: a resistor whose heat is handed to a part; its resistance follows the temperature coefficient.
joules: number | |
constructor(name: string, a: string, b: string, R: number, public alpha = 0, public temperature = 293.15, public T0 = 293.15) | |
get cold() | |
stamp(s: Stamper) | put the element into the matrix for a step of h ending at time t |
current(va: number, vb: number) | current a → b through the element for the solution (to read it) |
commit(va: number, vb: number, h: number, t: number, c: Circuit) | after the step is accepted: voltages across a→b and the current a→b through the element |
packages/physics-electric/src/circuit.ts:269
IdealTransformer class
class IdealTransformer extends BaseAn ideal transformer between two ports through one extra unknown (the secondary current). V1 = n·V2 and I1 = I2/n, n = N1/N2.
extra: number | extra unknowns this element needs (ideal voltage sources and transformers) |
kind: "other" | |
constructor(name: string, public p1: string, public p2: string, public s1: string, public s2: string, public n: number) | |
stamp(s: Stamper) | put the element into the matrix for a step of h ending at time t |
current(_va: number, _vb: number, x: number[]) | current a → b through the element for the solution (to read it) |
commit(va: number, vb: number, _h: number, _t: number, c: Circuit) | after the step is accepted: voltages across a→b and the current a→b through the element |
phasor(s: PhasorStamper) |
packages/physics-electric/src/circuit.ts:305
InductionMotor class
class InductionMotor extends BaseA three-phase induction motor, one phase of its equivalent circuit (wye, so the phase voltage is across a→b): the stator R1 + L1 in series with the
magnetising Lm across the rest, then the rotor L2 and R2/s. The slip s comes from the shaft speed and the supply frequency, so the load resistor
R2/s follows the shaft; the air-gap power of the phases over the synchronous speed is the torque, negative above that speed (a generator).
omega is set by whoever owns the shaft. install adds the parts and the motor to a circuit.
kind: "machine" | |
omega: number | |
torque: number | torque on the shaft, N·m (averaged over a few supply cycles) |
mechanical: number | |
readonly parts: { r1: Resistor; l1: Inductor; lm: Inductor; l2: Inductor; rr: Resistor } | |
constructor( name: string, a: string, b: string, public spec: { r1: number; x1: number; xm: number; r2: number; x2: number; hz: number; poles: number; phases?: number }, ) | |
get ws() | synchronous speed, rad/s |
get slip() | |
stamp(_s: Stamper) | put the element into the matrix for a step of h ending at time t |
current() | current a → b through the element for the solution (to read it) |
commit(_va: number, _vb: number, h: number, _t: number, _c: Circuit) | after the step is accepted: voltages across a→b and the current a→b through the element |
install(c: Circuit) |
packages/physics-electric/src/elements.ts:96
Inductor class
class Inductor extends Basekind: "storage" | |
constructor(name: string, a: string, b: string, public L: number, public Rw = 0, i0 = 0) | |
stamp(s: Stamper, h: number) | put the element into the matrix for a step of h ending at time t |
current(_va: number, _vb: number) | current a → b through the element for the solution (to read it) |
commit(va: number, vb: number, h: number, _t: number, c: Circuit) | after the step is accepted: voltages across a→b and the current a→b through the element |
stored() | |
phasor(s: PhasorStamper, w: number) |
packages/physics-electric/src/circuit.ts:95
ISource class
class ISource extends Basekind: "source" | |
constructor(name: string, a: string, b: string, public I: number | ((t: number) => number)) | |
stamp(s: Stamper, _h: number, t: number) | put the element into the matrix for a step of h ending at time t |
current(_va: number, _vb: number) | current a → b through the element for the solution (to read it) |
commit(va: number, vb: number, _h: number, t: number) | after the step is accepted: voltages across a→b and the current a→b through the element |
phasor(s: PhasorStamper) |
packages/physics-electric/src/circuit.ts:130
Lamp class
class Lamp extends BaseIncandescent lamp: the filament's resistance follows its temperature, which follows the power in and the radiation out.
nonlinear: boolean | |
T: number | |
burnt: boolean | |
constructor( name: string, a: string, b: string, /** cold resistance at T0, ohms */ public R0: number, /** heat capacity of the filament, J/K and its radiating area, m² (emissivity included) */ public C = 2e-3, public area = 6e-5, /** temperature coefficient of resistance, 1/K (tungsten ~4.5e-3 near room temperature, falling hot: R ∝ T^1.2 above) */ public alpha = 4.5e-3, public T0 = 293.15, public Tmelt = 3695, public ambient = 293.15, ) | |
resistance(T: number) | |
stamp(s: Stamper, h: number) | put the element into the matrix for a step of h ending at time t |
current(va: number, vb: number) | current a → b through the element for the solution (to read it) |
commit(va: number, vb: number, h: number, t: number, c: Circuit) | after the step is accepted: voltages across a→b and the current a→b through the element |
get radiated() | radiated power now, W |
packages/physics-electric/src/circuit.ts:218
Potentiometer class
class PotentiometerA potentiometer: a track of total resistance R from a to b with the wiper at w, position 0..1 from a. Add with addPotentiometer.
constructor(readonly top: Resistor, readonly bottom: Resistor, readonly total: number, private circuit: Circuit, position: number) | |
get position() | |
set position(p: number) |
packages/physics-electric/src/elements.ts:175
Rcd class
class Rcd extends SwitchA residual-current device (earth-leakage trip): a switch in the line that opens when the current out and the current back differ by more than
threshold for delay seconds. sense gives that difference, A (the circuit's own element currents: live − neutral).
tripped: boolean | |
constructor(name: string, a: string, b: string, public sense: () => number, public threshold = 0.03, public delay = 0.03) | |
reset() | |
commit(va: number, vb: number, h: number, t: number, c: Circuit) | after the step is accepted: voltages across a→b and the current a→b through the element |
packages/physics-electric/src/elements.ts:213
Relay class
class Relay extends CoilA relay: a coil that pulls a contact closed when its current passes pullIn and lets it go below dropOut, after the armature's travel time.
The contact is a Switch the circuit holds (addRelay adds both).
closed: boolean | |
readonly contact: Switch | |
constructor(name: string, a: string, b: string, ca: string, cb: string, public pullIn: number, public dropOut: number, public travel = 5e-3, coil = { turns: 2000, area: 1e-4, gap: 2e-3, Rw: 100 }) | |
commit(va: number, vb: number, h: number, t: number, c: Circuit) | after the step is accepted: voltages across a→b and the current a→b through the element |
packages/physics-electric/src/elements.ts:63
Resistor class
class Resistor extends Baseconstructor(name: string, a: string, b: string, public R: number) | |
stamp(s: Stamper) | put the element into the matrix for a step of h ending at time t |
current(va: number, vb: number) | current a → b through the element for the solution (to read it) |
phasor(s: PhasorStamper) |
packages/physics-electric/src/circuit.ts:73
SolarCell class
class SolarCell extends BaseA solar cell: the photocurrent Isc · irradiance / 1000 against the diode I0 (exp(V/(n Vt)) − 1), nonlinear. Wire its series resistance as a Resistor. The cell delivers when the current through it a→b is negative.
nonlinear: boolean | |
irradiance: number | W/m² |
constructor(name: string, a: string, b: string, public Isc = 3, public I0 = 1e-10, public n = 1.3, public cells = 1) | |
stamp(s: Stamper) | put the element into the matrix for a step of h ending at time t |
current(va: number, vb: number) | current a → b through the element for the solution (to read it) |
get Voc() | open-circuit voltage, V |
packages/physics-electric/src/elements.ts:193
Switch class
class Switch extends Baseconstructor(name: string, a: string, b: string, public closed = false, public Ron = 1e-3, public Roff = 1e9) | |
stamp(s: Stamper) | put the element into the matrix for a step of h ending at time t |
current(va: number, vb: number) | current a → b through the element for the solution (to read it) |
phasor(s: PhasorStamper) |
packages/physics-electric/src/circuit.ts:139
Thermistor class
class Thermistor extends BaseA thermistor: NTC R = R0 exp(B (1/T − 1/T0)) or PTC R = R0 (1 + α (T − T0)) (ptc = α), with its own temperature from self-heating,
C dT/dt = P − (T − T_amb)/Rth. It is stamped at the temperature of the start of the step.
T: number | |
R: number | |
constructor(name: string, a: string, b: string, public R0: number, public B = 3950, public T0 = 298.15, public ambient = 298.15, public Rth = 50, public heatCapacity = 0.05, public ptc = 0) | |
resistance(T: number) | |
stamp(s: Stamper) | put the element into the matrix for a step of h ending at time t |
current(va: number, vb: number) | current a → b through the element for the solution (to read it) |
phasor(s: PhasorStamper) | |
commit(va: number, vb: number, h: number, t: number, c: Circuit) | after the step is accepted: voltages across a→b and the current a→b through the element |
packages/physics-electric/src/elements.ts:157
VSource class
class VSource extends Basekind: "source" | |
extra: number | extra unknowns this element needs (ideal voltage sources and transformers) |
constructor(name: string, a: string, b: string, public V: number | ((t: number) => number), public phasorValue: [number, number] = [0, 0]) | |
value(t: number) | |
stamp(s: Stamper, _h: number, t: number) | put the element into the matrix for a step of h ending at time t |
current(_va: number, _vb: number, x: number[]) | current a → b through the element for the solution (to read it) |
commit(va: number, vb: number, _h: number, _t: number, c: Circuit) | after the step is accepted: voltages across a→b and the current a→b through the element |
phasor(s: PhasorStamper) |
packages/physics-electric/src/circuit.ts:115
Wire class
class Wire extends BaseA wire: resistance from its length, a heat capacity, and a thermal resistance to the air chosen so that the ampacity gives the rated rise.
T: number | |
over: boolean | |
joules: number | |
readonly R: number | |
readonly Rth: number | |
constructor( name: string, a: string, b: string, resistancePerM: number, public length: number, public ampacity: number, public heatCapacity: number, public insulation = 343.15, public ambient = 293.15, public ratedRise = 40, ) | |
stamp(s: Stamper) | put the element into the matrix for a step of h ending at time t |
current(va: number, vb: number) | current a → b through the element for the solution (to read it) |
commit(va: number, vb: number, h: number, t: number, c: Circuit) | after the step is accepted: voltages across a→b and the current a→b through the element |
phasor(s: PhasorStamper) |
packages/physics-electric/src/circuit.ts:285
Zener class
class Zener extends BaseA Zener diode: forward like a diode, and in reverse it holds the voltage at Vz with a slope resistance Rz.
nonlinear: boolean | |
constructor(name: string, a: string, b: string, public Vz = 5.1, public Rz = 2, public Vf = 0.7, public Ron = 0.05) | |
stamp(s: Stamper) | put the element into the matrix for a step of h ending at time t |
current(va: number, vb: number) | current a → b through the element for the solution (to read it) |
packages/physics-electric/src/elements.ts:141
Functions
addPotentiometer function
function addPotentiometer(c: Circuit, name: string, a: string, w: string, b: string, R: number, position = 0.5)packages/physics-electric/src/elements.ts:185
addRelay function
function addRelay(c: Circuit, name: string, a: string, b: string, ca: string, cb: string, pullIn: number, dropOut: number, travel?: number)Add a relay and its contact to a circuit.
packages/physics-electric/src/elements.ts:84
electric function
function electric(): ElectricCapabilitypackages/physics-electric/src/index.ts:42
gauss function
function gauss(A: number[][], b: number[]): number[] | nullGaussian elimination with partial pivoting; null when singular.
packages/physics-electric/src/circuit.ts:537
inductionTorque function
function inductionTorque(o: { tMax: number; slipMax: number; hz: number; poles: number; omega: number; voltage?: number }): numberReduced induction motor: Kloss torque against slip at the line frequency and voltage.
packages/physics-electric/src/circuit.ts:367
magnetForce function
function magnetForce(N: number, I: number, area: number, gap: number, gaps = 1): numberForce of a magnet with a coil of N turns, current I, pole area A over an air gap g (two gaps for a C-core): B²A/(2μ0) per gap.
packages/physics-electric/src/circuit.ts:375
mains function
function mains: (name: string, a: string, b: string, peak: number, hz: number, phase?: number) => VSourceMains: a sinusoidal source.
packages/physics-electric/src/circuit.ts:127
phasePeak function
function phasePeak: (lineRms: number) => numberThe phase peak of a balanced three-phase supply of a given line-to-line RMS voltage, V.
packages/physics-electric/src/elements.ts:236
railForce function
function railForce: (gradient: number, I: number) => numberForce of a rail gun carrying I, with inductance gradient L' (H/m): ½·L'·I².
packages/physics-electric/src/circuit.ts:380
synchronousSpeed function
function synchronousSpeed: (hz: number, poles: number) => numberpackages/physics-electric/src/circuit.ts:372
threePhase function
function threePhase(c: Circuit, name: string, p: [string, string, string], peak: number, hz: number, n = '0')Three-phase mains: three sources of the same peak 120° apart from the nodes p to a neutral n (default ground). The phasor form works as
for a single phase. Returns the sources.
packages/physics-electric/src/elements.ts:231
Interfaces
CircuitEntry interface
interface CircuitEntrycircuit: Circuit | |
machines: MachineBinding[] | |
induction: InductionBinding[] | |
heaters: HeaterBinding[] | |
shorted: boolean |
packages/physics-electric/src/index.ts:29
CircuitEvent interface
interface CircuitEventtype: CircuitEventType | |
element: string | |
time: number |
packages/physics-electric/src/circuit.ts:11
ElectricCapability interface
interface ElectricCapability extends Capabilityreadonly circuits: Map<string, CircuitEntry> | |
addCircuit(name: string): Circuit | |
bindMachine(circuit: string, machine: string, drivetrain: Drivetrain, shaft: Shaft): void | The machine turns the shaft with its torque and takes its speed from it. |
bindInduction(circuit: string, motor: string, drivetrain: Drivetrain, shaft: Shaft): void | An induction motor turns the shaft with its torque (negative above synchronous speed: a generator) and takes its speed from it. |
bindHeater(circuit: string, heater: string, entity: Entity): void | The heater's power goes into the part of the entity, and the part's temperature sets its resistance. |
packages/physics-electric/src/index.ts:31
Element interface
interface Elementreadonly name: string | |
readonly a: string | |
readonly b: string | |
extra: number | extra unknowns this element needs (ideal voltage sources and transformers) |
k: number | first extra index, set by the circuit |
nonlinear: boolean | |
kind: 'resistive' | 'storage' | 'source' | 'machine' | 'other' | |
stamp(s: Stamper, h: number, t: number): void | put the element into the matrix for a step of h ending at time t |
commit(va: number, vb: number, h: number, t: number, c: Circuit): void | after the step is accepted: voltages across a→b and the current a→b through the element |
current(va: number, vb: number, x: number[]): number | current a → b through the element for the solution (to read it) |
stored?(): number | energy stored, J |
phasor?(s: PhasorStamper, w: number): void | the phasor stamp at angular frequency w (complex admittances) |
power: number | power the element takes from the circuit now, W (negative = delivers) |
v: number | last voltage across it and last current through it |
i: number |
packages/physics-electric/src/circuit.ts:31
PhasorStamper interface
interface PhasorStampery(a: string, b: string, re: number, im: number): void | |
i(a: string, b: string, re: number, im: number): void | |
v(a: string, b: string, k: number, re: number, im: number): void | |
m(row: string, col: string, re: number, im: number): void |
packages/physics-electric/src/circuit.ts:58
Stamper interface
interface Stamperg(a: string, b: string, G: number): void | conductance between two nodes |
i(a: string, b: string, I: number): void | a current I leaving node a through the source into node b |
v(a: string, b: string, k: number, V: number): void | a voltage source V = v(a) − v(b) with its current (a → b through the source) as extra unknown number k |
at(n: string): number | the node voltage of the last Newton guess |
x(k: number): number | the extra current k of the last guess |
m(row: string, col: string, c: number): void | add a coefficient to the matrix (row and column are node names or '#k' for the extra unknowns) |
rhs(row: string, c: number): void | |
readonly be: boolean | the step is a backward-Euler one (the first, or after a discontinuity) |
packages/physics-electric/src/circuit.ts:13
TransformerSpec interface
interface TransformerSpecratio: number | turns ratio N1/N2 |
r1?: number | winding resistances, ohms |
r2?: number | |
lm?: number | magnetising inductance seen from the primary, H, and the core-loss resistance across it, ohms (Infinity = none) |
rcore?: number |
packages/physics-electric/src/circuit.ts:323
Types
CircuitEventType type
type CircuitEventType = 'blown' | 'trip' | 'battery:empty' | 'lamp:burnt' | 'overheat' | 'short' | 'motor:stall'packages/physics-electric/src/circuit.ts:10
Constants
ELECTRIC_DEFAULTS const
const ELECTRIC_DEFAULTS: { maxStep: number; shortCurrent: number; }electricity. Circuits are stepped with the world; machines turn shafts of M and are turned by them, heaters put their power into the parts of H, and every protection element reports as an event.
values (each at world / level / zone / entity scope):
maxStep longest circuit sub-step, s (0.001)
shortCurrent a source current above this is a short circuit, A (1000)
events: circuit:blown, circuit:trip, circuit:short, circuit:overheat, battery:empty, lamp:burnt, motor:stall, each { circuit, element }.
packages/physics-electric/src/index.ts:24
GND const
const GND: "0"A circuit network solved by modified nodal analysis. Capacitors and inductors are integrated by the trapezoid rule (second order, no numerical damping), every element that is not linear is solved by Newton iterations on the whole network, and a replay of the same circuit with the same step is identical. Node '0' is ground.
packages/physics-electric/src/circuit.ts:6
MU0 const
const MU0: numberpackages/physics-electric/src/circuit.ts:8
SIGMA const
const SIGMA: 5.670374419e-8packages/physics-electric/src/circuit.ts:7