File tree 3 files changed +16
-2
lines changed
platform/features/timeline
3 files changed +16
-2
lines changed Original file line number Diff line number Diff line change @@ -182,6 +182,16 @@ define([
182
182
"capacity"
183
183
] ,
184
184
"pattern" : "^-?\\d+(\\.\\d*)?$"
185
+ } ,
186
+ {
187
+ "name" : "Battery starting SOC (%)" ,
188
+ "control" : "textfield" ,
189
+ "required" : false ,
190
+ "conversion" : "number" ,
191
+ "property" : [
192
+ "startingSOC"
193
+ ] ,
194
+ "pattern" : "^([0-9](\\.\\d*)?|[1-9][0-9](\\.\\d*)?|100)%?$"
185
195
}
186
196
] ,
187
197
"model" : {
Original file line number Diff line number Diff line change @@ -37,7 +37,8 @@ define(
37
37
// Build graphs for this group of utilizations
38
38
function buildGraphs ( utilizations ) {
39
39
var utilizationMap = { } ,
40
- result = { } ;
40
+ result = { } ,
41
+ startingSOC ;
41
42
42
43
// Bucket utilizations by type
43
44
utilizations . forEach ( function ( u ) {
@@ -55,12 +56,14 @@ define(
55
56
if ( domainObject . getModel ( ) . type === 'timeline' &&
56
57
result . power &&
57
58
domainObject . getModel ( ) . capacity > 0 ) {
59
+ startingSOC = isNaN ( parseFloat ( domainObject . getModel ( ) . startingSOC ) ) ?
60
+ 100 : parseFloat ( domainObject . getModel ( ) . startingSOC ) ;
58
61
59
62
result . battery = new CumulativeGraph (
60
63
result . power ,
61
64
0 ,
62
65
domainObject . getModel ( ) . capacity , // Watts
63
- domainObject . getModel ( ) . capacity ,
66
+ ( startingSOC / 100 ) * domainObject . getModel ( ) . capacity ,
64
67
1 / 3600000 // millis-to-hour (since units are watt-hours)
65
68
) ;
66
69
}
Original file line number Diff line number Diff line change @@ -101,6 +101,7 @@ define(
101
101
it ( "provides a battery graph for timelines with capacity" , function ( ) {
102
102
var mockCallback = jasmine . createSpy ( 'callback' ) ;
103
103
testModel . capacity = 1000 ;
104
+ testModel . startingSOC = 100 ;
104
105
testModel . type = "timeline" ;
105
106
mockDomainObject . useCapability . andReturn ( asPromise ( [
106
107
{ key : "power" , start : 0 , end : 15 }
You can’t perform that action at this time.
0 commit comments