Author Topic: Open source EEZ Studio for accessing your (SCPI) instruments  (Read 41658 times)

0 Members and 1 Guest are viewing this topic.

Offline mvladic

  • Contributor
  • Posts: 14
  • Country: hr
Re: Open source EEZ Studio for accessing your (SCPI) instruments
« Reply #100 on: April 29, 2020, 09:32:50 am »
Can you send me the part of the script with fields definition and "await input", basically everything between "storage.getItem" and "storage.setItem".
 

Offline Pjoms

  • Regular Contributor
  • *
  • Posts: 51
  • Country: se
Re: Open source EEZ Studio for accessing your (SCPI) instruments
« Reply #101 on: April 29, 2020, 09:43:02 am »
You are so welcome.
It is practically a plain copy of the start of the "Dlog start" script.


Code: [Select]
var defaultValues = storage.getItem("LiPoChargeValues", {
    startCurrent: 1.5,
    stopCurrent: 0.1,
    maxChargeTime: 10,
});

var values = await input({
    title: "Start Dlog",
    fields: [
        {
            name: "startCurrent",
            displayName: "Charging current",
            unit: "current",
            validators: [validators.rangeInclusive(0.1, 5)]
        },
        {
            name: "stopCurrent",
            displayName: "End ocf charge current",
            unit: "current",
            validators: [validators.rangeInclusive(0.01, 0.5)]
        },
        {
            name: "maxChargeTime",
            displayName: "Max charging time",
            unit: "time",
            validators: [validators.rangeInclusive(1, 86400000)]
        }
    ]
}, defaultValues);

if (!values) {
    session.deleteScriptLogEntry();
    return;
}

storage.setItem("LiPoChargeValues", values);

session.scriptParameters = values;

 

Offline mvladic

  • Contributor
  • Posts: 14
  • Country: hr
Re: Open source EEZ Studio for accessing your (SCPI) instruments
« Reply #102 on: April 29, 2020, 10:07:45 am »
Let me give you some explanations first (sorry if you already know this):

The purpose of "storage.getItem" and "storage.setItem" is to remember (inside local storage which is kept even after Studio restarts) the last parameters that you entered, so when you start script again you will be greeted with same parameters you used last time. If you don't need this feature you can remove it, so your script can look like this:

Code: [Select]
var defaultValues = {
    startCurrent: 1.5,
    stopCurrent: 0.1,
    maxChargeTime: 10,
};

var values = await input({
    title: "Start Dlog",
    fields: [
        {
            name: "startCurrent",
            displayName: "Charging current",
            unit: "current",
            validators: [validators.rangeInclusive(0.1, 5)]
        },
        {
            name: "stopCurrent",
            displayName: "End ocf charge current",
            unit: "current",
            validators: [validators.rangeInclusive(0.01, 0.5)]
        },
        {
            name: "maxChargeTime",
            displayName: "Max charging time",
            unit: "time",
            validators: [validators.rangeInclusive(1, 86400000)]
        }
    ]
}, defaultValues);

if (!values) {
    session.deleteScriptLogEntry();
    return;
}

session.scriptParameters = values;

Also, to answer your question, any script can access this local storage items with "storage.getItem". Check this: https://developer.mozilla.org/en-US/docs/Web/API/Window/localStorage

Now, If I start the script code you send me everything works fine on my computer. But, If I change the script slightly I can see the same error as you. This is changed script:

Code: [Select]
var defaultValues = storage.getItem("LiPoChargeValues", {
    startCurrent: 1.5,
    stopCurrent: 0.1,
    maxChargeTime: 10,
});

var values = await input({
    title: "Start Dlog",
    fields: [
        {
            name: "startCurrent1", // "startCurrent" renamed to "startCurrent1"
            displayName: "Charging current",
            unit: "current",
            validators: [validators.rangeInclusive(0.1, 5)]
        },
        {
            name: "stopCurrent",
            displayName: "End ocf charge current",
            unit: "current",
            validators: [validators.rangeInclusive(0.01, 0.5)]
        },
        {
            name: "maxChargeTime",
            displayName: "Max charging time",
            unit: "time",
            validators: [validators.rangeInclusive(1, 86400000)]
        }
    ]
}, defaultValues);

