instrument-components¶
High-level control for VISA / SCPI instruments in Rust and C#: auto-discovery, IVI-inspired typed classes, and mock fixtures for CI — without waiting on a vendor IVI class driver.
What you get¶
- Auto-discovery of USB, GPIB, and serial VISA resources
- Typed instrument classes with SI units (V, A, Hz, s): DMM, DC power supply, function generator, oscilloscope, switch, counter, power meter, spectrum analyzer
- Mock transport for hardware-free CI
- Stable
DeviceIdfor instrument replacement workflows - Opt-in async APIs (true async in Rust via visa-rs; sync bridge in C# today)
Choose your path¶
| I want to… | Start here |
|---|---|
| First measure (mock, no VISA) | Getting started |
| Discover real instruments | Discovery |
| Use a typed class | Instrument classes |
| Async I/O | Rust async · C# async |
| Author OpenTAP plans | C# OpenTAP pack |
| See what's implemented | Capability matrix |
Install¶
Mock → volts¶
use instrument::prelude::*;
fn main() -> Result<()> {
let fixture = ScriptedFixture::builder()
.idn("Keysight Technologies", "34401A", "SN1", "1.0")
.kinds([InstrumentKind::Dmm])
.on_query("*IDN?", "Keysight Technologies,34401A,SN1,1.0")
.on_query(":MEAS:VOLT:DC?", "1.234")
.build();
let catalog = DeviceCatalog::from_fixture("mock://dmm-1", fixture)?;
let volts = catalog.open_dmm("mock://dmm-1")?.measure_voltage_dc(None)?;
println!("{volts} V");
Ok(())
}
using InstrumentComponents.Catalog;
using InstrumentComponents.Kind;
using InstrumentComponents.Mock;
var fixture = ScriptedFixture.Builder()
.Idn("Keysight Technologies", "34401A", "SN1", "1.0")
.Kinds(InstrumentKind.Dmm)
.OnQuery("*IDN?", "Keysight Technologies,34401A,SN1,1.0")
.OnQuery(":MEAS:VOLT:DC?", "1.234")
.Build();
var catalog = DeviceCatalog.FromFixture("mock://dmm-1", fixture);
var volts = catalog.OpenDmm("mock://dmm-1").MeasureVoltageDc();
Console.WriteLine($"{volts} V");
Source & API reference¶
- GitHub: josh-hemphill/instrument-components
- Rust API docs: docs.rs/instrument-components (after publish)
- Agent-oriented notes (roadmap, parity) live in the repo
docs/folder