-
-
Notifications
You must be signed in to change notification settings - Fork 702
/
demo.yaml
267 lines (253 loc) · 6.03 KB
/
demo.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
network:
port: 7070
log: debug
interval: 3s
javascript:
- vm: shared
script: |
state = {
residualpower: 500,
pvpower: 5000,
batterypower: -750,
batterySoc: 55,
gridpower: -1000,
loadpoints: [
{ enabled: true, vehicleSoc: 62, maxcurrent: 6, phases: 1, chargepower: 0 },
{ enabled: false, vehicleSoc: 22, maxcurrent: 0, phases: 3, chargepower: 0 }
]
};
function logState() {
console.log("state:", JSON.stringify(state));
}
meters:
- name: grid
type: custom
power:
source: js
vm: shared
script: |
state.gridpower = state.loadpoints[0].chargepower + state.loadpoints[1].chargepower + state.residualpower - batterypower - pvpower;
state.gridpower;
in:
- name: pvpower
type: float
config:
source: js
vm: shared
script: |
state.pvpower = 8000+500*Math.random();
state.pvpower
- name: batterypower
type: float
config:
source: js
vm: shared
script: |
state.batterypower = state.gridpower > 0 ? 1000 * Math.random() : 0;
state.batterypower
- name: pv
type: custom
power:
source: js
vm: shared
script: state.pvpower;
- name: battery
type: custom
power:
source: js
vm: shared
script: state.batterypower;
soc:
source: js
vm: shared
script: |
if (state.batterypower < 0) state.batterySoc++; else state.batterySoc--;
if (state.batterySoc < 10) state.batterySoc = 90;
if (state.batterySoc > 90) state.batterySoc = 10;
state.batterySoc;
capacity: 13.4
batterymode:
source: js
vm: shared
script: |
1
- name: meter_charger_1
type: custom
power:
source: js
vm: shared
script: state.loadpoints[0].chargepower;
- name: meter_charger_2
type: custom
power:
source: js
vm: shared
script: state.loadpoints[1].chargepower;
chargers:
- name: charger_1
type: custom
enable:
source: js
vm: shared
script: |
logState();
var lp = state.loadpoints[0];
lp.enabled = enable;
enable;
out:
- name: enable
type: bool
config:
source: js
vm: shared
script: |
if (enable) lp.chargepower = lp.maxcurrent * 230 * lp.phases; else lp.chargepower = 0;
enabled:
source: js
vm: shared
script: |
state.loadpoints[0].enabled;
status:
source: js
vm: shared
script: |
if (state.loadpoints[0].enabled) "C"; else "B";
maxcurrent:
source: js
vm: shared
script: |
logState();
var lp = state.loadpoints[0];
lp.maxcurrent = maxcurrent;
if (lp.enabled) lp.chargepower = lp.maxcurrent * 230 * lp.phases; else lp.chargepower = 0;
- name: charger_2
type: custom
enable:
source: js
vm: shared
script: |
logState();
var lp = state.loadpoints[1];
lp.enabled = enable;
if (lp.enabled) lp.chargepower = lp.maxcurrent * 230 * lp.phases; else lp.chargepower = 0;
enabled:
source: js
vm: shared
script: |
state.loadpoints[1].enabled;
status:
source: js
vm: shared
script: |
if (state.loadpoints[1].enabled) "C"; else "B";
maxcurrent:
source: js
vm: shared
script: |
logState();
var lp = state.loadpoints[1];
lp.maxcurrent = maxcurrent;
if (lp.enabled) lp.chargepower = lp.maxcurrent * 230 * lp.phases; else lp.chargepower = 0;
tos: true
phases1p3p:
source: js
vm: shared
script: |
logState();
if (phases === 1) lp.phases = 1; else lp.phases = 3;
lp.phases;
vehicles:
- name: vehicle_1
title: blauer e-Golf
type: custom
soc:
source: js
vm: shared
script: |
var lp = state.loadpoints[0];
if (lp.chargepower > 0) lp.vehicleSoc+=0.1; else lp.vehicleSoc-=0.1;
if (lp.vehicleSoc < 15) lp.vehicleSoc = 80;
if (lp.vehicleSoc > 80) lp.vehicleSoc = 15;
lp.vehicleSoc;
range:
source: js
vm: shared
script: |
var lp = state.loadpoints[0]
var range = (44 * lp.vehicleSoc) / 15;
range
capacity: 44
- name: vehicle_2
title: weißes Model 3
type: custom
soc:
source: js
vm: shared
script: |
var lp = state.loadpoints[1];
if (lp.chargepower > 0) lp.vehicleSoc++; else lp.vehicleSoc--;
if (lp.vehicleSoc < 15) lp.vehicleSoc = 75;
if (lp.vehicleSoc > 75) lp.vehicleSoc = 15;
lp.vehicleSoc;
range:
source: js
vm: shared
script: |
var lp = state.loadpoints[1]
var range = (80 * lp.vehicleSoc) / 17;
range
status:
source: js
vm: shared
script: |
"B"
capacity: 80
limitsoc:
source: const
value: 90
- name: vehicle_3
type: template
template: offline
title: grüner Honda e
capacity: 8
- name: vehicle_4
type: template
template: offline
title: schwarzes VanMoof
icon: bike
capacity: 0.46
- name: vehicle_5
type: template
template: offline
title: Wärmepumpe
icon: waterheater
site:
title: Zuhause
meters:
grid: grid
pv: pv
battery: battery
loadpoints:
- title: Carport
charger: charger_1
mode: pv
meter: meter_charger_1
vehicle: vehicle_1
- title: Garage
charger: charger_2
mode: "off"
meter: meter_charger_2
vehicle: vehicle_2
tariffs:
currency: EUR # three letter ISO-4217 currency code (default EUR)
grid:
type: template
template: energy-charts-api # epex spot market prices
bzn: DE-LU
charges: 0.15
feedin:
type: fixed
price: 0.08 # EUR/kWh
co2:
type: grünstromindex
zip: 12349