Author Topic: Program that can log/control many multimeters and other devices.  (Read 1563067 times)

0 Members and 356 Guests are viewing this topic.

Online HKJTopic starter

  • Super Contributor
  • ***
  • Posts: 4796
  • Country: dk
    • Tests
Re: Program that can log/control many multimeters and other devices.
« Reply #7400 on: September 04, 2026, 08:55:14 am »
Other menu — write a variable to a file and read it back

Is there a way from the Other menu to write the content of a script variable to a text file, and to read that file back into a variable?

You do have file access: https://lygte-info.dk/project/Calculator%20UK.html#File_access
 

Offline flash2b

  • Frequent Contributor
  • **
  • Posts: 949
  • Country: nl
  • Everything I like about myself is better with you.
Re: Program that can log/control many multimeters and other devices.
« Reply #7401 on: September 04, 2026, 02:16:58 pm »
There were 2 new # commands introduced that listed the Global and Local vars. What are the commands and documentation location ?


print(getVarList(0))
« Last Edit: September 04, 2026, 02:20:01 pm by flash2b »
They say attention is a shovel. It's time to dig 'em out.
 

Offline Cyclotron

  • Supporter
  • ****
  • Posts: 2217
  • Country: us
  • *POOF*
Re: Program that can log/control many multimeters and other devices.
« Reply #7402 on: September 04, 2026, 11:43:25 pm »
Another PSU family to the list:
This driver covers the E3640A, E3641A, E3642A, E3643A, E3644A, and the E3645A. 
This was created and validated against an E3641A

https://github.com/Cyclotronic/TC-Drivers/tree/main/drivers/HP_Agilent_E364xA

So, I made the mistake of keeping the "HP" part in the name of this driver. I had realized it was never produced under that brand and removed the metadefs but didn't fix the name.

And, I just acquired one of the dual output units in this line so its a good time to fix the name as well as update the driver to handle all 10 of the PSUs in this series. I've tested against at least one from the single and one for the dual output units and both GPIB and serial on each. 

That's a solid number if you count the total coverage toward your goal of 2k instrument coverage. ;)

The dual output and single output are detected and the setup menu changes to reflect that.
Please replace "HP_Agilent_E364xA.txt" with the one attached.





 

Offline flash2b

  • Frequent Contributor
  • **
  • Posts: 949
  • Country: nl
  • Everything I like about myself is better with you.
Re: Program that can log/control many multimeters and other devices.
« Reply #7403 on: September 05, 2026, 09:01:56 am »
While building a device definition I ran into a few things worth reporting. TC version 3.51, Windows.

1. popupFile from a #scpiCmd #pgm#
Calling popupFile() inside a #scpiCmd #pgm# throws java.lang.NullPointerException at dk.hkj.script.FunctionsPopup$14.execute(FunctionsPopup.java:427). Same exception with two, four and five arguments. The same call works from #otherFunc.

2. Underscore in a text control value
A value typed into a #cmdSetup text control arrives with underscores replaced by spaces. Typing YOKO7562_GP and reading the variable back gives "YOKO7562 GP". A value built in a #pgm# keeps the underscore.

3. Unknown command in :write:
If :write: names a #scpiCmd that does not exist, nothing happens and nothing is logged. Other errors produce a stack trace with the ____<----____ marker.

4. getGlobalVar() is not in the documentation
getGlobalVar(name) works and takes a variable name as a string, for example s = "" + handle + ".commandTimeAverage" followed by print(getGlobalVar(s)). I could not find it on the Calculator, Functions or Intro pages.

5. path variables are not in the documentation
print(getVarList(0)) lists five read-only globals: path.config, path.data, path.devices, path.program and path.script. These give the correct directories for a definition that reads or writes files. I did not find them documented.
They say attention is a shovel. It's time to dig 'em out.
 

Online HKJTopic starter

  • Super Contributor
  • ***
  • Posts: 4796
  • Country: dk
    • Tests
Re: Program that can log/control many multimeters and other devices.
« Reply #7404 on: September 05, 2026, 09:22:09 am »
There were 2 new # commands introduced that listed the Global and Local vars. What are the commands and documentation location ?

print(getVarList(0))

There are no # commands to list the vars, but there is a programming function (As you found out):
https://lygte-info.dk/project/Calculator%20UK.html#List_vars_&_functions
https://lygte-info.dk/project/TestControllerConfigDevice%20UK.html#Debugging_variables
 

Online HKJTopic starter

  • Super Contributor
  • ***
  • Posts: 4796
  • Country: dk
    • Tests
