Background
The above request comes from my effort to add support for the Keysight 34465A DMM using Clause AI.
The basic support is working but we came across the limitations below in the process of expanding functionality.# Feature Request:
Additional physical unit support for generic DMM and T&M instrument IEXTs
Summary
The UNITS object in packages/eez-studio-shared/units.ts currently covers electrical power and signal units well, but is missing several physical measurement units that are essential for bench DMMs, LCR meters, and general-purpose instruments. This causes the waveform renderer to crash (Error while rendering history item N!) when session.addChart() is called with a unit string that is not a key in UNITS.
Current state
UNITS keys as of the current codebase:
time, volt, voltage, amp, ampere, amperage, current,
watt, wattage, power, frequency, "sampling rate",
decibel, joule, unknown, unkn
Problem
A bench DMM — for example a Keysight 34465A or Rigol DM3058 — measures resistance, capacitance, temperature, and period in addition to voltage, current, and frequency. When an IEXT shortcut script calls session.addChart() with unit: "ohm" or unit: "celsius", the renderer looks up UNITS[unitName] and receives undefined. Any subsequent call to undefined.formatValue() throws, and the React error boundary catches it, displaying "Error while rendering history item N!" with no recovery path short of deleting the session entry.
The only current workaround is unit: "unknown", which silently drops axis labelling and SI prefix formatting for the user.
Requested additions
Resistance
ohm: OHM_UNIT, // Ω — SI prefix formatted: mΩ, Ω, kΩ, MΩ, GΩ
Needed for: 2-wire resistance, 4-wire (Kelvin) resistance, continuity threshold, diode forward voltage (secondary).
Capacitance
farad: FARAD_UNIT, // F — SI prefix formatted: pF, nF, µF, mF, F
capacitance: FARAD_UNIT, // alias
Needed for: capacitance measurement on DMMs and LCR meters.
Temperature
celsius: CELSIUS_UNIT, // °C
fahrenheit: FAHRENHEIT_UNIT, // °F
kelvin: KELVIN_UNIT, // K
Needed for: thermocouple, RTD, and thermistor measurements on DMMs and temperature loggers.
Period / time (sub-second)
time exists but the formatting and SI prefix support at sub-second resolution (ps, ns, µs, ms) would benefit from explicit aliases if the current TIME_UNIT formatter does not already handle them:
second: TIME_UNIT, // s — alias to confirm SI prefix support for ps/ns/µs/ms
period: TIME_UNIT, // alias for DMM period measurement context
Suggested implementation
Each new unit follows the same pattern as existing units. Example for resistance:
// units.ts
const OHM_UNIT: IUnit = {
name: "ohm",
color: "#4CAF50",
colorInverse: "#2E7D32",
label: "Ω",
units: {
"": { label: "Ω", conversion: 1 },
m: { label: "mΩ", conversion: 1e-3 },
k: { label: "kΩ", conversion: 1e3 },
M: { label: "MΩ", conversion: 1e6 },
G: { label: "GΩ", conversion: 1e9 }
},
formatValue(value: number, precision = 4) {
// SI prefix selection identical to VOLTAGE_UNIT pattern
...
}
};
// In UNITS:
ohm: OHM_UNIT,
resistance: OHM_UNIT,
const FARAD_UNIT: IUnit = {
name: "farad",
label: "F",
units: {
p: { label: "pF", conversion: 1e-12 },
n: { label: "nF", conversion: 1e-9 },
u: { label: "µF", conversion: 1e-6 },
m: { label: "mF", conversion: 1e-3 },
"": { label: "F", conversion: 1 }
},
...
};
// In UNITS:
farad: FARAD_UNIT,
capacitance: FARAD_UNIT,
const CELSIUS_UNIT: IUnit = {
name: "celsius",
label: "°C",
units: { "": { label: "°C", conversion: 1 } },
formatValue(value, precision = 4) {
return value.toPrecision(precision) + " °C";
}
};
// Similarly for fahrenheit, kelvin.
// In UNITS:
celsius: CELSIUS_UNIT,
fahrenheit: FAHRENHEIT_UNIT,
kelvin: KELVIN_UNIT,
Impact
- Unblocks IEXT authors writing DMM, LCR meter, and temperature logger extensions from having to fall back to
"unknown" for all non-electrical quantities
- Eliminates the renderer crash that currently occurs when an unsupported unit string is passed to
session.addChart()
- Aligns EEZ Studio's unit support with the full measurement capability of general-purpose bench instruments
References
packages/eez-studio-shared/units.ts — UNITS object and IUnit interface
packages/eez-studio-ui/chart/value-accesor.ts — initValuesAccesor (unit consumed here)
packages/eez-studio-ui/chart/WaveformFormat.tsx — WaveformFormat enum
packages/instrument/window/script.ts — addChart() implementation (line ~169), unitName: config.unit.toLowerCase()
packages/instrument/window/history/items/generic.tsx — isWaveform(), renderer entry point
Testing
A minimal reproduction with a generic SCPI instrument:
// In an IEXT shortcut JS script — currently crashes renderer with "ohm":
session.addChart({
data: [new Uint8Array(new Float64Array([1000, 1001, 999, 1002]).buffer)],
format: 8, // FLOATS_64BIT
unit: "ohm", // CRASHES: UNITS["ohm"] === undefined
samplingRate: 1,
offset: 0,
scale: 1,
...
});
// Workaround (loses axis label):
session.addChart({ ..., unit: "unknown" });
Background
The above request comes from my effort to add support for the Keysight 34465A DMM using Clause AI.
The basic support is working but we came across the limitations below in the process of expanding functionality.# Feature Request:
Additional physical unit support for generic DMM and T&M instrument IEXTs
Summary
The
UNITSobject inpackages/eez-studio-shared/units.tscurrently covers electrical power and signal units well, but is missing several physical measurement units that are essential for bench DMMs, LCR meters, and general-purpose instruments. This causes the waveform renderer to crash (Error while rendering history item N!) whensession.addChart()is called with a unit string that is not a key inUNITS.Current state
UNITSkeys as of the current codebase:Problem
A bench DMM — for example a Keysight 34465A or Rigol DM3058 — measures resistance, capacitance, temperature, and period in addition to voltage, current, and frequency. When an IEXT shortcut script calls
session.addChart()withunit: "ohm"orunit: "celsius", the renderer looks upUNITS[unitName]and receivesundefined. Any subsequent call toundefined.formatValue()throws, and the React error boundary catches it, displaying "Error while rendering history item N!" with no recovery path short of deleting the session entry.The only current workaround is
unit: "unknown", which silently drops axis labelling and SI prefix formatting for the user.Requested additions
Resistance
Needed for: 2-wire resistance, 4-wire (Kelvin) resistance, continuity threshold, diode forward voltage (secondary).
Capacitance
Needed for: capacitance measurement on DMMs and LCR meters.
Temperature
Needed for: thermocouple, RTD, and thermistor measurements on DMMs and temperature loggers.
Period / time (sub-second)
timeexists but the formatting and SI prefix support at sub-second resolution (ps, ns, µs, ms) would benefit from explicit aliases if the currentTIME_UNITformatter does not already handle them:Suggested implementation
Each new unit follows the same pattern as existing units. Example for resistance:
Impact
"unknown"for all non-electrical quantitiessession.addChart()References
packages/eez-studio-shared/units.ts—UNITSobject andIUnitinterfacepackages/eez-studio-ui/chart/value-accesor.ts—initValuesAccesor(unit consumed here)packages/eez-studio-ui/chart/WaveformFormat.tsx—WaveformFormatenumpackages/instrument/window/script.ts—addChart()implementation (line ~169),unitName: config.unit.toLowerCase()packages/instrument/window/history/items/generic.tsx—isWaveform(), renderer entry pointTesting
A minimal reproduction with a generic SCPI instrument: