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

KungFuJosh, HKJ, Gertjan and 165 Guests are viewing this topic.

Online HKJTopic starter

  • Super Contributor
  • ***
  • Posts: 4974
  • Country: dk
    • Tests
Re: Program that can log/control many multimeters and other devices.
« Reply #4650 on: September 19, 2025, 06:27:04 pm »
I tried, but anything besides value,0 breaks it.

You might need to specify the delimiter, I do not remember if space is automatic:

getElement(value,1,"[ ]")
 

Online KungFuJosh

  • Super Contributor
  • ***
  • Posts: 8489
  • Country: us
  • TEAS is real.
Re: Program that can log/control many multimeters and other devices.
« Reply #4651 on: September 19, 2025, 06:35:19 pm »
I tried, but anything besides value,0 breaks it.

You might need to specify the delimiter, I do not remember if space is automatic:

getElement(value,1,"[ ]")

Log:
Code: [Select]
;; Magnova: Tx <DynamicM1?>
;; Magnova: Script start
;; Magnova: Tx <:MEAS:VPP:CURR? CHAN1>
;; IP: Tx: <:MEAS:VPP:CURR? CHAN1.> 3A 4D 45 41 53 3A 56 50 50 3A 43 55 52 52 3F 20 43 48 41 4E 31 0A
;; IP: Rx: <0.619175> 30 2E 36 31 39 31 37 35 0A
;; Magnova: Rx <0.619175>
;; Magnova: Script end <0.619175>
;; Magnova: Rx <0.619175>
;; Magnova: Tx <getMeasUnit1?>
;; Magnova: Tx <none?>
;; Magnova: Rx <V>
;; Magnova: Rx as numbers <0.619175>
Thread for Magnova
java.lang.NullPointerException: Cannot invoke "String.equals(Object)" because "this.lastModeAnswer" is null
        at dk.hkj.main.DeviceInterface.getValuesFromDevices(DeviceInterface.java:408)
        at dk.hkj.devices.DeviceSCPI.getValuesFromDevices(DeviceSCPI.java:99)
        at dk.hkj.main.InterfaceThreads$DeviceThread.run(InterfaceThreads.java:1632)

That confuses me, along with the log...

Where are the spaces? Aren't the <> containing the complete answer at each step?
Why does the response include the numbers four times? First command response, then script response, then repeating (echo?) the script response, then again after the unit response Rx as numbers...


Thanks,
Josh
"Experience is something you don't get until just after you need it." - Steven Wright
Best Continuity Tester Ever
Best Continuity Tester Ever...Got Betterer!
 

Online HKJTopic starter

  • Super Contributor
  • ***
  • Posts: 4974
  • Country: dk
    • Tests
Re: Program that can log/control many multimeters and other devices.
« Reply #4652 on: September 19, 2025, 06:46:09 pm »

That confuses me, along with the log...

Where are the spaces? Aren't the <> containing the complete answer at each step?
Why does the response include the numbers four times? First command response, then script response, then repeating (echo?) the script response, then again after the unit response Rx as numbers...

When you put two SCPI commands in #getValues they will be put together with a space between them, i.e. I expect the answer string to look something like: "10.34 V"

One way you can see exactly what you receive is with the displayVar() https://lygte-info.dk/project/TestControllerFunctions%20UK.html#displayVar function. Use it instead of an expression in #askValuesMathFormat or #modeFromValue
if you really want the value pinned out use: displayVar(bytesAsHex(value))
The function will crash the input, but first after showing the value, it is possible to get around that, but it is not necessary here.
 

Online KungFuJosh

  • Super Contributor
  • ***
  • Posts: 8489
  • Country: us
  • TEAS is real.
Re: Program that can log/control many multimeters and other devices.
« Reply #4653 on: September 19, 2025, 07:02:24 pm »
When you put two SCPI commands in #getValues they will be put together with a space between them, i.e. I expect the answer string to look something like: "10.34 V"

One way you can see exactly what you receive is with the displayVar() https://lygte-info.dk/project/TestControllerFunctions%20UK.html#displayVar function. Use it instead of an expression in #askValuesMathFormat or #modeFromValue
if you really want the value pinned out use: displayVar(bytesAsHex(value))
The function will crash the input, but first after showing the value, it is possible to get around that, but it is not necessary here.

If they were being combined by #getValues, wouldn't they look combined already in the log or the Commands window?

Here's the log from that displayVar:
Code: [Select]
;; Magnova: Tx <DynamicM1?>
;; Magnova: Script start
;; Magnova: Tx <:MEAS:VPP:CURR? CHAN1>
;; IP: Tx: <:MEAS:VPP:CURR? CHAN1.> 3A 4D 45 41 53 3A 56 50 50 3A 43 55 52 52 3F 20 43 48 41 4E 31 0A
;; IP: Rx: <0.61955> 30 2E 36 31 39 35 35 0A
;; Magnova: Rx <0.61955>
;; Magnova: Script end <0.61955>
;; Magnova: Rx <0.61955>
;; Magnova: Tx <getMeasUnit1?>
;; Magnova: Tx <none?>
;; Magnova: Rx <V>
;; Magnova: Rx as numbers <0.61955>
Unknown mode: 0x30
Known modes: getMeasUnit1?,
Unknown mode: 0x2E
Known modes: getMeasUnit1?,
Unknown mode: 0x36
Known modes: getMeasUnit1?,
Unknown mode: 0x31
Known modes: getMeasUnit1?,
Unknown mode: 0x39
Known modes: getMeasUnit1?,
Unknown mode: 0x35
Known modes: getMeasUnit1?,
Unknown mode: 0x35
Known modes: getMeasUnit1?,
Unknown mode: 0x20
Known modes: getMeasUnit1?,
Unknown mode: 0x56
Known modes: getMeasUnit1?,
;; Magnova: Tx <getMeasUnit1?>
;; Magnova: Tx <none?>
;; Magnova: Rx <V>
;; Magnova: Rx after :readmath: displayVar(bytesAsHex(value)) <0x56>
Unknown mode: 0x56
Known modes: getMeasUnit1?,

Does #askMode matter for any of this, or is that just for the cmdMode button?

Thanks,
Josh
"Experience is something you don't get until just after you need it." - Steven Wright
Best Continuity Tester Ever
Best Continuity Tester Ever...Got Betterer!
 

Online KungFuJosh

  • Super Contributor
  • ***
  • Posts: 8489
  • Country: us
  • TEAS is real.
Re: Program that can log/control many multimeters and other devices.
« Reply #4654 on: September 19, 2025, 07:47:45 pm »
I added all 5 measurement channels in to see what happens. This looks more interesting, but still doesn't correctly update the Current Values with the mode:
Code: [Select]
;; Magnova: Tx <DynamicM1?>
;; Magnova: Script start
;; Magnova: Tx <:MEAS:HFReq:CURR? CHAN1>
;; IP: Tx: <:MEAS:HFReq:CURR? CHAN1.> 3A 4D 45 41 53 3A 48 46 52 65 71 3A 43 55 52 52 3F 20 43 48 41 4E 31 0A
;; IP: Rx: <1000.18352977075> 31 30 30 30 2E 31 38 33 35 32 39 37 37 30 37 35 0A
;; Magnova: Rx <1000.18352977075>
;; Magnova: Script end <1000.18352977075>
;; Magnova: Rx <1000.18352977075>
;; Magnova: Tx <getMeasUnit1?>
;; Magnova: Tx <none?>
;; Magnova: Rx <Hz>
;; Magnova: Tx <DynamicM2?>
;; Magnova: Script start
;; Magnova: Tx <:MEAS:VRMS:CURR? CHAN1>
;; IP: Tx: <:MEAS:VRMS:CURR? CHAN1.> 3A 4D 45 41 53 3A 56 52 4D 53 3A 43 55 52 52 3F 20 43 48 41 4E 31 0A
;; IP: Rx: <0.216686249275> 30 2E 32 31 36 36 38 36 32 34 39 32 37 35 0A
;; Magnova: Rx <0.216686249275>
;; Magnova: Script end <0.216686249275>
;; Magnova: Rx <0.216686249275>
;; Magnova: Tx <getMeasUnit2?>
;; Magnova: Tx <none?>
;; Magnova: Rx <V>
;; Magnova: Tx <DynamicM3?>
;; Magnova: Script start
;; Magnova: Tx <:MEAS:VMIN:CURR? CHAN1>
;; IP: Tx: <:MEAS:VMIN:CURR? CHAN1.> 3A 4D 45 41 53 3A 56 4D 49 4E 3A 43 55 52 52 3F 20 43 48 41 4E 31 0A
;; IP: Rx: <-0.31> 2D 30 2E 33 31 0A
;; Magnova: Rx <-0.31>
;; Magnova: Script end <-0.31>
;; Magnova: Rx <-0.31>
;; Magnova: Tx <getMeasUnit3?>
;; Magnova: Tx <none?>
;; Magnova: Rx <V>
;; Magnova: Tx <DynamicM4?>
;; Magnova: Script start
;; Magnova: Tx <:MEAS:VAMP:CURR? CHAN1>
;; IP: Tx: <:MEAS:VAMP:CURR? CHAN1.> 3A 4D 45 41 53 3A 56 41 4D 50 3A 43 55 52 52 3F 20 43 48 41 4E 31 0A
;; IP: Rx: <0.6111> 30 2E 36 31 31 31 0A
;; Magnova: Rx <0.6111>
;; Magnova: Script end <0.6111>
;; Magnova: Rx <0.6111>
;; Magnova: Tx <getMeasUnit4?>
;; Magnova: Tx <none?>
;; Magnova: Rx <V>
;; Magnova: Tx <DynamicM5?>
;; Magnova: Script start
;; Magnova: Tx <:MEAS:VMAX:CURR? CHAN1>
;; IP: Tx: <:MEAS:VMAX:CURR? CHAN1.> 3A 4D 45 41 53 3A 56 4D 41 58 3A 43 55 52 52 3F 20 43 48 41 4E 31 0A
;; IP: Rx: <0.3093875> 30 2E 33 30 39 33 38 37 35 0A
;; Magnova: Rx <0.3093875>
;; Magnova: Script end <0.3093875>
;; Magnova: Rx <0.3093875>
;; Magnova: Tx <getMeasUnit5?>
;; Magnova: Tx <none?>
;; Magnova: Rx <V>
;; Magnova: Rx as numbers <1000.18352977075 0.216686249275 -0.31 0.6111 0.3093875>

