mirror of
https://github.com/nasa/openmct.git
synced 2025-03-11 06:54:01 +00:00
[Timeline] Convert SOC to use percentages
Also includes updated validation params which allow for floats to a maximum of 100 as well as a percentage sign which is later removed.
This commit is contained in:
parent
d913798d5b
commit
943e2ebe14
@ -184,14 +184,14 @@ define([
|
|||||||
"pattern": "^-?\\d+(\\.\\d*)?$"
|
"pattern": "^-?\\d+(\\.\\d*)?$"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "Battery Starting SOC",
|
"name": "Battery starting SOC (%)",
|
||||||
"control": "textfield",
|
"control": "textfield",
|
||||||
"required": false,
|
"required": false,
|
||||||
"conversion": "number",
|
"conversion": "number",
|
||||||
"property": [
|
"property": [
|
||||||
"startingSOC"
|
"startingSOC"
|
||||||
],
|
],
|
||||||
"pattern": "^-?\\d+(\\.\\d*)?$"
|
"pattern": "^([0-9](\\.\\d*)?|[1-9][0-9](\\.\\d*)?|100)%?$"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"model": {
|
"model": {
|
||||||
|
@ -55,12 +55,14 @@ define(
|
|||||||
if (domainObject.getModel().type === 'timeline' &&
|
if (domainObject.getModel().type === 'timeline' &&
|
||||||
result.power &&
|
result.power &&
|
||||||
domainObject.getModel().capacity > 0) {
|
domainObject.getModel().capacity > 0) {
|
||||||
|
domainObject.getModel().startingSOC =
|
||||||
|
parseFloat(domainObject.getModel().startingSOC) || 100;
|
||||||
|
|
||||||
result.battery = new CumulativeGraph(
|
result.battery = new CumulativeGraph(
|
||||||
result.power,
|
result.power,
|
||||||
0,
|
0,
|
||||||
domainObject.getModel().capacity, // Watts
|
domainObject.getModel().capacity, // Watts
|
||||||
domainObject.getModel().startingSOC,
|
(domainObject.getModel().startingSOC/100)*domainObject.getModel().capacity,
|
||||||
1 / 3600000 // millis-to-hour (since units are watt-hours)
|
1 / 3600000 // millis-to-hour (since units are watt-hours)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user