Products > Test Equipment
Open source EEZ Studio for accessing your (SCPI) instruments
Pjoms:
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: --- {
name: "dummyReg",
displayName: "Dummy time (1-5h)",
unit: "time",
validators: [validators.rangeInclusive(1, 5)]
},
--- End code ---
The whole test code
--- Code: ---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")))
--- End code ---
mvladic:
--- Quote ---1. How can I solve this?
--- End quote ---
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?
--- End quote ---
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: ---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();
--- End code ---
(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: ---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();
}
--- End code ---
And this is how it looks:
prasimix:
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
prasimix:
The latest release 0.9.7 is available for download at https://github.com/eez-open/studio/releases/tag/0.9.7
prasimix:
Thanks to Lex Brugman, we got another "3rd-party" IEXT:
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version