urbanopt-cli 0.8.0 → 0.8.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -19,7 +19,7 @@ EUI:
19
19
  min: 10
20
20
  max: 60
21
21
  Office:
22
- min: 40
22
+ min: 30
23
23
  max: 75
24
24
  Laboratory:
25
25
  min: 100
@@ -35,7 +35,7 @@ EUI:
35
35
  max: 75
36
36
  Outpatient health care:
37
37
  min: 50
38
- max: 100
38
+ max: 130
39
39
  Refrigerated warehouse:
40
40
  min: 75
41
41
  max: 100
@@ -52,7 +52,7 @@ EUI:
52
52
  min: 200
53
53
  max: 500
54
54
  Inpatient health care:
55
- min: 200
55
+ min: 100
56
56
  max: 300
57
57
  Nursing:
58
58
  min: 50
@@ -61,7 +61,7 @@ EUI:
61
61
  min: 50
62
62
  max: 100
63
63
  Strip shopping mall:
64
- min: 80
64
+ min: 50
65
65
  max: 120
66
66
  Enclosed mall:
67
67
  min: 50
@@ -73,8 +73,8 @@ EUI:
73
73
  min: 30
74
74
  max: 75
75
75
  Mixed use:
76
- min: 10
77
- max: 75
76
+ min: 30
77
+ max: 250
78
78
 
79
79
  SI:
80
80
  Units: "kWh/m2/yr"
@@ -91,7 +91,7 @@ EUI:
91
91
  min: 30
92
92
  max: 200
93
93
  Office:
94
- min: 126
94
+ min: 100
95
95
  max: 237
96
96
  Laboratory:
97
97
  min: 315
@@ -107,7 +107,7 @@ EUI:
107
107
  max: 237
108
108
  Outpatient health care:
109
109
  min: 157
110
- max: 315
110
+ max: 410
111
111
  Refrigerated warehouse:
112
112
  min: 236
113
113
  max: 315
@@ -124,7 +124,7 @@ EUI:
124
124
  min: 630
125
125
  max: 1577
126
126
  Inpatient health care:
127
- min: 630
127
+ min: 315
128
128
  max: 946
129
129
  Nursing:
130
130
  min: 157
@@ -133,7 +133,7 @@ EUI:
133
133
  min: 157
134
134
  max: 315
135
135
  Strip shopping mall:
136
- min: 252
136
+ min: 157
137
137
  max: 379
138
138
  Enclosed mall:
139
139
  min: 157
@@ -145,5 +145,5 @@ EUI:
145
145
  min: 94
146
146
  max: 237
147
147
  Mixed use:
148
- min: 31
148
+ min: 100
149
149
  max: 789
@@ -217,6 +217,45 @@
217
217
  </div>
218
218
  </md-content>
219
219
 