This was the code during that test:
Code: [Select]
#askMode getMeasUnit1?;getMeasUnit2?;getMeasUnit3?;getMeasUnit4?;getMeasUnit5?
#askValues DynamicM1?;getMeasUnit1?;DynamicM2?;getMeasUnit2?;DynamicM3?;getMeasUnit3?;DynamicM4?;getMeasUnit4?;DynamicM5?;getMeasUnit5?;
#askValuesReadFormat fxfxfxfxfx
#askModeMathFormat getElement(value,1,"[ ]");
#modeFromValue getElement(value,1,"[ ]");

All the values update correctly, but not the units. You can see in the log it combines the values on one line, but ignores the units. I assume that's because of the fxfxfxfxfx?

ETA: To answer my own obvious question, yes. Commenting out the fxfxfxfxfx line shows:
Code: [Select]
;; Magnova: Rx as numbers <0.6195875 NaN 0.611725 NaN 0.3094 NaN -0.31 NaN 0.21675422826 NaN>It seems this should have worked:
Code: [Select]
#askModeMathFormat getElement(value,1,"[ ]");
#modeFromValue getElement(value,1,"[ ]");

It would be a lot easier if there was a #modeFromValue type command to simply select the mode from a variable directly. Hmm, #modeFromVariable sounds good. ;)


Thanks,
Josh
« Last Edit: September 19, 2025, 10:58:07 pm by KungFuJosh »
"Experience is something you don't get until just after you need it." - Steven Wright
Best Continuity Tester Ever
Best Continuity Tester Ever...Got Betterer!
 

Offline flash2b

  • Super Contributor
  • ***
  • Posts: 1054
  • Country: nl
  • Everything I like about myself is better with you.
Re: Program that can log/control many multimeters and other devices.
« Reply #4655 on: September 20, 2025, 07:21:11 am »
Question 1
I have a menu control like this:
Code: [Select]
#cmdSetup text Constant_KA
:read: ka?
:write: ka

ka? set the content to "+1.00000E+0"

To set the value in the meter, I need to sent base and the exponent separately. So the content of ka needs to be split in two values, before it can be sent to the meter.

The command to send is: KA<base> <exponent>

I tried this:
Code: [Select]
#scpiCmd ka
replace(value,"E"," ")
tx KA(value)
:setvar: kaVal = inputValue

But then I remembered what HKJ said, that value that is send to ka, is not available inside the scpiCmd.

The log shows:
Code: [Select]
;; YOKO7552: Tx <ka +0.00000E+0>
;; YOKO7552: Tx <replace(value,"E"," ")
tx KA(value)
:setvar: kaVal = inputValue>
;; COM50: Tx: <KA+0.00000E+0.> 4B 41 2B 30 2E 30 30 30 30 30 45 2B 30 0A
;; YOKO7552: Tx <ka?>
;; YOKO7552: Tx <none?
:readmath: kaVal>
;; YOKO7552: Rx <+0.00000E+0>

Clearly the E is not changed to a <space>.

Summarizing
value = "+1.00000E+0" but I need to send KA+1.00000 +0 (without the E). Please note that the E is not on a fixed position.

How to I modify the content of value, for scpiCmd ka before I sent it to the meter ?

Or.. can I get rid of the E in the :write: command of the menu control ?



Question 2
How can I do this in TestController ?

Code: [Select]
if (compVal == 1 && modeVal == 2)
:setvar: modeVal=9
endif

I added the above to my definition, but the if and endif are ignored and modeVal always is set to 9.
« Last Edit: September 20, 2025, 12:03:24 pm by flash2b »
They say attention is a shovel. It's time to dig 'em out.
 

Online HKJTopic starter

  • Super Contributor
  • ***
  • Posts: 4974
  • Country: dk
    • Tests
Re: Program that can log/control many multimeters and other devices.
« Reply #4656 on: September 20, 2025, 01:13:58 pm »
All the values update correctly, but not the units. You can see in the log it combines the values on one line, but ignores the units. I assume that's because of the fxfxfxfxfx?

ETA: To answer my own obvious question, yes. Commenting out the fxfxfxfxfx line shows:
Code: [Select]
;; Magnova: Rx as numbers <0.6195875 NaN 0.611725 NaN 0.3094 NaN -0.31 NaN 0.21675422826 NaN>It seems this should have worked:
Code: [Select]
#askModeMathFormat getElement(value,1,"[ ]");
#modeFromValue getElement(value,1,"[ ]");

You are confusing things.
#askMode uses #askModeMathFormat
#getValues uses #modeFromValue

The result from #modeFromValue must match the output from #askMode or #askModeMathFormat if it is used.

It would be a lot easier if there was a #modeFromValue type command to simply select the mode from a variable directly. Hmm, #modeFromVariable sounds good. ;)

You are the first that has needed it.
 

Online HKJTopic starter

  • Super Contributor
  • ***
  • Posts: 4974
  • Country: dk
    • Tests
Re: Program that can log/control many multimeters and other devices.
« Reply #4657 on: September 20, 2025, 01:21:07 pm »
Question 1
I have a menu control like this:
Code: [Select]
#cmdSetup text Constant_KA
:read: ka?
:write: ka

ka? set the content to "+1.00000E+0"

To set the value in the meter, I need to sent base and the exponent separately. So the content of ka needs to be split in two values, before it can be sent to the meter.

The command to send is: KA<base> <exponent>

I tried this:
Code: [Select]
#scpiCmd ka
replace(value,"E"," ")
tx KA(value)
:setvar: kaVal = inputValue

But then I remembered what HKJ said, that value that is send to ka, is not available inside the scpiCmd.

The log shows:
Code: [Select]
;; YOKO7552: Tx <ka +0.00000E+0>
;; YOKO7552: Tx <replace(value,"E"," ")
tx KA(value)
:setvar: kaVal = inputValue>
;; COM50: Tx: <KA+0.00000E+0.> 4B 41 2B 30 2E 30 30 30 30 30 45 2B 30 0A
;; YOKO7552: Tx <ka?>
;; YOKO7552: Tx <none?
:readmath: kaVal>
;; YOKO7552: Rx <+0.00000E+0>

Clearly the E is not changed to a <space>.

Summarizing
value = "+1.00000E+0" but I need to send KA+1.00000 +0 (without the E). Please note that the E is not on a fixed position.

How to I modify the content of value, for scpiCmd ka before I sent it to the meter ?

Or.. can I get rid of the E in the :write: command of the menu control ?


You can use expression in :write:, just put () around them.
You might want to check the formatDouble function: https://lygte-info.dk/project/TestControllerFunctions%20UK.html#formatDouble or maybe the formatSI

