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

UnlimitedMicro and 232 Guests are viewing this topic.

Offline HKJTopic starter

  • Super Contributor
  • ***
  • Posts: 4909
  • Country: dk
    • Tests
Re: Program that can log/control many multimeters and other devices.
« Reply #7750 on: October 13, 2026, 07:42:59 pm »
I have updated all my Temperature defs with features and bugfixes.

Updated, thanks.
 

Offline flash2b

  • Super Contributor
  • ***
  • Posts: 1026
  • Country: nl
  • Everything I like about myself is better with you.
Re: Program that can log/control many multimeters and other devices.
« Reply #7751 on: October 14, 2026, 12:35:40 pm »
How do I get more decimals #scale does not seem to work

=tableInitHeader(header)
=i=1
#while (i<=chCount)
#scale ("CH"+i+"_"+unitValue(meter)) 4 0 0 1
=i=i+1
#endwhile
They say attention is a shovel. It's time to dig 'em out.
 

Offline HKJTopic starter

  • Super Contributor
  • ***
  • Posts: 4909
  • Country: dk
    • Tests
Re: Program that can log/control many multimeters and other devices.
« Reply #7752 on: October 14, 2026, 12:38:06 pm »
How do I get more decimals #scale does not seem to work

Maybe you need a #waitui
 

Offline flash2b

  • Super Contributor
  • ***
  • Posts: 1026
  • Country: nl
  • Everything I like about myself is better with you.
Re: Program that can log/control many multimeters and other devices.
« Reply #7753 on: October 14, 2026, 12:42:03 pm »
but even from the command line #scale CH1_V 4 0 0 0 1 does not work
They say attention is a shovel. It's time to dig 'em out.
 

Offline HKJTopic starter

  • Super Contributor
  • ***
  • Posts: 4909
  • Country: dk
    • Tests
Re: Program that can log/control many multimeters and other devices.
« Reply #7754 on: October 14, 2026, 12:46:31 pm »
but even from the command line #scale CH1_V 4 0 0 0 1 does not work

You are a bit low on argument:
#scale Math.Max 2 0 0 1 1 1.0 1.0

I do not know if you need data in the table, before you can set the format.
 

Offline flash2b

  • Super Contributor
  • ***
  • Posts: 1026
  • Country: nl
  • Everything I like about myself is better with you.
Re: Program that can log/control many multimeters and other devices.
« Reply #7755 on: October 14, 2026, 01:03:58 pm »
Can a column made with tableInitHeader get a formatter, such as SI or D5, the way a #value line gives one to a device column?

#scale is for charts, so I cannot use it.
They say attention is a shovel. It's time to dig 'em out.
 

Offline HKJTopic starter

  • Super Contributor
  • ***
  • Posts: 4909
  • Country: dk
    • Tests
Re: Program that can log/control many multimeters and other devices.
« Reply #7756 on: October 14, 2026, 01:09:14 pm »
Can a column made with tableInitHeader get a formatter, such as SI or D5, the way a #value line gives one to a device column?

#scale is for charts, so I cannot use it.

Try #valueFormat
 

Offline flash2b

  • Super Contributor
  • ***
  • Posts: 1026
  • Country: nl
  • Everything I like about myself is better with you.
Re: Program that can log/control many multimeters and other devices.
« Reply #7757 on: October 14, 2026, 01:47:52 pm »
Scanner prototype as a script

Hi HKJ,

As a follow-up to my Scanner Popup proposal, I made a prototype as a script: a relay board plus one meter, scanning the channels in turn.

  • Devices selected with getDevice("BMM") and getDevice("relay"), channel count taken from the scanner's own channels
  • Settle, dwell and off wait (break before make) set in a popup
  • Its own table: a row per cycle, a column per channel, names and SI format from the meter
  • All relays open at start and end, every device call guarded with isLoaded()

Function tested on TC 3.57 with a Yokogawa 7552 and an LCUS-4.

[ Attachment Invalid Or Does Not Exist ]

The output is:
Code: [Select]
"index","time","minutes","dateTime","Volt_DC_CH1","Volt_DC_CH2","Volt_DC_CH3","Volt_DC_CH4"
0,33.201,0.55335240000083,1791985078.872,2.5006,2.5006,2.5006,2.5006
1,66.419,1.10700429666322,1791985112.091,2.5006,2.5006,2.5006,2.5006
2,99.638,1.66063241499942,1791985145.309,2.5006,2.5006,2.5006,2.5006
3,132.857,2.21428748333516,1791985178.528,2.5006,2.5006,2.5006,2.5006