220
+ <div ng-if="features && features[0] && features[0]['annual_values']['Future_Annual_Electricity_Emissions']" >
221
+ <h2>Emissions</h2>
222
+ <p>Multiple emissions associated with electricity may be included in the graphs below and represent different calculation approaches (e.g., future hourly and historical average). Electricity emissions values from different calculation approaches should NOT be summed together.</p>
223
+ <h3>Emissions Per Feature</h3>
224
+ <md-content class="md-padding" layout-sm="column" layout="row" layout-wrap>
225
+ <div flex-gt-sm="50" flex-gt-md="25" ng-repeat="feature in features">
226
+ <md-card>
227
+ <md-card-title>
228
+ <md-card-title-text>
229
+ <span class="md-headline">{{ feature.name }}</span>
230
+ <span class="md-subhead">Emissions per Fuel (mt CO2e)</span>
231
+ <span ng-if="feature.complete_simulation!=true" class="md-subhead error">{{errorText}}</span>
232
+ </md-card-title-text>
233
+ </md-card-title>
234
+ <md-card-content>
235
+ <nvd3 class="h-420 remove-x-lines" options="annualEmissionsChartOptions[feature.name]" data="annualEmissionsChartData[feature.name]"></nvd3>
236
+ </md-card-content>
237
+ </md-card>
238
+ </div>
239
+ </md-content>
240
+ </div>
241
+ <div ng-if="features && features[0] && features[0]['annual_values']['Future_Annual_Electricity_Emissions']" >
242
+ <h3>Emissions Per Fuel Type</h3>
243
+ <md-content class="md-padding" layout-sm="column" layout="row" layout-wrap>
244
+ <div flex-gt-sm="50" flex-gt-md="25" ng-repeat="chart in intensityCharts">
245
+ <md-card>
246
+ <md-card-title>
247
+ <md-card-title-text>
248
+ <span class="md-headline">{{ chart.name | strReplace:'_':' ' | strReplace:'Emissions':'' | strReplace:'Intensity':''}}</span>
249
+ <span class="md-subhead">Emissions Intensity per Feature (kg CO2e / ft2)</span>
250
+ </md-card-title-text>
251
+ </md-card-title>
252
+ <md-card-content>
253
+ <nvd3 class="h-420 remove-x-lines" options="annualIntensityChartOptions[chart.name]" data="annualIntensityChartData[chart.name]"></nvd3>
254
+ </md-card-content>
255
+ </md-card>
256
+ </div>
257
+ </md-content>
258
+ </div>
220
259
  </div>
221
260
 
222
261
  <div class="error">
@@ -376,10 +415,113 @@
376
415
  }
377
416
  };
378
417
 
418
+ //'#AFECE7'
419
+ $scope.defaultAnnualEmissionsChartOptions = {
420
+ chart: {
421
+ type: 'multiBarChart',
422
+ color: ['#156666', '#187C7C', '#20a0a0', '#27c6c6', '#8CC025', '#CE2828', '#F19953', '#1F77B4', '#9467BD'],
423
+ height: 320,
424
+ margin: {
425
+ top: 45,
426
+ right: 2,
427
+ bottom: 32,
428
+ left: 64
429
+ },
430
+ clipEdge: true,
431
+ groupSpacing: 0.3,
432
+ reduceXTicks: false,
433
+ stacked: false,
434
+ duration: 250,
435
+ x: function (d) {
436
+ return d.x;
437
+ },
438
+ y: function (d) {
439
+ return d.y;
440
+ },
441
+ yAxis: {
442
+ tickFormat: function (d) {
443
+ return d;
444
+ }
445
+ },
446
+ showControls: false,
447
+ legend: {
448
+ margin: {
449
+ top: 8,
450
+ bottom: 32,
451
+ left: 250,
452
+ right: 10
453
+ },
454
+ maxKeyLength: 100
455
+ },
456
+ tooltip: {
457
+ gravity: 's',
458
+ classes: 'gravity-s'
459
+ }
460
+ }
461
+ };
462
+
463
+ $scope.defaultAnnualIntensityChartOptions = {
464
+ chart: {
465
+ type: 'multiBarChart',
466
+ color: ['#187C7C', '#8CC025', '#CE2828', '#AFECE7', '#F19953', '#1F77B4', '#9467BD'],
467
+ height: 320,
468
+ margin: {
469
+ top: 45,
470
+ right: 2,
471
+ bottom: 32,
472
+ left: 64
473
+ },
474
+ clipEdge: true,
475
+ groupSpacing: 0.3,
476
+ reduceXTicks: false,
477
+ stacked: false,
478
+ duration: 250,
479
+ x: function (d) {
480
+ return d.x;
481
+ },
482
+ y: function (d) {
483
+ return d.y;
484
+ },
485
+ yAxis: {
486
+ tickFormat: function (d) {
487
+ return d;
488
+ }
489
+ },
490
+ showControls: false,
491
+ showLegend: false,
492
+ tooltip: {
493
+ gravity: 's',
494
+ classes: 'gravity-s'
495
+ }
496
+ }
497
+ };
498
+
379
499
  // use different options for each feature
380
500
  $scope.monthlyFuelChartOptions = {};
381
501
  $scope.monthlyNetChartOptions = {};