I changed "startCurrent" to "startCurrent1". The error is because defaultValues doesn't contain the value for "startCurrent1". But if I put "startCurrent1" inside defaultValues, everything is ok again:

Code: [Select]
var defaultValues = storage.getItem("LiPoChargeValues", {
    startCurrent1: 1.5, // now, we have the value for "startCurrent1"
    stopCurrent: 0.1,
    maxChargeTime: 10,
});

var values = await input({
    title: "Start Dlog",
    fields: [
        {
            name: "startCurrent1",
            displayName: "Charging current",
            unit: "current",
            validators: [validators.rangeInclusive(0.1, 5)]
        },
        {
            name: "stopCurrent",
            displayName: "End ocf charge current",
            unit: "current",
            validators: [validators.rangeInclusive(0.01, 0.5)]
        },
        {
            name: "maxChargeTime",
            displayName: "Max charging time",
            unit: "time",
            validators: [validators.rangeInclusive(1, 86400000)]
        }
    ]
}, defaultValues);

Maybe you also changed the fields definition for the input, but forget to change defaultValues?
 

Offline Pjoms

  • Regular Contributor
  • *
  • Posts: 51
  • Country: se
Re: Open source EEZ Studio for accessing your (SCPI) instruments
« Reply #103 on: April 29, 2020, 11:23:13 am »
Thanks, that clarify and confirm a lot of what I was assuming.
But I'm afraid I'm still banging my head pretty hard here...  |O

I have tried some more, and from what I can understand it looks like the deal breaker here is if I chose Cancel or Ok in the dialog box!
As long as I click Cancel in the dialog box then I run the script the storage seems still undefined and I can change anything. But as soon I click Ok the values stores and that storage structure seems unable to be changed by modifying the input variabels, eg. change startCurrent to startCurrent1.

If I choose a new name for the storage, eg. change LiPoChargeValues to LiPoChargeValues1, it works again with the new variables.

I tried to remove the stored values, but width no luck... "storage.removeItem is not a function)
storage.removeItem('LiPoChargeValues');

I hope you can follow me here...
 

Offline mvladic

  • Contributor
  • Posts: 14
  • Country: hr
Re: Open source EEZ Studio for accessing your (SCPI) instruments
« Reply #104 on: April 29, 2020, 11:43:06 am »
Which version of Studio do you use? Just to be sure we are on the same version.
 

Offline mvladic

  • Contributor
  • Posts: 14
  • Country: hr
Re: Open source EEZ Studio for accessing your (SCPI) instruments
« Reply #105 on: April 29, 2020, 12:02:43 pm »
I can't reproduce what you are experiencing. For me it works as expected. If I press Cancel button then script execution is done and nothing is stored inside local storage. If I press OK button then selected parameters are stored in local storage and script proceeds with the execution using selected parameters.

You can check what is stored in local storage here:



Knowing the true name of the "Key" you can remove from storage like this (by accessing "localStorage" object directly):

Code: [Select]
localStorage.removeItem("instrument/166/scripts-storage/LiPoChargeValues")
 
The following users thanked this post: Pjoms

Offline Pjoms

  • Regular Contributor
  • *
  • Posts: 51
  • Country: se
Re: Open source EEZ Studio for accessing your (SCPI) instruments
« Reply #106 on: April 29, 2020, 12:58:35 pm »
I use EEZ Studio 0.9.3
Thanks for that guide to find the stored data!
If I delete it there it's possible to run the script again with the new values.


https://imgur.com/a/kYVdPvk
Edit: I tried to insert a picture, but it doesn't show up...
« Last Edit: April 29, 2020, 01:01:53 pm by Pjoms »
 

Offline mvladic

  • Contributor
  • Posts: 14
  • Country: hr
Re: Open source EEZ Studio for accessing your (SCPI) instruments
« Reply #107 on: April 29, 2020, 01:29:40 pm »
Can you try with the latest version (nightly-build)?
 

Offline Pjoms

  • Regular Contributor
  • *
  • Posts: 51
  • Country: se
Re: Open source EEZ Studio for accessing your (SCPI) instruments
« Reply #108 on: April 29, 2020, 02:28:41 pm »
Can you try with the latest version (nightly-build)?
I can try it later, hopefully tonight. Can the nightly-build and 0.9.3 be installed at the same time?

The more I (hope) I understand how this works and hangs together, the more I'm starting to imagine that the behavior I experiencing maybe is just the right thing.
If I set up a storage with some variables in "Script1", and then if some other "Script2" is able to change the names of the variables, some funny things will surely occur in "Script1".
Am I thinking the right way here?
 

Offline mvladic

  • Contributor
  • Posts: 14
  • Country: hr
Re: Open source EEZ Studio for accessing your (SCPI) instruments
« Reply #109 on: April 29, 2020, 02:53:22 pm »
Quote
I can try it later, hopefully tonight. Can the nightly-build and 0.9.3 be installed at the same time?

No. Also, after you install nightly-build it is not safe to go back to version 0.9.3, unless you make a backup of settings and database which are stored here: C:\Users\<your_user_name>\AppData\Roaming\eezstudio. This is because newer version of Studio can automatically change format of settings and database which could be problematic if you decide later to start older version.

Quote
The more I (hope) I understand how this works and hangs together, the more I'm starting to imagine that the behavior I experiencing maybe is just the right thing.
If I set up a storage with some variables in "Script1", and then if some other "Script2" is able to change the names of the variables, some funny things will surely occur in "Script1".
Am I thinking the right way here?

Yes, use different names for local storage items in different scripts, unless you deliberately want to access same local storage item from different scripts.
 

Offline Pjoms

  • Regular Contributor
  • *
  • Posts: 51
  • Country: se
Re: Open source EEZ Studio for accessing your (SCPI) instruments
« Reply #110 on: April 30, 2020, 10:02:48 am »
Ok, here we go again...  ;) ::)
I think I now understand what caused my confusion yesterday, and I'm satisfied with that. Thanks again for your help!
Now a new problem...

If I set up the unit for an input value as "time" the dialog box shows "s" after the value.
So far so good.
But if I enter a large number eg. 3600s it first works fine, but the next time I run the script it shows like "3.6Ks" and the dialog will not accept it.
The same thing happens if I set a large number in defaultValues.
It is possible to enter eg. "1h" and it stores as 3600, but the next time it show "3.6Ks".

1. How can I solve this?
2. Are there any other types of units allowed, except Voltage, Current, Power, Time, Boolean and string?


Code: [Select]
        {
            name: "dummyReg",
            displayName: "Dummy time (1-5h)",
            unit: "time",
            validators: [validators.rangeInclusive(1, 5)]
        },



The whole test code
Code: [Select]
var values = await input({
    title: "Start Test",
    fields: [
        {
            name: "startCurrent",
            displayName: "Charging current",
            unit: "current",
            validators: [validators.rangeInclusive(0.1, 5)]
        },
        {
            name: "stopCurrent",
            displayName: "End ocf charge current",
            unit: "current",
            validators: [validators.rangeInclusive(0.01, 0.5)]
        },
        {
            name: "maxChargeTime",
            displayName: "Max charging time",
            unit: "time",
            validators: [validators.rangeInclusive(1, 86400000)]
        },
        {
            name: "dummyReg",
            displayName: "Dummy time (1-5h)",
            unit: "time",
            validators: [validators.rangeInclusive(1, 5)]
        },
        {
            name: "dummyReg2",
            displayName: "Dummy power",
            unit: "power",
            validators: [validators.rangeInclusive(0.1, 5)]
        }
    ]
}, defaultValues);

if (!values) {
    session.deleteScriptLogEntry();
    return;
}

storage.setItem("LiPoChargeValuesTest", values);

session.scriptParameters = values;

console.log(JSON.stringify(storage.getItem("LiPoChargeValuesY1")))
 

Offline mvladic

  • Contributor
  • Posts: 14
  • Country: hr
Re: Open source EEZ Studio for accessing your (SCPI) instruments
« Reply #111 on: April 30, 2020, 11:19:32 am »
Quote
1. How can I solve this?

This is bug in Studio. You should fill a bug report here https://github.com/eez-open/studio/issues.

Quote
2. Are there any other types of units allowed, except Voltage, Current, Power, Time, Boolean and string?

In the latest Studio (nightly-build) folowing types are supported:

- "integer"
- "number"
- "string"
- "boolean"
- "enum"
- "radio"
- "range"

And following units are allowed for "number" type:

- "volt" (alias: "voltage")
- "amp" (alias: "amperage", "ampere", "current")
- "watt" (alias: "wattage", "power")
- "frequency"
- "sampling rate"
- "decibel"
- "joule"
- "unknown" (alias: "unkn"). This means: no unit.

This is example of "radio" type (this is from Coupling script from BB3 instrument):

Code: [Select]
connection.acquire();

let numChannels = await connection.query("SYSTem:CHANnel?");

if (numChannels === 0) {
    connection.release();
    notify.error("There is no channel installed!");
    return;
}

let numValidChannels = 0;
let couplingPossible = true;

for (let i = 1; i <= numChannels; i++) {
    const testResult = await connection.query(`DIAG:TEST? CH` + i);
    if (testResult == 2) {
        ++numValidChannels;
    } else {
        if (i == 1 || i == 2) {
            couplingPossible = false;
        }
    }
}

couplingPossible = couplingPossible &&
    (await connection.query(`SYST:CHAN:OPT? CH1`)).indexOf("Coupling") != -1 &&
    (await connection.query(`SYST:CHAN:OPT? CH2`)).indexOf("Coupling") != -1;

if (!couplingPossible && numValidChannels < 2) {
    connection.release();
    notify.error("Coupling is not possible!");
    return;
}

const availableCouplingTypes = [
    {
        id: "NONE",
        label: "Uncoupled",
        image: "data:image/png;base64,..."
    }
];

if (couplingPossible) {
    availableCouplingTypes.push({
        id: "SER",
        label: "Series",
        image: "data:image/png;base64,..."
    });
    availableCouplingTypes.push({
        id: "PAR",
        label: "Parallel",
        image: "data:image/png;base64,..."
    });
    availableCouplingTypes.push({
        id: "SRA",
        label: "Split rails",
        image: "data:image/png;base64,..."
    });
}

availableCouplingTypes.push({
    id: "CGND",
    label: "Common GND",
    image: "data:image/png;base64,..."
});

const fields = [
    {
        name: "type",
        displayName: "",
        type: "radio",
        enumItems: availableCouplingTypes
    }
];

values = await input({
    title: "Power outputs coupling",
    fields
}, {
    type: "NONE"
});

if (!values) {
    connection.release();
    session.deleteScriptLogEntry();
    return;
}

session.scriptParameters = values.type;

connection.command(`INST:COUP:TRAC ${values.type}`);

connection.release();

