hoffmation-base 3.8.0 → 4.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/devices/dachs/dachs.d.ts +79 -2
- package/lib/devices/dachs/dachs.js +214 -18
- package/lib/devices/devices.d.ts +36 -1
- package/lib/devices/devices.js +64 -0
- package/lib/devices/jsObject/jsObjectEnergyManager.d.ts +16 -1
- package/lib/devices/jsObject/jsObjectEnergyManager.js +23 -0
- package/lib/devices/victron/victron-device.d.ts +83 -1
- package/lib/devices/victron/victron-device.js +151 -2
- package/lib/devices/victron/victron-morning-release.d.ts +16 -0
- package/lib/devices/victron/victron-morning-release.js +2 -0
- package/lib/enums/DeviceCapability.d.ts +1 -0
- package/lib/enums/DeviceCapability.js +1 -0
- package/lib/interfaces/baseDevices/iAirQualityCollector.d.ts +2 -1
- package/lib/interfaces/baseDevices/iAirQualityReadings.d.ts +50 -0
- package/lib/interfaces/baseDevices/iAirQualityReadings.js +2 -0
- package/lib/interfaces/baseDevices/iAirQualitySensor.d.ts +1 -54
- package/lib/interfaces/baseDevices/iAirQualitySensor.js +0 -5
- package/lib/interfaces/baseDevices/iEnergyManager.d.ts +43 -0
- package/lib/interfaces/baseDevices/iHumidityCollector.d.ts +0 -1
- package/lib/interfaces/baseDevices/iHumidityCollector.js +0 -2
- package/lib/interfaces/baseDevices/iTemperatureCollector.d.ts +0 -1
- package/lib/interfaces/baseDevices/iTemperatureCollector.js +0 -2
- package/lib/interfaces/baseDevices/index.d.ts +4 -0
- package/lib/interfaces/baseDevices/index.js +4 -0
- package/lib/interfaces/baseDevices/undefinedAirQualityValue.d.ts +4 -0
- package/lib/interfaces/baseDevices/undefinedAirQualityValue.js +7 -0
- package/lib/interfaces/baseDevices/undefinedHumidityValue.d.ts +4 -0
- package/lib/interfaces/baseDevices/undefinedHumidityValue.js +7 -0
- package/lib/interfaces/baseDevices/undefinedTempValue.d.ts +4 -0
- package/lib/interfaces/baseDevices/undefinedTempValue.js +7 -0
- package/lib/interfaces/dachs/KeyListEntity.d.ts +0 -5
- package/lib/interfaces/dachs/KeyListEntityResponse.d.ts +6 -0
- package/lib/interfaces/dachs/KeyListEntityResponse.js +2 -0
- package/lib/interfaces/dachs/index.d.ts +1 -0
- package/lib/interfaces/dachs/index.js +1 -0
- package/lib/interfaces/deviceSettings/iDachsDeviceSettings.d.ts +15 -0
- package/lib/interfaces/iActuatorStateSample.d.ts +13 -0
- package/lib/interfaces/iActuatorStateSample.js +2 -0
- package/lib/interfaces/iBatteryLevelSample.d.ts +13 -0
- package/lib/interfaces/iBatteryLevelSample.js +2 -0
- package/lib/interfaces/iConsumptionWindowSample.d.ts +26 -0
- package/lib/interfaces/iConsumptionWindowSample.js +2 -0
- package/lib/interfaces/iDachsHistoryGateResult.d.ts +29 -0
- package/lib/interfaces/iDachsHistoryGateResult.js +2 -0
- package/lib/interfaces/iEnergyHistoryBasis.d.ts +26 -0
- package/lib/interfaces/iEnergyHistoryBasis.js +2 -0
- package/lib/interfaces/iEnergyHistoryEstimate.d.ts +21 -0
- package/lib/interfaces/iEnergyHistoryEstimate.js +2 -0
- package/lib/interfaces/iEnergyHistoryFeatures.d.ts +21 -0
- package/lib/interfaces/iEnergyHistoryFeatures.js +2 -0
- package/lib/interfaces/iEnergyHistoryModel.d.ts +21 -0
- package/lib/interfaces/iEnergyHistoryModel.js +2 -0
- package/lib/interfaces/iEnergyHistoryOptions.d.ts +29 -0
- package/lib/interfaces/iEnergyHistoryOptions.js +2 -0
- package/lib/interfaces/iEnergyHistoryOutlook.d.ts +41 -0
- package/lib/interfaces/iEnergyHistoryOutlook.js +2 -0
- package/lib/interfaces/iEnergyHistorySample.d.ts +19 -0
- package/lib/interfaces/iEnergyHistorySample.js +2 -0
- package/lib/interfaces/iFossilGeneratorRun.d.ts +22 -0
- package/lib/interfaces/iFossilGeneratorRun.js +2 -0
- package/lib/interfaces/iFossilGeneratorSource.d.ts +21 -0
- package/lib/interfaces/iFossilGeneratorSource.js +2 -0
- package/lib/interfaces/iMorningReserveVerdict.d.ts +38 -0
- package/lib/interfaces/iMorningReserveVerdict.js +2 -0
- package/lib/interfaces/iPersist.d.ts +51 -0
- package/lib/interfaces/iProjectedSocBand.d.ts +7 -0
- package/lib/interfaces/iProjectedSocBand.js +2 -0
- package/lib/interfaces/iWeatherDaySummary.d.ts +21 -0
- package/lib/interfaces/iWeatherDaySummary.js +2 -0
- package/lib/interfaces/index.d.ts +16 -0
- package/lib/interfaces/index.js +16 -0
- package/lib/services/dbo/actuator-state-row.d.ts +14 -0
- package/lib/services/dbo/actuator-state-row.js +2 -0
- package/lib/services/dbo/battery-level-row.d.ts +16 -0
- package/lib/services/dbo/battery-level-row.js +2 -0
- package/lib/services/dbo/energy-consumption-row.d.ts +16 -0
- package/lib/services/dbo/energy-consumption-row.js +2 -0
- package/lib/services/dbo/postgreSqlPersist.d.ts +48 -1
- package/lib/services/dbo/postgreSqlPersist.js +298 -28
- package/lib/services/dbo/weather-day-summary-row.d.ts +18 -0
- package/lib/services/dbo/weather-day-summary-row.js +2 -0
- package/lib/services/energy/energy-history-service.d.ts +168 -0
- package/lib/services/energy/energy-history-service.js +499 -0
- package/lib/services/energy/index.d.ts +1 -0
- package/lib/services/energy/index.js +17 -0
- package/lib/services/energy/plant-energy-dials.d.ts +22 -0
- package/lib/services/energy/plant-energy-dials.js +2 -0
- package/lib/services/https-service.d.ts +48 -2
- package/lib/services/https-service.js +136 -10
- package/lib/services/index.d.ts +1 -0
- package/lib/services/index.js +1 -0
- package/lib/services/time-callback-service.d.ts +12 -0
- package/lib/services/time-callback-service.js +16 -2
- package/lib/services/weather/index.d.ts +1 -0
- package/lib/services/weather/index.js +1 -0
- package/lib/services/weather/open-weather-day-summary.d.ts +21 -0
- package/lib/services/weather/open-weather-day-summary.js +2 -0
- package/lib/services/weather/weather-day-summary-fetcher.d.ts +6 -0
- package/lib/services/weather/weather-day-summary-fetcher.js +2 -0
- package/lib/services/weather/weather-history-backfill.d.ts +88 -0
- package/lib/services/weather/weather-history-backfill.js +228 -0
- package/lib/services/weather/weather-service.js +29 -4
- package/lib/settings-service-instance.js +5 -2
- package/lib/settingsObjects/deviceSettings/dachsSettings.d.ts +6 -0
- package/lib/settingsObjects/deviceSettings/dachsSettings.js +14 -1
- package/lib/settingsObjects/deviceSettings/victronDeviceSettings.d.ts +116 -0
- package/lib/settingsObjects/deviceSettings/victronDeviceSettings.js +150 -5
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/lib/utils/dayMs.d.ts +7 -0
- package/lib/utils/dayMs.js +10 -0
- package/lib/utils/energy-history-dials.d.ts +19 -0
- package/lib/utils/energy-history-dials.js +2 -0
- package/lib/utils/energy-history-utils.d.ts +143 -0
- package/lib/utils/energy-history-utils.js +470 -0
- package/lib/utils/energy-manager-utils.d.ts +123 -1
- package/lib/utils/energy-manager-utils.js +226 -0
- package/lib/utils/index.d.ts +4 -0
- package/lib/utils/index.js +4 -0
- package/lib/utils/model-shadow.d.ts +61 -0
- package/lib/utils/model-shadow.js +83 -0
- package/lib/utils/morning-reserve-dials.d.ts +21 -0
- package/lib/utils/morning-reserve-dials.js +2 -0
- package/lib/utils/morning-verdict.d.ts +5 -0
- package/lib/utils/morning-verdict.js +2 -0
- package/lib/utils/utils.d.ts +0 -1
- package/lib/utils/utils.js +5 -5
- package/package.json +3 -2
|
@@ -20,3 +20,4 @@ __exportStar(require("./influxDbConnectionOptions"), exports);
|
|
|
20
20
|
__exportStar(require("./IReadKeyList"), exports);
|
|
21
21
|
__exportStar(require("./IWriteKeyList"), exports);
|
|
22
22
|
__exportStar(require("./KeyListEntity"), exports);
|
|
23
|
+
__exportStar(require("./KeyListEntityResponse"), exports);
|
|
@@ -73,6 +73,21 @@ export interface iDachsDeviceSettings extends iActuatorSettings {
|
|
|
73
73
|
* Defines the desired minimum temperature for heat storage during winter.
|
|
74
74
|
*/
|
|
75
75
|
winterMinimumPreNightHeatStorageTemp: number;
|
|
76
|
+
/**
|
|
77
|
+
* Defines the desired maximum temperature for warm water using dachs outside of winter heating mode.
|
|
78
|
+
* Applies in place of {@link warmWaterDesiredMaxTemp} whenever the heating mode is not winter.
|
|
79
|
+
*/
|
|
80
|
+
summerWarmWaterDesiredMaxTemp: number;
|
|
81
|
+
/**
|
|
82
|
+
* The rated electrical output of the unit in watt, used to remove its own contribution from a historical day.
|
|
83
|
+
* @default 5500
|
|
84
|
+
*/
|
|
85
|
+
dachsRatedElectricalWattage: number;
|
|
86
|
+
/**
|
|
87
|
+
* The share of the produced electrical energy that reaches the battery.
|
|
88
|
+
* @default 0.8
|
|
89
|
+
*/
|
|
90
|
+
dachsConversionFactor: number;
|
|
76
91
|
/**
|
|
77
92
|
*
|
|
78
93
|
*/
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* One persisted battery level reading, as it is stored alongside each energy calculation interval.
|
|
3
|
+
*/
|
|
4
|
+
export interface iBatteryLevelSample {
|
|
5
|
+
/**
|
|
6
|
+
* State of charge in percent (0-100)
|
|
7
|
+
*/
|
|
8
|
+
level: number;
|
|
9
|
+
/**
|
|
10
|
+
* The date of the reading
|
|
11
|
+
*/
|
|
12
|
+
date: Date;
|
|
13
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* House consumption over a stretch of time in kWh.
|
|
3
|
+
*
|
|
4
|
+
* The same shape serves both ends of the consumption calculation: a single persisted reading of one
|
|
5
|
+
* measuring interval, and the sum of those readings over a whole evaluation window. What separates
|
|
6
|
+
* the two is not the type but the step that produced it - see
|
|
7
|
+
* EnergyHistoryUtils.windowConsumptionSums, which turns the former into the latter.
|
|
8
|
+
*
|
|
9
|
+
* The distinction matters in exactly one place: the upper quantile is read from the distribution of
|
|
10
|
+
* window sums across the days, never from the individual readings. Summing per reading quantiles
|
|
11
|
+
* would apply the safety margin once per interval instead of once per window.
|
|
12
|
+
*/
|
|
13
|
+
export interface iConsumptionWindowSample {
|
|
14
|
+
/**
|
|
15
|
+
* House consumption over the interval or window in kWh
|
|
16
|
+
*/
|
|
17
|
+
consumedKwh: number;
|
|
18
|
+
/**
|
|
19
|
+
* Which end of the stretch this is depends on which of the two kinds the sample is, and the two
|
|
20
|
+
* differ: a raw persisted reading is dated at the END of the measuring interval it closes, the way
|
|
21
|
+
* iPersist hands it over, while a window sum produced by EnergyHistoryUtils.windowConsumptionSums is
|
|
22
|
+
* dated at the START of its window. Producers of the raw kind must not switch to the start, and
|
|
23
|
+
* consumers must not assume one meaning for both.
|
|
24
|
+
*/
|
|
25
|
+
date: Date;
|
|
26
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What the history based start gate decided in its last evaluation.
|
|
3
|
+
*
|
|
4
|
+
* The gate acts only on the plant's verdicts that need no fitted model - see
|
|
5
|
+
* {@link iMorningReserveVerdict.measured}. A modelled verdict lands here with both flags false and is
|
|
6
|
+
* reported for the operator alone.
|
|
7
|
+
*/
|
|
8
|
+
export interface iDachsHistoryGateResult {
|
|
9
|
+
/** True while the estimate suppresses an electricity driven start */
|
|
10
|
+
suppress: boolean;
|
|
11
|
+
/** True while the estimate asks for a start */
|
|
12
|
+
request: boolean;
|
|
13
|
+
/** The deciding stage and the numbers it decided on, for the log and for the operator */
|
|
14
|
+
reason: string;
|
|
15
|
+
/** State of charge in percent at the moment of the decision */
|
|
16
|
+
currentSoc: number;
|
|
17
|
+
/**
|
|
18
|
+
* Projected morning state of charge in percent at the lower band edge.
|
|
19
|
+
* Without a model there is no band; both edges then collapse onto {@link currentSoc} and
|
|
20
|
+
* {@link sampleDays} is zero.
|
|
21
|
+
*/
|
|
22
|
+
lowerEdgeSoc: number;
|
|
23
|
+
/** Projected morning state of charge in percent at the upper band edge */
|
|
24
|
+
upperEdgeSoc: number;
|
|
25
|
+
/** The minimum morning state of charge in percent the decision was measured against */
|
|
26
|
+
reserve: number;
|
|
27
|
+
/** How many historical days the model was fitted on; zero while there is no model */
|
|
28
|
+
sampleDays: number;
|
|
29
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Which of the inputs of an outlook are present.
|
|
3
|
+
*
|
|
4
|
+
* This is the reason side of the answer: a caller that got no statement has to be able to say *why*,
|
|
5
|
+
* and the three ways an answer can be absent look alike from the outside. An operator who reads "no
|
|
6
|
+
* consumption history" while the history is there looks in the wrong place.
|
|
7
|
+
*/
|
|
8
|
+
export interface iEnergyHistoryBasis {
|
|
9
|
+
/** Whether the energy manager reports a usable battery capacity */
|
|
10
|
+
batteryCapacityKnown: boolean;
|
|
11
|
+
/** How many usable consumption window sums the history window yielded */
|
|
12
|
+
consumptionWindows: number;
|
|
13
|
+
/**
|
|
14
|
+
* How many of them the plant demands before an upper quantile of them means anything - reported alongside
|
|
15
|
+
* the count so a caller can say "three of the four required" without reading the plant's dials itself.
|
|
16
|
+
*/
|
|
17
|
+
requiredConsumptionWindows: number;
|
|
18
|
+
/** Whether the last history read answered with any consumption readings at all */
|
|
19
|
+
consumptionReadingsSeen: boolean;
|
|
20
|
+
/** Whether a daily weather aggregate is stored for the running day */
|
|
21
|
+
weatherTodayKnown: boolean;
|
|
22
|
+
/** Whether a consumption reading of the running day is present */
|
|
23
|
+
consumptionTodayKnown: boolean;
|
|
24
|
+
/** Whether a model was fitted at all, with or without a feature row of the running day to apply it to */
|
|
25
|
+
modelFitted: boolean;
|
|
26
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A prediction with its uncertainty band.
|
|
3
|
+
*/
|
|
4
|
+
export interface iEnergyHistoryEstimate {
|
|
5
|
+
/**
|
|
6
|
+
* The point estimate of the change in percentage points
|
|
7
|
+
*/
|
|
8
|
+
expectedDelta: number;
|
|
9
|
+
/**
|
|
10
|
+
* expectedDelta - bandSigma * residualSigma
|
|
11
|
+
*/
|
|
12
|
+
lowerEdgeDelta: number;
|
|
13
|
+
/**
|
|
14
|
+
* expectedDelta + bandSigma * residualSigma
|
|
15
|
+
*/
|
|
16
|
+
upperEdgeDelta: number;
|
|
17
|
+
/**
|
|
18
|
+
* How many observations the underlying model was built from
|
|
19
|
+
*/
|
|
20
|
+
sampleDays: number;
|
|
21
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The four measured or forecast quantities a prediction is based on. Exactly four - no more.
|
|
3
|
+
*/
|
|
4
|
+
export interface iEnergyHistoryFeatures {
|
|
5
|
+
/**
|
|
6
|
+
* Hours of sunlight left until sunset at the moment of evaluation
|
|
7
|
+
*/
|
|
8
|
+
remainingSunHours: number;
|
|
9
|
+
/**
|
|
10
|
+
* Cloud cover in percent for the remainder of the day
|
|
11
|
+
*/
|
|
12
|
+
cloudCover: number;
|
|
13
|
+
/**
|
|
14
|
+
* House consumption since midnight in kWh at the moment of evaluation
|
|
15
|
+
*/
|
|
16
|
+
consumedSoFarKwh: number;
|
|
17
|
+
/**
|
|
18
|
+
* The day's maximum temperature in degrees celsius
|
|
19
|
+
*/
|
|
20
|
+
maxTemperature: number;
|
|
21
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The fitted model. Weights are never written by hand - they come out of the fit.
|
|
3
|
+
*/
|
|
4
|
+
export interface iEnergyHistoryModel {
|
|
5
|
+
/**
|
|
6
|
+
* One weight per feature, in the declaration order of iEnergyHistoryFeatures
|
|
7
|
+
*/
|
|
8
|
+
weights: [number, number, number, number];
|
|
9
|
+
/**
|
|
10
|
+
* The constant term of the fit in percentage points
|
|
11
|
+
*/
|
|
12
|
+
intercept: number;
|
|
13
|
+
/**
|
|
14
|
+
* Standard deviation of the residuals - this is what the band is made of
|
|
15
|
+
*/
|
|
16
|
+
residualSigma: number;
|
|
17
|
+
/**
|
|
18
|
+
* How many observations the fit was built from
|
|
19
|
+
*/
|
|
20
|
+
sampleDays: number;
|
|
21
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* How the plant's recorded history is read, fitted and reported on.
|
|
3
|
+
*
|
|
4
|
+
* **All three describe the plant, not whoever asks**: every consumer asks the same question - where the state
|
|
5
|
+
* of charge bottoms out before the coming morning - and how much history is telling enough to answer it is a
|
|
6
|
+
* property of the recorded data. A second bundle would mean a second read, a second paid backfill and two half
|
|
7
|
+
* samples in the shadow record.
|
|
8
|
+
*
|
|
9
|
+
* Handed in rather than read off a global, so the reading service stays off any concrete energy manager class
|
|
10
|
+
* and can be built in isolation. **Every field is read anew on each use**: the owner hands in a live view of
|
|
11
|
+
* its settings rather than a snapshot, because all three are editable at runtime.
|
|
12
|
+
*
|
|
13
|
+
* The rest of what describes the plant lives elsewhere: how good its recorded data has to be is stated by the
|
|
14
|
+
* energy manager, and its fuel burning generators announce themselves as devices - see
|
|
15
|
+
* {@link Devices.fossilGenerators}.
|
|
16
|
+
*/
|
|
17
|
+
export interface iEnergyHistoryOptions {
|
|
18
|
+
/** Length of the sliding window in days that is read, fitted and backfilled. */
|
|
19
|
+
windowDays: number;
|
|
20
|
+
/**
|
|
21
|
+
* Below this many usable historical days no model is fitted at all.
|
|
22
|
+
*
|
|
23
|
+
* The floor below which a fit is not merely uncertain but meaningless is plant wide and sits in the
|
|
24
|
+
* arithmetic itself, which raises any lower number to it - this dial can only ask for more than that.
|
|
25
|
+
*/
|
|
26
|
+
minimumModelDays: number;
|
|
27
|
+
/** How many residual sigmas each edge of the band lies away from the point estimate. */
|
|
28
|
+
bandSigma: number;
|
|
29
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { iEnergyHistoryBasis } from './iEnergyHistoryBasis';
|
|
2
|
+
import { iProjectedSocBand } from './iProjectedSocBand';
|
|
3
|
+
/**
|
|
4
|
+
* The raw quantities the plant can state about the coming morning low at one moment, with no arithmetic on
|
|
5
|
+
* them. The judgement made from them is {@link iMorningReserveVerdict}, which is what a consumer normally
|
|
6
|
+
* reads.
|
|
7
|
+
*/
|
|
8
|
+
export interface iEnergyHistoryOutlook {
|
|
9
|
+
/**
|
|
10
|
+
* The state of charge in percent every projection below starts from.
|
|
11
|
+
*
|
|
12
|
+
* Carried along rather than left to the reader, because a consumer that quoted its own charge level next to
|
|
13
|
+
* these projections could quote a different one than they were built on.
|
|
14
|
+
*/
|
|
15
|
+
currentSoc: number;
|
|
16
|
+
/** Hours of sun left on the day of the moment asked about, never negative */
|
|
17
|
+
remainingSunHours: number;
|
|
18
|
+
/**
|
|
19
|
+
* Where the state of charge would bottom out if no further photovoltaic yield arrived at all, in
|
|
20
|
+
* percent - `undefined` while capacity or consumption history are missing, see {@link basis}.
|
|
21
|
+
*/
|
|
22
|
+
worstCaseLowSoc: number | undefined;
|
|
23
|
+
/**
|
|
24
|
+
* The projected state of charge at the coming morning low at both edges of the residual band, in
|
|
25
|
+
* percent - `undefined` while there is no fitted model or no complete feature row for the running day.
|
|
26
|
+
*/
|
|
27
|
+
band: iProjectedSocBand | undefined;
|
|
28
|
+
/**
|
|
29
|
+
* The standard deviation of the fitted model's residuals in percentage points - `undefined` while there is
|
|
30
|
+
* no fitted model.
|
|
31
|
+
*
|
|
32
|
+
* Reported alongside {@link band} rather than hidden inside it, so that a consumer which one day may act on
|
|
33
|
+
* the model can form edges of its own width from the two without a second reading of the same history. That
|
|
34
|
+
* is the whole reason it is here; nothing reads it yet and no mechanism is built for it.
|
|
35
|
+
*/
|
|
36
|
+
residualSigma: number | undefined;
|
|
37
|
+
/** How many historical days the model was fitted on; zero while there is none */
|
|
38
|
+
sampleDays: number;
|
|
39
|
+
/** Which inputs the answer could be built from */
|
|
40
|
+
basis: iEnergyHistoryBasis;
|
|
41
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { iEnergyHistoryFeatures } from './iEnergyHistoryFeatures';
|
|
2
|
+
/**
|
|
3
|
+
* One historical observation: the features at a point in time and what happened afterwards.
|
|
4
|
+
*/
|
|
5
|
+
export interface iEnergyHistorySample {
|
|
6
|
+
/**
|
|
7
|
+
* The four quantities as they were at the moment of evaluation
|
|
8
|
+
*/
|
|
9
|
+
features: iEnergyHistoryFeatures;
|
|
10
|
+
/**
|
|
11
|
+
* Change of state of charge in percentage points from the moment of evaluation to the next
|
|
12
|
+
* morning's low, already corrected for what the fossil generators contributed.
|
|
13
|
+
*/
|
|
14
|
+
observedDelta: number;
|
|
15
|
+
/**
|
|
16
|
+
* The moment of evaluation this observation belongs to
|
|
17
|
+
*/
|
|
18
|
+
date: Date;
|
|
19
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What one fuel burning generator contributed inside an observation window.
|
|
3
|
+
*
|
|
4
|
+
* The correction is additive across these, so a second block heat and power unit or a standby
|
|
5
|
+
* generator is one more entry rather than one more branch. Only fuel burning generators belong in
|
|
6
|
+
* here: the point of the correction is to leave behind what the photovoltaic system alone did, and a
|
|
7
|
+
* generator that runs on sunlight is part of that answer rather than something to subtract from it.
|
|
8
|
+
*/
|
|
9
|
+
export interface iFossilGeneratorRun {
|
|
10
|
+
/**
|
|
11
|
+
* How long the generator ran inside the window, in milliseconds
|
|
12
|
+
*/
|
|
13
|
+
runMilliseconds: number;
|
|
14
|
+
/**
|
|
15
|
+
* Electrical rating of the generator in watt
|
|
16
|
+
*/
|
|
17
|
+
ratedElectricalWattage: number;
|
|
18
|
+
/**
|
|
19
|
+
* Share of the generated energy that reached the battery, between 0 and 1
|
|
20
|
+
*/
|
|
21
|
+
conversionFactor: number;
|
|
22
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* One fuel burning generator of the plant, seen from the history: the actuator whose recorded state
|
|
3
|
+
* changes say when it ran, plus what one hour of that run put into the battery.
|
|
4
|
+
*
|
|
5
|
+
* Implemented by the generator device itself, which is why the two numbers below are the device's own and
|
|
6
|
+
* not the asking caller's: what a unit is rated at and how much of that reaches the battery is a property of
|
|
7
|
+
* that machine, and nobody else can state it. Which generators the plant has is not asked here - a device
|
|
8
|
+
* carrying {@link DeviceCapability.fossilGenerator} is one, see {@link Devices.fossilGenerators}.
|
|
9
|
+
*
|
|
10
|
+
* Three values and no device surface, because the history only ever asks the persistence about them - a
|
|
11
|
+
* reader of this list is handed the generator's id, rating and factor and has no reason to know it is
|
|
12
|
+
* looking at a device at all.
|
|
13
|
+
*/
|
|
14
|
+
export interface iFossilGeneratorSource {
|
|
15
|
+
/** The device id the state changes of the generator are recorded under */
|
|
16
|
+
readonly actuatorId: string;
|
|
17
|
+
/** Electrical rating of the generator in watt */
|
|
18
|
+
readonly ratedElectricalWattage: number;
|
|
19
|
+
/** Share of the generated energy that reached the battery, between 0 and 1 */
|
|
20
|
+
readonly conversionFactor: number;
|
|
21
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { iProjectedSocBand } from './iProjectedSocBand';
|
|
2
|
+
/**
|
|
3
|
+
* Whether the plant expects the coming morning low to stay above the reserve its battery must not fall below.
|
|
4
|
+
*
|
|
5
|
+
* A judgement about the plant, spoken by the plant: the reserve and the sun threshold it is measured against
|
|
6
|
+
* describe the battery, not whoever is asking. What a consumer does with a verdict - suppress, request, ignore -
|
|
7
|
+
* is that consumer's own risk appetite and stays with it.
|
|
8
|
+
*/
|
|
9
|
+
export interface iMorningReserveVerdict {
|
|
10
|
+
/**
|
|
11
|
+
* True while the coming morning holds the reserve, false while it misses it, undefined while the plant can
|
|
12
|
+
* say neither.
|
|
13
|
+
*/
|
|
14
|
+
holds: boolean | undefined;
|
|
15
|
+
/**
|
|
16
|
+
* Whether {@link holds} rests on the plant's measured consumption alone.
|
|
17
|
+
*
|
|
18
|
+
* A verdict that needs the fitted model is reported but carries an unmeasured assumption: the window length
|
|
19
|
+
* of the fit has never been checked against recorded data. Consumers that move something act on the measured
|
|
20
|
+
* verdicts only; the modelled ones exist so an operator can see what the model would have said.
|
|
21
|
+
*/
|
|
22
|
+
measured: boolean;
|
|
23
|
+
/** Whether a model was fitted at all when the verdict was formed, regardless of which rung answered */
|
|
24
|
+
modelFitted: boolean;
|
|
25
|
+
/** What made the plant answer this way, as one phrase for the asking consumer's log line */
|
|
26
|
+
reason: string;
|
|
27
|
+
/** The state of charge in percent every projection behind the verdict starts from */
|
|
28
|
+
currentSoc: number;
|
|
29
|
+
/**
|
|
30
|
+
* The projected morning state of charge at both band edges. Both edges collapse onto {@link currentSoc}
|
|
31
|
+
* wherever the verdict needed no band.
|
|
32
|
+
*/
|
|
33
|
+
band: iProjectedSocBand;
|
|
34
|
+
/** The minimum morning state of charge in percent the verdict was measured against */
|
|
35
|
+
reserve: number;
|
|
36
|
+
/** How many historical days the model was fitted on; zero while there is none */
|
|
37
|
+
sampleDays: number;
|
|
38
|
+
}
|
|
@@ -6,6 +6,10 @@ import { iDesiredShutterPosition } from './IDesiredShutterPosition';
|
|
|
6
6
|
import { iCountToday } from './iCountToday';
|
|
7
7
|
import { iEnergyCalculation } from './iEnergyCalculation';
|
|
8
8
|
import { iShutterCalibration } from './iShutterCalibration';
|
|
9
|
+
import { iBatteryLevelSample } from './iBatteryLevelSample';
|
|
10
|
+
import { iActuatorStateSample } from './iActuatorStateSample';
|
|
11
|
+
import { iWeatherDaySummary } from './iWeatherDaySummary';
|
|
12
|
+
import { iConsumptionWindowSample } from './iConsumptionWindowSample';
|
|
9
13
|
/**
|
|
10
14
|
* The interface to interact with the persistence layer.
|
|
11
15
|
* In the past there was a mongo-db implementation, but this is now replaced by currently only postgresSql.
|
|
@@ -51,6 +55,53 @@ export interface iPersist {
|
|
|
51
55
|
* @returns - The measurements
|
|
52
56
|
*/
|
|
53
57
|
getTemperatureHistory(deviceId: string, startDate?: Date, endDate?: Date): Promise<iTemperatureMeasurement[]>;
|
|
58
|
+
/**
|
|
59
|
+
* Gets the recorded battery levels of the house battery within the given window, in percent, dated at the
|
|
60
|
+
* end of the interval each reading closes - the same time base the consumption readings use.
|
|
61
|
+
* An absent, unreachable or empty persistence is a defined state, not a failure: the answer is then an
|
|
62
|
+
* empty list. Readings without a usable level, and levels outside the range above 0 up to 100, are dropped
|
|
63
|
+
* rather than replaced by a substitute value - which means an energy manager that does not actually record
|
|
64
|
+
* the state of charge yields no history at all instead of a history of zeroes.
|
|
65
|
+
* @param startDate - Start of the window (inclusive)
|
|
66
|
+
* @param endDate - End of the window (inclusive)
|
|
67
|
+
* @returns - The readings, newest first
|
|
68
|
+
*/
|
|
69
|
+
getBatteryLevelHistory(startDate: Date, endDate: Date): Promise<iBatteryLevelSample[]>;
|
|
70
|
+
/**
|
|
71
|
+
* Gets the recorded state changes of one actuator within the given window.
|
|
72
|
+
* An absent, unreachable or empty persistence is a defined state, not a failure: the answer is then an
|
|
73
|
+
* empty list.
|
|
74
|
+
* @param deviceId - The ID of the device to load the state changes for
|
|
75
|
+
* @param startDate - Start of the window (inclusive)
|
|
76
|
+
* @param endDate - End of the window (inclusive)
|
|
77
|
+
* @returns - The state changes, newest first
|
|
78
|
+
*/
|
|
79
|
+
getActuatorHistory(deviceId: string, startDate: Date, endDate: Date): Promise<iActuatorStateSample[]>;
|
|
80
|
+
/**
|
|
81
|
+
* Gets the recorded house consumption within the given window. Each reading carries the energy consumed
|
|
82
|
+
* since the preceding one and is dated at the end of the interval it closes, so readings can be added up
|
|
83
|
+
* over a window without counting an interval into the wrong one.
|
|
84
|
+
* An absent, unreachable or empty persistence is a defined state, not a failure: the answer is then an
|
|
85
|
+
* empty list. Readings without a usable value are dropped rather than replaced by a substitute value.
|
|
86
|
+
* @param startDate - Start of the window (inclusive)
|
|
87
|
+
* @param endDate - End of the window (inclusive)
|
|
88
|
+
* @returns - The readings, newest first
|
|
89
|
+
*/
|
|
90
|
+
getEnergyConsumptionHistory(startDate: Date, endDate: Date): Promise<iConsumptionWindowSample[]>;
|
|
91
|
+
/**
|
|
92
|
+
* Gets the stored daily weather aggregates within the given window.
|
|
93
|
+
* An absent, unreachable or empty persistence is a defined state, not a failure: the answer is then an
|
|
94
|
+
* empty list. Aggregates missing a value are dropped rather than completed with a substitute value.
|
|
95
|
+
* @param startDate - Start of the window (inclusive)
|
|
96
|
+
* @param endDate - End of the window (inclusive)
|
|
97
|
+
* @returns - The aggregates, newest first
|
|
98
|
+
*/
|
|
99
|
+
getWeatherDaySummaries(startDate: Date, endDate: Date): Promise<iWeatherDaySummary[]>;
|
|
100
|
+
/**
|
|
101
|
+
* Persists one daily weather aggregate. Writing the same day twice updates the existing record.
|
|
102
|
+
* @param summary - The aggregate to persist
|
|
103
|
+
*/
|
|
104
|
+
persistWeatherDaySummary(summary: iWeatherDaySummary): void;
|
|
54
105
|
/**
|
|
55
106
|
* Initializes the database-connection and prepares the database
|
|
56
107
|
* @returns - The promise that resolves when the database is initialized
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The daily weather aggregate a historical day is characterised by.
|
|
3
|
+
*/
|
|
4
|
+
export interface iWeatherDaySummary {
|
|
5
|
+
/**
|
|
6
|
+
* The day this aggregate describes, at local midnight
|
|
7
|
+
*/
|
|
8
|
+
date: Date;
|
|
9
|
+
/**
|
|
10
|
+
* Cloud cover in percent (0-100)
|
|
11
|
+
*/
|
|
12
|
+
cloudCover: number;
|
|
13
|
+
/**
|
|
14
|
+
* The day's minimum temperature in degrees celsius
|
|
15
|
+
*/
|
|
16
|
+
tempMin: number;
|
|
17
|
+
/**
|
|
18
|
+
* The day's maximum temperature in degrees celsius
|
|
19
|
+
*/
|
|
20
|
+
tempMax: number;
|
|
21
|
+
}
|
|
@@ -44,6 +44,22 @@ export * from './p-i-d-options';
|
|
|
44
44
|
export { iDesiredShutterPosition } from './IDesiredShutterPosition';
|
|
45
45
|
export { iCountToday } from './iCountToday';
|
|
46
46
|
export { iEnergyCalculation } from './iEnergyCalculation';
|
|
47
|
+
export * from './iConsumptionWindowSample';
|
|
48
|
+
export * from './iEnergyHistoryBasis';
|
|
49
|
+
export * from './iEnergyHistoryEstimate';
|
|
50
|
+
export * from './iEnergyHistoryFeatures';
|
|
51
|
+
export * from './iEnergyHistoryModel';
|
|
52
|
+
export * from './iEnergyHistoryOptions';
|
|
53
|
+
export * from './iEnergyHistoryOutlook';
|
|
54
|
+
export * from './iEnergyHistorySample';
|
|
55
|
+
export * from './iFossilGeneratorRun';
|
|
56
|
+
export * from './iFossilGeneratorSource';
|
|
57
|
+
export * from './iProjectedSocBand';
|
|
58
|
+
export * from './iMorningReserveVerdict';
|
|
59
|
+
export * from './iDachsHistoryGateResult';
|
|
60
|
+
export * from './iBatteryLevelSample';
|
|
61
|
+
export * from './iActuatorStateSample';
|
|
62
|
+
export * from './iWeatherDaySummary';
|
|
47
63
|
export { iShutterCalibration } from './iShutterCalibration';
|
|
48
64
|
export { iDeviceList } from './iDeviceList';
|
|
49
65
|
export { iIoBrokerBaseDevice } from './iIoBrokerBaseDevice';
|
package/lib/interfaces/index.js
CHANGED
|
@@ -57,3 +57,19 @@ __exportStar(require("./iProximityCallback"), exports);
|
|
|
57
57
|
__exportStar(require("./iUnifiConnectionOptions"), exports);
|
|
58
58
|
__exportStar(require("./iUnifiProtectOptions"), exports);
|
|
59
59
|
__exportStar(require("./p-i-d-options"), exports);
|
|
60
|
+
__exportStar(require("./iConsumptionWindowSample"), exports);
|
|
61
|
+
__exportStar(require("./iEnergyHistoryBasis"), exports);
|
|
62
|
+
__exportStar(require("./iEnergyHistoryEstimate"), exports);
|
|
63
|
+
__exportStar(require("./iEnergyHistoryFeatures"), exports);
|
|
64
|
+
__exportStar(require("./iEnergyHistoryModel"), exports);
|
|
65
|
+
__exportStar(require("./iEnergyHistoryOptions"), exports);
|
|
66
|
+
__exportStar(require("./iEnergyHistoryOutlook"), exports);
|
|
67
|
+
__exportStar(require("./iEnergyHistorySample"), exports);
|
|
68
|
+
__exportStar(require("./iFossilGeneratorRun"), exports);
|
|
69
|
+
__exportStar(require("./iFossilGeneratorSource"), exports);
|
|
70
|
+
__exportStar(require("./iProjectedSocBand"), exports);
|
|
71
|
+
__exportStar(require("./iMorningReserveVerdict"), exports);
|
|
72
|
+
__exportStar(require("./iDachsHistoryGateResult"), exports);
|
|
73
|
+
__exportStar(require("./iBatteryLevelSample"), exports);
|
|
74
|
+
__exportStar(require("./iActuatorStateSample"), exports);
|
|
75
|
+
__exportStar(require("./iWeatherDaySummary"), exports);
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The raw shape the driver hands back for one recorded actuator state change.
|
|
3
|
+
*
|
|
4
|
+
* The boolean column may arrive as a string depending on how it was written; the timestamp is a Date built
|
|
5
|
+
* from naive components because the column carries no zone.
|
|
6
|
+
*
|
|
7
|
+
* Not part of the published surface - a database row shape is not an interface anyone implements.
|
|
8
|
+
*/
|
|
9
|
+
export type ActuatorStateRow = {
|
|
10
|
+
/** Whether the actuator was on, as the driver hands it back */
|
|
11
|
+
on: boolean | string | null;
|
|
12
|
+
/** When the change was recorded, built from naive components */
|
|
13
|
+
date: Date | null;
|
|
14
|
+
};
|