Voltecx is in beta. The macOS build comes first; Windows and Linux packages are still being tested.Beta. macOS comes first; Windows and Linux are still in testing. What's new
Documentation

Ammeter (ammeter)

A zero-volt meter in series that reports the current as a signal on out.

ammeter

Component reference · 繁體中文

Group: Meters · Kind: {"kind":"meter","quantity":"current"}

When to use it

Use it to feed a current into a control block or onto a scope without a shunt resistor. To measure voltage, use Voltmeter.

Pins

Pin Domain Meaning
p electrical One end; positive current flows from p to n
n electrical The other end; the current continues from here
out signal Signal output with the current in amperes

Common parameters

  • bandwidth: How fast the measurement can follow (Default: optional (off))
  • sensitivity: Output change per unit measured (Default: 1)
  • vref: Output voltage when the input is zero (Default: 0)
  • outMin: Lowest voltage the sensor can output (Default: optional (off))
  • outMax: Highest voltage the sensor can output (Default: optional (off))

Parameters

Key Unit Default Typical range Description
bandwidth Hz optional (off) 1k – 20meg Hz How fast the measurement can follow
delay s 0 0 – 10u s Delay before the reading appears
gain — 1 900m – 1.1 Scale error of the reading
offset — 0 Fixed error added to the reading
sensitivity — 1 1m – 100 Output change per unit measured
vref V 0 100m – 15 V Output voltage when the input is zero
outMin V optional (off) Lowest voltage the sensor can output
outMax V optional (off) Highest voltage the sensor can output
noise V 0 1u – 100m V Random noise added to the output
seed — 1 Number that picks the noise pattern

Parameter descriptions are in English in both languages.

Use for: Current loops · Overcurrent sensing · Real sensor models

Not for: Measuring a voltage → voltmeter · A Hall sensor with datasheet values → hallCurrentSensor

Formulas

Formula Equation Source
Sensor output out = vref + sensitivity·i Allegro MicroSystems, ACS712 data sheet, characteristic definitions (sensitivity, zero-current output voltage)
Full-scale current ifs = (outMax − vref) / sensitivity Allegro MicroSystems, ACS712 data sheet, characteristic definitions (sensitivity, zero-current output voltage)

Quick check

Inputs:

  • i: Measured current = 10 A
  • sensitivity: Sensitivity = 100m V/A, sensitivity
  • vref: Output at zero current = 2.5 V, vref
  • outMin: Lowest output = 0 V, outMin
  • outMax: Highest output = 5 V, outMax

Outputs:

  • out: Sensor output = limit(vref + sensitivity*i, outMin, outMax) V
  • ifs: Largest positive current = (outMax - vref)/sensitivity A
  • ineg: Largest negative current = (outMin - vref)/sensitivity A

Model logic

  • The meter is a zero-volt source between p and n with its current as an unknown, so it adds no drop and no burden to the circuit.
  • It counts as a voltage source, so a meter across a source, or in a loop of voltage sources, makes the circuit unsolvable.
  • The output is vref + sensitivity·gain·i + offset, then the low-pass at bandwidth, the delay, noise and the limits outMin and outMax, each only when set.

Model

The meter is a zero-volt source between p and n with the current as an unknown, so it adds no drop. The output starts as the current i and becomes out = vref + sensitivity * gain * i + offset, then goes through a first-order low-pass at bandwidth, a pure delay, seeded Gaussian noise of noise volts rms, and a limit to outMin ... outMax. With none of these set, the output is the instantaneous current in amperes.

Common mistakes

  • The ammeter counts as an ideal voltage source, so putting it across a source, or in a loop of such parts, makes the circuit unsolvable. Place it in series with the branch you want to measure.
  • Joining out to a power net is flagged. The sign follows p to n, so turn the meter around when the reading is negative.
  • To model a real current sensor, set sensitivity (V/A), vref (the output at zero current, 1.65 V or 2.5 V for a two-way part) and outMin and outMax (the output swing). A reading stuck at one of these limits is clipped, and noise with a whole-number seed repeats exactly on every run.

Problems rules: loop.voltage_sources, pin.domain_mismatch

Datasheet and sources

The defaults give an ideal meter. For a real sensor, take bandwidth, delay, sensitivity (185 mV/A is 0.185), vref, outMin, outMax, noise, gain and offset from its datasheet, or use a library sensor such as Hall-Effect Current Sensor, which already has them.

Example

Open the example with the command file.openExample and the name demo:ammeter.


Generated by cargo xtask reference from the usage texts and parameter specs. Do not edit by hand.