Re: Program that can log/control many multimeters and other devices.
« Reply #7405 on: September 05, 2026, 09:29:58 am »
So, I made the mistake of keeping the "HP" part in the name of this driver. I had realized it was never produced under that brand and removed the metadefs but didn't fix the name.

And, I just acquired one of the dual output units in this line so its a good time to fix the name as well as update the driver to handle all 10 of the PSUs in this series. I've tested against at least one from the single and one for the dual output units and both GPIB and serial on each. 

That's a solid number if you count the total coverage toward your goal of 2k instrument coverage. ;)

The dual output and single output are detected and the setup menu changes to reflect that.
Please replace "HP_Agilent_E364xA.txt" with the one attached.

Updated, thanks.
 

Online HKJTopic starter

  • Super Contributor
  • ***
  • Posts: 4796
  • Country: dk
    • Tests
Re: Program that can log/control many multimeters and other devices.
« Reply #7406 on: September 05, 2026, 09:38:07 am »
While building a device definition I ran into a few things worth reporting. TC version 3.51, Windows.

1. popupFile from a #scpiCmd #pgm#
Calling popupFile() inside a #scpiCmd #pgm# throws java.lang.NullPointerException at dk.hkj.script.FunctionsPopup$14.execute(FunctionsPopup.java:427). Same exception with two, four and five arguments. The same call works from #otherFunc.

I am fine with that, you do not do menus from a scpiCmd.


2. Underscore in a text control value
A value typed into a #cmdSetup text control arrives with underscores replaced by spaces. Typing YOKO7562_GP and reading the variable back gives "YOKO7562 GP". A value built in a #pgm# keeps the underscore.

I may have to look into that, but I do not know if it is something I can fix.

3. Unknown command in :write:
If :write: names a #scpiCmd that does not exist, nothing happens and nothing is logged. Other errors produce a stack trace with the ____<----____ marker.

Any command will be send to the device, except if it matches a defined #scpiCmd. That means no errors are output (Except maybe a timeout).

4. getGlobalVar() is not in the documentation
getGlobalVar(name) works and takes a variable name as a string, for example s = "" + handle + ".commandTimeAverage" followed by print(getGlobalVar(s)). I could not find it on the Calculator, Functions or Intro pages.

I will update the documentation.

5. path variables are not in the documentation
print(getVarList(0)) lists five read-only globals: path.config, path.data, path.devices, path.program and path.script. These give the correct directories for a definition that reads or writes files. I did not find them documented.

The documentation do not really list any predefined variables (There are more than them), I may have to update it a bit.
 

Offline flash2b

  • Frequent Contributor
  • **
  • Posts: 949
  • Country: nl
  • Everything I like about myself is better with you.
Re: Program that can log/control many multimeters and other devices.
« Reply #7407 on: September 05, 2026, 11:55:14 am »
Transforming the parameter in a #scpiCmd
In a tx line, NS(int(value)) fails with "Expected a identifier" and the marker shows round100.0, so (value) is substituted before parsing. Is there a way to get an integer out of a plain #scpiCmd, or does it need a #pgm#? The control is an advNumber, which returns 100.0 where the meter needs 100. :format: D0 changes the display only, and numberInt returns an integer but takes only literal bounds where this needs a computed range.
They say attention is a shovel. It's time to dig 'em out.
 

Online HKJTopic starter

  • Super Contributor
  • ***
  • Posts: 4796
  • Country: dk
    • Tests
Re: Program that can log/control many multimeters and other devices.
« Reply #7408 on: September 05, 2026, 12:01:02 pm »
Transforming the parameter in a #scpiCmd
In a tx line, NS(int(value)) fails with "Expected a identifier" and the marker shows round100.0, so (value) is substituted before parsing. Is there a way to get an integer out of a plain #scpiCmd, or does it need a #pgm#? The control is an advNumber, which returns 100.0 where the meter needs 100. :format: D0 changes the display only, and numberInt returns an integer but takes only literal bounds where this needs a computed range.

You hit a optimization, any instance of (value) is replace with the actual value, instead of calling the parser.
To get around that use: ( value ) i.e. add spaces around value.
 

Offline flash2b

  • Frequent Contributor
  • **
  • Posts: 949
  • Country: nl
  • Everything I like about myself is better with you.