My dilemma is where it should live. As an external script it is easy to change and test, but a user has to find and load it. Putting it in the Other menu of my relay defs would make it one click away, but then the same script sits in every relay def, with all # escaped as \x23 and the runScript strings nested inside runScriptAsync. Every fix would have to be repeated in each def. A Scanner Popup in TC would solve that, since it would work with any relay board and any meter without touching a def.

Two things forced me to build commands as text and run them with runScript:
  • tableAddRow does not accept an array, so a row for a variable channel count has to be built as a string
  • #valueFormat does not evaluate a name in brackets, unlike #scale

Would either of those be possible? Then the script would not need runScript at all.
« Last Edit: Yesterday at 09:39:42 am by flash2b »
They say attention is a shovel. It's time to dig 'em out.
 

Offline HKJTopic starter

  • Super Contributor
  • ***
  • Posts: 4909
  • Country: dk
    • Tests
Re: Program that can log/control many multimeters and other devices.
« Reply #7758 on: October 14, 2026, 06:10:24 pm »
My dilemma is where it should live. As an external script it is easy to change and test, but a user has to find and load it. Putting it in the Other menu of my relay defs would make it one click away, but then the same script sits in every relay def, with all # escaped as \x23 and the runScript strings nested inside runScriptAsync. Every fix would have to be repeated in each def. A Scanner Popup in TC would solve that, since it would work with any relay board and any meter without touching a def.

A possibility is that I include it with TC, there is already a couple of scripts included.
They will usually start with something like:
#scriptMenu Power supply;Voltage sweep
#scriptSystemVersion 0.96
#scriptInterface PS setCurrent setVoltage setOn
#logcmds 0
This restrict when to list them, they same tags can be used in all scripts saved as menu.



Two things forced me to build commands as text and run them with runScript:
  • tableAddRow does not accept an array, so a row for a variable channel count has to be built as a string
  • #valueFormat does not evaluate a name in brackets, unlike #scale

Would either of those be possible? Then the script would not need runScript at all.

There is a new test version up.
 

Offline flash2b

  • Super Contributor
  • ***
  • Posts: 1026
  • Country: nl
  • Everything I like about myself is better with you.
Re: Program that can log/control many multimeters and other devices.
« Reply #7759 on: October 14, 2026, 07:14:19 pm »
Well that was a big surprise and thank you for the new test version. My issue is solved completely no runScript needed inside.

I have perfected the script and added an Interval time and a Continuous mode as well, as per specification. I also checked the script with real connections now and it works perfectly.

I also added the header you requested.

Very handy to check a resistor bank with one meter or 2 references with one meter !!

The script can be added to the next release of TC.

[ Attachment Invalid Or Does Not Exist ]

