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

Voltmeter (voltmeter)

Reports the voltage between p and n as a signal on out.

voltmeter

Component reference · 繁體中文

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

When to use it

Use it to feed a voltage into a control block or put it on a scope. To measure current, use Ammeter.

Pins

Pin Domain Meaning
p electrical Positive sense end; reads v(p) - v(n)
n electrical Negative sense end
out signal Signal output with the voltage in volts

Common parameters

  • bandwidth: How fast the measurement can follow (Default: optional (off))
  • gain: Scale error of the reading (Default: 1)
  • offset: Fixed error added to the reading (Default: 0)
  • delay: Delay before the reading appears (Default: 0)

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: Voltage feedback · Scope signals · Real sensor models

Not for: Measuring a current → ammeter · Isolated voltage sensing → isolatedVoltageSensor

Formulas

Formula Equation Source
Gain at frequency f abs(H) = gain / √(1 + (f/bandwidth)²) Hayt, Kemmerly & Durbin, Engineering Circuit Analysis, 8th ed. (2012), ch. 16 (Bode diagrams)
Phase lag at frequency f φ = −atan(f/bandwidth) − 360·f·delay Ogata, Modern Control Engineering, 5th ed. (2010), ch. 7 (first-order factor and transport lag)

Quick check

Inputs:

  • x: Measured voltage = 400 V
  • gain: Gain = 1 —, gain
  • bandwidth: Bandwidth = 10k Hz, bandwidth
  • delay: Delay = 1u s, delay
  • f: Signal frequency = 1k Hz

Outputs:

  • out: Steady reading = gain*x V
  • mag: Gain at f = gain/sqrt(1 + (f/bandwidth)^2) —
  • phase: Phase at f = -atan(f/bandwidth)*180/pi - 360*f*delay °

Model logic

  • The meter stamps nothing: it draws no current and does not load the circuit, so the reading is v(p) − v(n) exactly.
  • The output is vref + sensitivity·gain·x + offset, then a first-order low-pass at bandwidth, a delay, noise and the limits outMin and outMax.
  • Only the stages that are set are added, so with none set the output is the instantaneous voltage; unset bandwidth means no filter.
  • noise is Gaussian from seed, held for 1 µs per value, so a whole-number seed gives the same noise on every run.

Model

The meter has infinite input resistance, draws no current and adds nothing to the circuit. Its output starts as x = v(p) - v(n) and becomes out = vref + sensitivity * gain * x + 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 voltage.

Common mistakes

  • A signal net can have only one writer, so joining out to a net that another block already drives is an error. Joining out to a power net is also flagged.
  • A low bandwidth or a long delay adds phase lag to the control loop it feeds. Typical values are 1k to 20M Hz and up to 10u s, and a gain outside 0.9 to 1.1 is flagged.

Problems rules: compile.error, pin.domain_mismatch, param.out_of_range

Datasheet and sources

The defaults give an ideal meter. To model a real sensor, take bandwidth from its -3 dB bandwidth, delay from its propagation delay, and gain and offset from its gain and offset error.

Example

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


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