Re: Program that can log/control many multimeters and other devices.
« Reply #7409 on: September 05, 2026, 01:24:19 pm »
Follow-up: getting an integer out of a plain #scpiCmd
The spaces tip solved the substitution, thanks. For anyone hitting the same thing, two more steps were needed. What did not work: NS(int(value)) fails with "Expected a identifier" because of the literal replacement; NS( int( value ) ) parses but then fails with "Invalid digit in <100.0>" because the parameter arrives as text with a decimal point, and round() fails the same way underneath; :format: D0 changes the display only, verified with and without on two controls; and getElement with "." as the separator returns an empty value, because the separator is a regular expression and the dot matches every character - that one shows up as a read timeout rather than an error. Escaped as "[.]" it works. The full form for an advNumber control writing to an instrument that needs an integer:

#scpiCmd numSamples tx NS( getElement( value ,0,"[.]") )
:setvar: numSamplesVal = getElement(inputValue,0,"[.]")
They say attention is a shovel. It's time to dig 'em out.
 

Offline flash2b

  • Frequent Contributor
  • **
  • Posts: 949
  • Country: nl
  • Everything I like about myself is better with you.
Re: Program that can log/control many multimeters and other devices.
« Reply #7410 on: September 05, 2026, 01:26:28 pm »
Documentation suggestions from the above
Four behaviours here are not on any page and each cost time on its own: that (value) written exactly like that is a literal replacement rather than an expression, and that spaces around it force the parser; that the separator argument of getElement is a regular expression, so "." has to be written "[.]"; that advNumber returns a floating point value where numberInt returns an integer; and that :format: affects the display only. Adding those four would have made this a five minute job.
They say attention is a shovel. It's time to dig 'em out.
 

Offline Cyclotron

  • Supporter
  • ****
  • Posts: 2217
  • Country: us
  • *POOF*
Re: Program that can log/control many multimeters and other devices.
« Reply #7411 on: September 05, 2026, 02:05:24 pm »
I've published a new notebook on things I've learned creating drivers for TC.
https://github.com/Cyclotronic/TC-Drivers/blob/main/notebooks/silent-failures-in-cmdsetup-and-ascii.md

These are things that haunted me because I didn't see an error. It just silently ignored me much like my wife does.   :)

I hesitate to call anything a bug unless the developer says it is. These are just observations and may well be intentional design choices.

 

Offline flash2b

  • Frequent Contributor
  • **
  • Posts: 949
  • Country: nl
  • Everything I like about myself is better with you.
Re: Program that can log/control many multimeters and other devices.
« Reply #7412 on: September 05, 2026, 02:39:13 pm »
Still short...  ;D

Mine is in MD format and is slightly longer....
They say attention is a shovel. It's time to dig 'em out.
 

Online HKJTopic starter

  • Super Contributor
  • ***
  • Posts: 4796
  • Country: dk
    • Tests
Re: Program that can log/control many multimeters and other devices.
« Reply #7413 on: September 05, 2026, 02:53:36 pm »
I've published a new notebook on things I've learned creating drivers for TC.
https://github.com/Cyclotronic/TC-Drivers/blob/main/notebooks/silent-failures-in-cmdsetup-and-ascii.md

These are things that haunted me because I didn't see an error. It just silently ignored me much like my wife does.   :)

I hesitate to call anything a bug unless the developer says it is. These are just observations and may well be intentional design choices.

Do you check console output for errors?
Also note that debug mode do not activate all debug options, there you need to use the #debug command.
 

Online HKJTopic starter

  • Super Contributor
  • ***
  • Posts: 4796
  • Country: dk
    • Tests
Re: Program that can log/control many multimeters and other devices.
« Reply #7414 on: September 05, 2026, 02:59:15 pm »
Documentation suggestions from the above
Four behaviours here are not on any page and each cost time on its own: that (value) written exactly like that is a literal replacement rather than an expression, and that spaces around it force the parser; that the separator argument of getElement is a regular expression, so "." has to be written "[.]"; that advNumber returns a floating point value where numberInt returns an integer; and that :format: affects the display only. Adding those four would have made this a five minute job.

I may update a bit in the documentation.
The issue with int("100.0") is that it directly tries to convert the string to a int and that fails. I cannot change that, but I could change the int function to not use the vars own type conversion.
 

Offline flash2b

  • Frequent Contributor
  • **
  • Posts: 949
  • Country: nl
  • Everything I like about myself is better with you.
Re: Program that can log/control many multimeters and other devices.
« Reply #7415 on: September 05, 2026, 03:33:16 pm »
I've published a new notebook on things I've learned creating drivers for TC.
https://github.com/Cyclotronic/TC-Drivers/blob/main/notebooks/silent-failures-in-cmdsetup-and-ascii.md

These are things that haunted me because I didn't see an error. It just silently ignored me much like my wife does.   :)

I hesitate to call anything a bug unless the developer says it is. These are just observations and may well be intentional design choices.

