Author Topic: Program that can log from many multimeters.  (Read 648360 times)

0 Members and 5 Guests are viewing this topic.

Offline HKJTopic starter

  • Super Contributor
  • ***
  • Posts: 3037
  • Country: dk
    • Tests
Re: Program that can log from many multimeters.
« Reply #3700 on: October 31, 2024, 03:24:28 pm »
I agree and it is exactly what I would make in a standard programming language. Unfortunately I never understood how to make variables working in Test Controller. Their scope is something simply I don't understand. I can create a variable, but after I am not able to retrieve it, or I am not able to retrieve WHERE I need it. I made a lot of testing also with global variables, but without  success.
Only variables in function #pgm# work as expected, anyway I was not able to pass the content of a variable to the custom function, just immediate values. So, after several days I gived up......

Now I simply try to avoid them, that's why my question, although I understand that in this way what I can do in Test Controller programming is quite basic.

I forgot to say variables only works in #scpiCmd, they share a common context and will share variables.

Note: Using printLog(getVarList(1)) after a :readmath: will show all defined variable (and trigger an error after that). printLog() only exist in the newest release of TC.

 

Offline KungFuJosh

  • Super Contributor
  • ***
  • Posts: 2783
  • Country: us
  • TEAS is real.
Re: Program that can log from many multimeters.
« Reply #3701 on: October 31, 2024, 05:32:34 pm »
The attached adds basic support for Siglent SDS2000X Plus and HD models.

Thanks,
Josh
"Right now I’m having amnesia and déjà vu at the same time. I think I’ve forgotten this before." - Steven Wright
 
The following users thanked this post: Kirkhaan

Offline fricci

  • Contributor
  • Posts: 26
  • Country: it
Re: Program that can log from many multimeters.
« Reply #3702 on: October 31, 2024, 06:28:54 pm »
I forgot to say variables only works in #scpiCmd, they share a common context and will share variables.

Note: Using printLog(getVarList(1)) after a :readmath: will show all defined variable (and trigger an error after that). printLog() only exist in the newest release of TC.
Interesting......
So, if I correctly understand there is no way to pass the content of a variable as parameter to a custom function (#pgm#). I succeeded to make it working only passing immediate values (it didn't work using a variable as parameters), but this was completely useless for what I had to do.
 

Offline fricci

  • Contributor
  • Posts: 26
  • Country: it
Re: Program that can log from many multimeters.
« Reply #3703 on: November 01, 2024, 06:30:12 am »
Stating your last clarifications, I succeeded to successfully use some variables inside #scpiCmd commands so I wrote a working code to manage the scale changes.  :-+
I would like to ask you some more questions:
1) Any chance to call an #scpiCmd inside another #scpiCmd?
2) Time ago I wrote a working function using #pgm# that accepted some input parameters and it was called inside a #cmdSetup. Unfortunately it worked only if I pass immediate values, I didn't succeed to pass it the content of a variable, the function got the variable name (as a string), instead of its content. The use of parenthesis around the variable name did not change the result. Is this the expected behavior?
 

Offline HKJTopic starter

  • Super Contributor
  • ***
  • Posts: 3037
  • Country: dk
    • Tests
Re: Program that can log from many multimeters.
« Reply #3704 on: November 01, 2024, 03:51:51 pm »
Interesting......
So, if I correctly understand there is no way to pass the content of a variable as parameter to a custom function (#pgm#). I succeeded to make it working only passing immediate values (it didn't work using a variable as parameters), but this was completely useless for what I had to do.

You cannot pass variables from a context where no variables are defined.
Using the command from the command line or a script you can pass variables.
 

Offline HKJTopic starter

  • Super Contributor
  • ***
  • Posts: 3037
  • Country: dk
    • Tests
Re: Program that can log from many multimeters.
« Reply #3705 on: November 01, 2024, 03:59:04 pm »
Stating your last clarifications, I succeeded to successfully use some variables inside #scpiCmd commands so I wrote a working code to manage the scale changes.  :-+
I would like to ask you some more questions:
1) Any chance to call an #scpiCmd inside another #scpiCmd?

Don't, I believe you can do it, but all #scpiCmd for a device shares the same execution context, so it will not work reliable.

2) Time ago I wrote a working function using #pgm# that accepted some input parameters and it was called inside a #cmdSetup. Unfortunately it worked only if I pass immediate values, I didn't succeed to pass it the content of a variable, the function got the variable name (as a string), instead of its content. The use of parenthesis around the variable name did not change the result. Is this the expected behavior?

I do not remember exactly what places I handle expressions or not, but I do handle them in most places. A simple test is to use (3*5) as a parameter, if the result is 3*5 no expressions are processed, if the result is 15 expressions are processed and variables can be used (Global variables can be access from all contexts, but it is very bad style to use them in a device definition).
 

Offline HKJTopic starter

  • Super Contributor
  • ***
  • Posts: 3037
  • Country: dk
    • Tests
Re: Program that can log from many multimeters.
« Reply #3706 on: November 01, 2024, 04:00:17 pm »
The attached adds basic support for Siglent SDS2000X Plus and HD models.

Thanks, it will be include in the next release.
Of course anybody can download the file and replace the existing file of the same name, if they want it now.
 

Offline fricci

  • Contributor
  • Posts: 26
  • Country: it
Re: Program that can log from many multimeters.
« Reply #3707 on: November 01, 2024, 06:48:09 pm »
Stating your last clarifications, I succeeded to successfully use some variables inside #scpiCmd commands so I wrote a working code to manage the scale changes.  :-+
I would like to ask you some more questions:
1) Any chance to call an #scpiCmd inside another #scpiCmd?
Don't, I believe you can do it, but all #scpiCmd for a device shares the same execution context, so it will not work reliable.

Anyway I didn't succeeded to make it working.

2) Time ago I wrote a working function using #pgm# that accepted some input parameters and it was called inside a #cmdSetup. Unfortunately it worked only if I pass immediate values, I didn't succeed to pass it the content of a variable, the function got the variable name (as a string), instead of its content. The use of parenthesis around the variable name did not change the result. Is this the expected behavior?
I do not remember exactly what places I handle expressions or not, but I do handle them in most places. A simple test is to use (3*5) as a parameter, if the result is 3*5 no expressions are processed, if the result is 15 expressions are processed and variables can be used (Global variables can be access from all contexts, but it is very bad style to use them in a device definition).

I absolutely agree....... but if there is no way to pass the content of a variable to a custom #pgm# function , this could be the last resort.
 

Offline HKJTopic starter

  • Super Contributor
  • ***
  • Posts: 3037
  • Country: dk
    • Tests
Re: Program that can log from many multimeters.
« Reply #3708 on: November 01, 2024, 07:09:40 pm »
I absolutely agree....... but if there is no way to pass the content of a variable to a custom #pgm# function , this could be the last resort.

Variable in a device content can be access from all #scpiCmd, i.e. they are nearly global within your device definition, you generally do not need global variable.
I.e. set a variable where you change range, then you can use it in all #scpiCmd that process data from that range. No parameters required.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf