Products > Test Equipment
lxi-tools TTi PL303QMD-P connection help required
lambcutlet:
Hi,
I need some help using 'script' in lxi-tools.
lxi-tools version 2.6, fedora dnf install.
In the 'script' window i have this. Which does not work.
--- Code: ---psu = lxi_connect("192.168.1.124", 9221, nil, 2000, "RAW") --
print("psu id = " .. lxi_scpi(psu, "*IDN?"))
lxi_disconnect(psu)
--- End code ---
Using the 'scpi' window I can send '*IDN?'', using a manual configured, ip address, RAW/TCP, 9221. This works.
Even using a simple bash script I can get a response.
--- Code: ---#!/bin/bash
IP_ADDR=192.168.1.124
PORT=9221
lxi benchmark --address $IP_ADDR --raw --port $PORT
lxi scpi --address $IP_ADDR --raw --port $PORT "*IDN?"
lxi scpi --address $IP_ADDR --raw --port $PORT "v1 12.34"
lxi scpi --address $IP_ADDR --raw --port $PORT "v1?"
--- End code ---
But the 'script' window has me stumped.
Can anyone provide advice?
tautech:
Suggest you engage directly with the developer:
https://www.eevblog.com/forum/testgear/open-source-lxi-tools-v2-0-released/
lambcutlet:
Hi Lundmar,
Testing to find the cause I copied
https://github.com/lxi-tools/lxi-tools/blob/master/examples/lua/basics.lua
And dropped this into 'script' in the GUI. This fails. Reporting
--- Code: ---[string "buffer"]:103: attempt to call a nil value (field 'pow')
--- End code ---
Even running the same program from the commandline results in
--- Code: ---lua: test.lua:103: attempt to call a nil value (field 'pow')
stack traceback:
test.lua:103: in main chunk
[C]: in ?
--- End code ---
Realised then when i run
--- Code: ---psu = lxi_connect("192.168.1.124", 9221, nil, 2000, "RAW") --
print("psu id = " .. lxi_scpi(psu, "*IDN?"))
lxi_disconnect(psu)
--- End code ---
This also fails with 'attempt to call nil value'.
Any idea why this is?
Is there a package that needs installed?
Lua version 5.4.4
lundmar:
--- Quote from: lambcutlet on August 17, 2023, 09:22:28 pm ---Hi Lundmar,
Testing to find the cause I copied
https://github.com/lxi-tools/lxi-tools/blob/master/examples/lua/basics.lua
And dropped this into 'script' in the GUI. This fails. Reporting
--- Code: ---[string "buffer"]:103: attempt to call a nil value (field 'pow')
--- End code ---
Even running the same program from the commandline results in
--- Code: ---lua: test.lua:103: attempt to call a nil value (field 'pow')
stack traceback:
test.lua:103: in main chunk
[C]: in ?
--- End code ---
--- End quote ---
Turns out that math.pow() has been deprecated by lua. Instead we need to use the math operator "^". I've updated the lua script to use this.
--- Quote from: lambcutlet on August 17, 2023, 09:22:28 pm ---Realised then when i run
--- Code: ---psu = lxi_connect("192.168.1.124", 9221, nil, 2000, "RAW") --
print("psu id = " .. lxi_scpi(psu, "*IDN?"))
lxi_disconnect(psu)
--- End code ---
This also fails with 'attempt to call nil value'.
Any idea why this is?
Is there a package that needs installed?
Lua version 5.4.4
--- End quote ---
I'm not sure. The documentation for your instrument does state that it only supports socket (raw) communication on port 9221 so it should work.
I can connect to my R&S NGM202 PSU using the following raw connect test script:
https://github.com/lxi-tools/lxi-tools/blob/master/examples/lua/connect-raw.lua
lundmar:
FYI - lxi-tools had a regression so that the print() function printed the output to the console of the application instead of the console of the gui.
This is now fixed in the recently released lxi-tools v2.7.
So if the problem is that you didn't see any response, that is why.
Navigation
[0] Message Index
[#] Next page
Go to full version