#2 I cannot reproduce, my Yokogawa uses E command txrx E works like a charm but is longer than tx E
#4 infoAsk does not support :update: by design since a user has to press get
#5 I can confirm the same behavior experience, know your default when timeout
« Last Edit: September 05, 2026, 03:35:25 pm by flash2b »
They say attention is a shovel. It's time to dig 'em out.
 

Offline KungFuJosh

  • Super Contributor
  • ***
  • Posts: 8223
  • Country: us
  • TEAS is real.
Re: Program that can log/control many multimeters and other devices.
« Reply #7416 on: September 05, 2026, 03:54:07 pm »
Does sync popups update infoAsk? Or what about that update all command that I can't remember right now?  :palm:
"Experience is something you don't get until just after you need it." - Steven Wright
Best Continuity Tester Ever
 

Offline flash2b

  • Frequent Contributor
  • **
  • Posts: 949
  • Country: nl
  • Everything I like about myself is better with you.
Re: Program that can log/control many multimeters and other devices.
« Reply #7417 on: September 05, 2026, 04:05:41 pm »
#updateModeChange ??
They say attention is a shovel. It's time to dig 'em out.
 

Offline KungFuJosh

  • Super Contributor
  • ***
  • Posts: 8223
  • Country: us
  • TEAS is real.
Re: Program that can log/control many multimeters and other devices.
« Reply #7418 on: September 05, 2026, 04:15:15 pm »
No, I think it's a #commandThing.

I used it a few hundred posts ago, and it replaces all need for the :update: command across the setup menu.
"Experience is something you don't get until just after you need it." - Steven Wright
Best Continuity Tester Ever
 

Offline flash2b

  • Frequent Contributor
  • **
  • Posts: 949
  • Country: nl
  • Everything I like about myself is better with you.
Re: Program that can log/control many multimeters and other devices.
« Reply #7419 on: September 05, 2026, 04:23:16 pm »
#SYNCPOPUPS ??

what you describe is #updateModeChange no not for :updatemodechange: with that one
« Last Edit: September 05, 2026, 04:24:59 pm by flash2b »
They say attention is a shovel. It's time to dig 'em out.
 

Offline KungFuJosh

  • Super Contributor
  • ***
  • Posts: 8223
  • Country: us
  • TEAS is real.
Re: Program that can log/control many multimeters and other devices.
« Reply #7420 on: September 05, 2026, 04:35:33 pm »
#updateModeChange 1

...but I dunno if it affects infoAsk or not.
"Experience is something you don't get until just after you need it." - Steven Wright
Best Continuity Tester Ever
 

Online HKJTopic starter

  • Super Contributor
  • ***
  • Posts: 4796
  • Country: dk
    • Tests
Re: Program that can log/control many multimeters and other devices.
« Reply #7421 on: September 05, 2026, 04:36:55 pm »
#updateModeChange 1

...but I dunno if it affects infoAsk or not.

#infoAsk only updates when the button is pressed
 
The following users thanked this post: KungFuJosh

Offline flash2b

  • Frequent Contributor
  • **
  • Posts: 949
  • Country: nl
  • Everything I like about myself is better with you.
Re: Program that can log/control many multimeters and other devices.
« Reply #7422 on: September 05, 2026, 05:58:46 pm »
This confirms my answer.
« Last Edit: September 05, 2026, 06:12:32 pm by flash2b »
They say attention is a shovel. It's time to dig 'em out.
 

Offline flash2b

  • Frequent Contributor
  • **
  • Posts: 949
  • Country: nl
  • Everything I like about myself is better with you.
Re: Program that can log/control many multimeters and other devices.
« Reply #7423 on: September 05, 2026, 07:10:20 pm »
Can I from the definition:

- Start the log
- do a loop of 500 samples to output to the #askValue command
- Stop the log

or

- do a loop of 500 samples
- return those as a sting of values space separated
- read them in or start log to read them in
- stop the log

All from the def so not in the #otherMenu
They say attention is a shovel. It's time to dig 'em out.
 

Online HKJTopic starter

  • Super Contributor
  • ***
  • Posts: 4796
  • Country: dk
    • Tests
Re: Program that can log/control many multimeters and other devices.
« Reply #7424 on: September 05, 2026, 07:17:08 pm »
Can I from the definition:

- Start the log
- do a loop of 500 samples to output to the #askValue command
- Stop the log

or

- do a loop of 500 samples
- return those as a sting of values space separated
- read them in or start log to read them in
- stop the log

All from the def so not in the #otherMenu

You might be able to do something like that from a #scpiCmd #pgm#, but TC is not designed to work that way.

You have much more freedom in the other menu.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf