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

ton4eff and 115 Guests are viewing this topic.

Offline Gertjan

  • Frequent Contributor
  • **
  • Posts: 358
  • Country: nl
Re: Program that can log/control many multimeters and other devices.
« Reply #7725 on: October 12, 2026, 12:07:44 pm »
I can support #interface setAmplitudeV by adding an extra SCPI command to make sure the generator is in the correct mode (dBm or V):

As long as logging output do not change!


Yes, logging will also change from dBm to V or vice versa.. (On both generators it is a mode change)
But I don't think this a a problem. One will work either with dBm or in Volt. (just what is appropriate for the current measurement)
So the generator stays in the current used amplitude unit.

Quote
TC has a function for dB, or rather a couple
Yes, I found those. But could not figure out how to use them for converting dBm to V and vice versa....

regards, Gertjan.
 

Offline HKJTopic starter

  • Super Contributor
  • ***
  • Posts: 4919
  • Country: dk
    • Tests
Re: Program that can log/control many multimeters and other devices.
« Reply #7726 on: October 12, 2026, 12:12:38 pm »
Yes, logging will also change from dBm to V or vice versa.. (On both generators it is a mode change)
But I don't think this a a problem. One will work either with dBm or in Volt. (just what is appropriate for the current measurement)
So the generator stays in the current used amplitude unit.

The issue is if the user uses the function and the column change unit, that means it will list values with two different units in the same column at the same time.

Quote
TC has a function for dB, or rather a couple
Yes, I found those. But could not figure out how to use them for converting dBm to V and vice versa....

They are only from volt to db, maybe I ought to add the reverse also.

They one you need is:
dBm(voltage,resistance)

With resistance==50

 

Offline Gertjan

  • Frequent Contributor
  • **
  • Posts: 358
  • Country: nl
Re: Program that can log/control many multimeters and other devices.
« Reply #7727 on: October 12, 2026, 12:28:21 pm »
Yes, logging will also change from dBm to V or vice versa.. (On both generators it is a mode change)
But I don't think this a a problem. One will work either with dBm or in Volt. (just what is appropriate for the current measurement)
So the generator stays in the current used amplitude unit.

The issue is if the user uses the function and the column change unit, that means it will list values with two different units in the same column at the same time.

My thinking is that if one, for example, is working in Volt, logging will be done in Volts.
Using the #interface commands to set/get Volts will keep the mode in Volt. So no problem.
Only when using the dBm #interface commands, the mode will change. But who will use/need the dBm commands when working in Volts?

But maybe I am missing something?
If you are not happy with it, I will leave it out.

Regards, Gertjan.
 

Offline HKJTopic starter

  • Super Contributor
  • ***
  • Posts: 4919
  • Country: dk
    • Tests
Re: Program that can log/control many multimeters and other devices.
« Reply #7728 on: October 12, 2026, 12:38:33 pm »
Yes, logging will also change from dBm to V or vice versa.. (On both generators it is a mode change)
But I don't think this a a problem. One will work either with dBm or in Volt. (just what is appropriate for the current measurement)
So the generator stays in the current used amplitude unit.

The issue is if the user uses the function and the column change unit, that means it will list values with two different units in the same column at the same time.

My thinking is that if one, for example, is working in Volt, logging will be done in Volts.
Using the #interface commands to set/get Volts will keep the mode in Volt. So no problem.
Only when using the dBm #interface commands, the mode will change. But who will use/need the dBm commands when working in Volts?

But maybe I am missing something?
If you are not happy with it, I will leave it out.

Anything that changes the columns belong in the "Mode" popup, there a checkmark (#cmdModeCheck) to select between dBm and V would be fine.
 

Offline Gertjan

  • Frequent Contributor
  • **
  • Posts: 358
  • Country: nl
Re: Program that can log/control many multimeters and other devices.
« Reply #7729 on: October 12, 2026, 12:59:01 pm »
Yes, it is a bit unconventional use of mode. But very convenient to switch everything from dBm to V.
A generator has no modes, so there is no mode menu. It would be a bit strange and inconvenient to have to open a separate (mode)menu , just to click dBm or V. After all, it is not really a different mode, just a different unit.

I am not going to re-write 2 perfectly fine working definitions for this. So I'll just leave them as is for now.
(Without # interface commands. Or if you prefer, with # interface just for dBm)

regards, Gertjan.
« Last Edit: October 12, 2026, 01:11:56 pm by Gertjan »
 

Offline HKJTopic starter

  • Super Contributor
  • ***
  • Posts: 4919
  • Country: dk
    • Tests
Re: Program that can log/control many multimeters and other devices.
« Reply #7730 on: October 12, 2026, 01:12:45 pm »
Yes, it is a bit unconventional use of mode. But very convenient to switch everything from dBm to V.
A generator has no modes, so there is no mode menu. It would be a bit strange and inconvenient to have to open a separate (mode)menu , just to click dBm or V. After all, it is not really a different mode, just a different unit.

I am not going to re-write 2 perfectly fine working definitions for this. So I'll just leave them as is for now.
(Without # interface commands. Or if you prefer, with # interface just for dBm)

I prefer you leave the #interface commands in.
 

Offline Gertjan

  • Frequent Contributor
  • **
  • Posts: 358
  • Country: nl
Re: Program that can log/control many multimeters and other devices.
« Reply #7731 on: October 12, 2026, 02:11:00 pm »
I will leave them in.. I'll sleep on it, and see what I can do.
Maybe create a separate command to read amplitude in dBm and V without touching mode.

regards, Gertjan
 

Offline Benleentje

  • Contributor
  • Posts: 45
  • Country: nl
Re: Program that can log/control many multimeters and other devices.
« Reply #7732 on: October 12, 2026, 06:58:24 pm »


Anything that changes the columns belong in the "Mode" popup, there a checkmark (#cmdModeCheck) to select between dBm and V would be fine.
Quote
Yes, it is a bit unconventional use of mode. But very convenient to switch everything from dBm to V.

If you have both readings in de column current value's then you don't have to switch mode.
For me i like many value's in current value's especially when the device have no modes
« Last Edit: October 12, 2026, 07:35:05 pm by Benleentje »
 

Online flash2b

  • Super Contributor
  • ***
  • Posts: 1030
  • Country: nl
  • Everything I like about myself is better with you.
Re: Program that can log/control many multimeters and other devices.
« Reply #7733 on: October 13, 2026, 06:36:51 am »
Hi HKJ,

While building a Wave page for the BSide I8 def, I found that :enable: doesn’t work on controls that live on a page owned by a selector.

Minimal case:

Code: [Select]
#cmdSetup checkbox Wave_Enable Wave
:read: waveEnable?
:write: waveEnable
On 0 1

#cmdSetup advNumber Offset WaveV
:read: waveOffset?
:write: waveOffset
:enable: Wave.Wave_Enable.On==1
V 0.00 Main.maxVoltage

#cmdSetup selector Offset_settings Wave
:read: waveTarget?

0 WaveV.
1 WaveC.

When the setup menu opens, and again when the checkbox is clicked:

dk.hkj.script.ProgramExceptions$UnknownException: Variable not found Wave.Wave_Enable.On
        at dk.hkj.devices.SetupFormats.calcEnable(SetupFormats.java:443)
        at dk.hkj.devices.SetupFormats$SelectorField.calcEnable(SetupFormats.java:5103)
        at dk.hkj.devices.SetupFormats$SelectorField.syncValue(SetupFormats.java:5198)


Using a def variable instead, :enable: waveEnableVal==1, fails in the same way: Variable not found waveEnableVal. The same :enable: Wave.Wave_Enable.On==1 works fine on controls placed directly on the Wave page, and on an advNumber outside a selector.

So it looks as though controls inside a selector are evaluated in a scope that sees neither the other controls nor the def’s variables. Is that intended? And is there a way to reference a control or variable from inside a selector page?
They say attention is a shovel. It's time to dig 'em out.
 

Online flash2b

  • Super Contributor
  • ***
  • Posts: 1030
  • Country: nl
  • Everything I like about myself is better with you.
Re: Program that can log/control many multimeters and other devices.
« Reply #7734 on: October 13, 2026, 09:17:33 am »
Suggestion: a way to pause an Updater

Hi HKJ,

Would it be possible to pause an Updater, for example with :enable: on the Updater, or with an interval taken from a variable, where 0 means stopped?

Some thoughts on how it could work:
  • :enable: on the Updater: evaluated before each tick. While false, the tick does nothing: no updates, no log lines. When it turns true again, the next tick fires after the normal interval.
  • Interval from a variable: the parameter line accepts a variable name instead of a number, re-read after every tick. A def can then change the speed or stop the Updater with :setvar:. A value of 0 stops it, and a value above 0 restarts it.
  • Backward compatible: without the tag, or with a literal interval, the Updater behaves exactly as it does now.
Either option would do. :enable: fits the existing control syntax best, and the variable interval would also allow a def to change the speed at run time.
They say attention is a shovel. It's time to dig 'em out.
 

Offline HKJTopic starter

  • Super Contributor
  • ***
  • Posts: 4919
  • Country: dk
    • Tests
Re: Program that can log/control many multimeters and other devices.
« Reply #7735 on: October 13, 2026, 11:41:52 am »
I will leave them in.. I'll sleep on it, and see what I can do.
Maybe create a separate command to read amplitude in dBm and V without touching mode.

I have added the reverse dB function, say if you want a test version with them included.

dbVToVolt(dBV)      // The reverse of dBV function, i.e. convert a dBV value to voltage
dBmToPower(dBm)      // The reverse of dBm(power), i.e. convert a dBm value to power in watt
dBmToVolt(dBm,resistance)// The reverse of dBm(voltage,resistance), i.e. convert a dBm value to voltage across a resistor
 

Offline HKJTopic starter

  • Super Contributor
  • ***
  • Posts: 4919
  • Country: dk
    • Tests
Re: Program that can log/control many multimeters and other devices.
« Reply #7736 on: October 13, 2026, 11:46:34 am »
While building a Wave page for the BSide I8 def, I found that :enable: doesn’t work on controls that live on a page owned by a selector.

Try something like this:
:enable: return1(displayVar(split(getVarList(1),"\n")));
Then you can see all the variables.

All controls inside a selector lives in that selector and it controls access to them, i.e. invisible controls inside a selector cannot be seen anywhere or accessed.
 

Offline HKJTopic starter

  • Super Contributor
  • ***
  • Posts: 4919
  • Country: dk
    • Tests
Re: Program that can log/control many multimeters and other devices.
« Reply #7737 on: October 13, 2026, 11:48:37 am »
Suggestion: a way to pause an Updater

Interesting idea. I am not going to work on it, but I have saved the idea.
 

Online flash2b

  • Super Contributor
  • ***
  • Posts: 1030
  • Country: nl
  • Everything I like about myself is better with you.
Re: Program that can log/control many multimeters and other devices.
« Reply #7738 on: October 13, 2026, 12:32:05 pm »
While building a Wave page for the BSide I8 def, I found that :enable: doesn’t work on controls that live on a page owned by a selector.

Try something like this:
:enable: return1(displayVar(split(getVarList(1),"\n")));
Then you can see all the variables.

All controls inside a selector lives in that selector and it controls access to them, i.e. invisible controls inside a selector cannot be seen anywhere or accessed.


Thanks. The self created def variable waveEnableVal isn’t visible inside the selector either. Is that intended too?
They say attention is a shovel. It's time to dig 'em out.
 

Offline HKJTopic starter

  • Super Contributor
  • ***
  • Posts: 4919
  • Country: dk
    • Tests
Re: Program that can log/control many multimeters and other devices.
« Reply #7739 on: October 13, 2026, 12:36:30 pm »
While building a Wave page for the BSide I8 def, I found that :enable: doesn’t work on controls that live on a page owned by a selector.

Try something like this:
:enable: return1(displayVar(split(getVarList(1),"\n")));
Then you can see all the variables.

All controls inside a selector lives in that selector and it controls access to them, i.e. invisible controls inside a selector cannot be seen anywhere or accessed.


Thanks. The self created def variable waveEnableVal isn’t visible inside the selector either. Is that intended too?

The only place you can create stating variables is in :setvar: and #scpiCmd or if you create it as a globalvar and that is bad praxis from a definition.
 

Online flash2b

  • Super Contributor
  • ***
  • Posts: 1030
  • Country: nl
  • Everything I like about myself is better with you.
Re: Program that can log/control many multimeters and other devices.
« Reply #7740 on: October 13, 2026, 01:14:14 pm »
I did, but I could not read it from the control that was part of the selector.
They say attention is a shovel. It's time to dig 'em out.
 

Online flash2b

  • Super Contributor
  • ***
  • Posts: 1030
  • Country: nl
  • Everything I like about myself is better with you.
Re: Program that can log/control many multimeters and other devices.
« Reply #7741 on: October 13, 2026, 01:19:40 pm »
I have updated my BSide I8 def with a nice feature that allows it to shape its output for Brownout and undervoltage lockout, Regulator dropout and Automotive-style dips analysis.



The output of the PSU against a small light bulb:




Also included in the ZIP are updates of my eTommens (and look a like) PSU's from the eTM-P and eTM-MP line. These are all bugfixes.

Please add all 3 def to the next release of TC.

[ Specified attachment is not available ]

Part of TC v3.60
« Last Edit: October 19, 2026, 09:27:06 am by flash2b »
They say attention is a shovel. It's time to dig 'em out.
 

Offline HKJTopic starter

  • Super Contributor
  • ***
  • Posts: 4919
  • Country: dk
    • Tests
Re: Program that can log/control many multimeters and other devices.
« Reply #7742 on: October 13, 2026, 01:34:13 pm »
I have updated my BSide I8 def with a nice feature that allows it to shape its output for Brownout and undervoltage lockout, Regulator dropout and Automotive-style dips analysis.

Updated, thanks.

You could already do that in TC, but it was more complex. Any virtual generator can be used to control any setting with a very simple script.

You could also have used to generate the data (They use the PC timer in the background and have no defined starting point):
sineWave(period,amplitude)
squareWave(period,amplitude)
sawWave(period,amplitude)
triangleWave(period,amplitude)
« Last Edit: October 13, 2026, 01:37:55 pm by HKJ »
 

Online flash2b

  • Super Contributor
  • ***
  • Posts: 1030
  • Country: nl
  • Everything I like about myself is better with you.
Re: Program that can log/control many multimeters and other devices.
« Reply #7743 on: October 13, 2026, 01:51:41 pm »
True but for me the advantages are:

No script: Just tick Wave Enable, picks a shape and press Wave On.
Built-in safety: the amplitude limit per target, the park to idle value for Wave Off, and the stop on an output trip are all things a quick script won’t include.
Model awareness: the limits come from the device’s own registers.

And it was fun to write to.... and to see the graphs was also confirmation that it works.

You could also have used to generate the data (They use the PC timer in the background and have no defined starting point):
sineWave(period,amplitude)
squareWave(period,amplitude)
sawWave(period,amplitude)
triangleWave(period,amplitude)

These are time-based, I use index-based
They not define the start
No single-shot ramp is supported, which is what I needed for brownout or UVLO tests.
« Last Edit: October 13, 2026, 01:55:46 pm by flash2b »
They say attention is a shovel. It's time to dig 'em out.
 

Offline HKJTopic starter

  • Super Contributor
  • ***
  • Posts: 4919
  • Country: dk
    • Tests
Re: Program that can log/control many multimeters and other devices.
« Reply #7744 on: October 13, 2026, 02:02:20 pm »
True but for me the advantages are:

No script: Just tick Wave Enable, picks a shape and press Wave On.
Built-in safety: the amplitude limit per target, the park to idle value for Wave Off, and the stop on an output trip are all things a quick script won’t include.
Model awareness: the limits come from the device’s own registers.

And it was fun to write to.... and to see the graphs was also confirmation that it works.

I wonder if I need to look at ways to control a separate thread, this kind of stuff would work much better if it had its own thread.

You can launch a separate thread, but the only way to communicate is with global vars and that is not ideal in a device definition.
 

Online flash2b

  • Super Contributor
  • ***
  • Posts: 1030
  • Country: nl
  • Everything I like about myself is better with you.
Re: Program that can log/control many multimeters and other devices.
« Reply #7745 on: October 13, 2026, 02:10:12 pm »
Well nothing blocked the polling, all is still very quick the way I implemented it. Nothing locked up as well.

On a core i5-4200 with 4Gb windows 10, so I was happy with the performance but yes, a separate thread would be better.
They say attention is a shovel. It's time to dig 'em out.
 

Offline HKJTopic starter

  • Super Contributor
  • ***
  • Posts: 4919
  • Country: dk
    • Tests
Re: Program that can log/control many multimeters and other devices.
« Reply #7746 on: October 13, 2026, 02:40:34 pm »
Well nothing blocked the polling, all is still very quick the way I implemented it. Nothing locked up as well.

On a core i5-4200 with 4Gb windows 10, so I was happy with the performance but yes, a separate thread would be better.

The issues is that it runs in the user interface thread and that can be blocked for short amount of time for many reasons. A separate thread would only block if a command to the device is outstanding.
 

Offline BigBoss

  • Regular Contributor
  • *
  • Posts: 163
  • Country: fr
Re: Program that can log/control many multimeters and other devices.
« Reply #7747 on: October 13, 2026, 02:41:23 pm »
I requested a python script from AI for my Fluke45 and it wrote this and works well.
Code: [Select]
import time
import datetime
import serial
import pandas as pd

# CONFIGURATION
SERIAL_PORT = "COM3"  # À modifier selon votre Gestionnaire de périphériques
OUTPUT_FILE = "mesures_fluke45.xlsx"
INTERVALLE = 1.0

# Dictionnaire des commandes directes natives du Fluke 45
MODES_DISPONIBLES = {
    "1": ("VDC", "Tension Continue (Volt DC)"),
    "2": ("VAC", "Tension Alternative (Volt AC)"),
    "3": ("OHMS", "Résistance (Ohms)"),
    "4": ("FREQ", "Fréquence (Hz)"),
    "5": ("ADC", "Courant Continu (Ampère DC)"),
    "6": ("AAC", "Courant Alternatif (Ampère AC)"),
    "7": ("DIODE", "Test de Diode"),
    "8": ("CONT", "Test de Continuité")
}

print("--- SÉLECTION DU MODE DE MESURE ---")
for touche, (code, description) in MODES_DISPONIBLES.items():
    print(f"[{touche}] {description}")

choix = input("Entrez le numéro du mode choisi : ").strip()

if choix in MODES_DISPONIBLES:
    cmd_mode = MODES_DISPONIBLES[choix][0]
    nom_mode = MODES_DISPONIBLES[choix][1]
else:
    print("Choix invalide. Mode par défaut : Volt DC")
    cmd_mode = "VDC"
    nom_mode = "Tension Continue (Volt DC)"

liste_donnees = []

try:
    # Initialisation avec gestion stricte des flux
    ser = serial.Serial(
        port=SERIAL_PORT,
        baudrate=9600,
        bytesize=serial.EIGHTBITS,
        parity=serial.PARITY_NONE,
        stopbits=serial.STOPBITS_ONE,
        timeout=1,
        xonxoff=True  # Indispensable pour le Fluke 45
    )

    def vider_tampon():
        """Vide les caractères résiduels ou l'écho renvoyé par l'appareil."""
        time.sleep(0.1)
        if ser.in_waiting:
            ser.read(ser.in_waiting)

    def piloter_appareil(commande):
        """Envoie une commande de configuration sans attendre de valeur de mesure."""
        vider_tampon()
        # On teste la commande directe brute (ex: VDC\r\n) qui est la plus fiable
        ser.write(f"{commande}\r\n".encode("ascii"))
        time.sleep(0.5)  # Pause cruciale pour laisser les relais physiques commuter
        vider_tampon()

    def requete_mesure():
        """Demande spécifiquement la valeur sur l'afficheur principal."""
        vider_tampon()
        ser.write(b"VAL1?\r\n")
        time.sleep(0.1)
       
        # Lecture de la réponse de l'appareil
        reponse = ser.readline().decode("ascii").strip()
       
        # Nettoyage si l'appareil est en mode écho ou renvoie les invites =>
        reponse = reponse.replace("=>", "").replace("?>", "").strip()
        return reponse

    print(f"\nConfiguration de l'appareil sur : {nom_mode}...")
    piloter_appareil(cmd_mode)  # Envoi direct de la fonction (ex: "VDC" ou "OHMS")
    piloter_appareil("AUTO")     # Forcer le calibre automatique

    print("\n--- Enregistrement démarré (Appuyez sur Ctrl+C pour arrêter et enregistrer) ---")
   
    while True:
        horodatage = datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")
        lecture = requete_mesure()
       
        # Si la chaîne contient des données valides (exclure les lignes vides)
        if lecture and not lecture.startswith("VAL1"):
            print(f"[{horodatage}] [{cmd_mode}] Valeur : {lecture}")
            liste_donnees.append({
                "Date et Heure": horodatage,
                "Mode": nom_mode,
                "Mesure brute": lecture
            })
           
        time.sleep(INTERVALLE)

except serial.SerialException as e:
    print(f"\nErreur de connexion port série : {e}")
    print("Vérifiez le numéro du port COM dans le Gestionnaire de périphériques.")
except KeyboardInterrupt:
    print("\nMesures interrompues par l'utilisateur.")
finally:
    if liste_donnees:
        print("Génération du fichier Excel...")
        df = pd.DataFrame(liste_donnees)
        df.to_excel(OUTPUT_FILE, index=False)
        print(f"✅ Fichier '{OUTPUT_FILE}' enregistré avec {len(liste_donnees)} lignes.")
    else:
        print("Aucune donnée enregistrée.")
       
    if 'ser' in locals() and ser.is_open:
        ser.close()
        print("Port série fermé.")
 

Offline HKJTopic starter

  • Super Contributor
  • ***
  • Posts: 4919
  • Country: dk
    • Tests
Re: Program that can log/control many multimeters and other devices.
« Reply #7748 on: October 13, 2026, 02:58:50 pm »
I requested a python script from AI for my Fluke45 and it wrote this and works well.

This is not the thread to show your scripts (Except if they are for TestController), AI generated or not.
TestController supports the Fluke45 and provide much more functionality than a simple script can do.
 

Online flash2b

  • Super Contributor
  • ***
  • Posts: 1030
  • Country: nl
  • Everything I like about myself is better with you.
Re: Program that can log/control many multimeters and other devices.
« Reply #7749 on: October 13, 2026, 07:22:15 pm »
I have updated all my Temperature defs with features and bugfixes.

They are within the zip file and are ready for the next release of TC.

[ Attachment Invalid Or Does Not Exist ]

Part of TC v3.60
« Last Edit: October 19, 2026, 09:25:58 am by flash2b »
They say attention is a shovel. It's time to dig 'em out.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf

 

-->