Piiri — Plateforme Interactive d’Apprentissage et de Simulation d’Analyse des Circuits
Plateforme web interactive de génie électrique sans dépendances externes, comprenant 24 leçons guidées, des laboratoires de circuits DC/AC en temps réel et 67+ exercices.
Overview
Piiri (“Circuit” in Finnish) is an interactive circuit analysis learning platform and real-time laboratory simulator designed to teach foundational electrical engineering concepts step by step. Built as a lightweight, zero-dependency static web application, it bridges intuitive physical reasoning with formal mathematical circuit analysis.
The curriculum spans 6 core modules and 24 interactive lessons:
- Foundations, Power & Sources: Current, Ohm’s law, series/parallel networks, passive sign convention (), and independent vs. dependent sources ().
- DC Network Analysis & Transformations: Voltage/current dividers under load, Y– transformations, Nodal Analysis (KCL), Mesh Current Analysis (KVL), Superposition, and Thévenin/Norton equivalents.
- Energy Storage & First-Order Transients: Capacitors (, ), inductors (), stored energy, and step-response time constants (, ).
- Sinusoidal Steady-State (AC) & Frequency Response: Complex phasors, RLC impedance, passive RC/RL filters, Bode magnitude/phase intuition, and resonance.
- Complex Power & Impedance Matching: Active (), reactive (), and apparent power (), power factor correction, and maximum power transfer ().
- Engineering Applications: Ideal transformers, operational amplifier (op-amp) feedback topologies, and balanced three-phase () systems.
System Architecture & Design
1. Pedagogical Flow & State Architecture
Every lesson follows a structured multi-stage learning loop:
- Conceptual Foundation first: Before exposing formulas or numeric sliders, learners complete a qualitative thought experiment (“Pieni ajatuskoe”) to build physical intuition.
- Interactive Circuit Laboratory: A deterministic real-time solver recomputes branch currents, node voltages, phasor angles, and power balances on every parameter change, updating a custom vector schematic (
<svg viewBox="0 0 600 300">) and animated charge-flow paths. - Practice & Seeded Mastery Exams: Includes 67 guided practice questions with targeted misconception feedback, plus a seeded procedural assessment generator (
assessment.js) that synthesizes randomized numerical exam pairs for mastery verification.
2. Mathematical Circuit Models
All 24 laboratory modules evaluate exact analytical circuit equations in SI units. For example:
-
Two-Loop Mesh Analysis & Y– Equivalent Networks:
-
First-Order RC/RL Transient Step Response & Stored Energy:
-
Sinusoidal AC Impedance & Phasor Domain:
3. Deterministic Laboratory Engine & Verification Suite
The simulation engine (labs.js) pairs each circuit solver with a procedural SVG schematic generator (element, source, wave, arrow) with zero external runtime dependencies:
// Excerpt from Piiri's AC Series RLC Impedance Laboratory (labs.js)
labs.impedance = {
defaults: { mode: 'rl', u: 10, r: 10, l: 10, c: 100, omega: 500 },
compute: (p) => {
const xl = p.omega * p.l * 0.001;
const xc = 1 / (p.omega * p.c * 1e-6);
const x = p.mode === 'rl' ? xl : p.mode === 'rc' ? -xc : xl - xc;
const z = Math.hypot(p.r, x);
const phase = -Math.atan2(x, p.r);
return {
xl,
xc,
x,
z,
i: p.u / z,
phaseDeg: (phase * 180) / Math.PI,
ire: (p.u * p.r) / z ** 2,
iim: (-p.u * x) / z ** 2,
};
},
};
To guarantee physical and numerical accuracy across all lessons, a headless Node.js verification harness (verify.cjs) executes the entire application inside a node:vm sandbox—asserting KCL/KVL invariants, energy conservation, phasor phase relationships, and localStorage state migrations (v1 v2) across hundreds of test cases.
Results & Takeaways
- Zero-Dependency Performance: The complete 24-lesson platform, SVG schematic renderer, and interactive kaavapaperi (formula scratchpad) load instantaneously as pure static assets without heavy framework bundles.
- Automated Physical Invariant Testing: Using
verify.cjsto test KCL (), KVL (), passive sign power balance (), and SVG output validity (NaN/Infinityguards) caught edge-case division-by-zero and phase-wrapping bugs early. - Gamified Progression Without Gating Content: Learners earn points for completing lessons (+20 pts) and unassisted mastery challenges (+10 bonus pts) to unlock custom hardware-inspired UI themes (Copper PCB, Oscilloscope, and Night) while keeping all educational material freely accessible from the start.