Question 2
How can I do this in TestController ?

Code: [Select]
if (compVal == 1 && modeVal == 2)
:setvar: modeVal=9
endif

I added the above to my definition, but the if and endif are ignored and modeVal always is set to 9.

Depends on context, one way is
Code: [Select]
if (compVal == 1 && modeVal == 2)
modeVal=9
endif

Another is
Code: [Select]
:setvar: modeVal=(compVal == 1 && modeVal == 2)?9:modeVal;
endif
 
The following users thanked this post: flash2b

Online KungFuJosh

  • Super Contributor
  • ***
  • Posts: 8489
  • Country: us
  • TEAS is real.
Re: Program that can log/control many multimeters and other devices.
« Reply #4658 on: September 20, 2025, 02:31:15 pm »
All the values update correctly, but not the units. You can see in the log it combines the values on one line, but ignores the units. I assume that's because of the fxfxfxfxfx?

ETA: To answer my own obvious question, yes. Commenting out the fxfxfxfxfx line shows:
Code: [Select]
;; Magnova: Rx as numbers <0.6195875 NaN 0.611725 NaN 0.3094 NaN -0.31 NaN 0.21675422826 NaN>It seems this should have worked:
Code: [Select]
#askModeMathFormat getElement(value,1,"[ ]");
#modeFromValue getElement(value,1,"[ ]");

You are confusing things.
#askMode uses #askModeMathFormat
#getValues uses #modeFromValue

The result from #modeFromValue must match the output from #askMode or #askModeMathFormat if it is used.
Maybe I am, but if so, please show me the correct way. I've tried it a lot of different ways, and nothing works. The best I could get it to do was to switch to Hz (inconsistently), but then it couldn't switch back to V. The variables are always set correctly, but TC doesn't respond as expected.


Quote
It would be a lot easier if there was a #modeFromValue type command to simply select the mode from a variable directly. Hmm, #modeFromVariable sounds good. ;)

You are the first that has needed it.
What difference does that make? This appears to be a new situation. I've looked at every single definition that uses these options. All of them require more effort to get the basic info separated from the device response.

The way it works currently requires me to make a convoluted scheme- increasing processing and resources to force values to be together that have no need to be together, and then force them apart to separate them again to make them useful. Where is the logic or efficiency in that?

My suggestion would be this:
Code: [Select]
#askMode getMeasUnit1?;getMeasUnit2?;getMeasUnit3?;getMeasUnit4?;getMeasUnit5?
#askValues DynamicM1?;DynamicM2?;DynamicM3?;DynamicM4?;DynamicM5?
#modeFromVariable meas1Unit;meas2Unit;meas3Unit;meas4Unit;meas5Unit

#modeFromVariable directly reads the variable, rather than needing to call other commands in series to read them. Simple! This way, there's no need to make a device pretend to behave a way that it doesn't.

So far, I've tried 100 variations of this:
Code: [Select]
#askMode getMeasUnit1?;getMeasUnit2?;getMeasUnit3?;getMeasUnit4?;getMeasUnit5?
#askValues DynamicM1?;getMeasUnit1?;DynamicM2?;getMeasUnit2?;DynamicM3?;getMeasUnit3?;DynamicM4?;getMeasUnit4?;DynamicM5?;getMeasUnit5?;
#askValuesReadFormat fxfxfxfxfx
#askModeMathFormat getElement(value,1,"[ ]");
#modeFromValue getElement(value,1,"[ ]");

I also tried this since you said the responses need to match:

Code: [Select]
#askMode DynamicM1?;getMeasUnit1?;DynamicM2?;getMeasUnit2?;DynamicM3?;getMeasUnit3?;DynamicM4?;getMeasUnit4?;DynamicM5?;getMeasUnit5?;
#askValues DynamicM1?;getMeasUnit1?;DynamicM2?;getMeasUnit2?;DynamicM3?;getMeasUnit3?;DynamicM4?;getMeasUnit4?;DynamicM5?;getMeasUnit5?;
#askValuesReadFormat fxfxfxfxfx
#askModeMathFormat getElement(value,1,"[ ]");
#modeFromValue getElement(value,1,"[ ]");

I've also tried changing DynamicM#? to include the Unit variable, but the results are identical, as I suppose you would expect.

I expect #askValuesReadFormat fxfxfxfxfx to skip the units, and it does. I also expect #modeFromValue getElement(value,1,"[ ]"); to skip the value and catch the unit, which it should, but does not.

Every single variable and device control function works as expected. However, I simply can't figure out what's wrong here. If you see it, please show me.

Personally, I think #modeFromVariable would be a great and efficient addition to TC, and I'm sure this won't be the only device to benefit from it.

Thanks,
Josh
"Experience is something you don't get until just after you need it." - Steven Wright
Best Continuity Tester Ever
Best Continuity Tester Ever...Got Betterer!
 

Online HKJTopic starter

  • Super Contributor
  • ***
  • Posts: 4974
  • Country: dk
    • Tests
Re: Program that can log/control many multimeters and other devices.
« Reply #4659 on: September 20, 2025, 03:25:16 pm »
Personally, I think #modeFromVariable would be a great and efficient addition to TC, and I'm sure this won't be the only device to benefit from it.

I may add it, but I do not have tine the next few days,

You have not showed anything where you use  displayVar()
You out it in #modeFromValue
 
The following users thanked this post: KungFuJosh

Online KungFuJosh

  • Super Contributor
  • ***
  • Posts: 8489
  • Country: us
  • TEAS is real.
Re: Program that can log/control many multimeters and other devices.
« Reply #4660 on: September 20, 2025, 03:49:53 pm »
Personally, I think #modeFromVariable would be a great and efficient addition to TC, and I'm sure this won't be the only device to benefit from it.

I may add it, but I do not have tine the next few days
Thank you! I'll patiently look forward to this new feature. ;)


Quote
You have not showed anything where you use  displayVar()
You out it in #modeFromValue

I did:
Here's the log from that displayVar:
Code: [Select]
;; Magnova: Tx <DynamicM1?>
;; Magnova: Script start
;; Magnova: Tx <:MEAS:VPP:CURR? CHAN1>
;; IP: Tx: <:MEAS:VPP:CURR? CHAN1.> 3A 4D 45 41 53 3A 56 50 50 3A 43 55 52 52 3F 20 43 48 41 4E 31 0A
;; IP: Rx: <0.61955> 30 2E 36 31 39 35 35 0A
;; Magnova: Rx <0.61955>
;; Magnova: Script end <0.61955>
;; Magnova: Rx <0.61955>
;; Magnova: Tx <getMeasUnit1?>
;; Magnova: Tx <none?>
;; Magnova: Rx <V>
;; Magnova: Rx as numbers <0.61955>
Unknown mode: 0x30
Known modes: getMeasUnit1?,
Unknown mode: 0x2E
Known modes: getMeasUnit1?,
Unknown mode: 0x36
Known modes: getMeasUnit1?,
Unknown mode: 0x31
Known modes: getMeasUnit1?,
Unknown mode: 0x39
Known modes: getMeasUnit1?,
Unknown mode: 0x35
Known modes: getMeasUnit1?,
Unknown mode: 0x35
Known modes: getMeasUnit1?,
Unknown mode: 0x20
Known modes: getMeasUnit1?,
Unknown mode: 0x56
Known modes: getMeasUnit1?,
;; Magnova: Tx <getMeasUnit1?>
;; Magnova: Tx <none?>
;; Magnova: Rx <V>
;; Magnova: Rx after :readmath: displayVar(bytesAsHex(value)) <0x56>
Unknown mode: 0x56
Known modes: getMeasUnit1?,



Thanks,
Josh
"Experience is something you don't get until just after you need it." - Steven Wright
Best Continuity Tester Ever
Best Continuity Tester Ever...Got Betterer!
 

Online HKJTopic starter

  • Super Contributor
  • ***
  • Posts: 4974
  • Country: dk
    • Tests
Re: Program that can log/control many multimeters and other devices.
« Reply #4661 on: September 20, 2025, 04:08:02 pm »
I did:

Here's the log from that displayVar:
Code: [Select]
;; Magnova: Tx <DynamicM1?>
;; Magnova: Script start
;; Magnova: Tx <:MEAS:VPP:CURR? CHAN1>

displayVar() opens a window with the data, to put it in the log you use printLog()
 

Online KungFuJosh

  • Super Contributor
  • ***
  • Posts: 8489
  • Country: us
  • TEAS is real.
