← Smart Energy Monitoring Project 01 / Software model V1 / Hardware not built

DC energy monitor.
Run the instrument.

A simulated low-voltage DC energy monitor: source, load, sensing chain, embedded sampling and energy accumulation, all running in this page. True and measured values are shown side by side so the difference is never hidden.

Software model V1 · verified Hardware prototype · not built Runs in your browser
Ready
Simulated time
00:00.0
Samples
0
Rejected / clipped
0

Source → load → sensing → controller → logging. Select a block to read what the model does at that stage.

Source
Load
Sampling and sensing
Error terms and calibration

Calibration applies to each channel separately. With these defaults it corrects the gain error and offset you enter, which is exactly the correction a real calibration would estimate.

Run

Start, pause and reset are exact: a paused run does not advance simulated time, and a reset clears the accumulator. Changing the load model or the calibration starts a new run so energy cannot carry over from a different configuration.

Voltage—Vtrue — V
Current—Atrue — A
Power—Wtrue — W
Energy—Whtrue — Wh

Load state — Large numbers are the measurement chain output; the small line under each is the simulated truth.

Hover or focus a chart to read a point.

Voltage V
Current A
Power W
Accumulated energy Wh

Solid lines are the simulated truth; dashed lines are what the sensing chain reports. Both come from the same sample set.

01 / EXPERIMENTS

Five things
worth looking at.

Each experiment loads a complete configuration into the instrument above. They all use the same validated model — there is no second implementation for the demonstrations.

EXPERIMENT 01

Constant DC load

Voltage, current, power and energy in the simplest case.

A 12 V supply into a 12 Ω resistive load. The current follows from the supply and the resistance, and the energy graph is a straight line whose slope is the power.

EXPERIMENT 02

Changing load

What a step does to power and to the energy slope.

The load current halves part-way through the run. Power halves with it, so the energy trace bends rather than stopping.

EXPERIMENT 03

ADC quantisation

Ideal signal against a quantised measurement.

An 8-bit converter on a slowly varying signal. The measured trace is a staircase; every step is one LSB of the sensing chain.

EXPERIMENT 04

Calibration and error

Systematic error, random error, and the correction.

Gain error and offset bias the reading in a predictable direction. Calibration removes the systematic part; the noise remains.

EXPERIMENT 05

Sampling interval

What sparse samples cannot tell you.

A 4 s duty cycle sampled every 2 s. The reported average depends on where the samples land, which is a property of the sampling, not of the load.

02 / THE MODEL

Power, energy,
and the time between samples.

Discrete samples do not measure instantaneous power; they bracket it. The model says exactly what it does between two samples.

Power

P=V·I

Computed from the two measured channels after scaling and quantisation, and separately from the simulated truth so the difference can be read directly.

Energy, trapezoidal

Ej+=Pj−1+Pj2·Δtj

Each interval contributes the average of its two endpoint powers times the actual elapsed time. Power is never summed without multiplying by time.

Units

EWh=EJ3600

Accumulators hold joules; the interface shows watt-hours. 1 Wh = 3600 J exactly, with no rounding in between.

Sensing chain

Vpin=V·S·(1+g)+Vos+n

Sensitivity, gain error, offset and noise at the pin, then uniform quantisation to the nearest LSB. A channel with 0 bits is treated as ideal.

What the numbers between samples mean

  • The simulated truth is evaluated at each sample instant. Between samples it is undefined — the model does not interpolate a "true" waveform.
  • The trapezoidal rule assumes power varies linearly across an interval. That is exact for constant power, slightly high or low across a step, and approximate for anything curved.
  • A step that falls between two samples is smeared across that interval. Reference case C quantifies it: 2.5 J in 27 000 J, or 0.0093 %.
  • Imported and exported energy are integrated separately, splitting the interval at a sign change, so reversed current cannot reduce a consumption total by accident.
  • Rejected samples — duplicate, non-monotonic, non-numeric or out of range — are counted and never integrated.
03 / VERIFICATION

Reference cases,
with their tolerances.

Every row below is asserted by dcem-reference.test.js and re-derived by a separate method in dcem-independent.test.js. These are the values the test files print.

Reference cases asserted by the test suite
CaseInputExpected resultWhy that number
A12 V, 1 A, 3600 s43 200 J / 12 Whexact — constant power, so the trapezoidal rule has no error
B5 V, 2 A, 1800 s18 000 J / 5 Whexact
C10 V, 1 A → 0.5 A at 1800 s26 997.5 J / 7.49931 Wh0.0093 % below the 27 000 J continuous ideal — the step straddles one interval
D12 V, 0 A, 600 s0 Jzero current, so zero energy, with the voltage still measured
Eirregular timestamps, 5 intervals77.605 Jhand-checkable; the naive mean × time estimate would give 77.973 J
F10 V true, +2 % gain, +50 mV offset10.4 V uncalibrated → 10.000 V calibratedanalytical; calibrating removes the bias exactly
Ginvalid datasetsclassified and refusedmissing, duplicate, non-monotonic, non-numeric, extreme and empty inputs

Software verification only. Nothing on this page is a measurement of a physical circuit, and no accuracy claim about real hardware follows from it.

04 / ARTEFACTS

Everything needed
to reproduce it.

The model, both test suites, the documentation and the reference datasets are plain files served from this site. You do not need the dashboard to check the numbers.

node energy-monitor/tests/dcem-reference.test.js
node energy-monitor/tests/dcem-independent.test.js

Software model V1

Verified against reference cases

The model, its tests and its datasets are complete for the scope described in the requirements document.

Hardware prototype

Not yet built

No sensor, ADC, microcontroller, board or enclosure exists. The hardware plan lists the stages and the approvals required before anything is energised.