382
502
  $scope.annualEndUseChartOptions = {};
503
+ $scope.annualEmissionsChartOptions = {};
504
+ $scope.annualIntensityChartOptions = {};
505
+
506
+ $scope.emissionCharts = [
507
+ {'name': 'Future_Annual_Electricity_Emissions', 'units': 'mt CO2e', 'short': 'FA Elec', 'display': 'Future Annual Elec' },
508
+ {'name': 'Future_Hourly_Electricity_Emissions','units': 'mt CO2e', 'short': 'FH Elec', 'display': 'Future Hourly Elec' },
509
+ {'name': 'Historical_Annual_Electricity_Emissions','units': 'mt CO2e', 'short': 'HA Elec' , 'display': 'Historical Annual Elec'},
510
+ {'name': 'Historical_Hourly_Electricity_Emissions','units': 'mt CO2e', 'short': 'HH Elec', 'display': 'Historical Hourly Elec' },
511
+ {'name': 'Natural_Gas_Emissions', 'units': 'mt CO2e', 'short': 'Gas', 'display': 'Natural Gas' },
512
+ {'name': 'Propane_Emissions', 'units': 'mt CO2e', 'short': 'Propane', 'display': 'Propane'},
513
+ {'name': 'FuelOilNo2_Emissions', 'units': 'mt CO2e', 'short': 'FuelOil2', 'display': 'Fuel Oil No2' }
514
+ ];
515
+
516
+ $scope.intensityCharts = [
517
+ {'name': 'Future_Annual_Electricity_Emissions_Intensity', 'units': 'kg CO2e / ft2' },
518
+ {'name': 'Future_Hourly_Electricity_Emissions_Intensity', 'units': 'kg CO2e / ft2' },
519
+ {'name': 'Historical_Annual_Electricity_Emissions_Intensity', 'units': 'kg CO2e / ft2' },
520
+ {'name': 'Historical_Hourly_Electricity_Emissions_Intensity', 'units': 'kg CO2e / ft2' },
521
+ {'name': 'Natural_Gas_Emissions_Intensity', 'units': 'kg CO2e / ft2' },
522
+ {'name': 'Propane_Emissions_Intensity', 'units': 'kg CO2e / ft2' },
523
+ {'name': 'FuelOilNo2_Emissions_Intensity', 'units': 'kg CO2e / ft2' }
524
+ ];
383
525
 
384
526
  var months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
385
527
 
@@ -388,33 +530,47 @@
388
530
  var endUseKeys = ['Heating:Electricity', 'Cooling:Electricity', 'InteriorLights:Electricity', 'ExteriorLights:Electricity', 'ExteriorEquipment:Electricity', 'InteriorEquipment:Electricity', 'Fans:Electricity', 'Pumps:Electricity', 'HeatRejection:Electricity', 'WaterSystems:Electricity'];
389
531
 
390
532
  var kbtu_datasets = ['NaturalGas:Facility', 'Propane:Facility', 'FuelOilNo2:Facility', 'OtherFuels:Facility'];
533
+
391
534
  var changeToKbtu = false;
392
535
 
393
-
394
536
  var applicableEndUseKeys = [];
395
537
 
396
538
  $scope.monthlyFuelChartData = {};
397
539
  $scope.monthlyNetChartData = {};
398
540
  $scope.annualNetChartData = {};
399
-
400
541
  $scope.annualEndUseChartData = {};
542
+ $scope.annualEmissionsChartData = {};
543
+ $scope.annualIntensityChartData = {};
401
544
 
402
545
  // calculate global maximums across features
403
546
  var monthlyFuelYMax = 0;
404
547
  var monthlyNetYMin = 0;
405
548
  var monthlyNetYMax = 0;
406
549
  var annualTotalYMax = 0;
550
+ var annualEmissionsTotalYMax = 0;
551
+ var annualIntensityTotalYMax = 0;
407
552
 
408
553
  // also record totals per feature
409
554
  $scope.annualEndUseTotals = {};
410
555
  $scope.monthlyFuelTotals = {};