Re: Program that can log/control many multimeters and other devices.
« Reply #4662 on: September 20, 2025, 04:14:25 pm »
I did:

Here's the log from that displayVar:
Code: [Select]
;; Magnova: Tx <DynamicM1?>
;; Magnova: Script start
;; Magnova: Tx <:MEAS:VPP:CURR? CHAN1>

displayVar() opens a window with the data, to put it in the log you use printLog()

Could you please edit this with exactly what you'd like it to do?

Code: [Select]
#askMode getMeasUnit1?;getMeasUnit2?;getMeasUnit3?;getMeasUnit4?;getMeasUnit5?
#askValues DynamicM1?;getMeasUnit1?;DynamicM2?;getMeasUnit2?;DynamicM3?;getMeasUnit3?;DynamicM4?;getMeasUnit4?;DynamicM5?;getMeasUnit5?;
#askValuesReadFormat fxfxfxfxfx
#askModeMathFormat getElement(value,1,"[ ]");
#modeFromValue getElement(value,1,"[ ]");

Thanks,
Josh
"Experience is something you don't get until just after you need it." - Steven Wright
Best Continuity Tester Ever
Best Continuity Tester Ever...Got Betterer!
 

Online HKJTopic starter

  • Super Contributor
  • ***
  • Posts: 4974
  • Country: dk
    • Tests
Re: Program that can log/control many multimeters and other devices.
« Reply #4663 on: September 20, 2025, 04:50:05 pm »
I did:

Here's the log from that displayVar:
Code: [Select]
;; Magnova: Tx <DynamicM1?>
;; Magnova: Script start
;; Magnova: Tx <:MEAS:VPP:CURR? CHAN1>

displayVar() opens a window with the data, to put it in the log you use printLog()

Could you please edit this with exactly what you'd like it to do?

Code: [Select]
#askMode getMeasUnit1?;getMeasUnit2?;getMeasUnit3?;getMeasUnit4?;getMeasUnit5?
#askValues DynamicM1?;getMeasUnit1?;DynamicM2?;getMeasUnit2?;DynamicM3?;getMeasUnit3?;DynamicM4?;getMeasUnit4?;DynamicM5?;getMeasUnit5?;
#askValuesReadFormat fxfxfxfxfx
#askModeMathFormat getElement(value,1,"[ ]");
#modeFromValue getElement(value,1,"[ ]");


Use either printLog() or displayVar with the bytesAsHex(value) as argument, you could also use bytesAsHex(value)+" "+value as argument, that would include a ascii string with the values.

i.e.
#modeFromValue printLog(bytesAsHex(value)+" "+value)
or
#modeFromValue displayVarbytesAsHex(value)+" "+value)
 

Online KungFuJosh

  • Super Contributor
  • ***
  • Posts: 8489
  • Country: us
  • TEAS is real.
Re: Program that can log/control many multimeters and other devices.
« Reply #4664 on: September 20, 2025, 05:11:56 pm »
Use either printLog() or displayVar with the bytesAsHex(value) as argument, you could also use bytesAsHex(value)+" "+value as argument, that would include a ascii string with the values.

i.e.
#modeFromValue printLog(bytesAsHex(value)+" "+value)
or
#modeFromValue displayVarbytesAsHex(value)+" "+value)

#modeFromValue printLog(bytesAsHex(value)+" "+value):
Code: [Select]
;; Magnova: Tx <DynamicM1?>
;; Magnova: Script start
;; Magnova: Tx <:MEAS:VPP:CURR? CHAN1>
;; IP: Tx: <:MEAS:VPP:CURR? CHAN1.> 3A 4D 45 41 53 3A 56 50 50 3A 43 55 52 52 3F 20 43 48 41 4E 31 0A
;; IP: Rx: <0.5005> 30 2E 35 30 30 35 0A
;; Magnova: Rx <0.5005>
;; Magnova: Script end <0.5005>
;; Magnova: Rx <0.5005>
;; Magnova: Tx <getMeasUnit1?>
;; Magnova: Tx <none?>
;; Magnova: Rx <V>
;; Magnova: Tx <DynamicM2?>
;; Magnova: Script start
;; Magnova: Tx <:MEAS:VAMP:CURR? CHAN1>
;; IP: Tx: <:MEAS:VAMP:CURR? CHAN1.> 3A 4D 45 41 53 3A 56 41 4D 50 3A 43 55 52 52 3F 20 43 48 41 4E 31 0A
;; IP: Rx: <0.499625> 30 2E 34 39 39 36 32 35 0A
;; Magnova: Rx <0.499625>
;; Magnova: Script end <0.499625>
;; Magnova: Rx <0.499625>
;; Magnova: Tx <getMeasUnit2?>
;; Magnova: Tx <none?>
;; Magnova: Rx <V>
;; Magnova: Tx <DynamicM3?>
;; Magnova: Script start
;; Magnova: Tx <:MEAS:VMAX:CURR? CHAN1>
;; IP: Tx: <:MEAS:VMAX:CURR? CHAN1.> 3A 4D 45 41 53 3A 56 4D 41 58 3A 43 55 52 52 3F 20 43 48 41 4E 31 0A
;; IP: Rx: <0.2480375> 30 2E 32 34 38 30 33 37 35 0A
;; Magnova: Rx <0.2480375>
;; Magnova: Script end <0.2480375>
;; Magnova: Rx <0.2480375>
;; Magnova: Tx <getMeasUnit3?>
;; Magnova: Tx <none?>
;; Magnova: Rx <V>
;; Magnova: Tx <DynamicM4?>
;; Magnova: Script start
;; Magnova: Tx <:MEAS:VMIN:CURR? CHAN1>
;; IP: Tx: <:MEAS:VMIN:CURR? CHAN1.> 3A 4D 45 41 53 3A 56 4D 49 4E 3A 43 55 52 52 3F 20 43 48 41 4E 31 0A
;; IP: Rx: <-0.252675> 2D 30 2E 32 35 32 36 37 35 0A
;; Magnova: Rx <-0.252675>
;; Magnova: Script end <-0.252675>
;; Magnova: Rx <-0.252675>
;; Magnova: Tx <getMeasUnit4?>
;; Magnova: Tx <none?>
;; Magnova: Rx <V>
;; Magnova: Tx <DynamicM5?>
;; Magnova: Script start
;; Magnova: Tx <:MEAS:VRMS:CURR? CHAN1>
;; IP: Tx: <:MEAS:VRMS:CURR? CHAN1.> 3A 4D 45 41 53 3A 56 52 4D 53 3A 43 55 52 52 3F 20 43 48 41 4E 31 0A
;; IP: Rx: <0.173419929741> 30 2E 31 37 33 34 31 39 39 32 39 37 34 31 0A
;; Magnova: Rx <0.173419929741>
;; Magnova: Script end <0.173419929741>
;; Magnova: Rx <0.173419929741>
;; Magnova: Tx <getMeasUnit5?>
;; Magnova: Tx <none?>
;; Magnova: Rx <V>
;; Magnova: Rx as numbers <0.5005 0.499625 0.2480375 -0.252675 0.173419929741>
;; 0x30 0x2E 0x35 0x30 0x30 0x35 0x20 0x56 0x20 0x30 0x2E 0x34 0x39 0x39 0x36 0x32 0x35 0x20 0x56 0x20 0x30 0x2E 0x32 0x34 0x38 0x30 0x33 0x37 0x35 0x20 0x56 0x20 0x2D 0x30 0x2E 0x32 0x35 0x32 0x36 0x37 0x35 0x20 0x56 0x20 0x30 0x2E 0x31 0x37 0x33 0x34 0x31 0x39 0x39 0x32 0x39 0x37 0x34 0x31 0x20 0x56 0.5005 V 0.499625 V 0.2480375 V -0.252675 V 0.173419929741 V
Thread for Magnova
java.lang.NullPointerException: Cannot invoke "dk.hkj.vars.Var.asString()" because the return value of "dk.hkj.script.Script.expression(String)" is null
        at dk.hkj.main.DeviceInterface.getValuesFromDevices(DeviceInterface.java:407)
        at dk.hkj.devices.DeviceSCPI.getValuesFromDevices(DeviceSCPI.java:99)
        at dk.hkj.main.InterfaceThreads$DeviceThread.run(InterfaceThreads.java:1632)

Thanks,
Josh
"Experience is something you don't get until just after you need it." - Steven Wright
Best Continuity Tester Ever
Best Continuity Tester Ever...Got Betterer!
 

Online HKJTopic starter

  • Super Contributor
  • ***
  • Posts: 4974
  • Country: dk
    • Tests
Re: Program that can log/control many multimeters and other devices.
« Reply #4665 on: September 20, 2025, 05:49:35 pm »
;; 0x30 0x2E 0x35 0x30 0x30 0x35 0x20 0x56 0x20 0x30 0x2E 0x34 0x39 0x39 0x36 0x32 0x35 0x20 0x56 0x20 0x30 0x2E 0x32 0x34 0x38 0x30 0x33 0x37 0x35 0x20 0x56 0x20 0x2D 0x30 0x2E 0x32 0x35 0x32 0x36 0x37 0x35 0x20 0x56 0x20 0x30 0x2E 0x31 0x37 0x33 0x34 0x31 0x39 0x39 0x32 0x39 0x37 0x34 0x31 0x20 0x56 0.5005 V 0.499625 V 0.2480375 V -0.252675 V 0.173419929741 V

That looks exactly correct, you get the units by:

getElement(value,1)+" "+getElement(value,3)+" "+getElement(value,5)+" "+getElement(value,7)+" "+getElement(value,9)

You can try putting the above in a printLog()
i.e.
printLog(getElement(value,1)+" "+getElement(value,3)+" "+getElement(value,5)+" "+getElement(value,7)+" "+getElement(value,9))

Without the printLog() it will just request 5 modes all called V, that do not really work for selecting from 5 different group of columns, you have to use modes like: V1, V2, V3 for that.
 

Online KungFuJosh

  • Super Contributor
  • ***
  • Posts: 8489
  • Country: us
  • TEAS is real.
Re: Program that can log/control many multimeters and other devices.
« Reply #4666 on: September 20, 2025, 06:36:09 pm »
This is frustrating. It gave me "known mode" errors with the #askMode not matching, so I changed it to:
Code: [Select]
#askMode DynamicM1?;getMeasUnit1?;DynamicM2?;getMeasUnit2?;DynamicM3?;getMeasUnit3?;DynamicM4?;getMeasUnit4?;DynamicM5?;getMeasUnit5?;
#askValues DynamicM1?;getMeasUnit1?;DynamicM2?;getMeasUnit2?;DynamicM3?;getMeasUnit3?;DynamicM4?;getMeasUnit4?;DynamicM5?;getMeasUnit5?;
#askValuesReadFormat fxfxfxfxfx
#askModeMathFormat getElement(value,1)+" "+getElement(value,3)+" "+getElement(value,5)+" "+getElement(value,7)+" "+getElement(value,9)
#modeFromValue getElement(value,1)+" "+getElement(value,3)+" "+getElement(value,5)+" "+getElement(value,7)+" "+getElement(value,9)



Here's the log from that:
Code: [Select]
;; Magnova: Tx <MeasType1 HFReq>
;; Magnova: Script start
;; Magnova: Tx <CHAN1:UNIT?>
;; IP: Tx: <CHAN1:UNIT?.> 43 48 41 4E 31 3A 55 4E 49 54 3F 0A
;; IP: Rx: <V> 56 0A
;; Magnova: Rx <V>
;; Magnova: Script end <>
;; Magnova: Tx <getMeasType1?>
;; Magnova: Tx <none?>
;; Magnova: Rx <HFReq>
;; Magnova: Tx <MeasType2 VRMS>
;; Magnova: Script start
;; Magnova: Tx <CHAN1:UNIT?>
;; IP: Tx: <CHAN1:UNIT?.> 43 48 41 4E 31 3A 55 4E 49 54 3F 0A
;; IP: Rx: <V> 56 0A
;; Magnova: Rx <V>
;; Magnova: Script end <>
;; Magnova: Tx <getMeasType2?>
;; Magnova: Tx <none?>
;; Magnova: Rx <VRMS>
;; Magnova: Tx <MeasType3 VNAArea>
;; Magnova: Script start
;; Magnova: Tx <CHAN1:UNIT?>
;; IP: Tx: <CHAN1:UNIT?.> 43 48 41 4E 31 3A 55 4E 49 54 3F 0A
;; IP: Rx: <V> 56 0A
;; Magnova: Rx <V>
;; Magnova: Script end <>
;; Magnova: Tx <getMeasType3?>
;; Magnova: Tx <none?>
;; Magnova: Rx <VNAArea>
;; Magnova: Tx <MeasType4 HRTime>
;; Magnova: Script start
;; Magnova: Tx <CHAN1:UNIT?>
;; IP: Tx: <CHAN1:UNIT?.> 43 48 41 4E 31 3A 55 4E 49 54 3F 0A
;; IP: Rx: <V> 56 0A
;; Magnova: Rx <V>
;; Magnova: Script end <>
;; Magnova: Tx <getMeasType4?>
;; Magnova: Tx <none?>
;; Magnova: Rx <HRTime>
;; Magnova: Tx <MeasType5 RECount>
;; Magnova: Script start
;; Magnova: Tx <CHAN1:UNIT?>
;; IP: Tx: <CHAN1:UNIT?.> 43 48 41 4E 31 3A 55 4E 49 54 3F 0A
;; IP: Rx: <V> 56 0A
;; Magnova: Rx <V>
;; Magnova: Script end <>
;; Magnova: Tx <getMeasType5?>
;; Magnova: Tx <none?>
;; Magnova: Rx <RECount>
;; Magnova: Tx <DynamicM1?>
;; Magnova: Script start
;; Magnova: Tx <:MEAS:HFReq:CURR? CHAN1>
;; IP: Tx: <:MEAS:HFReq:CURR? CHAN1.> 3A 4D 45 41 53 3A 48 46 52 65 71 3A 43 55 52 52 3F 20 43 48 41 4E 31 0A
Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException: Cannot read field "modes" because "this.form" is null
        at dk.hkj.devices.SetupFormats.syncModeChange(SetupFormats.java:428)
        at dk.hkj.main.PopupSetupSelection.syncModeChange(PopupSetupSelection.java:189)
        at dk.hkj.main.DeviceInterface$4.run(DeviceInterface.java:487)
        at java.desktop/java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:318)
        at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:773)
        at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:720)
        at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:714)
        at java.base/java.security.AccessController.doPrivileged(AccessController.java:400)
        at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:87)
        at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:742)
        at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203)
        at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124)
        at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113)
        at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109)
        at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
        at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:90)
;; IP: Rx: <1000000> 31 30 30 30 30 30 30 0A
;; Magnova: Rx <1000000>
;; Magnova: Script end <1000000>
;; Magnova: Rx <1000000>
;; Magnova: Tx <getMeasUnit1?>
;; Magnova: Tx <none?>
;; Magnova: Rx <Hz>
;; Magnova: Tx <DynamicM2?>
;; Magnova: Script start
;; Magnova: Tx <:MEAS:VRMS:CURR? CHAN1>
;; IP: Tx: <:MEAS:VRMS:CURR? CHAN1.> 3A 4D 45 41 53 3A 56 52 4D 53 3A 43 55 52 52 3F 20 43 48 41 4E 31 0A
;; IP: Rx: <0.173437909909> 30 2E 31 37 33 34 33 37 39 30 39 39 30 39 0A
;; Magnova: Rx <0.173437909909>
;; Magnova: Script end <0.173437909909>
;; Magnova: Rx <0.173437909909>
;; Magnova: Tx <getMeasUnit2?>
;; Magnova: Tx <none?>
;; Magnova: Rx <V>
;; Magnova: Tx <DynamicM3?>
;; Magnova: Script start
;; Magnova: Tx <:MEAS:VNAArea:CURR? CHAN1>
;; IP: Tx: <:MEAS:VNAArea:CURR? CHAN1.> 3A 4D 45 41 53 3A 56 4E 41 41 72 65 61 3A 43 55 52 52 3F 20 43 48 41 4E 31 0A
;; IP: Rx: <-5.515E-09> 2D 35 2E 35 31 35 45 2D 30 39 0A
;; Magnova: Rx <-5.515E-09>
;; Magnova: Script end <-5.515E-09>
;; Magnova: Rx <-5.515E-09>
;; Magnova: Tx <getMeasUnit3?>
;; Magnova: Tx <none?>
;; Magnova: Rx <Vs>
;; Magnova: Tx <DynamicM4?>
;; Magnova: Script start
;; Magnova: Tx <:MEAS:HRTime:CURR? CHAN1>
;; IP: Tx: <:MEAS:HRTime:CURR? CHAN1.> 3A 4D 45 41 53 3A 48 52 54 69 6D 65 3A 43 55 52 52 3F 20 43 48 41 4E 31 0A
;; IP: Rx: <2.94707E-07> 32 2E 39 34 37 30 37 45 2D 30 37 0A
;; Magnova: Rx <2.94707E-07>
;; Magnova: Script end <2.94707E-07>
;; Magnova: Rx <2.94707E-07>
;; Magnova: Tx <getMeasUnit4?>
;; Magnova: Tx <none?>
;; Magnova: Rx <s>
;; Magnova: Tx <DynamicM5?>
;; Magnova: Script start
;; Magnova: Tx <:MEAS:RECount:CURR? CHAN1>
;; IP: Tx: <:MEAS:RECount:CURR? CHAN1.> 3A 4D 45 41 53 3A 52 45 43 6F 75 6E 74 3A 43 55 52 52 3F 20 43 48 41 4E 31 0A
;; IP: Rx: <3> 33 0A
;; Magnova: Rx <3>
;; Magnova: Script end <3>
;; Magnova: Rx <3>
;; Magnova: Tx <getMeasUnit5?>
;; Magnova: Tx <none?>
;; Magnova: Rx Timeout
;; Magnova: Rx as numbers <1000000.0 0.173437909909 -5.515E-9 2.94707E-7 3.0>
;; Magnova: Tx <DynamicM1?>
;; Magnova: Script start
;; Magnova: Tx <:MEAS:HFReq:CURR? CHAN1>
;; IP: Tx: <:MEAS:HFReq:CURR? CHAN1.> 3A 4D 45 41 53 3A 48 46 52 65 71 3A 43 55 52 52 3F 20 43 48 41 4E 31 0A
;; IP: Rx: <999960.939025819> 39 39 39 39 36 30 2E 39 33 39 30 32 35 38 31 39 0A
;; Magnova: Rx <999960.939025819>
;; Magnova: Script end <999960.939025819>
;; Magnova: Rx <999960.939025819>
;; Magnova: Tx <getMeasUnit1?>
;; Magnova: Tx <none?>
;; Magnova: Rx <Hz>
;; Magnova: Tx <DynamicM2?>
;; Magnova: Script start
;; Magnova: Tx <:MEAS:VRMS:CURR? CHAN1>
;; IP: Tx: <:MEAS:VRMS:CURR? CHAN1.> 3A 4D 45 41 53 3A 56 52 4D 53 3A 43 55 52 52 3F 20 43 48 41 4E 31 0A
;; IP: Rx: <0.173458530257> 30 2E 31 37 33 34 35 38 35 33 30 32 35 37 0A
;; Magnova: Rx <0.173458530257>
;; Magnova: Script end <0.173458530257>
;; Magnova: Rx <0.173458530257>
;; Magnova: Tx <getMeasUnit2?>
;; Magnova: Tx <none?>
;; Magnova: Rx <V>
;; Magnova: Tx <DynamicM3?>
;; Magnova: Script start
;; Magnova: Tx <:MEAS:VNAArea:CURR? CHAN1>
;; IP: Tx: <:MEAS:VNAArea:CURR? CHAN1.> 3A 4D 45 41 53 3A 56 4E 41 41 72 65 61 3A 43 55 52 52 3F 20 43 48 41 4E 31 0A
;; IP: Rx: <-5.527E-09> 2D 35 2E 35 32 37 45 2D 30 39 0A
;; Magnova: Rx <-5.527E-09>
;; Magnova: Script end <-5.527E-09>
;; Magnova: Rx <-5.527E-09>
;; Magnova: Tx <getMeasUnit3?>
;; Magnova: Tx <none?>
;; Magnova: Rx <Vs>
;; Magnova: Tx <DynamicM4?>
;; Magnova: Script start
;; Magnova: Tx <:MEAS:HRTime:CURR? CHAN1>
;; IP: Tx: <:MEAS:HRTime:CURR? CHAN1.> 3A 4D 45 41 53 3A 48 52 54 69 6D 65 3A 43 55 52 52 3F 20 43 48 41 4E 31 0A
;; IP: Rx: <2.94277E-07> 32 2E 39 34 32 37 37 45 2D 30 37 0A
;; Magnova: Rx <2.94277E-07>
;; Magnova: Script end <2.94277E-07>
;; Magnova: Rx <2.94277E-07>
;; Magnova: Tx <getMeasUnit4?>
;; Magnova: Tx <none?>
;; Magnova: Rx <s>
;; Magnova: Tx <DynamicM5?>
;; Magnova: Script start
;; Magnova: Tx <:MEAS:RECount:CURR? CHAN1>
;; IP: Tx: <:MEAS:RECount:CURR? CHAN1.> 3A 4D 45 41 53 3A 52 45 43 6F 75 6E 74 3A 43 55 52 52 3F 20 43 48 41 4E 31 0A
;; IP: Rx: <3> 33 0A
;; Magnova: Rx <3>
;; Magnova: Script end <3>
;; Magnova: Rx <3>
;; Magnova: Tx <getMeasUnit5?>
;; Magnova: Tx <none?>
;; Magnova: Rx Timeout
;; Magnova: Rx as numbers <999960.939025819 0.173458530257 -5.527E-9 2.94277E-7 3.0>
Exception in thread "AWT-EventQueue-0" ;; Magnova: Tx <DynamicM1?>
java.lang.NullPointerException: Cannot read field "modes" because "this.form" is null
        at dk.hkj.devices.SetupFormats.syncModeChange(SetupFormats.java:428)
        at dk.hkj.main.PopupSetupSelection.syncModeChange(PopupSetupSelection.java:189)
        at dk.hkj.main.DeviceInterface.initColumns(DeviceInterface.java:481)
        at dk.hkj.devices.DeviceSCPI.initColumns(DeviceSCPI.java:125)
        at dk.hkj.main.DeviceInterface$2.actionPerformed(DeviceInterface.java:444)
        at java.desktop/javax.swing.Timer.fireActionPerformed(Timer.java:311)
        at java.desktop/javax.swing.Timer$DoPostEvent.run(Timer.java:243)
        at java.desktop/java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:318)
        at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:773)
        at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:720)
        at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:714)
        at java.base/java.security.AccessController.doPrivileged(AccessController.java:400)
        at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:87)
        at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:742)
        at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203)
        at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124)
        at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113)
        at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109)
        at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
        at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:90)
Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException: Cannot read field "modes" because "this.form" is null
        at dk.hkj.devices.SetupFormats.syncModeChange(SetupFormats.java:428)
        at dk.hkj.main.PopupSetupSelection.syncModeChange(PopupSetupSelection.java:189)
        at dk.hkj.main.DeviceInterface$4.run(DeviceInterface.java:487)
        at java.desktop/java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:318)
        at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:773)
        at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:720)
        at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:714)
        at java.base/java.security.AccessController.doPrivileged(AccessController.java:400)
        at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:87)
        at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:742)
        at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203)
        at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124)
        at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113)
        at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109)
        at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
        at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:90)