(Please note that I shortened "image" properties because forum software would not allowed me to post such a big script. To get data uri from image file you can use online tools like this: https://onlinepngtools.com/convert-png-to-data-uri)

This dialog look like this:



And here is example of "enum" and "range" types:

Code: [Select]
const STORAGE_ITEM = "test";

var defaultValues = storage.getItem(STORAGE_ITEM, {
    option: "Option 2",
    color: 4,
    howMany: 3
});

var values = await input({
    title: "Test enum and range field types",
    fields: [
        {
            name: "option",
            type: "enum",
            enumItems: ["Option 1", "Option 2", "Option 3"]
        },
        {
            name: "color",
            type: "enum",
            enumItems: [
                {
                    id: 1,
                    label: "Red"
                },
                {
                    id: 2,
                    label: "Green"
                },
                {
                    id: 3,
                    label: "Blue"
                },
                {
                    id: 4,
                    label: "Yellow"
                }
            ]
        },
        {
            name: "howMany",
            type: "range",
            minValue: 1,
            maxValue: 10
        }
    ]
}, defaultValues);

if (values) {
    storage.setItem(STORAGE_ITEM, values);
    console.log(values);
} else{
    session.deleteScriptLogEntry();
}

And this is how it looks:




« Last Edit: April 30, 2020, 11:21:41 am by mvladic »
 
The following users thanked this post: Pjoms

Offline prasimixTopic starter

  • Supporter
  • ****
  • Posts: 2023
  • Country: hr
    • EEZ
Re: Open source EEZ Studio for accessing your (SCPI) instruments
« Reply #112 on: August 07, 2020, 08:58:49 pm »
We are slowly progressing with EEZ Studio, by adding new features here and there based on the requirements that have arisen from everyday work. I'm started lately to work on adding AC line filter for passing CE testing and I made a dozens of measurements with different filters. Quick comparison of results (i.e. screenshots from the spectrum analyzer) became very difficult. Therefore a Scrapbook is introduced where you can with drag & drop add screenshots of current interest. This significantly accelerated my finding a filter with the desired characteristics. Example of what I currently have in the scrapbook:



The latest EEZ Studio can be downloaded at: https://github.com/eez-open/studio/releases/tag/nightly-build


 
The following users thanked this post: Kean, JohnG, RoGeorge

Offline prasimixTopic starter

  • Supporter
  • ****
  • Posts: 2023
  • Country: hr
    • EEZ
Re: Open source EEZ Studio for accessing your (SCPI) instruments
« Reply #113 on: October 16, 2020, 09:08:56 am »
The latest release 0.9.7 is available for download at https://github.com/eez-open/studio/releases/tag/0.9.7

Offline prasimixTopic starter

  • Supporter
  • ****
  • Posts: 2023
  • Country: hr
    • EEZ
Re: Open source EEZ Studio for accessing your (SCPI) instruments
« Reply #114 on: March 16, 2021, 08:11:16 am »
Thanks to Lex Brugman, we got another "3rd-party" IEXT:




Offline prasimixTopic starter

  • Supporter
  • ****
  • Posts: 2023
  • Country: hr
    • EEZ
Re: Open source EEZ Studio for accessing your (SCPI) instruments
« Reply #115 on: March 23, 2021, 11:26:04 am »
Thanks to Andrew Young (yngndrw) we got IEXT for Keysight DSO/MSO Infiniivision 2000 X series ...




Offline prasimixTopic starter

  • Supporter
  • ****
  • Posts: 2023
  • Country: hr
    • EEZ
EEZ Flow, first milestone introduction
« Reply #116 on: March 27, 2021, 03:00:22 pm »
I am glad to announce EEZ Flow to you. It allows visual programming like Node-RED, or say LabVIEW if we are talking about T&M solutions. We have been thinking about EEZ Flow (which we didn't even know what it would be called at the time) for more than five years and finally something started happening in that area thanks primarily to NLnet who decided to sponsor its development.
Yesterday, the first milestone (tagged as Pre-release 0.9.8.1) was completed, which brings the first basic elements for creating flowcharts from existing components, editing, copying, deleting, etc. EEZ flow will be able to work with three types of components: Widgets and Actions are already supported and we will add Decorations. The important thing is that it will be possible to import external components as well, so as a first example, a component was created to connect to the Postgres database. This will allow other developers to add their own components.

We continue to work on the EEZ flow and through the next four milestones the idea is to achieve the following:
  • Execute flows on a PC (to control various instruments including BB3) and display the corresponding dashboards
  • Execute flows directly on BB3 which will mean that the complete existing GUI can be replaced if someone wants it
  • Debugger for PC (with single step execution, breakpoints, etc.)
  • Debugger for BB3 (with single step execution, breakpoints, etc.)
The EEZ flow will start to be usable as soon as the next milestone is finished. Execution on BB3 (i.e. its MCU module) opens up the possibility to design a display module like Nextion that will be completely open source.

Here are the first screenshots:





 
The following users thanked this post: luma, AlanS

Offline AlanS

  • Supporter
  • ****
  • Posts: 103
  • Country: au
Re: Open source EEZ Studio for accessing your (SCPI) instruments
« Reply #117 on: March 28, 2021, 10:23:34 pm »
Fabulous progress - well done to all! :clap:
 

Offline prasimixTopic starter

  • Supporter
  • ****
  • Posts: 2023
  • Country: hr
    • EEZ
Re: Open source EEZ Studio for accessing your (SCPI) instruments
« Reply #118 on: March 31, 2021, 02:36:50 pm »
As work on EEZ flow has continued, we already have the first runtime results: this is a functional flow that reads voltage and current from an external device and displays them on the screen. Commands are MEAS:VOLT? and MEAS:CURR? The set delay between two readings is 500 ms. If the delay is not set the reading speed is up to 160 times per second!

 
The following users thanked this post: AlanS

Offline prasimixTopic starter

  • Supporter
  • ****
  • Posts: 2023
  • Country: hr
    • EEZ
Support for Plotly graphs
« Reply #119 on: April 01, 2021, 02:21:11 pm »
New thing for today is added support for popular Plotly graphs. This means that through EEZ flow data will be able to be presented in a variety of attractive ways. Here is the first example with flip between EEZ Flow frontend and backend. Again, this is not a simulation, this is what can be seen on the screen when the flow is started and communicates with an external device (EEZ BB3 in this case, but it can be any other instrument that supports SCPI).

 
The following users thanked this post: PlainName, Kean, AlanS

Offline Mike G

  • Regular Contributor
  • *
  • Posts: 83
Re: Open source EEZ Studio for accessing your (SCPI) instruments
« Reply #120 on: July 07, 2021, 02:14:15 pm »
Hi Prasimix, further to posts 601 - 602 a week or so ago, in the (EEZ Bench Box 3 - sequel to H24005) topic, my BB3 with the notorious green board is still causing me serious problems.
It still will not always power on correctly, sometimes showing a black screen with standby light on, power cycling ususally corrects this, but far more seriously it resets completely and randomly with no input from me.  By this I mean it can be just turned on doing nothing but with the outputs turned on, not connected, I will hear a beep and when I look across the workshop the BB3 has reset, I see the ethernet symbol flash as it reconnects and all outputs are now off.
This is really causing me doubts about the useability of this power supply, certainly for long term tests and analysis.
PLease could you offer any help or, hopefully, a solution.
Thank you and regards Mike
 

Offline Mike G

  • Regular Contributor
  • *
  • Posts: 83
Re: Open source EEZ Studio for accessing your (SCPI) instruments
« Reply #121 on: July 07, 2021, 02:34:24 pm »
Hi again, just look what it is doing right now :-//
 

Offline prasimixTopic starter

  • Supporter
  • ****
  • Posts: 2023
  • Country: hr
    • EEZ
Re: Open source EEZ Studio for accessing your (SCPI) instruments
« Reply #122 on: July 07, 2021, 03:38:30 pm »
Ok, don't know how you ended up reporting this issue here, but never mind. It's highly likely that your MCU module is in trouble (a green version again that comes from Poland). If you have any artifacts on the screen probably there is some soldering issue with SDRAM or STM32F7 MCU itself. Please contact me on PM or info@envox.eu to continue with discussion.

Offline Mike G

  • Regular Contributor
  • *
  • Posts: 83
Re: Open source EEZ Studio for accessing your (SCPI) instruments
« Reply #123 on: July 08, 2021, 03:49:22 am »
I reported this matter here because in post 606 on the  (EEZ Bench Box 3 - sequel to H24005) topic you asked me and any others to report problems on this topic page to enable you to build up evidence, if I misunderstood then I apologise.
I will contact you in private later today.
Mike
 

Offline prasimixTopic starter

  • Supporter
  • ****
  • Posts: 2023
  • Country: hr
    • EEZ
Re: Open source EEZ Studio for accessing your (SCPI) instruments
« Reply #124 on: July 08, 2021, 06:38:11 am »
It was this #606 and you kept posting in the right place, so it confused me how we ended up here, but it doesn’t matter. You have my PM in your inbox.


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf