diff --git a/src/app/compressed-air-assessment/compressed-air-assessment-results.service.ts b/src/app/compressed-air-assessment/compressed-air-assessment-results.service.ts index 9bf3b4c94c..fbabefc5b5 100644 --- a/src/app/compressed-air-assessment/compressed-air-assessment-results.service.ts +++ b/src/app/compressed-air-assessment/compressed-air-assessment-results.service.ts @@ -70,7 +70,7 @@ export class CompressedAirAssessmentResultsService { if (compressedAirAssessment.systemInformation.co2SavingsData) { compressedAirAssessment.systemInformation.co2SavingsData.electricityUse = baselineResults.power; dayTypeAnnualEmissionsOutput = this.assessmentCo2SavingsService.getCo2EmissionsResult(compressedAirAssessment.systemInformation.co2SavingsData, settings); - // * converts annualEmissionOutput to tonne + // * handle offset result - electricity use is passed here as kWh but the method is meant to accept MWh dayTypeAnnualEmissionsOutput = dayTypeAnnualEmissionsOutput / 1000; } dayTypeResults.push({ @@ -198,9 +198,9 @@ export class CompressedAirAssessmentResultsService { if (baselineResults && compressedAirAssessment.systemInformation.co2SavingsData) { compressedAirAssessment.systemInformation.co2SavingsData.electricityUse = allSavingsResults.adjustedResults.power; allSavingsResults.adjustedResults.annualEmissionOutput = this.assessmentCo2SavingsService.getCo2EmissionsResult(compressedAirAssessment.systemInformation.co2SavingsData, settings); - // * converts annualEmissionOutput to tonne + // * handle offset result - electricity use is passed here as kWh but the method is meant to accept MWh allSavingsResults.adjustedResults.annualEmissionOutput = allSavingsResults.adjustedResults.annualEmissionOutput / 1000; - + let currentDayTypeBaselineResult: BaselineResult = baselineResults.dayTypeResults.find(result => result.dayTypeId === dayType.dayTypeId); allSavingsResults.savings.annualEmissionOutputSavings = currentDayTypeBaselineResult.annualEmissionOutput - allSavingsResults.adjustedResults.annualEmissionOutput; } diff --git a/src/app/compressed-air-assessment/compressed-air-report/executive-summary/executive-summary.component.html b/src/app/compressed-air-assessment/compressed-air-report/executive-summary/executive-summary.component.html index 8b72532649..4ae7666178 100644 --- a/src/app/compressed-air-assessment/compressed-air-report/executive-summary/executive-summary.component.html +++ b/src/app/compressed-air-assessment/compressed-air-report/executive-summary/executive-summary.component.html @@ -218,7 +218,9 @@ - Annual Emission Output Rate (tonne CO2) + Annual Emission Output Rate + (ton CO2) + (tonne CO2) {{baselineResults.total.annualEmissionOutput | number:'1.0-0'}} @@ -261,7 +263,9 @@ - Annual Emission Savings (tonne CO2) + Annual Emission Savings + (ton CO2) + (tonne CO2) — —
{{dayTypeBaselineResult.annualEmissionOutput | - number:'1.0-0'}} tonne CO2 + number:'1.0-0'}} + (ton CO2) + (tonne CO2) +
{{dayTypeModificationResult.annualEmissionOutput - | number:'1.0-0'}} tonne CO2 + | number:'1.0-0'}} + (ton CO2) + (tonne CO2) +
@@ -221,7 +227,10 @@
{{dayTypeModificationResult.allSavingsResults.savings.annualEmissionOutputSavings - | number:'1.0-0'}} tonne CO2 + | number:'1.0-0'}} + (ton CO2) + (tonne CO2) +
diff --git a/src/app/compressed-air-assessment/explore-opportunities/explore-opportunities-results/explore-opportunities-results.component.ts b/src/app/compressed-air-assessment/explore-opportunities/explore-opportunities-results/explore-opportunities-results.component.ts index d33449d4b0..c8e8abb3eb 100644 --- a/src/app/compressed-air-assessment/explore-opportunities/explore-opportunities-results/explore-opportunities-results.component.ts +++ b/src/app/compressed-air-assessment/explore-opportunities/explore-opportunities-results/explore-opportunities-results.component.ts @@ -5,6 +5,7 @@ import { BaselineResult, BaselineResults, CompressedAirAssessmentResult, Compres import { CompressedAirAssessmentService } from '../../compressed-air-assessment.service'; import { ExploreOpportunitiesValidationService } from '../explore-opportunities-validation.service'; import { ExploreOpportunitiesService } from '../explore-opportunities.service'; +import { Settings } from '../../../shared/models/settings'; @Component({ selector: 'app-explore-opportunities-results', @@ -28,9 +29,6 @@ export class ExploreOpportunitiesResultsComponent implements OnInit { baselineResults: BaselineResults; dayTypeBaselineResult: BaselineResult; - - - addReceiverVolumeValid: boolean; addReceiverVolumeValidSub: Subscription; adjustCascadingSetPointsValid: boolean; @@ -47,11 +45,13 @@ export class ExploreOpportunitiesResultsComponent implements OnInit { useAutomaticSequencerValidSub: Subscription; hasInvalidData: boolean; isInit: boolean = true; + settings: Settings; constructor(private compressedAirAssessmentService: CompressedAirAssessmentService, private exploreOpportunitiesService: ExploreOpportunitiesService, private compressedAirAssessmentResultsService: CompressedAirAssessmentResultsService, private exploreOpportunitiesValidationService: ExploreOpportunitiesValidationService) { } ngOnInit(): void { + this.settings = this.compressedAirAssessmentService.settings.getValue(); this.setValidationSubs(); this.compressedAirAssessmentSub = this.compressedAirAssessmentService.compressedAirAssessment.subscribe(val => { if (val) { diff --git a/src/app/examples/mockCompressedAirAssessment.ts b/src/app/examples/mockCompressedAirAssessment.ts index 1ca9ac0ef6..0e98a175c3 100644 --- a/src/app/examples/mockCompressedAirAssessment.ts +++ b/src/app/examples/mockCompressedAirAssessment.ts @@ -17360,6 +17360,7 @@ export const MockCompressedAirAssessmentSettings: Settings = { "language": "English", "currency": "$", "unitsOfMeasure": "Imperial", + "emissionsUnit": "Metric", "distanceMeasurement": "ft", "flowMeasurement": "gpm", "powerMeasurement": "hp", diff --git a/src/app/examples/mockFsat.ts b/src/app/examples/mockFsat.ts index dfa683360a..289476c116 100644 --- a/src/app/examples/mockFsat.ts +++ b/src/app/examples/mockFsat.ts @@ -226,6 +226,7 @@ export const MockFsatSettings: Settings = { language: "English", currency: "$", unitsOfMeasure: "Imperial", + emissionsUnit: "Metric", distanceMeasurement: "ft", flowMeasurement: "gpm", powerMeasurement: "hp", diff --git a/src/app/examples/mockPhast.ts b/src/app/examples/mockPhast.ts index 8f1faf290d..fc87929320 100644 --- a/src/app/examples/mockPhast.ts +++ b/src/app/examples/mockPhast.ts @@ -1302,6 +1302,7 @@ export const MockPhastSettings: Settings = { co2SavingsEnergySource: "Natural Gas", co2SavingsFuelType: "Natural Gas", totalEmissionOutputRate: 401.07, + emissionsUnit: 'Metric', totalFuelEmissionOutputRate: 0, totalNaturalGasEmissionOutputRate: 53.06, totalCoalEmissionOutputRate: 0, diff --git a/src/app/examples/mockPsat.ts b/src/app/examples/mockPsat.ts index f8c7a25e58..3052755388 100644 --- a/src/app/examples/mockPsat.ts +++ b/src/app/examples/mockPsat.ts @@ -175,6 +175,7 @@ export const MockPsatSettings: Settings = { "language": "English", "currency": "$", "unitsOfMeasure": "Imperial", + "emissionsUnit": "Metric", "distanceMeasurement": "ft", "flowMeasurement": "gpm", "powerMeasurement": "hp", diff --git a/src/app/examples/mockSsmt.ts b/src/app/examples/mockSsmt.ts index 5c77be4017..f9aec484f9 100644 --- a/src/app/examples/mockSsmt.ts +++ b/src/app/examples/mockSsmt.ts @@ -450,6 +450,7 @@ export const MockSsmtSettings: Settings = { "language": "English", "currency": "$", "unitsOfMeasure": "Imperial", + "emissionsUnit": "Metric", "distanceMeasurement": "ft", "flowMeasurement": "gpm", "powerMeasurement": "hp", diff --git a/src/app/examples/mockTreasureHunt.ts b/src/app/examples/mockTreasureHunt.ts index a8fcea959e..3dadedd1a3 100644 --- a/src/app/examples/mockTreasureHunt.ts +++ b/src/app/examples/mockTreasureHunt.ts @@ -1394,6 +1394,7 @@ export const MockTreasureHuntSettings: Settings = { "language": "English", "currency": "$", "unitsOfMeasure": "Imperial", + "emissionsUnit": "Metric", "distanceMeasurement": "ft", "flowMeasurement": "gpm", "powerMeasurement": "hp", diff --git a/src/app/examples/mockWasteWater.ts b/src/app/examples/mockWasteWater.ts index ce4f023fdb..8ae7fee469 100644 --- a/src/app/examples/mockWasteWater.ts +++ b/src/app/examples/mockWasteWater.ts @@ -141,6 +141,7 @@ export const MockWasteWaterSettings: Settings = { "language": "English", "currency": "$", "unitsOfMeasure": "Imperial", + "emissionsUnit": "Metric", "distanceMeasurement": "ft", "flowMeasurement": "MGD", "powerMeasurement": "hp", diff --git a/src/app/fsat/fsat-report/results-summary/results-summary.component.html b/src/app/fsat/fsat-report/results-summary/results-summary.component.html index b23f5009f9..ac5a3c3b67 100644 --- a/src/app/fsat/fsat-report/results-summary/results-summary.component.html +++ b/src/app/fsat/fsat-report/results-summary/results-summary.component.html @@ -138,7 +138,10 @@

Report Results

- Annual CO2 Emissions (tonne CO2) + Annual CO2 Emissions + (ton CO2) + (tonne CO2) + {{fsat.outputs.co2EmissionsOutput | number:'1.1-1'}} Report Results - Annual CO2 Emissions Savings (tonne CO2) + Annual CO2 Emissions Savings + (ton CO2) + (tonne CO2) + — diff --git a/src/app/fsat/fsat-results/fsat-results-panel/fsat-results-panel.component.html b/src/app/fsat/fsat-results/fsat-results-panel/fsat-results-panel.component.html index 3683e467c5..6c4ba664dc 100644 --- a/src/app/fsat/fsat-results/fsat-results-panel/fsat-results-panel.component.html +++ b/src/app/fsat/fsat-results/fsat-results-panel/fsat-results-panel.component.html @@ -224,7 +224,10 @@
- Annual CO2 Emissions (tonne CO2) + Annual CO2 Emissions + (ton CO2) + (tonne CO2) +
{{baselineResults.co2EmissionsOutput | number:'1.1-1'}} @@ -238,7 +241,10 @@
- Annual CO2 Emissions Savings (tonne CO2) + Annual CO2 Emissions Savings + (ton CO2) + (tonne CO2) +
diff --git a/src/app/fsat/fsat-results/fsat-results-panel/fsat-results-panel.component.ts b/src/app/fsat/fsat-results/fsat-results-panel/fsat-results-panel.component.ts index dba316e38a..e30e184007 100644 --- a/src/app/fsat/fsat-results/fsat-results-panel/fsat-results-panel.component.ts +++ b/src/app/fsat/fsat-results/fsat-results-panel/fsat-results-panel.component.ts @@ -36,6 +36,7 @@ export class FsatResultsPanelComponent implements OnInit { constructor(private fsatService: FsatService) { } ngOnInit() { + console.log('settings', this.settings); this.updateDataSub = this.fsatService.updateData.subscribe(() => { this.getResults(); }); if (this.fsat.modifications && this.fsat.modifications.length > 0) { this.isWhatIfScenario = this.fsat.modifications[this.modificationIndex].fsat.whatIfScenario; diff --git a/src/app/motor-inventory/motor-inventory-summary/inventory-summary-overview/inventory-overview-table/inventory-overview-table.component.html b/src/app/motor-inventory/motor-inventory-summary/inventory-summary-overview/inventory-overview-table/inventory-overview-table.component.html index dad9f6a43d..51ccef507e 100644 --- a/src/app/motor-inventory/motor-inventory-summary/inventory-summary-overview/inventory-overview-table/inventory-overview-table.component.html +++ b/src/app/motor-inventory/motor-inventory-summary/inventory-summary-overview/inventory-overview-table/inventory-overview-table.component.html @@ -48,11 +48,13 @@ - {{departmentSummaryItem.co2EmissionOutput | number :'1.0-0'}} tonne CO2 + {{departmentSummaryItem.co2EmissionOutput | number :'1.0-0'}} - — tonne CO2 + — + (ton CO2) + (tonne CO2) @@ -82,11 +84,13 @@ - {{inventorySummary.totalEmissions | number :'1.0-0'}} tonne CO2 + {{inventorySummary.totalEmissions | number :'1.0-0'}} - — tonne CO2 + — + (ton CO2) + (tonne CO2) diff --git a/src/app/motor-inventory/motor-inventory-summary/inventory-summary-overview/inventory-overview-table/inventory-overview-table.component.ts b/src/app/motor-inventory/motor-inventory-summary/inventory-summary-overview/inventory-overview-table/inventory-overview-table.component.ts index d93e62f11c..b0b13f2feb 100644 --- a/src/app/motor-inventory/motor-inventory-summary/inventory-summary-overview/inventory-overview-table/inventory-overview-table.component.ts +++ b/src/app/motor-inventory/motor-inventory-summary/inventory-summary-overview/inventory-overview-table/inventory-overview-table.component.ts @@ -1,6 +1,7 @@ -import { Component, ElementRef, OnInit, ViewChild } from '@angular/core'; +import { Component, ElementRef, Input, OnInit, ViewChild } from '@angular/core'; import { Subscription } from 'rxjs'; import { InventorySummaryOverviewService, InventorySummary } from '../inventory-summary-overview.service'; +import { Settings } from '../../../../shared/models/settings'; @Component({ selector: 'app-inventory-overview-table', @@ -10,6 +11,8 @@ import { InventorySummaryOverviewService, InventorySummary } from '../inventory- export class InventoryOverviewTableComponent implements OnInit { @ViewChild('copyTable', { static: false }) copyTable: ElementRef; tableString: any; + @Input() + settings: Settings; inventorySummary: InventorySummary; invetorySummarySub: Subscription; constructor(private inventorySummaryOverviewService: InventorySummaryOverviewService) { } diff --git a/src/app/motor-inventory/motor-inventory-summary/inventory-summary-overview/inventory-summary-overview.component.html b/src/app/motor-inventory/motor-inventory-summary/inventory-summary-overview/inventory-summary-overview.component.html index 7740e9838b..63afcd151c 100644 --- a/src/app/motor-inventory/motor-inventory-summary/inventory-summary-overview/inventory-summary-overview.component.html +++ b/src/app/motor-inventory/motor-inventory-summary/inventory-summary-overview/inventory-summary-overview.component.html @@ -1,6 +1,6 @@
- +
diff --git a/src/app/motor-inventory/motor-inventory-summary/inventory-summary-overview/inventory-summary-overview.component.ts b/src/app/motor-inventory/motor-inventory-summary/inventory-summary-overview/inventory-summary-overview.component.ts index 5e56b8c317..36aba429f7 100644 --- a/src/app/motor-inventory/motor-inventory-summary/inventory-summary-overview/inventory-summary-overview.component.ts +++ b/src/app/motor-inventory/motor-inventory-summary/inventory-summary-overview/inventory-summary-overview.component.ts @@ -2,6 +2,7 @@ import { Component, OnInit } from '@angular/core'; import { MotorInventoryService } from '../../motor-inventory.service'; import { InventorySummaryOverviewService } from './inventory-summary-overview.service'; import { Subscription } from 'rxjs'; +import { Settings } from '../../../shared/models/settings'; @Component({ selector: 'app-inventory-summary-overview', templateUrl: './inventory-summary-overview.component.html', @@ -10,9 +11,11 @@ import { Subscription } from 'rxjs'; export class InventorySummaryOverviewComponent implements OnInit { filterInventorySummarySub: Subscription; + settings: Settings; constructor(private motorInventoryService: MotorInventoryService, private inventorySummaryOverviewService: InventorySummaryOverviewService) { } ngOnInit(): void { + this.settings = this.motorInventoryService.settings.getValue(); this.filterInventorySummarySub = this.motorInventoryService.filterInventorySummary.subscribe(val => { this.inventorySummaryOverviewService.setDepartmentSummaryItems(); }) diff --git a/src/app/phast/losses/operations/co2-savings-phast/co2-savings-phast.service.ts b/src/app/phast/losses/operations/co2-savings-phast/co2-savings-phast.service.ts index ae1fd6d373..73555709b5 100644 --- a/src/app/phast/losses/operations/co2-savings-phast/co2-savings-phast.service.ts +++ b/src/app/phast/losses/operations/co2-savings-phast/co2-savings-phast.service.ts @@ -193,6 +193,10 @@ export class Co2SavingsPhastService { return energyValue; } + /** + * Returns total emissions output in tons (imperial) or tonne (metric) + * @param phast - emissions output rates in GJ/MMBtu + */ setCo2EmissionsResults(phast: PHAST, results: PhastResults, settings: Settings): PhastCo2EmissionsOutput { let phastCopy: PHAST = JSON.parse(JSON.stringify(phast)); let resultsCopy: PhastResults = JSON.parse(JSON.stringify(results)); @@ -261,6 +265,16 @@ export class Co2SavingsPhastService { co2EmissionsOutput.totalEmissionOutput = co2EmissionsOutput.hourlyTotalEmissionOutput * phastCopy.operatingHours.hoursPerYear; } + if (settings.emissionsUnit !== 'Metric') { + co2EmissionsOutput.hourlyTotalEmissionOutput = co2EmissionsOutput.hourlyTotalEmissionOutput !== undefined? this.convertUnitsService.value(co2EmissionsOutput.hourlyTotalEmissionOutput).from('tonne').to('ton') : undefined; + co2EmissionsOutput.emissionsSavings = co2EmissionsOutput.emissionsSavings !== undefined? this.convertUnitsService.value(co2EmissionsOutput.emissionsSavings).from('tonne').to('ton') : undefined; + co2EmissionsOutput.totalEmissionOutput = co2EmissionsOutput.totalEmissionOutput !== undefined? this.convertUnitsService.value(co2EmissionsOutput.totalEmissionOutput).from('tonne').to('ton') : undefined; + co2EmissionsOutput.fuelEmissionOutput = co2EmissionsOutput.fuelEmissionOutput !== undefined? this.convertUnitsService.value(co2EmissionsOutput.fuelEmissionOutput).from('tonne').to('ton') : undefined; + co2EmissionsOutput.electricityEmissionOutput = co2EmissionsOutput.electricityEmissionOutput !== undefined? this.convertUnitsService.value(co2EmissionsOutput.electricityEmissionOutput).from('tonne').to('ton') : undefined; + co2EmissionsOutput.electrodeEmissionsOutput = co2EmissionsOutput.electrodeEmissionsOutput !== undefined? this.convertUnitsService.value(co2EmissionsOutput.electrodeEmissionsOutput).from('tonne').to('ton') : undefined; + co2EmissionsOutput.otherFuelEmissionsOutput = co2EmissionsOutput.otherFuelEmissionsOutput !== undefined? this.convertUnitsService.value(co2EmissionsOutput.otherFuelEmissionsOutput).from('tonne').to('ton') : undefined; + co2EmissionsOutput.coalCarbonEmissionsOutput = co2EmissionsOutput.coalCarbonEmissionsOutput !== undefined? this.convertUnitsService.value(co2EmissionsOutput.coalCarbonEmissionsOutput).from('tonne').to('ton') : undefined; + } return co2EmissionsOutput; } diff --git a/src/app/phast/phast-report/executive-summary/executive-summary.component.html b/src/app/phast/phast-report/executive-summary/executive-summary.component.html index 84c96711b6..39e129025e 100644 --- a/src/app/phast/phast-report/executive-summary/executive-summary.component.html +++ b/src/app/phast/phast-report/executive-summary/executive-summary.component.html @@ -54,7 +54,10 @@ - Total CO2 Emissions (tonne CO2) + Total CO2 Emissions + (ton CO2) + (tonne CO2) + {{baselineSummary.co2EmissionsOutput.totalEmissionOutput | number:'1.0-2'}} Assessment Executive Summary - CO2 Emissions Savings (tonne CO2) + CO2 Emissions Savings + (ton CO2) + (tonne CO2) + — — @@ -331,7 +337,10 @@ - Electrical CO2 Emissions (tonne CO2) + Electrical CO2 Emissions + (ton CO2) + (tonne CO2) + {{baselinePhastResults.co2EmissionsOutput.electricityEmissionOutput | number:'1.0-2'}} Assessment Executive Summary - Natural Gas CO2 Emissions (tonne - CO2) - Fuel CO2 Emissions (tonne - CO2) + Natural Gas CO2 Emissions + (ton CO2) + (tonne CO2) + + Fuel CO2 Emissions + (ton CO2) + (tonne CO2) + {{baselinePhastResults.co2EmissionsOutput.fuelEmissionOutput | number:'1.0-2'}} Assessment Executive Summary - Coal Carbon CO2 Emissions (tonne CO2) + Coal Carbon CO2 Emissions + (ton CO2) + (tonne CO2) + {{baselinePhastResults.co2EmissionsOutput.coalCarbonEmissionsOutput | number:'1.0-2'}} Assessment Executive Summary - Electrode CO2 Emissions (tonne CO2) + Electrode CO2 Emissions + (ton CO2) + (tonne CO2) + {{baselinePhastResults.co2EmissionsOutput.electrodeEmissionsOutput | number:'1.0-2'}} Assessment Executive Summary - Other Fuel CO2 Emissions (tonne CO2) + Other Fuel CO2 Emissions + (ton CO2) + (tonne CO2) + {{baselinePhastResults.co2EmissionsOutput.otherFuelEmissionsOutput | diff --git a/src/app/phast/phast-report/results-data/results-data.component.html b/src/app/phast/phast-report/results-data/results-data.component.html index f6070f674f..1f1a8a4d18 100644 --- a/src/app/phast/phast-report/results-data/results-data.component.html +++ b/src/app/phast/phast-report/results-data/results-data.component.html @@ -404,7 +404,10 @@ - CO2 Emissions (tonne CO2/hr) + CO2 Emissions + (ton CO2) + (tonne CO2) + {{baseLineResults.co2EmissionsOutput.hourlyTotalEmissionOutput | number:'1.0-2'}} @@ -419,7 +422,10 @@ - CO2 Emissions Savings (tonne CO2/hr) + CO2 Emissions Savings + (ton CO2) + (tonne CO2) + — — diff --git a/src/app/phast/phast-results.service.ts b/src/app/phast/phast-results.service.ts index eacb9812e2..5c9574e978 100644 --- a/src/app/phast/phast-results.service.ts +++ b/src/app/phast/phast-results.service.ts @@ -261,7 +261,7 @@ export class PhastResultsService { } if (phast.co2SavingsData) { - results.co2EmissionsOutput = this.co2SavingPhastService.setCo2EmissionsResults(phast, results, settings); + results.co2EmissionsOutput = this.co2SavingPhastService.setCo2EmissionsResults(phast, results, settings); } // * IMPORTANT - grossHeatInput is in differing units/time depending on energy source type. diff --git a/src/app/psat/explore-opportunities/explore-opportunities-results/explore-opportunities-results.component.html b/src/app/psat/explore-opportunities/explore-opportunities-results/explore-opportunities-results.component.html index db664df5b2..d4240e9b74 100644 --- a/src/app/psat/explore-opportunities/explore-opportunities-results/explore-opportunities-results.component.html +++ b/src/app/psat/explore-opportunities/explore-opportunities-results/explore-opportunities-results.component.html @@ -180,7 +180,10 @@
- Annual CO2 Emissions (tonne CO2) + Annual CO2 Emissions + (ton CO2) + (tonne CO2) +
{{baselineResults.co2EmissionsOutput | number:'1.1-1'}} @@ -194,7 +197,10 @@
- Annual CO2 Emissions Savings (tonne CO2) + Annual CO2 Emissions Savings + (ton CO2) + (tonne CO2) +
diff --git a/src/app/psat/psat-report/output-summary/output-summary.component.html b/src/app/psat/psat-report/output-summary/output-summary.component.html index 0389441731..9a0d90e9c8 100644 --- a/src/app/psat/psat-report/output-summary/output-summary.component.html +++ b/src/app/psat/psat-report/output-summary/output-summary.component.html @@ -145,7 +145,10 @@

Report Results

- Annual CO2 Emissions (tonne CO2) + Annual CO2 Emissions + (ton CO2) + (tonne CO2) + {{psat.outputs.co2EmissionsOutput | number:'1.1-1'}} Report Results - Annual CO2 Emissions Savings (tonne CO2) + Annual CO2 Emissions Savings + (ton CO2) + (tonne CO2) + — diff --git a/src/app/pump-inventory/pump-inventory-summary/inventory-summary-overview/inventory-overview-table/inventory-overview-table.component.html b/src/app/pump-inventory/pump-inventory-summary/inventory-summary-overview/inventory-overview-table/inventory-overview-table.component.html index 295a4179f6..1c897ca240 100644 --- a/src/app/pump-inventory/pump-inventory-summary/inventory-summary-overview/inventory-overview-table/inventory-overview-table.component.html +++ b/src/app/pump-inventory/pump-inventory-summary/inventory-summary-overview/inventory-overview-table/inventory-overview-table.component.html @@ -48,11 +48,13 @@ - {{departmentSummaryItem.co2EmissionOutput | number :'1.0-0'}} tonne CO2 + {{departmentSummaryItem.co2EmissionOutput | number :'1.0-0'}} - — tonne CO2 + — + (ton CO2) + (tonne CO2) @@ -82,11 +84,13 @@ - {{inventorySummary.totalEmissions | number :'1.0-0'}} tonne CO2 + {{inventorySummary.totalEmissions | number :'1.0-0'}} - — tonne CO2 + — + (ton CO2) + (tonne CO2) diff --git a/src/app/pump-inventory/pump-inventory-summary/inventory-summary-overview/inventory-overview-table/inventory-overview-table.component.ts b/src/app/pump-inventory/pump-inventory-summary/inventory-summary-overview/inventory-overview-table/inventory-overview-table.component.ts index 367506d7da..a2425e8669 100644 --- a/src/app/pump-inventory/pump-inventory-summary/inventory-summary-overview/inventory-overview-table/inventory-overview-table.component.ts +++ b/src/app/pump-inventory/pump-inventory-summary/inventory-summary-overview/inventory-overview-table/inventory-overview-table.component.ts @@ -1,6 +1,7 @@ -import { Component, ElementRef, OnInit, ViewChild } from '@angular/core'; +import { Component, ElementRef, Input, OnInit, ViewChild } from '@angular/core'; import { Subscription } from 'rxjs'; import { InventorySummary, InventorySummaryOverviewService } from '../inventory-summary-overview.service'; +import { Settings } from '../../../../shared/models/settings'; @Component({ selector: 'app-pump-inventory-overview-table', @@ -9,6 +10,8 @@ import { InventorySummary, InventorySummaryOverviewService } from '../inventory- }) export class InventoryOverviewTableComponent implements OnInit { @ViewChild('copyTable', { static: false }) copyTable: ElementRef; + @Input() + settings: Settings; tableString: any; inventorySummary: InventorySummary; invetorySummarySub: Subscription; diff --git a/src/app/pump-inventory/pump-inventory-summary/inventory-summary-overview/inventory-summary-overview.component.html b/src/app/pump-inventory/pump-inventory-summary/inventory-summary-overview/inventory-summary-overview.component.html index 953162e4b8..5d784c8bcc 100644 --- a/src/app/pump-inventory/pump-inventory-summary/inventory-summary-overview/inventory-summary-overview.component.html +++ b/src/app/pump-inventory/pump-inventory-summary/inventory-summary-overview/inventory-summary-overview.component.html @@ -1,6 +1,6 @@
- +
diff --git a/src/app/pump-inventory/pump-inventory-summary/inventory-summary-overview/inventory-summary-overview.component.ts b/src/app/pump-inventory/pump-inventory-summary/inventory-summary-overview/inventory-summary-overview.component.ts index c31ea009dc..3767ae2a3d 100644 --- a/src/app/pump-inventory/pump-inventory-summary/inventory-summary-overview/inventory-summary-overview.component.ts +++ b/src/app/pump-inventory/pump-inventory-summary/inventory-summary-overview/inventory-summary-overview.component.ts @@ -2,6 +2,7 @@ import { Component, OnInit } from '@angular/core'; import { Subscription } from 'rxjs'; import { PumpInventoryService } from '../../pump-inventory.service'; import { InventorySummaryOverviewService } from './inventory-summary-overview.service'; +import { Settings } from '../../../shared/models/settings'; @Component({ @@ -11,9 +12,11 @@ import { InventorySummaryOverviewService } from './inventory-summary-overview.se }) export class InventorySummaryOverviewComponent implements OnInit { filterInventorySummarySub: Subscription; + settings: Settings; constructor(private pumpInventoryService: PumpInventoryService, private inventorySummaryOverviewService: InventorySummaryOverviewService) { } ngOnInit(): void { + this.settings = this.pumpInventoryService.settings.getValue(); this.filterInventorySummarySub = this.pumpInventoryService.filterInventorySummary.subscribe(val => { this.inventorySummaryOverviewService.setDepartmentSummaryItems(); }); diff --git a/src/app/report-rollup/compressed-air-report-rollup.service.ts b/src/app/report-rollup/compressed-air-report-rollup.service.ts index 993b64f5d5..db848901d7 100644 --- a/src/app/report-rollup/compressed-air-report-rollup.service.ts +++ b/src/app/report-rollup/compressed-air-report-rollup.service.ts @@ -122,19 +122,14 @@ export class CompressedAirReportRollupService { sumCost += result.modificationResults.totalAnnualOperatingCost; diffEnergy = result.baselineResults.total.energyUse - result.modificationResults.allSavingsResults.adjustedResults.power; sumEnergy += result.modificationResults.allSavingsResults.adjustedResults.power; - - //1000 kg / 1 tonne - let co2SavingsConvertedTonne = result.modificationResults.allSavingsResults.savings.annualEmissionOutputSavings / 1000; - sumCo2Savings += co2SavingsConvertedTonne; - let co2EmissionsConvertedTonne = result.modificationResults.annualEmissionOutput / 1000; - sumCo2Emissions += co2EmissionsConvertedTonne; + // * results already in ton/tonne (calculated from assessment) + sumCo2Savings += result.modificationResults.allSavingsResults.savings.annualEmissionOutputSavings; + sumCo2Emissions += result.modificationResults.annualEmissionOutput; } else { sumCost += result.baselineResults.total.totalAnnualOperatingCost; sumEnergy += result.baselineResults.total.energyUse; - - //1000 kg / 1 tonne - let co2EmissionsConvertedTonne = result.baselineResults.total.annualEmissionOutput / 1000; - sumCo2Emissions += co2EmissionsConvertedTonne; + // * results already in ton/tonne (calculated from assessment) + sumCo2Emissions += result.baselineResults.total.annualEmissionOutput; } sumSavings += diffCost; sumEnergySavings += diffEnergy; diff --git a/src/app/report-rollup/report-rollup.service.ts b/src/app/report-rollup/report-rollup.service.ts index 181921032a..8f36d898bd 100644 --- a/src/app/report-rollup/report-rollup.service.ts +++ b/src/app/report-rollup/report-rollup.service.ts @@ -173,4 +173,16 @@ export class ReportRollupService { } } + getCarbonEmissionsUnit(settings: Settings): string { + let carbonEmissionsUnit = 'tonne CO2'; + if (settings.emissionsUnit !== 'Metric') { + carbonEmissionsUnit = 'ton CO2'; + } + return carbonEmissionsUnit + } + + getAnnualCarbonEmissionsLabel(carbonEmissionsUnit: string): string { + return `Annual CO2 Emissions (${carbonEmissionsUnit})` + } + } diff --git a/src/app/report-rollup/report-summary-graphs/report-summary-graphs-print/report-summary-graphs-print.component.html b/src/app/report-rollup/report-summary-graphs/report-summary-graphs-print/report-summary-graphs-print.component.html index 3c86d15ee7..b39b7e5cfa 100644 --- a/src/app/report-rollup/report-summary-graphs/report-summary-graphs-print/report-summary-graphs-print.component.html +++ b/src/app/report-rollup/report-summary-graphs/report-summary-graphs-print/report-summary-graphs-print.component.html @@ -34,13 +34,15 @@
- +
diff --git a/src/app/report-rollup/report-summary-graphs/report-summary-graphs-print/report-summary-graphs-print.component.ts b/src/app/report-rollup/report-summary-graphs/report-summary-graphs-print/report-summary-graphs-print.component.ts index 86b298bc06..7a76063896 100644 --- a/src/app/report-rollup/report-summary-graphs/report-summary-graphs-print/report-summary-graphs-print.component.ts +++ b/src/app/report-rollup/report-summary-graphs/report-summary-graphs-print/report-summary-graphs-print.component.ts @@ -30,6 +30,9 @@ export class ReportSummaryGraphsPrintComponent implements OnInit { carbonBarChartSub: Subscription; carbonBarChart: Array; + + carbonEmissionsUnit: string; + carbonEmissionsBarYLabel: string; settings: Settings; settingsSub: Subscription; @@ -41,6 +44,8 @@ export class ReportSummaryGraphsPrintComponent implements OnInit { this.settingsSub = this.reportRollupService.settings.subscribe(settings => { this.settings = settings; this.reportSummaryEnergyUnit = settings.commonRollupUnit; + this.carbonEmissionsUnit = this.reportRollupService.getCarbonEmissionsUnit(settings); + this.carbonEmissionsBarYLabel = this.reportRollupService.getAnnualCarbonEmissionsLabel(this.carbonEmissionsUnit); }); this.pieChartDataSub = this.reportSummaryGraphService.reportSummaryGraphData.subscribe(val => { this.pieChartData = val; diff --git a/src/app/report-rollup/report-summary-graphs/report-summary-graphs.component.html b/src/app/report-rollup/report-summary-graphs/report-summary-graphs.component.html index d9b5568e11..7d1d9e0fb4 100644 --- a/src/app/report-rollup/report-summary-graphs/report-summary-graphs.component.html +++ b/src/app/report-rollup/report-summary-graphs/report-summary-graphs.component.html @@ -56,13 +56,15 @@

Annual Carbon Emissions

-
diff --git a/src/app/report-rollup/report-summary-graphs/report-summary-graphs.component.ts b/src/app/report-rollup/report-summary-graphs/report-summary-graphs.component.ts index e63eace3b0..66d9c5b97e 100644 --- a/src/app/report-rollup/report-summary-graphs/report-summary-graphs.component.ts +++ b/src/app/report-rollup/report-summary-graphs/report-summary-graphs.component.ts @@ -31,6 +31,9 @@ export class ReportSummaryGraphsComponent implements OnInit { carbonBarChartSub: Subscription; carbonBarChart: Array; + carbonEmissionsUnit: string; + carbonEmissionsBarYLabel: string; + settings: Settings; settingsSub: Subscription; @@ -43,6 +46,8 @@ export class ReportSummaryGraphsComponent implements OnInit { this.settingsSub = this.reportRollupService.settings.subscribe(settings => { this.settings = settings; this.reportSummaryEnergyUnit = settings.commonRollupUnit; + this.carbonEmissionsUnit = this.reportRollupService.getCarbonEmissionsUnit(settings); + this.carbonEmissionsBarYLabel = this.reportRollupService.getAnnualCarbonEmissionsLabel(this.carbonEmissionsUnit); }); this.pieChartDataSub = this.reportSummaryGraphService.reportSummaryGraphData.subscribe(val => { this.pieChartData = val; diff --git a/src/app/report-rollup/report-summary-graphs/report-summary-graphs.service.ts b/src/app/report-rollup/report-summary-graphs/report-summary-graphs.service.ts index ad14e5c481..150c46b038 100644 --- a/src/app/report-rollup/report-summary-graphs/report-summary-graphs.service.ts +++ b/src/app/report-rollup/report-summary-graphs/report-summary-graphs.service.ts @@ -12,6 +12,7 @@ import { SsmtReportRollupService } from '../ssmt-report-rollup.service'; import { WasteWaterReportRollupService } from '../waste-water-report-rollup.service'; import * as _ from 'lodash'; import { BarChartDataItem } from '../rollup-summary-bar-chart/rollup-summary-bar-chart.component'; +import { ReportRollupService } from '../report-rollup.service'; @Injectable() export class ReportSummaryGraphsService { @@ -24,6 +25,7 @@ export class ReportSummaryGraphsService { constructor(private convertUnitsService: ConvertUnitsService, private compressedAirReportRollupService: CompressedAirReportRollupService, private fsatReportRollupService: FsatReportRollupService, private phastReportRollupService: PhastReportRollupService, private psatReportRollupService: PsatReportRollupService, private ssmtReportRollupService: SsmtReportRollupService, + private reportRollupService: ReportRollupService, private wasteWaterReportRollupService: WasteWaterReportRollupService) { this.reportSummaryGraphData = new BehaviorSubject>(new Array()); this.energyChartData = new BehaviorSubject>(new Array()); @@ -119,7 +121,7 @@ export class ReportSummaryGraphsService { reportSummaryCostData.push(costBarChartItem); } if (compressedAirTotals.carbonEmissions != 0) { - let carbonBarChartItem: BarChartDataItem = this.getCO2BarChartItem(compressedAirTotals, 'Compressed Air', '#7030A0'); + let carbonBarChartItem: BarChartDataItem = this.getCO2BarChartItem(compressedAirTotals, 'Compressed Air', '#7030A0', settings); reportSummaryCarbonData.push(carbonBarChartItem); } if (fsatTotals.totalEnergy != 0) { @@ -133,7 +135,7 @@ export class ReportSummaryGraphsService { reportSummaryCostData.push(costBarChartItem); } if (fsatTotals.carbonEmissions != 0){ - let carbonBarChartItem: BarChartDataItem = this.getCO2BarChartItem(fsatTotals, 'Fans', '#FFE400'); + let carbonBarChartItem: BarChartDataItem = this.getCO2BarChartItem(fsatTotals, 'Fans', '#FFE400', settings); reportSummaryCarbonData.push(carbonBarChartItem); } if (phastTotals.totalEnergy != 0) { @@ -147,7 +149,7 @@ export class ReportSummaryGraphsService { reportSummaryCostData.push(costBarChartItem); } if (phastTotals.carbonEmissions != 0) { - let carbonBarChartItem: BarChartDataItem = this.getCO2BarChartItem(phastTotals, 'Process Heating', '#bf3d00'); + let carbonBarChartItem: BarChartDataItem = this.getCO2BarChartItem(phastTotals, 'Process Heating', '#bf3d00', settings); reportSummaryCarbonData.push(carbonBarChartItem); } if (ssmtTotals.totalEnergy != 0) { @@ -161,7 +163,7 @@ export class ReportSummaryGraphsService { reportSummaryCostData.push(costBarChartItem); } if (ssmtTotals.carbonEmissions != 0) { - let carbonBarChartItem: BarChartDataItem = this.getCO2BarChartItem(ssmtTotals, 'Steam', '#F39C12'); + let carbonBarChartItem: BarChartDataItem = this.getCO2BarChartItem(ssmtTotals, 'Steam', '#F39C12', settings); reportSummaryCarbonData.push(carbonBarChartItem); } if (psatTotals.totalEnergy != 0) { @@ -175,7 +177,7 @@ export class ReportSummaryGraphsService { reportSummaryCostData.push(costBarChartItem); } if (psatTotals.carbonEmissions != 0) { - let carbonBarChartItem: BarChartDataItem = this.getCO2BarChartItem(psatTotals, 'Pumps', '#2980b9'); + let carbonBarChartItem: BarChartDataItem = this.getCO2BarChartItem(psatTotals, 'Pumps', '#2980b9', settings); reportSummaryCarbonData.push(carbonBarChartItem); } if (wasteWaterTotals.totalEnergy != 0) { @@ -189,7 +191,7 @@ export class ReportSummaryGraphsService { reportSummaryCostData.push(costBarChartItem); } if (wasteWaterTotals.carbonEmissions != 0) { - let carbonBarChartItem: BarChartDataItem = this.getCO2BarChartItem(wasteWaterTotals, 'Waste Water', '#003087'); + let carbonBarChartItem: BarChartDataItem = this.getCO2BarChartItem(wasteWaterTotals, 'Waste Water', '#003087', settings); reportSummaryCarbonData.push(carbonBarChartItem); } this.reportSummaryGraphData.next(reportSummaryGraphData); @@ -251,8 +253,9 @@ export class ReportSummaryGraphsService { } } - getCO2BarChartItem(totals: ReportUtilityTotal, equipmentName: string, color: string): BarChartDataItem { - let hoverTemplate: string = '%{y:,.0f} ' + 'tonne CO2'; + getCO2BarChartItem(totals: ReportUtilityTotal, equipmentName: string, color: string, settings: Settings): BarChartDataItem { + let carbonEmissionsUnit = this.reportRollupService.getCarbonEmissionsUnit(settings); + let hoverTemplate: string = '%{y:,.0f} ' + carbonEmissionsUnit; let baselineCO2: number = totals.carbonEmissions + totals.carbonSavings; let modCO2: number = totals.carbonEmissions; return { diff --git a/src/app/report-rollup/report-summary-graphs/report-summary-pie-chart/report-summary-pie-chart.component.ts b/src/app/report-rollup/report-summary-graphs/report-summary-pie-chart/report-summary-pie-chart.component.ts index e67ff3e3b8..e01a8b88c4 100644 --- a/src/app/report-rollup/report-summary-graphs/report-summary-pie-chart/report-summary-pie-chart.component.ts +++ b/src/app/report-rollup/report-summary-graphs/report-summary-pie-chart/report-summary-pie-chart.component.ts @@ -1,6 +1,7 @@ import { Component, OnInit, Input, ElementRef, ViewChild, ChangeDetectorRef } from '@angular/core'; import { PlotlyService } from 'angular-plotly.js'; import { PieChartDataItem } from '../../rollup-summary-pie-chart/rollup-summary-pie-chart.component'; +import { Settings } from '../../../shared/models/settings'; @Component({ selector: 'app-report-summary-pie-chart', @@ -19,6 +20,9 @@ export class ReportSummaryPieChartComponent implements OnInit { energyUnit: string; @Input() printView: boolean; + @Input() + carbonEmissionsUnit: string; + @ViewChild('reportSummaryPieChart', { static: false }) reportSummaryPieChart: ElementRef; @@ -76,7 +80,7 @@ export class ReportSummaryPieChartComponent implements OnInit { valuesArr = this.pieChartData.map(dataItem => { return dataItem.carbonEmissions }); - textTemplate = '%{label}:
%{value:,.0f} ' + 'tonne CO2'; + textTemplate = '%{label}:
%{value:,.0f} ' + this.carbonEmissionsUnit; } let data = [{ values: valuesArr, @@ -145,7 +149,7 @@ export class ReportSummaryPieChartComponent implements OnInit { valuesArr = this.pieChartData.map(dataItem => { return dataItem.carbonEmissions }); - textTemplate = '%{label}:
%{value:,.0f} ' + 'tonne CO2'; + textTemplate = '%{label}:
%{value:,.0f} ' + this.carbonEmissionsUnit; } let data = [{ values: valuesArr, diff --git a/src/app/settings/assessment-settings/assessment-settings.component.html b/src/app/settings/assessment-settings/assessment-settings.component.html index 2f7bb0482b..0b0d139628 100644 --- a/src/app/settings/assessment-settings/assessment-settings.component.html +++ b/src/app/settings/assessment-settings/assessment-settings.component.html @@ -34,9 +34,31 @@ +

These will be default settings for any new assessments and folders.

- + +
+
+ +
+
+
+ +
+
+ +
+
+
+
+
+ +
diff --git a/src/app/settings/co2-savings-settings/co2-savings-settings.component.ts b/src/app/settings/co2-savings-settings/co2-savings-settings.component.ts index c613f6383e..e059fb0ceb 100644 --- a/src/app/settings/co2-savings-settings/co2-savings-settings.component.ts +++ b/src/app/settings/co2-savings-settings/co2-savings-settings.component.ts @@ -13,8 +13,6 @@ export class Co2SavingsSettingsComponent implements OnInit { settingsForm: UntypedFormGroup; @Output('startSavePolling') startSavePolling = new EventEmitter(); - @Input() - generalSettings: boolean; co2SavingsData: Co2SavingsData; diff --git a/src/app/settings/settings.service.ts b/src/app/settings/settings.service.ts index d7e9c1c13a..fd71725faa 100644 --- a/src/app/settings/settings.service.ts +++ b/src/app/settings/settings.service.ts @@ -15,42 +15,6 @@ export class SettingsService { } - // getSettingsForm(): FormGroup { - // return this.formBuilder.group({ - // 'language': ['', Validators.required], - // 'currency': ['', Validators.required], - // 'unitsOfMeasure': ['', Validators.required], - // 'distanceMeasurement': [''], - // 'flowMeasurement': [''], - // 'powerMeasurement': [''], - // 'pressureMeasurement': [''], - // 'steamPressureMeasurement': [''], - // 'steamTemperatureMeasurement': [''], - // 'steamSpecificEnthalpyMeasurement': [''], - // 'steamSpecificEntropyMeasurement': [''], - // 'steamSpecificVolumeMeasurement': [''], - // 'steamPowerMeasurement': [''], - // 'steamMassFlowMeasurement': [''], - // 'steamVolumeMeasurement': [''], - // 'steamVolumeFlowMeasurement': [''], - // 'steamVacuumPressure': [''], - // 'currentMeasurement': [''], - // 'viscosityMeasurement': [''], - // 'voltageMeasurement': [''], - // 'energySourceType': [''], - // 'furnaceType': [''], - // 'energyResultUnit': [''], - // 'customFurnaceName': [''], - // 'temperatureMeasurement': [''], - // 'phastRollupUnit': [''], - // 'defaultPanelTab': [''], - // 'fuelCost': [3.99], - // 'steamCost': [4.69], - // 'electricityCost': [.066], - // 'densityMeasurement': [''] - // }); - // } - setPumpSettingsUnitType(settings: Settings): Settings { let hasImperialUnits: boolean = this.checkHasPumpMatchingUnitTypes(settings, PumpImperialDefaults); let hasMetricUnits: boolean = this.checkHasPumpMatchingUnitTypes(settings, PumpMetricDefaults); @@ -168,6 +132,7 @@ export class SettingsService { 'co2SavingsEnergyType': settings.co2SavingsEnergyType || 'electricity', 'co2SavingsEnergySource': settings.co2SavingsEnergySource || 'Natural Gas', 'co2SavingsFuelType': settings.co2SavingsFuelType || 'Natural Gas', + 'emissionsUnit': settings.emissionsUnit || 'Metric', 'totalEmissionOutputRate': settings.totalEmissionOutputRate || 401.07, 'electricityUse': settings.electricityUse || 0, 'eGridRegion': settings.eGridRegion || '', @@ -275,6 +240,7 @@ export class SettingsService { co2SavingsEnergySource: form.controls.co2SavingsEnergySource.value, co2SavingsFuelType: form.controls.co2SavingsFuelType.value, totalEmissionOutputRate: form.controls.totalEmissionOutputRate.value, + emissionsUnit: form.controls.emissionsUnit.value, totalFuelEmissionOutputRate: form.controls.totalFuelEmissionOutputRate.value, electricityUse: form.controls.electricityUse.value, eGridRegion: form.controls.eGridRegion.value, @@ -380,6 +346,7 @@ export class SettingsService { co2SavingsEnergySource: settings.co2SavingsEnergySource, co2SavingsFuelType: settings.co2SavingsFuelType, totalEmissionOutputRate: settings.totalEmissionOutputRate, + emissionsUnit: settings.emissionsUnit, totalFuelEmissionOutputRate: settings.totalFuelEmissionOutputRate, electricityUse: settings.electricityUse, eGridRegion: settings.eGridRegion, @@ -454,6 +421,8 @@ export class SettingsService { co2SavingsEnergySource: "Natural Gas", co2SavingsFuelType: "Natural Gas", totalEmissionOutputRate: 401.07, + // emissionsUnit should always default to Metric + emissionsUnit: 'Metric', totalNaturalGasEmissionOutputRate: 53.06, totalCoalEmissionOutputRate: 0, totalOtherEmissionOutputRate: 0, @@ -508,6 +477,7 @@ export class SettingsService { co2SavingsFuelType: "Natural Gas", totalEmissionOutputRate: 401.07, totalNaturalGasEmissionOutputRate: 53.06, + emissionsUnit: 'Metric', totalCoalEmissionOutputRate: 0, totalOtherEmissionOutputRate: 0, coalFuelType: 'Mixed - Industrial Sector', diff --git a/src/app/shared/assessment-co2-savings/assessment-co2-savings.service.ts b/src/app/shared/assessment-co2-savings/assessment-co2-savings.service.ts index 6b99f58c5e..fd111074f5 100644 --- a/src/app/shared/assessment-co2-savings/assessment-co2-savings.service.ts +++ b/src/app/shared/assessment-co2-savings/assessment-co2-savings.service.ts @@ -4,6 +4,7 @@ import { BehaviorSubject } from 'rxjs'; import { Co2SavingsData } from '../../calculator/utilities/co2-savings/co2-savings.service'; import { ConvertUnitsService } from '../convert-units/convert-units.service'; import { Settings } from '../models/settings'; +import { copyObject } from '../helperFunctions'; @Injectable() export class AssessmentCo2SavingsService { @@ -112,10 +113,13 @@ export class AssessmentCo2SavingsService { return obj; } + /** + * Returns total emissions output in tons (imperial) or tonne (metric) + * @param data - data.electricityUse in MWh OR GJ/MMBtu, EXCEPT compressed air (kWh) + */ getCo2EmissionsResult(data: Co2SavingsData, settings: Settings, isCombinedEnergy?: boolean): number { - //use copy for conversion data - let dataCpy: Co2SavingsData = JSON.parse(JSON.stringify(data)); - let totalEmissionsResult: number; + let dataCpy: Co2SavingsData = copyObject(data); + let totalEmissionsOutput: number; let totalEmissionOutputRate: number = dataCpy.totalEmissionOutputRate; if (isCombinedEnergy) { totalEmissionOutputRate = dataCpy.totalFuelEmissionOutputRate; @@ -127,12 +131,17 @@ export class AssessmentCo2SavingsService { } if (totalEmissionOutputRate && dataCpy.electricityUse) { - // * converts electricity use to MWh - totalEmissionsResult = totalEmissionOutputRate * (dataCpy.electricityUse / 1000); + // * totalEmissionOutputRate (in kg CO2/MWh) * electricityUse (converted to MWH) + totalEmissionsOutput = totalEmissionOutputRate * (dataCpy.electricityUse / 1000); } else { - totalEmissionsResult = 0; + totalEmissionsOutput = 0; } - return totalEmissionsResult; + + if (settings.emissionsUnit !== 'Metric') { + totalEmissionsOutput = this.convertUnitsService.value(totalEmissionsOutput).from('tonne').to('ton'); + } + + return totalEmissionsOutput; } diff --git a/src/app/shared/models/settings.ts b/src/app/shared/models/settings.ts index b80cc49555..3816f657f8 100644 --- a/src/app/shared/models/settings.ts +++ b/src/app/shared/models/settings.ts @@ -97,6 +97,7 @@ export interface Settings { co2SavingsEnergySource?: string, co2SavingsFuelType?: string, totalEmissionOutputRate?: number, + emissionsUnit?: 'Metric' | 'Imperial', electricityUse?: number, eGridRegion?: string, eGridSubregion?: string, diff --git a/src/app/ssmt/ssmt-report/energy-summary/energy-summary.component.html b/src/app/ssmt/ssmt-report/energy-summary/energy-summary.component.html index c75d6928f2..c2254cb381 100644 --- a/src/app/ssmt/ssmt-report/energy-summary/energy-summary.component.html +++ b/src/app/ssmt/ssmt-report/energy-summary/energy-summary.component.html @@ -93,7 +93,9 @@

Energy Summary

- CO2 Emissions (tonne CO2) + CO2 Emissions + (ton CO2) + (tonne CO2) Energy Summary - CO2 Emissions Savings (tonne CO2) + CO2 Emissions Savings + (ton CO2) + (tonne CO2) Energy Summary - CO2 Emissions (tonne CO2/yr) + CO2 Emissions + (ton CO2) + (tonne CO2)
- Annual Emissions (tonne CO2) + Annual Emissions + (ton CO2) + (tonne CO2) +
@@ -351,7 +354,10 @@
- Annual Emissions Savings (tonne CO2) + Annual Emissions Savings + (ton CO2) + (tonne CO2) +
diff --git a/src/app/ssmt/ssmt.service.ts b/src/app/ssmt/ssmt.service.ts index f8db49985b..c8296154cf 100644 --- a/src/app/ssmt/ssmt.service.ts +++ b/src/app/ssmt/ssmt.service.ts @@ -136,7 +136,14 @@ export class SsmtService { ssmtInputCopy.co2SavingsData.electricityUse = fuelUse; ssmtOutput.co2EmissionsOutput.fuelEmissionOutput = this.assessmentCo2SavingsService.getCo2EmissionsResult(ssmtInputCopy.co2SavingsData, settings, true); - ssmtOutput.co2EmissionsOutput.totalEmissionOutput = ssmtOutput.co2EmissionsOutput.fuelEmissionOutput + ssmtOutput.co2EmissionsOutput.electricityEmissionsFromChange + ssmtOutput.co2EmissionsOutput.electricityEmissionsFromSelling; + if (settings.emissionsUnit !== 'Metric') { + ssmtOutput.co2EmissionsOutput.electricityEmissionsFromChange = this.convertUnitsService.value(ssmtOutput.co2EmissionsOutput.electricityEmissionsFromChange).from('tonne').to('ton'); + ssmtOutput.co2EmissionsOutput.electricityEmissionsFromSelling = this.convertUnitsService.value(ssmtOutput.co2EmissionsOutput.electricityEmissionsFromSelling).from('tonne').to('ton'); + } + + ssmtOutput.co2EmissionsOutput.totalEmissionOutput = ssmtOutput.co2EmissionsOutput.fuelEmissionOutput + + ssmtOutput.co2EmissionsOutput.electricityEmissionsFromChange + + ssmtOutput.co2EmissionsOutput.electricityEmissionsFromSelling; } return ssmtOutput.co2EmissionsOutput; diff --git a/src/app/treasure-hunt/treasure-chest/summary-card/summary-card.component.html b/src/app/treasure-hunt/treasure-chest/summary-card/summary-card.component.html index bd300464a1..d8aa80423b 100644 --- a/src/app/treasure-hunt/treasure-chest/summary-card/summary-card.component.html +++ b/src/app/treasure-hunt/treasure-chest/summary-card/summary-card.component.html @@ -35,7 +35,10 @@
- + diff --git a/src/app/treasure-hunt/treasure-hunt-report/executive-summary/carbon-emissions-summary-pie-chart/carbon-emissions-summary-pie-chart.component.ts b/src/app/treasure-hunt/treasure-hunt-report/executive-summary/carbon-emissions-summary-pie-chart/carbon-emissions-summary-pie-chart.component.ts index ac1b730875..07b72fba8a 100644 --- a/src/app/treasure-hunt/treasure-hunt-report/executive-summary/carbon-emissions-summary-pie-chart/carbon-emissions-summary-pie-chart.component.ts +++ b/src/app/treasure-hunt/treasure-hunt-report/executive-summary/carbon-emissions-summary-pie-chart/carbon-emissions-summary-pie-chart.component.ts @@ -98,8 +98,12 @@ export class CarbonEmissionsSummaryPieChartComponent implements OnInit { rotation: 115 }]; + let emissionsUnits: string = 'tonne CO2'; + if (this.settings.emissionsUnit !== 'Metric') { + emissionsUnits = 'ton CO2'; + } var layout = { - title: 'CO2 Emission Savings (tonne CO2)', + title: `CO2 Emission Savings (${emissionsUnits})`, font: { size: 10, }, diff --git a/src/app/treasure-hunt/treasure-hunt-report/executive-summary/carbon-emissions-summary-table/carbon-emissions-summary-table.component.html b/src/app/treasure-hunt/treasure-hunt-report/executive-summary/carbon-emissions-summary-table/carbon-emissions-summary-table.component.html index 93c981e572..ca5f3fec1f 100644 --- a/src/app/treasure-hunt/treasure-hunt-report/executive-summary/carbon-emissions-summary-table/carbon-emissions-summary-table.component.html +++ b/src/app/treasure-hunt/treasure-hunt-report/executive-summary/carbon-emissions-summary-table/carbon-emissions-summary-table.component.html @@ -6,13 +6,19 @@ Utility diff --git a/src/app/treasure-hunt/treasure-hunt-report/report-graphs/report-graphs.component.html b/src/app/treasure-hunt/treasure-hunt-report/report-graphs/report-graphs.component.html index 79292ea2ff..45b07dc112 100644 --- a/src/app/treasure-hunt/treasure-hunt-report/report-graphs/report-graphs.component.html +++ b/src/app/treasure-hunt/treasure-hunt-report/report-graphs/report-graphs.component.html @@ -46,13 +46,19 @@
- + - +
- Current CO2 Emissions (tonne CO2) + Current CO2 Emissions + (ton CO2) + (tonne CO2) - Projected CO2 Emissions (tonne CO2) + Projected CO2 Emissions + (ton CO2) + (tonne CO2) - CO2 Emission Savings (tonne CO2) + CO2 Emission Savings + (ton CO2) + (tonne CO2)
Annual CO2 Emissions (tonne CO2)Annual CO2 Emissions + (ton CO2) + (tonne CO2) + {{wasteWater.baselineData.outputs.co2EmissionsOutput | number:'1.0-0'}} Report Results | number:'1.0-0'}}
Annual CO2 Emissions Savings (tonne CO2)Annual CO2 Emissions Savings + (ton CO2) + (tonne CO2) + {{modification.outputs.co2EmissionsSavings