Skip to content
Get started

Electrical components

Standard sources · Install this source revision

Canonical owner: Electrical.Basic / basic.eqi. Its Pin is a scalar-physical connector: across is voltage in V, through is outward current in A. The declaration spells dimensions in SI base units.

Declaration Required parameter Ports and mathematical contract
IdealVoltageSource voltage, V positive, negative: fixes their voltage difference and conserves current
Resistor resistance, ohm positive, negative: voltage difference equals resistance times positive-port current; conserves current
Ground None terminal: fixes its across voltage to zero, without prescribing its current

These are ideal, time-independent declarations. Ground fixes potential, not current.

electrical.eqi
// Append after the unchanged Eqiora.Electrical.Basic release source.
model ReferenceCircuit(parameter supply: kg * m ^ 2 / (s ^ 3 * A) = 12, parameter resistance: kg * m ^ 2 / (s ^ 3 * A ^ 2) = 4) {
instance source: IdealVoltageSource(voltage = supply);
instance resistor: Resistor(resistance = resistance);
instance ground: Ground();
connect conserving source.positive, resistor.positive;
connect conserving source.negative, resistor.negative, ground.terminal;
}

The supplied source imposes 12 V across a 4-ohm resistor. The connections identify voltage nodes and close current conservation; Ground fixes the reference. supply and resistance are typed parameters rather than untyped instance numbers. See Composition for named bindings.

After installing the source checkout, save the example as electrical.eqi beside eqiora-source and compile:

python
from pathlib import Path
import eqiora
basic = Path("eqiora-source/packages/Eqiora.Electrical.Basic/src/basic.eqi")
source = basic.read_text() + "\n" + Path("electrical.eqi").read_text()
model = eqiora.compile(source=source, filename="electrical.eqi")

All three definitions are exercised by this compilation. Changing a parameter’s dimension or omitting its required binding produces a diagnostic.

Example source · Canonical declaration and package description · Next: Continuum laws and boundaries