411
556
  $scope.monthlyNetTotals = {};
557
+ $scope.annualEmissionsTotals = {};
558
+ $scope.annualIntensityTotals = {};
559
+
560
+ // setup emissions intensity charts
561
+ // var intensityYMin = {};
562
+ // var intensityYMax = {};
563
+ _.forEach($scope.intensityCharts, function(chart) {
564
+ $scope.annualIntensityChartData[chart.name] = [{key: chart.name, values: []}];
565
+ // intensityYMin[chart.name] = 0;
566
+ // intensityYMax[chart.name] = 0;
567
+ });
412
568
 
413
569
  $scope.errorText = "No data. This feature either did not complete successfully or did not include an annual simulation ranging from January 1 to December 31.";
414
570
 
415
571
  // figure out max total energy use and applicable end uses
572
+
416
573
  _.forEach($scope.features, function (feature) {
417
- console.log("Feature: ", feature.name);
418
574
  var total_value = 0;
419
575
 
420
576
  _.forEach(endUseKeys, function (endUseKey) {
@@ -432,15 +588,44 @@
432
588
  // global maximum
433
589
  annualTotalYMax = _.max([annualTotalYMax, total_value]);
434
590
 
591
+ // emissions
592
+ $scope.annualEmissionsTotals[feature.name] = 0;
593
+ _.forEach($scope.emissionCharts, function(chart){
594
+ var eVal = feature.annual_values[chart.name];
595
+
596
+ if (eVal == 0 || !eVal) {
597
+ console.log("no data found for: ", chart.name);
598
+ }
599
+ else {
600
+ annualEmissionsTotalYMax = _.max([annualEmissionsTotalYMax, eVal]);
601
+ $scope.annualEmissionsTotals[feature.name] = _.max([$scope.annualEmissionsTotals[feature.name], _.round(eVal)]);
602
+ }
603
+ });
604
+
605
+ // emissions intensity
606
+ _.forEach($scope.intensityCharts, function(chart){
607
+ var iVal = feature.annual_values[chart.name];
608
+ if (iVal == 0 || !iVal) {
609
+ console.log("no data found for: ", chart.name);
610
+ } else {
611
+ // global intensity maximum
612
+ annualIntensityTotalYMax = _.max([annualIntensityTotalYMax, iVal]);
613
+ $scope.annualIntensityTotals[chart.name] = _.max([$scope.annualIntensityTotals[chart.name], _.round(iVal)]);
614
+ }
615
+ });
616
+
435
617
  });
436
618
 
619
+ // applicable end uses
437
620
  applicableEndUseKeys = _.uniq(applicableEndUseKeys).sort();
438
621
 
439
622
  // store global default
440
623
  $scope.defaultAnnualEndUseChartOptions.chart['yDomain'] = [0, _.round(annualTotalYMax)];
624
+ $scope.defaultAnnualEmissionsChartOptions.chart['yDomain'] = [0, _.round(annualEmissionsTotalYMax)];
625
+ $scope.defaultAnnualIntensityChartOptions.chart['yDomain'] = [0, _.round(annualIntensityTotalYMax)];
441
626
 
442
627
  // gather data for each feature
443
- _.forEach($scope.features, function (feature) {
628
+ _.forEach($scope.features, function (feature, feature_index) {
444
629
 
445
630
  // calculate local maximums per feature
446
631
  var localFuelYMax = 0;
@@ -448,6 +633,7 @@
448
633
  var localNetYMin = 100000000;
449
634
  var localEndUseMax = 0;
450
635
 
636
+ // annual
451
637
  if(feature['complete_simulation'] == true){
452
638
 
453
639
  // monthly fuel use
@@ -456,7 +642,7 @@
456
642
  // first iterate through all kbtu datasets to see if you'll need to change to kBtu units
457
643
  _.forEach(kbtu_datasets, function (kbtu_dataset) {
458
644
  var values = feature.monthly_values[kbtu_dataset];
459
- if (!(values.every(item => item === 0))) {
645
+ if ((typeof values !== 'undefined') && (!(values.every(item => item === 0)))) {
460
646
  changeToKbtu = true;
461
647
  }
462
648
  });
@@ -468,8 +654,8 @@
468
654
 
469
655
  if (dataset == 'Electricity:Facility') {
470
656
  // first check if there is data to include
471
- if (!(values.every(item => item === 0))) {
472
- console.log(changeToKbtu);
657
+ if ((typeof values !== 'undefined') && (!(values.every(item => item === 0)))) {
658
+ console.log("change to Kbtu: ", changeToKbtu);
473
659
  if (changeToKbtu) {
474
660
  var kBtuValues = [];
475
661
  var kwhValues = feature.monthly_values[dataset]
@@ -503,7 +689,7 @@
503
689
  }
504
690
  } else {
505
691
  // everything else gets kBtu for now
506
- if (!(values.every(item => item === 0))) {
692
+ if ((typeof values !== 'undefined') && (!(values.every(item => item === 0)))) {
507
693
  datasetUnit = dataset + '(kBtu)';
508
694
  }
509
695
  };
@@ -604,6 +790,36 @@
604
790
  $scope.annualEndUseTotals[feature.name] = _.round(localEndUseMax);
605
791
 
606
792
  }
793
+
794
+ // emissions per feature
795
+ if(feature['complete_simulation'] == true) {
796
+ $scope.annualEmissionsChartData[feature.name] = [];
797
+ _.forEach($scope.emissionCharts, function (chart){
798
+ var eValue = feature.annual_values[chart.name];
799
+
800
+ $scope.annualEmissionsChartData[feature.name].push({
801
+ key: chart.display,
802
+ values: [{
803
+ x: chart.short,
804
+ y: eValue
805
+ }]
806
+ });
807
+ });
808
+ }
809
+
810
+ // emission intensity per fuel
811
+ var the_name = _.truncate(feature.name, {'length': 4, 'omission': ''});
812
+ _.forEach($scope.intensityCharts, function(chart) {
813
+ var val = feature.annual_values[chart.name];
814
+ $scope.annualIntensityChartData[chart.name][0]['values'].push({
815
+ //x: feature_index + 1,
816
+ x: the_name,
817
+ y: val,
818
+ });
819
+ // intensityYMin[chart.name] = _.min([intensityYMin[chart.name], val]);
820
+ // intensityYMax[chart.name] = _.max([intensityYMax[chart.name], val]);
821
+ });
822
+
607
823
  });
608
824
 
609
825
  // assign chart options for each feature. assign global maximum to start
@@ -611,7 +827,11 @@
611
827
  $scope.monthlyFuelChartOptions[feature.name] = _.cloneDeep($scope.defaultMonthlyFuelChartOptions);
612
828
  $scope.monthlyNetChartOptions[feature.name] = _.cloneDeep($scope.defaultMonthlyNetChartOptions);
613
829
  $scope.annualEndUseChartOptions[feature.name] = _.cloneDeep($scope.defaultAnnualEndUseChartOptions);
614
-
830
+ $scope.annualEmissionsChartOptions[feature.name] = _.cloneDeep($scope.defaultAnnualEmissionsChartOptions);
831
+ });
832
+ // intensity default charts
833
+ _.forEach($scope.intensityCharts, function(chart){
834
+ $scope.annualIntensityChartOptions[chart.name] = _.cloneDeep($scope.defaultAnnualIntensityChartOptions);
615
835
  });
616
836
 
617
837
  // console.log("LOCAL MAXES:");
@@ -639,6 +859,10 @@
639
859
  $scope.monthlyFuelChartOptions[feature.name].chart['yDomain'] = [0, $scope.monthlyFuelTotals[feature.name]];
640
860
  $scope.monthlyNetChartOptions[feature.name].chart['yDomain'] = $scope.monthlyNetTotals[feature.name];
641
861
  $scope.annualEndUseChartOptions[feature.name].chart['yDomain'] = [0, $scope.annualEndUseTotals[feature.name]];
862
+ $scope.annualEmissionsChartOptions[feature.name].chart['yDomain'] = [0, $scope.annualEmissionsTotals[feature.name]];
863
+ });
864
+ _.forEach($scope.intensityCharts, function(chart){
865
+ $scope.annualIntensityChartOptions[chart.name].chart['yDomain'] = [0, $scope.annualIntensityTotals[chart.name]];
642
866
  });
643
867
 
644
868
  $scope.axes = 1;
@@ -649,6 +873,10 @@
649
873
  $scope.monthlyFuelChartOptions[feature.name].chart['yDomain'] = _.cloneDeep($scope.defaultMonthlyFuelChartOptions.chart['yDomain']);
650
874
  $scope.monthlyNetChartOptions[feature.name].chart['yDomain'] = _.cloneDeep($scope.defaultMonthlyNetChartOptions.chart['yDomain']);
651
875
  $scope.annualEndUseChartOptions[feature.name].chart['yDomain'] = _.cloneDeep($scope.defaultAnnualEndUseChartOptions.chart['yDomain']);
876
+ $scope.annualEmissionsChartOptions[feature.name].chart['yDomain'] = _.cloneDeep($scope.defaultAnnualEmissionsChartOptions.chart['yDomain']);
877
+ });
878
+ _.forEach($scope.intensityCharts, function(chart){
879
+ $scope.annualIntensityChartOptions[chart.name].chart['yDomain'] = _.cloneDeep($scope.defaultAnnualIntensityChartOptions.chart['yDomain']);
652
880
  });
653
881
  $scope.axes = 0;
654
882
  }
@@ -660,6 +888,15 @@
660
888
  window.dispatchEvent(new Event('resize'));
661
889
  }, 1000);
