Fix formatting issue Payload struct comment.
All checks were successful
Build Docker image / build (push) Successful in 56s

This commit is contained in:
Pieter Hollander 2024-02-20 16:55:12 +01:00
parent dbb8319752
commit 68e7f28f81
Signed by: pieter
SSH key fingerprint: SHA256:HbX+9cBXsop9SuvL+mELd29sK+7DehFfdVweFVDtMSg

32
main.go
View file

@ -27,27 +27,29 @@ import (
// //
// Gas consumption is updated once per minute. // Gas consumption is updated once per minute.
// Not saving intermittent values theoretically saves 4 bytes per value. // Not saving intermittent values theoretically saves 4 bytes per value.
// Storage for non-NULL values every second: //
// 86,400entries/day×4bytes/entry=345,600bytes/day86,400entries/day×4bytes/entry=345,600bytes/day // Storage for non-NULL values every second:
// Storage for non-NULL values every minute: // 86,400entries/day×4bytes/entry=345,600bytes/day86,400entries/day×4bytes/entry=345,600bytes/day
// 1,440entries/day×4bytes/entry=5,760bytes/day1,440entries/day×4bytes/entry=5,760bytes/day // Storage for non-NULL values every minute:
// Storage savings: // 1,440entries/day×4bytes/entry=5,760bytes/day1,440entries/day×4bytes/entry=5,760bytes/day
// 345,600bytes/day5,760bytes/day=339,840bytes/day345,600bytes/day5,760bytes/day=339,840bytes/day // Storage savings:
// (about 331.5 KB / day or 9.72 MB / month) // 345,600bytes/day5,760bytes/day=339,840bytes/day345,600bytes/day5,760bytes/day=339,840bytes/day
// In practice, savings will be even higher when gas is not being consumed continuously. // (about 331.5 KB / day or 9.72 MB / month)
// In practice, savings will be even higher when gas is not being consumed continuously.
// //
// When Tariff 1 is active, Tariff 2 isn't. // When Tariff 1 is active, Tariff 2 isn't.
// When energy is being imported, it is not being returned. // When energy is being imported, it is not being returned.
// Therefore, only updating their values on-change should save at least 75% storage capacity requirements //
// An average month has 2 629 743.83 seconds. // Therefore, only updating their values on-change should save at least 75% storage capacity requirements
// This saves at least: // An average month has 2 629 743.83 seconds.
// 2,629,743.83 seconds * 4 bytes = 10,518,975.32 bytes = 10,518.98 kB = 10.52 MB // This saves at least:
// This applies both to Dt1 and Dt2 as well as Rt1 and Rt2, only one is recorded at a time. // 2,629,743.83 seconds * 4 bytes = 10,518,975.32 bytes = 10,518.98 kB = 10.52 MB
// 10.52 * 3 = 31.56 MB. // This applies both to Dt1 and Dt2 as well as Rt1 and Rt2, only one is recorded at a time.
// 10.52 * 3 = 31.56 MB.
//
// In addition, many meters only update these metrics once every 10 seconds, // In addition, many meters only update these metrics once every 10 seconds,
// meaning even more storage capacity is saved: // meaning even more storage capacity is saved:
// 10.52 / 10 * 9 = 9,468 MB. // 10.52 / 10 * 9 = 9,468 MB.
type Payload struct { type Payload struct {
T string `json:"t"` // Timestamp T string `json:"t"` // Timestamp
Dt1 *int `json:"dt1"` // Delivered / imported meter reading tariff 1 (kWh) Dt1 *int `json:"dt1"` // Delivered / imported meter reading tariff 1 (kWh)