Use same test step for different instruments


I am working with different SCPI devices and have created a class for each SCPI device. Some methods are the same for each device., e.g. getting the ID of the insturment with "*IDN? ". I want to create a test step that requests the ID of the instrument and I want to be able to select the instrument that I want the ID from in the Editor X. I thought this should be easy but I do not understand how this is done because test steps are directly connected to an instrument , e.g. in the BasicFunctionality Python example the test step BasicFunctionality works only with instrument BasicInstrument

How can I make Instrument to be for example one of three possible Instrument classes?

Hi @schoepfel and welcome to the forum!

The instrument settings is being created at

    Instrument = property(BasicInstrument, None)\#...

The first argument to property is the instrument type. This can be the type or a base class of the type you want to be able to select. So if you have

  • ScpiInstrument → DMM
  • ScpiInstrument → PSU

Then if you do property(ScpiInstrument #,... then you can select either DMM or PSU.
If you do property(DMM #,... Then only DMM instances can be used.

1 Like