662
890
 
891
+ myApp.filter('strReplace', function () {
892
+ return function (input, from, to) {
893
+ input = input || '';
894
+ from = from || '';
895
+ to = to || '';
896
+ return input.replace(new RegExp(from, 'g'), to);
897
+ };
898
+ });
899
+
663
900
  </script>
664
901
 
665
902
  </body>
@@ -212,6 +212,30 @@
212
212
  </div>
213
213
  </md-content>
214
214
 
215
+ <div ng-if="scenarios && scenarios[0] && scenarios[0]['annual_values']['Future_Annual_Electricity_Emissions']" >
216
+ <h2>Emissions</h2>
217
+ <p>Multiple emissions associated with electricity may be included in the graphs below and represent different calculation approaches (e.g., future hourly and historical average). Electricity emissions values from different calculation approaches should NOT be summed together.</p>
218
+ <md-content class="md-padding" layout-sm="column" layout="row" layout-wrap>
219
+ <div flex-gt-sm="50" flex-gt-md="25" ng-repeat="chart in emissionCharts">
220
+ <md-card>
221
+ <md-card-title>
222
+ <md-card-title-text>
223
+ <span class="md-headline">{{ chart.name | strReplace:'_':' ' | strReplace:'Emissions':'' | strReplace:'Intensity':''}}</span>
224
+ <span class="md-subhead">
225
+ <span>Emissions</span>
226
+ <span ng-if="chart.name.includes('Intensity')"> Intensity </span>
227
+ ({{ chart.units}})</span>
228
+
229
+ <!-- <span ng-if="scenario.complete_simulation!=true" class="md-subhead error">{{errorText}}</span> -->
230
+ </md-card-title-text>
231
+ </md-card-title>
232
+ <md-card-content>
233
+ <nvd3 class="h-420 remove-x-lines" options="annualEmissionsChartOptions[chart.name]" data="annualEmissionsChartData[chart.name]"></nvd3>
234
+ </md-card-content>
235
+ </md-card>
236
+ </div>
237
+ </md-content>
238
+ </div>
215
239
  </div>
