SiLab-Bonn / basil

A data acquisition framework in Python and Verilog.
BSD 3-Clause "New" or "Revised" License
40 stars 29 forks source link

Test of SCPI fails #61

Closed laborleben closed 8 years ago

laborleben commented 8 years ago

ERROR: test_write (test_SimScpi.TestSimScpi)

Traceback (most recent call last): File "/home/travis/build/SiLab-Bonn/basil/tests/test_SimScpi.py", line 43, in test_write self.device['Pulser'].set_on() File "/home/travis/build/SiLab-Bonn/basil/basil/HL/scpi.py", line 65, in method raise ValueError('Invalid SCPI command %s for device %s' % (name, self.name)) ValueError: Invalid SCPI command set_on for device Pulser

The error in the test never occurred because set_on command was never executed because "if .. elif .." statement had no final "else". I added "else" recently, so the error is visible now.

What was the intention of "set_on" / "get_on"? These commands doesn't exist in our device drivers. There is only "on" / "off". We might just implement "set_on" / "get_on" / "set_off" / "get_off" if that makes sense.

DavidLP commented 8 years ago

It is a simulated device and the commands do exist.

DavidLP commented 8 years ago

Is working again after this commit.

laborleben commented 8 years ago

Thanks, do you know where pyvisa-py has the @sim backend definition?

DavidLP commented 8 years ago

Pyvisa-sim it is a special backend for pyvisa for testing if no hardware is available. Documentation is here. In BASIL this line tells pyvisa to use the simulation backend.

laborleben commented 8 years ago

I know, but I see only "?IDN" support for standard "@sim" backend. Where are the these commands defined: identifier : ERROR set_on : "!OUT" get_on : "?OUT" get_frequency : "?FREQ"

Additional commands (like the ones above) can be implemented via a yaml file. But I cant find that.

laborleben commented 8 years ago

OK, it is an extra package ... pip install -U pyvisa-sim

DavidLP commented 8 years ago

Correct.

laborleben commented 8 years ago

OK, the default device is here:

But "?IDN" should return "LSG Serial #1234". But the identifier in this file is "ERROR".

print(inst.query("?IDN")) LSG Serial #1234

laborleben commented 8 years ago

Default IEEE 488.2 commands are in a dict.

DavidLP commented 8 years ago

Yep, that's nicer