tektronix / tm_devices

Test & Measurement Device Management
https://tm-devices.readthedocs.io
Apache License 2.0
48 stars 21 forks source link

[BUG]: Argument mismatch in the following APIs #103

Open u625355 opened 1 year ago

u625355 commented 1 year ago

Description of the bug

Arguments data type is mismatched in the following APIs:

Models affected: Keithley SMU 2450|2451|2460|2470 Source Measure Units.

API | PI | Comments -- | -- | -- smu.commands.buffer.write.format() | buffer.write.format() | String argument mapped to integer. smu.commands.buffer.make() | buffer.make() | Return type is a table instead of a variable.

Steps To Reproduce

  1. Create a driver object named "smu" for any of the affected models.
  2. Use the "smu" driver object to write and query the above-mentioned APIs. Examples:

          smu.commands.buffer.write.format() 
           smu.commands.buffer.make()
  3. Error: There is a mismatch in the data type of one of the arguments and return type is a table instead of a variable.

image

Environment Information

Operating System:

Software Version:

Additional Information

Alternative way to make the API functional as expected:

   buffervar1 = smu.write("buffer.make(200, buffer.STYLE_FULL)")
     smu.write("buffer.write.format(extBuffer, buffer.UNIT_WATT, buffer.DIGITS_3_5)")
c3charvat commented 12 months ago

It returns a table because a buffer object is Lua a table. You can do nothing with it.

In order to get measurements back you must use the "printbuffer" command.

In order to use the buffer you must use the string name of it.

Fundamentally, the make buffer command should return the string name of the buffer if it was successfully made or raise an error of it isn't. It's the only way to do anything useful with it.

Addressing the way to make the api behave.. why is a write returning anything?... Does it really return the variable name? If so why? Seems highly inconsistent with the visa definitions of "write","read"and "query"

I found something like this works with visa. buffervarname = "buff1" Smu.write(f"{buffervarname} = buffer.make(100) ") *Do stuff to fill Smu.query(f"printbuffer(1,{buffervarname}.n, {buffervarname}. readings)")

As for the incorrect mapping of a str variable to an integer, reference manual (2450 rev E. 2019 ) page 14-50 and 14-51. Is the relevant documentation for those interested.