216
240
 
217
241
  <div class="error">
@@ -371,6 +395,59 @@
371
395
  }
372
396
  };
373
397
 
398
+ $scope.emissionCharts = [
399
+ {'name': 'Future_Annual_Electricity_Emissions', 'units': 'mt CO2e' },
400
+ {'name': 'Future_Hourly_Electricity_Emissions','units': 'mt CO2e' },
401
+ {'name': 'Historical_Annual_Electricity_Emissions','units': 'mt CO2e' },
402
+ {'name': 'Historical_Hourly_Electricity_Emissions','units': 'mt CO2e' },
403
+ {'name': 'Natural_Gas_Emissions', 'units': 'mt CO2e' },
404
+ {'name': 'Propane_Emissions', 'units': 'mt CO2e' },
405
+ {'name': 'FuelOilNo2_Emissions', 'units': 'mt CO2e' }
406
+ ];
407
+
408
+ $scope.annualEmissionsChartOptions = [];
409
+ _.forEach($scope.emissionCharts, function(chart) {
410
+ $scope.annualEmissionsChartOptions[chart.name] = {
411
+ chart: {
412
+ type: 'multiBarChart',
413
+ color: ['#014D4D'],
414
+ height: 320,
415
+ margin: {
416
+ top: 45,
417
+ right: 2,
418
+ bottom: 32,
419
+ left: 64
420
+ },
421
+ clipEdge: true,
422
+ groupSpacing: 0.3,
423
+ reduceXTicks: false,
424
+ stacked: false,
425
+ duration: 250,
426
+ x: function (d) {
427
+ return d.x;
428
+ },
429
+ y: function (d) {
430
+ return d.y;
431
+ },
432
+ yAxis: {
433
+ tickFormat: function (d) {
434
+ return d;
435
+ }
436
+ },
437
+ showControls: false,
438
+ showLegend: false,
439
+ tooltip: {
440
+ gravity: 's',
441
+ classes: 'gravity-s'
442
+ }
443
+ }
444
+ };
445
+ // update color for Intensity charts
446
+ if (chart.name.includes('Intensity')) {
447
+ $scope.annualEmissionsChartOptions[chart.name]['chart']['color'] = ['#8CC025'];
448
+ }
449
+ });
450
+
374
451
  var months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