;; Magnova: Script start
;; Magnova: Tx <:MEAS:HFReq:CURR? CHAN1>
;; IP: Tx: <:MEAS:HFReq:CURR? CHAN1.> 3A 4D 45 41 53 3A 48 46 52 65 71 3A 43 55 52 52 3F 20 43 48 41 4E 31 0A
;; IP: Rx: <1000019.53163148> 31 30 30 30 30 31 39 2E 35 33 31 36 33 31 34 38 0A
;; Magnova: Rx <1000019.53163148>
;; Magnova: Script end <1000019.53163148>
;; Magnova: Rx <1000019.53163148>
;; Magnova: Tx <getMeasUnit1?>
;; Magnova: Tx <none?>
;; Magnova: Rx <Hz>
;; Magnova: Tx <DynamicM2?>
;; Magnova: Script start
;; Magnova: Tx <:MEAS:VRMS:CURR? CHAN1>
;; IP: Tx: <:MEAS:VRMS:CURR? CHAN1.> 3A 4D 45 41 53 3A 56 52 4D 53 3A 43 55 52 52 3F 20 43 48 41 4E 31 0A
;; IP: Rx: <0.173401251167> 30 2E 31 37 33 34 30 31 32 35 31 31 36 37 0A
;; Magnova: Rx <0.173401251167>
;; Magnova: Script end <0.173401251167>
;; Magnova: Rx <0.173401251167>
;; Magnova: Tx <getMeasUnit2?>
;; Magnova: Tx <none?>
;; Magnova: Rx <V>
;; Magnova: Tx <DynamicM3?>
;; Magnova: Script start
;; Magnova: Tx <:MEAS:VNAArea:CURR? CHAN1>
;; IP: Tx: <:MEAS:VNAArea:CURR? CHAN1.> 3A 4D 45 41 53 3A 56 4E 41 41 72 65 61 3A 43 55 52 52 3F 20 43 48 41 4E 31 0A
;; IP: Rx: <-5.369E-09> 2D 35 2E 33 36 39 45 2D 30 39 0A
;; Magnova: Rx <-5.369E-09>
;; Magnova: Script end <-5.369E-09>
;; Magnova: Rx <-5.369E-09>
;; Magnova: Tx <getMeasUnit3?>
;; Magnova: Tx <none?>
;; Magnova: Rx <Vs>
;; Magnova: Tx <DynamicM4?>
;; Magnova: Script start
;; Magnova: Tx <:MEAS:HRTime:CURR? CHAN1>
;; IP: Tx: <:MEAS:HRTime:CURR? CHAN1.> 3A 4D 45 41 53 3A 48 52 54 69 6D 65 3A 43 55 52 52 3F 20 43 48 41 4E 31 0A
;; IP: Rx: <2.9418E-07> 32 2E 39 34 31 38 45 2D 30 37 0A
;; Magnova: Rx <2.9418E-07>
;; Magnova: Script end <2.9418E-07>
;; Magnova: Rx <2.9418E-07>
;; Magnova: Tx <getMeasUnit4?>
;; Magnova: Tx <none?>
;; Magnova: Rx <s>
;; Magnova: Tx <DynamicM5?>
;; Magnova: Script start
;; Magnova: Tx <:MEAS:RECount:CURR? CHAN1>
;; IP: Tx: <:MEAS:RECount:CURR? CHAN1.> 3A 4D 45 41 53 3A 52 45 43 6F 75 6E 74 3A 43 55 52 52 3F 20 43 48 41 4E 31 0A
;; IP: Rx: <3> 33 0A
;; Magnova: Rx <3>
;; Magnova: Script end <3>
;; Magnova: Rx <3>
;; Magnova: Tx <getMeasUnit5?>
;; Magnova: Tx <none?>
;; Magnova: Rx Timeout
;; Magnova: Rx after :readmath: getElement(value,1)+" "+getElement(value,3)+" "+getElement(value,5)+" "+getElement(value,7)+" "+getElement(value,9) <Hz V Vs s >


Before that, I tried it this way, which also doesn't work:
Code: [Select]
#askMode getMeasUnit1?;getMeasUnit2?;getMeasUnit3?;getMeasUnit4?;getMeasUnit5?
#askValues DynamicM1?;getMeasUnit1?;DynamicM2?;getMeasUnit2?;DynamicM3?;getMeasUnit3?;DynamicM4?;getMeasUnit4?;DynamicM5?;getMeasUnit5?;
#askValuesReadFormat fxfxfxfxfx
;#askModeMathFormat
#modeFromValue getElement(value,1)+" "+getElement(value,3)+" "+getElement(value,5)+" "+getElement(value,7)+" "+getElement(value,9)


This is the log from that:
Code: [Select]
;; Magnova: Tx <DynamicM1?>
;; Magnova: Script start
;; Magnova: Tx <:MEAS:VAMP:CURR? CHAN1>
;; IP: Tx: <:MEAS:VAMP:CURR? CHAN1.> 3A 4D 45 41 53 3A 56 41 4D 50 3A 43 55 52 52 3F 20 43 48 41 4E 31 0A
;; IP: Rx: <0.49965> 30 2E 34 39 39 36 35 0A
;; Magnova: Rx <0.49965>
;; Magnova: Script end <0.49965>
;; Magnova: Rx <0.49965>
;; Magnova: Tx <getMeasUnit1?>
;; Magnova: Tx <none?>
;; Magnova: Rx <V>
Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException: Cannot read field "modes" because "this.form" is null
        at dk.hkj.devices.SetupFormats.syncModeChange(SetupFormats.java:428)
        at dk.hkj.main.PopupSetupSelection.syncModeChange(PopupSetupSelection.java:189)
        at dk.hkj.main.DeviceInterface$4.run(DeviceInterface.java:487)
        at java.desktop/java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:318)
        at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:773)
        at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:720)
        at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:714)
        at java.base/java.security.AccessController.doPrivileged(AccessController.java:400)
        at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:87)
        at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:742)
        at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203)
        at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124)
        at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113)
        at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109)
        at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
        at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:90)
;; Magnova: Tx <DynamicM2?>
;; Magnova: Script start
;; Magnova: Tx <:MEAS:VNAArea:CURR? CHAN1>
;; IP: Tx: <:MEAS:VNAArea:CURR? CHAN1.> 3A 4D 45 41 53 3A 56 4E 41 41 72 65 61 3A 43 55 52 52 3F 20 43 48 41 4E 31 0A
;; IP: Rx: <-5.185E-09> 2D 35 2E 31 38 35 45 2D 30 39 0A
;; Magnova: Rx <-5.185E-09>
;; Magnova: Script end <-5.185E-09>
;; Magnova: Rx <-5.185E-09>
;; Magnova: Tx <getMeasUnit2?>
;; Magnova: Tx <none?>
;; Magnova: Rx <Vs>
;; Magnova: Tx <DynamicM3?>
;; Magnova: Script start
;; Magnova: Tx <:MEAS:HRTime:CURR? CHAN1>
;; IP: Tx: <:MEAS:HRTime:CURR? CHAN1.> 3A 4D 45 41 53 3A 48 52 54 69 6D 65 3A 43 55 52 52 3F 20 43 48 41 4E 31 0A
;; IP: Rx: <2.9457E-07> 32 2E 39 34 35 37 45 2D 30 37 0A
;; Magnova: Rx <2.9457E-07>
;; Magnova: Script end <2.9457E-07>
;; Magnova: Rx <2.9457E-07>
;; Magnova: Tx <getMeasUnit3?>
;; Magnova: Tx <none?>
;; Magnova: Rx <s>
;; Magnova: Tx <DynamicM4?>
;; Magnova: Script start
;; Magnova: Tx <:MEAS:RECount:CURR? CHAN1>
;; IP: Tx: <:MEAS:RECount:CURR? CHAN1.> 3A 4D 45 41 53 3A 52 45 43 6F 75 6E 74 3A 43 55 52 52 3F 20 43 48 41 4E 31 0A
;; IP: Rx: <3> 33 0A
;; Magnova: Rx <3>
;; Magnova: Script end <3>
;; Magnova: Rx <3>
;; Magnova: Tx <getMeasUnit4?>
;; Magnova: Tx <none?>
;; Magnova: Rx Timeout
;; Magnova: Tx <DynamicM5?>
;; Magnova: Script start
;; Magnova: Tx <:MEAS:HFReq:CURR? CHAN1>
;; IP: Tx: <:MEAS:HFReq:CURR? CHAN1.> 3A 4D 45 41 53 3A 48 46 52 65 71 3A 43 55 52 52 3F 20 43 48 41 4E 31 0A
;; IP: Rx: <1000019.53163148> 31 30 30 30 30 31 39 2E 35 33 31 36 33 31 34 38 0A
;; Magnova: Rx <1000019.53163148>
;; Magnova: Script end <1000019.53163148>
;; Magnova: Rx <1000019.53163148>
;; Magnova: Tx <getMeasUnit5?>
;; Magnova: Tx <none?>
;; Magnova: Rx <Hz>
;; Magnova: Rx as numbers <0.49965 -5.185E-9 2.9457E-7 3.0 0.0>
Unknown mode: 1000019.53163148
Known modes: getMeasUnit1?,
Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException: Cannot read field "modes" because "this.form" is null
        at dk.hkj.devices.SetupFormats.syncModeChange(SetupFormats.java:428)
        at dk.hkj.main.PopupSetupSelection.syncModeChange(PopupSetupSelection.java:189)
        at dk.hkj.main.DeviceInterface.initColumns(DeviceInterface.java:481)
        at dk.hkj.devices.DeviceSCPI.initColumns(DeviceSCPI.java:125)
        at dk.hkj.main.DeviceInterface$2.actionPerformed(DeviceInterface.java:444)
        at java.desktop/javax.swing.Timer.fireActionPerformed(Timer.java:311)
        at java.desktop/javax.swing.Timer$DoPostEvent.run(Timer.java:243)
        at java.desktop/java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:318)
        at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:773)
        at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:720)
        at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:714)
        at java.base/java.security.AccessController.doPrivileged(AccessController.java:400)
        at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:87)
        at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:742)
        at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203)
        at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124)
        at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113)
        at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109)
        at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
        at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:90)



Thanks,
Josh
« Last Edit: September 20, 2025, 06:38:55 pm by KungFuJosh »
"Experience is something you don't get until just after you need it." - Steven Wright
Best Continuity Tester Ever
Best Continuity Tester Ever...Got Betterer!
 

Online Gertjan

  • Frequent Contributor
  • **
  • Posts: 378
  • Country: nl
Re: Program that can log/control many multimeters and other devices.
« Reply #4667 on: September 21, 2025, 03:30:12 pm »
A feature request:
- Could you make an extra field for measurement delay in the param sweeper? (with default setting of zero) The best and most versatile option :).
- Or add a standard, built in, delay between the next sweep step, and the command to the log system for the measurement. Something like 10% of the log interval would work most of the time. (after all, with slower devices to control one would choose a longer log interval)

It would be a option to synchronize the logging to param sweeper and then I could re-purpose the log timing field when that is checked.
I will take a look at it.
Hi HKJ,

I was very surprised by your statement above. I always took for granted that the param sweeper and logging were synchronised.....
After all, when doing e.g. a linearity measurement it is important that exactly each step is one measurement in the table.

I have struggled for days with linearity measurements, where I got somewhere in the table twice the same value. And thus a big linearity deviation.
For now I solved this by adding a delay to each measurement, thus making sure that all measurements were taken in the middle of the step time. (I just edited the device files with #askValues starting with a delay)

So, YES, please synchronise the param sweeper with the logging! The delay setting for the measurement would be the icing on the cake :)

regards, Gertjan.
 

Online KungFuJosh

  • Super Contributor
  • ***
  • Posts: 8489
  • Country: us
  • TEAS is real.
Re: Program that can log/control many multimeters and other devices.
« Reply #4668 on: September 21, 2025, 04:15:28 pm »
So, YES, please synchronise the param sweeper with the logging! The delay setting for the measurement would be the icing on the cake :)

regards, Gertjan.

What kind of logging are you referring to?

I've only done basic sweeps with the parameter sweeper, but it always saved its own CSV log, and there are delay settings on the sweeper setup as well. Attached is recent parameter sweeper results before self cal on an AWG.

Thanks,
Josh
"Experience is something you don't get until just after you need it." - Steven Wright
Best Continuity Tester Ever
Best Continuity Tester Ever...Got Betterer!
 

Online KungFuJosh

  • Super Contributor
  • ***
  • Posts: 8489
  • Country: us
  • TEAS is real.
Re: Program that can log/control many multimeters and other devices.
« Reply #4669 on: September 21, 2025, 04:33:11 pm »
Here's another fun feature request for you ;):

I would like a Control multi that can handle separate read/write functions. Something like this:
Code: [Select]
#cmdSetup multi Math_CH1_Setup Math
:read: :MATH1:UNIT?;:MATH1:OFFS?;:MATH1:SCAL?
:write: :MATH1:UNIT (value);:MATH1:OFFS (value);:MATH1:SCAL (value)
:update: Math_CH1_Setup
:tip: Enter desired setup values.
text Unit
number Offset _ 0 6
text Scale

In the attached screenshot, you can see it's cuckoo tall with everything active. I'll use selectors to hide each inactive channel, but if somebody uses all 4 math channels, it's too tall.
I don't want to separate them to different tabs, because there's already a lot of tabs. Maybe if the multiple Setup button feature happens eventually, I could add a separate cmdSetup_Math button with separate tabs, but the Control multi would be a nice feature also.

Thanks,
Josh
"Experience is something you don't get until just after you need it." - Steven Wright
Best Continuity Tester Ever
Best Continuity Tester Ever...Got Betterer!
 

Online HKJTopic starter

  • Super Contributor
  • ***
  • Posts: 4974
  • Country: dk
    • Tests
Re: Program that can log/control many multimeters and other devices.
« Reply #4670 on: September 23, 2025, 10:14:02 am »
This is frustrating. It gave me "known mode" errors with the #askMode not matching, so I changed it to:

I am not really sure what you did wrong here.

I have made the #modeFromVar, but it is  completely untested, i.e. start by using printLog() function to see that it returns anything useful.

The syntax is #modeFromVar varName
No expression, quotes or anything else allowed, it goes directly into the var table lookup, not to a parser.
 
The following users thanked this post: KungFuJosh

Online HKJTopic starter

  • Super Contributor
  • ***
  • Posts: 4974
  • Country: dk
    • Tests
Re: Program that can log/control many multimeters and other devices.
« Reply #4671 on: September 23, 2025, 10:16:24 am »
I was very surprised by your statement above. I always took for granted that the param sweeper and logging were synchronised.....
After all, when doing e.g. a linearity measurement it is important that exactly each step is one measurement in the table.

I have struggled for days with linearity measurements, where I got somewhere in the table twice the same value. And thus a big linearity deviation.
For now I solved this by adding a delay to each measurement, thus making sure that all measurements were taken in the middle of the step time. (I just edited the device files with #askValues starting with a delay)

So, YES, please synchronise the param sweeper with the logging! The delay setting for the measurement would be the icing on the cake :)

I have always see it as using small enough steps at it din not matter, but I can see that see that not all agree with me on that. I will see if I can add a sync option.
 

Online HKJTopic starter

  • Super Contributor
  • ***
  • Posts: 4974
  • Country: dk
    • Tests
Re: Program that can log/control many multimeters and other devices.
« Reply #4672 on: September 23, 2025, 10:18:28 am »
Here's another fun feature request for you ;):

I would like a Control multi that can handle separate read/write functions. Something like this:
Code: [Select]
#cmdSetup multi Math_CH1_Setup Math
:read: :MATH1:UNIT?;:MATH1:OFFS?;:MATH1:SCAL?
:write: :MATH1:UNIT (value);:MATH1:OFFS (value);:MATH1:SCAL (value)
:update: Math_CH1_Setup
:tip: Enter desired setup values.
text Unit
number Offset _ 0 6
text Scale

In the attached screenshot, you can see it's cuckoo tall with everything active. I'll use selectors to hide each inactive channel, but if somebody uses all 4 math channels, it's too tall.
I don't want to separate them to different tabs, because there's already a lot of tabs. Maybe if the multiple Setup button feature happens eventually, I could add a separate cmdSetup_Math button with separate tabs, but the Control multi would be a nice feature also.

You can already do this:
:read: :MATH1:UNIT?;:MATH1:OFFS?;:MATH1:SCAL?
:write: :MATH1:UNIT (value);:MATH1:OFFS (value2);:MATH1:SCAL (value3)

or this (Assuming they are in sequence):
:write: :MATH1:UNIT (#);:MATH1:OFFS (#);:MATH1:SCAL (#)



 
The following users thanked this post: KungFuJosh

Offline gby

  • Frequent Contributor
  • **
  • Posts: 282
  • Country: us
Re: Program that can log/control many multimeters and other devices.
« Reply #4673 on: September 23, 2025, 01:35:33 pm »
Hi HKJ,

I am trying to support a device whose documentation says:
   Commands and responses are sent as ASCII strings terminated with a line feed.
   Multiple commands cannot be sent in a single string where a ‘;’ character is used
   at the end of each command.

My issue is that I need to poll multiple items in the #askValues.  Normally I would do:
   #askValues :FRD:CH1?; :FRD:CH2?
But per documentation and testing the above does not work.  The device just ignore the second command after the ";".

Any suggestion on how to set the #askValues to send individual strings with a line feed between instead of the normal single string with ";" between?

For reference, this device is over Ethernet with #port 5025 in the device file.
 

Online HKJTopic starter

  • Super Contributor
  • ***
  • Posts: 4974
  • Country: dk
    • Tests
Re: Program that can log/control many multimeters and other devices.
« Reply #4674 on: September 23, 2025, 01:58:10 pm »
I am trying to support a device whose documentation says:
   Commands and responses are sent as ASCII strings terminated with a line feed.
   Multiple commands cannot be sent in a single string where a ‘;’ character is used
   at the end of each command.

My issue is that I need to poll multiple items in the #askValues.  Normally I would do:
   #askValues :FRD:CH1?; :FRD:CH2?
But per documentation and testing the above does not work.  The device just ignore the second command after the ";".

Any suggestion on how to set the #askValues to send individual strings with a line feed between instead of the normal single string with ";" between?

TC is always sending one command to a line (I have recent added a possibility to get around that), it do not matter you write it on a single line, TC will find the ; and split it into multiple command lines.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf

 

- - -
-->