See note: ; - This script requires TC >=v3.58 (array in tableAddRow, name in brackets for #valueFormat)
« Last Edit: Yesterday at 09:39:14 am by flash2b »
They say attention is a shovel. It's time to dig 'em out.
 

Offline HKJTopic starter

  • Super Contributor
  • ***
  • Posts: 4909
  • Country: dk
    • Tests
Re: Program that can log/control many multimeters and other devices.
« Reply #7760 on: October 14, 2026, 07:23:27 pm »
I have perfected the script and added an Interval time and a Continuous mode as well, as per specification. I also checked the script with real connections now and it works perfectly.
...
The script can be added to the next release of TC.

Added, thanks.
It does not work that way with script, restart TC and it is included!
That is the reason it needs the version check.
 

Offline flash2b

  • Super Contributor
  • ***
  • Posts: 1026
  • Country: nl
  • Everything I like about myself is better with you.
Re: Program that can log/control many multimeters and other devices.
« Reply #7761 on: October 14, 2026, 07:42:44 pm »
Yes, it is is in.

I cleaned up my old scripts and made my own library in the ScriptLibrary folder.

There were some auto generated scripts there already from popups and layout. Most scripts I made were from the Analog Output device comparison but those were just settings, not loops or vars.

My old scripts were like 5 lines of code or so with no guards, but this one is my first script that has some depth. Most effort was to write data to the table. And since I have written mostly definition DSL it was another learning experience. Almost all of my initial demand got in to the 1.00 Final.

They say attention is a shovel. It's time to dig 'em out.
 

Offline HKJTopic starter

  • Super Contributor
  • ***
  • Posts: 4909
  • Country: dk
    • Tests
Re: Program that can log/control many multimeters and other devices.
« Reply #7762 on: October 14, 2026, 07:54:05 pm »
Yes, it is is in.

I cleaned up my old scripts and made my own library in the ScriptLibrary folder.

There were some auto generated scripts there already from popups and layout. Most scripts I made were from the Analog Output device comparison but those were just settings, not loops or vars.

My old scripts were like 5 lines of code or so with no guards, but this one is my first script that has some depth. Most effort was to write data to the table. And since I have written mostly definition DSL it was another learning experience. Almost all of my initial demand got in to the 1.00 Final.

As you can see on the "List and manage scripts" popup, TC has some system scripts. They are all stored in a single file and downloaded at each start if TC is online, if it is offline it will look for latest downloaded version. If the TC version is never online, you can copy the files from another TC computer that is online. The downloaded files are stored in : ...\Documents\TestController\Settings (The script library is not stored in the script directory, that is for user scripts)


I forgot to mention that the reverse dB functions I listed earlier is included in the test version.
« Last Edit: October 14, 2026, 07:58:43 pm by HKJ »
 

Offline flash2b

  • Super Contributor
  • ***
  • Posts: 1026
  • Country: nl
  • Everything I like about myself is better with you.
Re: Program that can log/control many multimeters and other devices.
« Reply #7763 on: October 14, 2026, 08:06:48 pm »
Yes I got that now. They are also filtered based on what is connected and the version compatibility of TC.

My own "user" scripts are also now ordered similar so better structured since today. But those are not all bulletproof with guarding of loaded devices.

There is also a section User Scripts on your website, https://lygte-info.dk/project/TestControllerUserScripts1%20UK.html
They say attention is a shovel. It's time to dig 'em out.
 

Offline HKJTopic starter

  • Super Contributor
  • ***
  • Posts: 4909
  • Country: dk
    • Tests
Re: Program that can log/control many multimeters and other devices.
« Reply #7764 on: October 14, 2026, 08:15:01 pm »
Yes I got that now. They are also filtered based on what is connected and the version compatibility of TC.

You can filter on a bit more, check these commands:
https://lygte-info.dk/project/TestControllerScriptCommands%20UK.html#Script_options

My own "user" scripts are also now ordered similar so better structured since today. But those are not all bulletproof with guarding of loaded devices.

There is also a section User Scripts on your website, https://lygte-info.dk/project/TestControllerUserScripts1%20UK.html

That section is the normal place for user scripts, but I liked your idea so much I wanted easier access to it.
But it is still required you have a relay and a bench meter connected before you can see it.
 

Offline HKJTopic starter

  • Super Contributor
  • ***
  • Posts: 4909
  • Country: dk
    • Tests
Re: Program that can log/control many multimeters and other devices.
« Reply #7765 on: October 15, 2026, 10:05:54 am »
TC has some inconsequential issues with some commands, like the two flash2b found.
There are more of them, but I am not going to look through the code to find them. If they are pointed out I may very likely fix them.
 

Offline Gertjan

  • Frequent Contributor
  • **
  • Posts: 357
  • Country: nl
Re: Program that can log/control many multimeters and other devices.
« Reply #7766 on: October 15, 2026, 11:37:10 am »
[...]
I forgot to mention that the reverse dB functions I listed earlier is included in the test version.

Thanks for the reverse dB functions! That was quick :)

At the moment I am working on a definition for a counter, and repairing some TEA.
After that I will return to the # interface for the RF generators.

regards, Gertjan.
 

Offline flash2b

  • Super Contributor
  • ***
  • Posts: 1026
  • Country: nl
  • Everything I like about myself is better with you.
Re: Program that can log/control many multimeters and other devices.
« Reply #7767 on: October 15, 2026, 12:58:44 pm »
TC has some inconsequential issues with some commands, like the two flash2b found.
There are more of them, but I am not going to look through the code to find them. If they are pointed out I may very likely fix them.

dateTime column

Code: [Select]
=tableInitHeader("index,time,minutes,dateTime")
=tableAddRow(0,0,0,date())            ; shows 1970
=tableAddRow(1,0,0,long(date()))      ; milliseconds, wrong as well
=tableAddRow(2,0,0,dateTos(date()))   ; seconds, correct
The suggestion: tableAddRow could convert a date() value itself, so the natural form simply works.

isLoaded and channels

Code: [Select]
=setRelay("LCUS4:3",1)    ; works, switches channel 3
=isLoaded("LCUS4:3")      ; 0
=isLoaded("LCUS4")        ; 1

The suggestion: isLoaded could accept a channel handle, since setRelay does. A script could then check a channel directly, instead of counting through getDevice("relay*").
They say attention is a shovel. It's time to dig 'em out.
 

Offline HKJTopic starter

  • Super Contributor
  • ***
  • Posts: 4909
  • Country: dk
    • Tests
