diff --git a/src/main/angular/src/app/api/series/constants.ts b/src/main/angular/src/app/api/series/constants.ts index e0802d5..15d2810 100644 --- a/src/main/angular/src/app/api/series/constants.ts +++ b/src/main/angular/src/app/api/series/constants.ts @@ -1,3 +1,5 @@ +import {ValueConstant} from "../value/Value"; + export const ELECTRICITY_GRID_PURCHASED_ENERGY = 'electricity.grid.purchase.energy'; export const ELECTRICITY_GRID_DELIVERED_ENERGY = 'electricity.grid.delivery.energy'; export const ELECTRICITY_GRID_POWER = 'electricity.grid.power'; @@ -25,3 +27,13 @@ export const HEATING_BUFFER_HOT_TEMPERATURE = 'heating.buffer.hot.temperature'; export const HEATING_BUFFER_CIRCULATION_TEMPERATURE = 'heating.buffer.circulation.temperature'; export const HEATING_LOOP_SUPPLY_TEMPERATURE = 'heating.loop.supply.temperature'; export const HEATING_LOOP_RETURN_TEMPERATURE = 'heating.loop.return.temperature'; + +export const ELECTRICITY_GRID_PURCHASED_FEW = 7.7; +export const ELECTRICITY_GRID_PURCHASED_MUCH = 9.7; +export const ELECTRICITY_GRID_POWER_MUCH = 400; + +export const ELECTRICITY_PHOTOVOLTAIC_PRODUCED_FEW = 0.7; +export const ELECTRICITY_PHOTOVOLTAIC_PRODUCED_MUCH = 2; +export const ELECTRICITY_PHOTOVOLTAIC_POWER_FEW = 50; +export const ELECTRICITY_PHOTOVOLTAIC_POWER_MUCH = 200; +export const ELECTRICITY_PHOTOVOLTAIC_PRODUCED_BEFORE_METER_CHANGE = new ValueConstant(287.995, "kWh"); diff --git a/src/main/angular/src/app/api/value/Value.ts b/src/main/angular/src/app/api/value/Value.ts index 28f4442..441bb49 100644 --- a/src/main/angular/src/app/api/value/Value.ts +++ b/src/main/angular/src/app/api/value/Value.ts @@ -1,5 +1,3 @@ -import {ValueConstant} from "./ValueConstant"; - export class Value { constructor( @@ -113,3 +111,14 @@ export class Value { } +export class ValueConstant extends Value { + + constructor( + value: number | null, + unit: string, + ) { + super(new Date(Date.now()), value, unit); + } + +} + diff --git a/src/main/angular/src/app/api/value/ValueConstant.ts b/src/main/angular/src/app/api/value/ValueConstant.ts deleted file mode 100644 index d2e09da..0000000 --- a/src/main/angular/src/app/api/value/ValueConstant.ts +++ /dev/null @@ -1,12 +0,0 @@ -import {Value} from "./Value"; - -export class ValueConstant extends Value { - - constructor( - value: number | null, - unit: string, - ) { - super(new Date(Date.now()), value, unit); - } - -} diff --git a/src/main/angular/src/app/pages/dashboard/electricity/dashboard-electricity-tile.component.ts b/src/main/angular/src/app/pages/dashboard/electricity/dashboard-electricity-tile.component.ts index d08f589..97609b8 100644 --- a/src/main/angular/src/app/pages/dashboard/electricity/dashboard-electricity-tile.component.ts +++ b/src/main/angular/src/app/pages/dashboard/electricity/dashboard-electricity-tile.component.ts @@ -1,24 +1,11 @@ import {Component, Input} from '@angular/core'; import {ValueListComponent} from "../../../shared/value-list/value-list.component"; import {Display, DisplayValue} from "../../../api/value/Display"; -import {ValueConstant} from "../../../api/value/ValueConstant"; import {SeriesCacheService} from "../../../api/series/series-cache.service"; import {SliceService} from "../../../api/series/consumption/slice/slice.service"; import {Slice} from "../../../api/series/consumption/slice/Slice"; import {Interval} from "../../../api/series/consumption/interval/Interval"; -import {ELECTRICITY_GRID_DELIVERED_ENERGY, ELECTRICITY_GRID_PURCHASED_ENERGY, ELECTRICITY_PHOTOVOLTAIC_PRODUCED} from "../../../api/series/constants"; - -const PRODUCED_BEFORE_METER_CHANGE = new ValueConstant(287.995, "kWh"); - -const ELECTRICITY_GRID_PURCHASED_FEW = 7.7; - -const ELECTRICITY_GRID_PURCHASED_MUCH = 9.7; - -const ELECTRICITY_GRID_POWER_MUCH = 400; - -const ELECTRICITY_PHOTOVOLTAIC_PRODUCED_FEW = 0.7; - -const ELECTRICITY_PHOTOVOLTAIC_PRODUCED_MUCH = 2; +import {ELECTRICITY_GRID_DELIVERED_ENERGY, ELECTRICITY_GRID_POWER_MUCH, ELECTRICITY_GRID_PURCHASED_ENERGY, ELECTRICITY_GRID_PURCHASED_FEW, ELECTRICITY_GRID_PURCHASED_MUCH, ELECTRICITY_PHOTOVOLTAIC_POWER_FEW, ELECTRICITY_PHOTOVOLTAIC_POWER_MUCH, ELECTRICITY_PHOTOVOLTAIC_PRODUCED, ELECTRICITY_PHOTOVOLTAIC_PRODUCED_BEFORE_METER_CHANGE, ELECTRICITY_PHOTOVOLTAIC_PRODUCED_FEW, ELECTRICITY_PHOTOVOLTAIC_PRODUCED_MUCH} from "../../../api/series/constants"; @Component({ selector: 'app-dashboard-electricity-tile', @@ -65,7 +52,7 @@ export class DashboardElectricityTileComponent { } getDisplayList(): Display[] { - const producedAfterChange = this.seriesCacheService.photovoltaicProduced.minus(PRODUCED_BEFORE_METER_CHANGE); + const producedAfterChange = this.seriesCacheService.photovoltaicProduced.minus(ELECTRICITY_PHOTOVOLTAIC_PRODUCED_BEFORE_METER_CHANGE); const selfAfterChange = producedAfterChange.minus(this.seriesCacheService.gridDelivered); const selfRatio = selfAfterChange.div(producedAfterChange); const selfConsumed = selfRatio.mul(this.seriesCacheService.photovoltaicProduced); @@ -86,7 +73,7 @@ export class DashboardElectricityTileComponent { new DisplayValue('Produziert', this.seriesCacheService.photovoltaicProduced, ''), new DisplayValue('Selbst verbraucht', selfConsumed, ''), 'Leistung', - new DisplayValue('Produktion', this.seriesCacheService.photovoltaicPower, this.seriesCacheService.photovoltaicPower.color(50, 200, 'red', 'orange', 'green')), + new DisplayValue('Produktion', this.seriesCacheService.photovoltaicPower, this.seriesCacheService.photovoltaicPower.color(ELECTRICITY_PHOTOVOLTAIC_POWER_FEW, ELECTRICITY_PHOTOVOLTAIC_POWER_MUCH, 'red', 'orange', 'green')), new DisplayValue('Netz', this.seriesCacheService.gridPower, gridColor), new DisplayValue('Verbrauch', consumptionPower, ''), 'Heute',