375
452
 
376
453
  var datasets = ['Electricity:Facility', 'REopt:ElectricityProduced:Total', 'NaturalGas:Facility', 'Propane:Facility', 'FuelOilNo2:Facility', 'OtherFuels:Facility'];
@@ -385,9 +462,18 @@
385
462
  $scope.monthlyFuelChartData = {};
386
463
  $scope.monthlyNetChartData = {};
387
464
  $scope.annualNetChartData = {};
388
-
389
465
  $scope.annualEndUseChartData = {};
466
+ $scope.annualEmissionsChartData = {};
390
467
 
468
+ // setup emissions
469
+ var emissionsYMin = {};
470
+ var emissionsYMax = {};
471
+ _.forEach($scope.emissionCharts, function(chart) {
472
+ $scope.annualEmissionsChartData[chart.name] = [{key: chart.name, values: []}];
473
+ emissionsYMin[chart.name] = 0;
474
+ emissionsYMax[chart.name] = 0;
475
+ });
476
+
391
477
  var monthlyFuelYMax = 0;
392
478
  var monthlyNetYMin = 0;
393
479
  var monthlyNetYMax = 0;
@@ -397,7 +483,6 @@
397
483
 
398
484
  // figure out max total energy use and applicable end uses
399
485
  _.forEach($scope.scenarios, function (scenario) {
400
- console.log("SCENARIO: ", scenario.name);
401
486
  var total_value = 0;
402
487
 
403
488
  _.forEach(endUseKeys, function (endUseKey) {
@@ -417,19 +502,29 @@
417
502
 
418
503
  applicableEndUseKeys = _.uniq(applicableEndUseKeys).sort();
419
504
 
420
-
421
505
  // gather data for each scenario
422
506
  _.forEach($scope.scenarios, function (scenario) {
423
507
 
424
508
  if(scenario['complete_simulation'] == true){
425
509
 
510
+ // emissions chart
511
+ _.forEach($scope.emissionCharts, function(chart) {
512
+ var val = scenario.annual_values[chart.name];
513
+ $scope.annualEmissionsChartData[chart.name][0]['values'].push({
514
+ x: scenario.name,
515
+ y: val
516
+ });
517
+ emissionsYMin[chart.name] = _.min([emissionsYMin[chart.name], val]);
518
+ emissionsYMax[chart.name] = _.max([emissionsYMax[chart.name], val]);
519
+ });
520
+
426
521
  // monthly fuel use
427
522
  $scope.monthlyFuelChartData[scenario.name] = [];
428
523
 
429
524
  // first iterate through all kbtu datasets to see if you'll need to change to kBtu units
430
525
  _.forEach(kbtu_datasets, function (kbtu_dataset) {
431
526
  var values = scenario.monthly_values[kbtu_dataset];
432
- if (!(values.every(item => item === 0))) {
527
+ if ((typeof values !== 'undefined') && (!(values.every(item => item === 0)))) {
433
528
  changeToKbtu = true;
434
529
  }
435
530
  });
@@ -441,8 +536,8 @@
441
536
 
442
537
  if (dataset == 'Electricity:Facility') {
443
538
  // first check if there is data to include
444
- if (!(values.every(item => item === 0))) {
445
- console.log(changeToKbtu);
539
+ if ((typeof values !== 'undefined') && (!(values.every(item => item === 0)))) {
540
+ console.log("change to kbtu?", changeToKbtu);
446
541
  if (changeToKbtu) {
447
542
  var kBtuValues = [];
448
543
  var kwhValues = scenario.monthly_values[dataset]
@@ -501,7 +596,7 @@
501
596
  $scope.monthlyNetChartData[scenario.name] = [];
502
597
  var values = scenario.monthly_values['NaturalGas:Facility'];
503
598
  var changeToKbtu = false;
504
- if (!(values.every(item => item === 0))) {
599
+ if ((typeof values !== 'undefined') && (!(values.every(item => item === 0)))) {
505
600
  changeToKbtu = true
506
601
  }
507
602
  var unit = ' (kWh)'
@@ -516,6 +611,7 @@
516
611
  var value = 0;
517
612
  if (changeToKbtu){
518
613
  value = scenario.monthly_values['Electricity:Facility'][i]*3.41 + scenario.monthly_values['NaturalGas:Facility'][i] + scenario.monthly_values['Propane:Facility'][i] + scenario.monthly_values['FuelOilNo2:Facility'][i] + scenario.monthly_values['OtherFuels:Facility'][i];
614
+
519
615
  // check that we have ElectricityProduced monthly data
520
616
  if(scenario.monthly_values['REopt:ElectricityProduced:Total']) {
521
617
  value = value - scenario.monthly_values['REopt:ElectricityProduced:Total'][i]*3.41
@@ -565,13 +661,25 @@
565
661
 
566
662
  }
567
663
  });
568
- });
569
-
570
-
664
+
665
+ // fix the emissions charts Y range
666
+ _.forEach($scope.emissionCharts, function(chart) {
667
+ $scope.annualEmissionsChartOptions[chart.name].chart['yDomain'] = [_.round(emissionsYMin[chart.name]), _.round(emissionsYMax[chart.name])];
668
+ });
669
+ });
670
+
571
671
  _.delay(function () {
572
672
  window.dispatchEvent(new Event('resize'));
573
673
  }, 1000);
574
-
674
+
675
+ myApp.filter('strReplace', function () {
676
+ return function (input, from, to) {
677
+ input = input || '';
678
+ from = from || '';
679
+ to = to || '';
680
+ return input.replace(new RegExp(from, 'g'), to);
681
+ };
682
+ });
575
683
  </script>
576
684
 
577
685
  </body>
@@ -40,6 +40,6 @@
40
40
 
41
41
  module URBANopt
42
42
  module CLI
43
- VERSION = '0.8.0'.freeze
43
+ VERSION = '0.8.1'.freeze
44
44
  end
45
45
  end