Recipe: from a real instrument to its profile
You do not need to describe the instrument’s whole manual. You need to describe what your software uses, and describe it well.
- Find out which commands your software sends.
- If you have the real instrument, capture the traffic: NI I/O Trace, your application’s log, or Wireshark on the instrument’s port.
- If not, search the code for
write(,query(,VISA Write…
- Copy the real device’s
*IDN?intodispositivo.idn. - For each configuration command (
VOLT 5,RANG 10):- a variable in
estado, with its power-on value; - a command with
muta; - and, if your software also reads it back, a query with
respuesta: "{variable}".
- a variable in
- For each measurement (
MEAS:VOLT?,READ?): a model with the simplest physics your test needs. A constant with some noise, or Ohm’s law with the supply voltage. Matchformatoto the device. - Add the instrument to the bench with its port (chapter 5).
- Validate:
crucible --validar banco.yaml. - Start it and run your software. If something does not answer, ask that
instrument
SYST:ERR?: it tells you which header it did not recognise. Add it to the profile and repeat.
Tips
- Patterns from the manual, not from your code.
MEASure:VOLTage[:DC]acceptsMEAS:VOLT,measure:voltage:dcand every other form;MEAS:VOLTonly accepts itself. - One profile per model, one scenario per bench. If a test needs the
instrument to start already configured, do not touch the profile: use
estado_inicialon the bench. The profile describes the device; the bench, the situation. - Simulation commands. To provoke scenarios from the script (an
out-of-range voltage, a failing sensor) add commands the real device does not
have, like the example multimeter’s
SIMulate:INPut. - Start from the example profiles.
fuente_dc.yamlandmultimetro.yamlare meant as templates and commented line by line.