Re: Program that can log/control many multimeters and other devices.
« Reply #7768 on: October 15, 2026, 01:52:47 pm »
The suggestion: tableAddRow could convert a date() value itself, so the natural form simply works.
The suggestion: isLoaded could accept a channel handle, since setRelay does. A script could then check a channel directly, instead of counting through getDevice("relay*").

God suggestion , they are implemented, but no new test version yet.
The isLoaded was a bit tricky, now it will check if the :number specification is valid, even if you use a device name, instead of a handle.
 

Offline flash2b

  • Super Contributor
  • ***
  • Posts: 1026
  • Country: nl
  • Everything I like about myself is better with you.
Re: Program that can log/control many multimeters and other devices.
« Reply #7769 on: October 15, 2026, 01:57:27 pm »
When a advcomboboxHot control has a blank space between the control code and the list items, TC will refuse to load

Exception in thread "Scan ports" java.lang.StringIndexOutOfBoundsException: String index out of range: -1
        at java.lang.String.substring(Unknown Source)
        at dk.hkj.devices.SetupFormats$ToggleButtonField.parseParamsList(SetupFormats.java:2624)
        at dk.hkj.devices.SetupFormats.setup(SetupFormats.java:713)
        at dk.hkj.devices.ManageDeviceDefinitions$DeviceDefinition.parse(ManageDeviceDefinitions.java:1161)

Normal TC ignores silently, which is not always useful, but this is the total opposite !
They say attention is a shovel. It's time to dig 'em out.
 

Offline HKJTopic starter

  • Super Contributor
  • ***
  • Posts: 4909
  • Country: dk
    • Tests
Re: Program that can log/control many multimeters and other devices.
« Reply #7770 on: October 15, 2026, 02:01:38 pm »
When a advcomboboxHot control has a blank space between the control code and the list items, TC will refuse to load

Exception in thread "Scan ports" java.lang.StringIndexOutOfBoundsException: String index out of range: -1
        at java.lang.String.substring(Unknown Source)
        at dk.hkj.devices.SetupFormats$ToggleButtonField.parseParamsList(SetupFormats.java:2624)
        at dk.hkj.devices.SetupFormats.setup(SetupFormats.java:713)
        at dk.hkj.devices.ManageDeviceDefinitions$DeviceDefinition.parse(ManageDeviceDefinitions.java:1161)

Normal TC ignores silently, which is not always useful, but this is the total opposite !

I am not sure what you mean and I am not sure it is anything I will fix.
 

Offline flash2b

  • Super Contributor
  • ***
  • Posts: 1026
  • Country: nl
  • Everything I like about myself is better with you.
Re: Program that can log/control many multimeters and other devices.
« Reply #7771 on: October 15, 2026, 02:06:52 pm »
#cmdSetup comboboxHot Step_Time Wave
:read: waveDiv?
:write: waveDiv

0.1s 1
0.2s 2
0.5s 5
1s 10
2s 20
5s 50
10s 100

will give the error, because of the empty line TC refuses to load but not pointing to the problem 
They say attention is a shovel. It's time to dig 'em out.
 

Offline flash2b

  • Super Contributor
  • ***
  • Posts: 1026
  • Country: nl
  • Everything I like about myself is better with you.
Re: Program that can log/control many multimeters and other devices.
« Reply #7772 on: October 15, 2026, 02:08:52 pm »
The suggestion: tableAddRow could convert a date() value itself, so the natural form simply works.
The suggestion: isLoaded could accept a channel handle, since setRelay does. A script could then check a channel directly, instead of counting through getDevice("relay*").

God suggestion , they are implemented, but no new test version yet.
The isLoaded was a bit tricky, now it will check if the :number specification is valid, even if you use a device name, instead of a handle.

I will try it when it the test version is avail and update my scanner script.
They say attention is a shovel. It's time to dig 'em out.
 

Offline HKJTopic starter

  • Super Contributor
  • ***
  • Posts: 4909
  • Country: dk
    • Tests
Re: Program that can log/control many multimeters and other devices.
« Reply #7773 on: October 15, 2026, 02:13:57 pm »
#cmdSetup comboboxHot Step_Time Wave
:read: waveDiv?
:write: waveDiv

0.1s 1
0.2s 2

will give the error, because of the empty line TC refuses to load but not pointing to the problem

Not on my computer and I have not modified the code in any way.
 

Offline flash2b

  • Super Contributor
  • ***
  • Posts: 1026
  • Country: nl
  • Everything I like about myself is better with you.
Re: Program that can log/control many multimeters and other devices.
« Reply #7774 on: October 15, 2026, 02:16:33 pm »
I report it again when I get it, the error was still in my notes not the control that caused it.
They say attention is a shovel. It's time to dig 'em out.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf

 

-->