Skip to content

Commit 91a3e2f

Browse files
committed
rework #504 with simplify, unify naming scheme with already existing and add 'Stat' prefix, add StatEnergySumYear with input params
1 parent 0b6a210 commit 91a3e2f

File tree

1 file changed

+114
-48
lines changed

1 file changed

+114
-48
lines changed

src/vaillant/b516_inc.tsp

Lines changed: 114 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -7,98 +7,164 @@ namespace Vaillant;
77

88
/** b516 energy statistics */
99
namespace B516_inc {
10+
@base(MF, 0x16, 0x10)
11+
model rc {
12+
// @out
13+
// @values(Values_period)
14+
// period: UCH;
15+
// @out
16+
// @constValue(0xffff)
17+
// ign2: UIN;
18+
/** the energy source */
19+
@out
20+
@values(Values_source)
21+
source: UCH;
22+
23+
/** the energy usage */
24+
@out
25+
@values(Values_usage)
26+
usage: UCH;
27+
}
28+
29+
@inherit(rc)
30+
@ext(
31+
3, // period=year
32+
0xff, 0xff // fix value
33+
)
34+
model StatEnergySumYear {
35+
// according to #490 and #504:
36+
// hex digits MDYY with M=month*2 (or 0 for year period), D=day of month (or 0 for year/month period), YY=year*2 since 2000 (or 0 for total)
37+
// i.e. bits (rev): yyyyyyy mmmm ddddd
38+
// e.g. 0x3257 = 0b0011001 0010 10111 = 2025-02-23
39+
// e.g. 0x3180 = 0b0011000 1100 00000 = 2024-12-00
40+
// @out
41+
// date: UIN; // would require a new base datatype
42+
@out
43+
@constValue(0)
44+
ign2: UCH; // ignored M+D for period=year
45+
46+
/** the year as offset from 2000 */
47+
@out
48+
@divisor(2)
49+
year: UCH; // upper 7 bits of YY (with divisor)
1050

11-
model energye {
1251
@maxLength(7)
13-
ign: IGN;
14-
@unit("Wh")
15-
energye: EXP;
52+
ign: IGN; // repeats the query (more or less)
53+
54+
value: energye;
1655
}
1756

18-
@base(MF, 0x16, 0x10)
19-
model r_1 {}
57+
enum Values_period {
58+
total: 0,
59+
day: 1,
60+
month: 2,
61+
year: 3,
62+
}
63+
64+
enum Values_source {
65+
solar: 1,
66+
environment: 2,
67+
electricity: 3,
68+
gas: 4,
69+
}
70+
71+
enum Values_usage {
72+
all: 0,
73+
heat: 2,
74+
water: 4,
75+
cool: 5,
76+
}
77+
78+
@base(MF, 0x16, 0x10,
79+
0, // period=total
80+
0xff, 0xff // fix value
81+
)
82+
model r {
83+
@maxLength(7)
84+
ign: IGN;
85+
}
2086

21-
@inherit(r_1)
22-
@ext(0x00, 0xff, 0xff, 0x01, 0x00, 0x00, 0x30)
23-
model SolarSumSystem {
87+
@inherit(r)
88+
@ext(1, 0, 0, 0)
89+
model StatSolarEnergySum {
2490
value: energye;
2591
}
2692

27-
@inherit(r_1)
28-
@ext(0x00, 0xff, 0xff, 0x01, 0x03, 0x00, 0x30)
29-
model SolarHeatingSystem {
93+
@inherit(r)
94+
@ext(1, 0x03, 0, 0)
95+
model StatSolarEnergySumHc {
3096
value: energye;
3197
}
3298

33-
@inherit(r_1)
34-
@ext(0x00, 0xff, 0xff, 0x01, 0x04, 0x00, 0x30)
35-
model SolarHotWaterSystem {
99+
@inherit(r)
100+
@ext(1, 0x04, 0, 0)
101+
model StatSolarEnergySumHwc {
36102
value: energye;
37103
}
38104

39-
@inherit(r_1)
40-
@ext(0x00, 0xff, 0xff, 0x02, 0x00, 0x00, 0x30)
41-
model EnvironmentalSumSystem {
105+
@inherit(r)
106+
@ext(0x02, 0, 0, 0)
107+
model StatEnvironmentEnergySum {
42108
value: energye;
43109
}
44110

45-
@inherit(r_1)
46-
@ext(0x00, 0xff, 0xff, 0x02, 0x03, 0x00, 0x30)
47-
model EnvironmentalHeatingSystem {
111+
@inherit(r)
112+
@ext(0x02, 0x03, 0, 0)
113+
model StatEnvironmentEnergySumHc {
48114
value: energye;
49115
}
50116

51-
@inherit(r_1)
52-
@ext(0x00, 0xff, 0xff, 0x02, 0x04, 0x00, 0x30)
53-
model EnvironmentalHotWaterSystem {
117+
@inherit(r)
118+
@ext(0x02, 0x04, 0, 0)
119+
model StatEnvironmentEnergySumHwc {
54120
value: energye;
55121
}
56122

57-
@inherit(r_1)
58-
@ext(0x00, 0xff, 0xff, 0x02, 0x05, 0x00, 0x30)
59-
model EnvironmentalCoolingSystem {
123+
@inherit(r)
124+
@ext(0x02, 0x05, 0, 0)
125+
model StatEnvironmentEnergySumCool {
60126
value: energye;
61127
}
62128

63-
@inherit(r_1)
64-
@ext(0x00, 0xff, 0xff, 0x03, 0x00, 0x00, 0x30)
65-
model ElectricalSumSystem {
129+
@inherit(r)
130+
@ext(0x03, 0, 0, 0)
131+
model StatElectricEnergySum {
66132
value: energye;
67133
}
68134

69-
@inherit(r_1)
70-
@ext(0x00, 0xff, 0xff, 0x03, 0x03, 0x00, 0x30)
71-
model ElectricalHeatingSystem {
135+
@inherit(r)
136+
@ext(0x03, 0x03, 0, 0)
137+
model StatElectricEnergySumHc {
72138
value: energye;
73139
}
74140

75-
@inherit(r_1)
76-
@ext(0x00, 0xff, 0xff, 0x03, 0x04, 0x00, 0x30)
77-
model ElectricalHotWaterSystem {
141+
@inherit(r)
142+
@ext(0x03, 0x04, 0, 0)
143+
model StatElectricEnergySumHwc {
78144
value: energye;
79145
}
80146

81-
@inherit(r_1)
82-
@ext(0x00, 0xff, 0xff, 0x03, 0x05, 0x00, 0x30)
83-
model ElectricalCoolingSystem {
147+
@inherit(r)
148+
@ext(0x03, 0x05, 0, 0)
149+
model StatElectricEnergySumCool {
84150
value: energye;
85151
}
86152

87-
@inherit(r_1)
88-
@ext(0x00, 0xff, 0xff, 0x04, 0x00, 0x00, 0x30)
89-
model FuelSumSystem {
153+
@inherit(r)
154+
@ext(0x04, 0, 0, 0)
155+
model StatFuelSum {
90156
value: energye;
91157
}
92158

93-
@inherit(r_1)
94-
@ext(0x00, 0xff, 0xff, 0x04, 0x03, 0x00, 0x30)
95-
model FuelHeatingSystem {
159+
@inherit(r)
160+
@ext(0x04, 0x03, 0, 0)
161+
model StatFuelSumHc {
96162
value: energye;
97163
}
98164

99-
@inherit(r_1)
100-
@ext(0x00, 0xff, 0xff, 0x04, 0x04, 0x00, 0x30)
101-
model FuelHotWaterSystem {
165+
@inherit(r)
166+
@ext(0x04, 0x04, 0, 0)
167+
model StatFuelSumHwc {
102168
value: energye;
103169
}
104170
}

0 commit comments

Comments
 (0)