-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathpalm_settings.py
295 lines (267 loc) · 9.77 KB
/
palm_settings.py
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
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
# version 2023.12.03
"""
Settings file for use with palm.py: Compatible with v0.9, v0.10, v1.0.x and v1.1.x
2023.09.29: Added Shelly power monitor
2023.11.25: Added Shelly switch to activate other loads when Smart Charging
2023.12.03 Updated Loads for Shelly switches and MinBattSoc
"""
######
# Do not edit this class definition, it is used to share global variables between components of the PALM system
class pg:
"""PALM global variable definitions. Used by palm_utils and project-specific wrappers"""
test_mode: bool = False
debug_mode: bool = False
once_mode: bool = False
long_t_now: str = ""
month: str = ""
t_now: str = ""
t_now_mins: int = 0
loop_counter: int = 0 # 1 minute minor frame. "0" = initialise
pvo_tstamp: int = 0 # Records value of loop_counter when PV data last written
palm_version: str = ""
######
# Edit from this point onwards
# SolCast PV forecast generator. Two forecasts are obtained, one per array
class Solcast:
enable = True
key = "xxxx"
url_se = "https://api.solcast.com.au/rooftop_sites/xxxx"
url_sw = "https://api.solcast.com.au/rooftop_sites/xxxx"
cmd = "/forecasts?format=json"
weight = 35 # Confidence factor for forecast (range 10 to 90)
class PVData:
PwrThreshold = 30 # Sets power threshold for virtual sunset (lighting up time)
# PVOutput.org data logging/analysis service
class PVOutput:
enable = True
url= "https://pvoutput.org/service/r2/"
key = "xxxx"
sid = "xxxx"
# API for obtaining current UK carbon intensity of electricity generation
class CarbonIntensity:
enable = True
url = "https://api.carbonintensity.org.uk/regional/intensity/"
RegionID = "/fw24h/regionid/15"
Threshold = 250 # For Used to trigger afternoon battery charge
Multiplier = 1.5 # For afternoon battery charge
# Weather data
class OpenWeatherMap:
enable = True
url = "https://api.openweathermap.org/data/2.5/"
url_weather = "https://api.openweathermap.org/data/2.5/weather?"
url_forecast = "https://api.openweathermap.org/data/2.5/forecast?"
city_id = "xxxx"
payload = {
"lat" : 51.05,
"lon" : -0.985,
"appid" : "xxxx",
"exclude" : "daily",
"mode" : 'JSON'
}
# User settings for GivEnergy inverter API
class GE:
enable = True
url = "https://api.givenergy.cloud/v1/inverter/CEXXXX/"
key="XXXX"
# Disable SoC calculation in the winter months as consumption >> generation
winter = ["01", "02", "11", "12"]
# Throttle SoC calculation in shoulder months as consumption can vary with heating coming on
shoulder = ["03", "04", "09", "10"]
# Lower limit for state of charge (summertime)
min_soc_target = 20
# Higher SoC limit for shoulder months
max_soc_target = 60
# Battery reserve for power cuts (minmum of 4%)
batt_reserve = 4
# Nominal battery capacity
batt_capacity = 10.4
# Proportion of battery that's usable
batt_utilisation = 0.85
batt_max_charge = batt_capacity * batt_utilisation
# Inverter charge/discharge rate
charge_rate = 3
# Default data for base load. Overwritten by actual data if available
base_load = [0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.2, \
0.2, 0.2, 0.2, 0.3, 0.2, 0.2, 0.1, 0.3, 0.3, 0.2, 0.3, 0.8, 0.6, 0.3, 0.3, 0.2, \
0.2, 0.2, 0.2, 0.6, 0.6, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1]
# Load history is a weighted average of actual load from previous days.
# Uncomment required settings or make your own using positive integers only. Examples:
# Most recent day only
# load_hist_weight = [1]
# 3-day average
load_hist_weight = [1, 1, 1]
# 7-day average
# load_hist_weight = [1, 1, 1, 1, 1, 1, 1]
# Same day last week - useful if, say, Monday is always wash-day
# load_hist_weight = [0, 0, 0, 0, 0, 0, 1]
# Weighted average (a more extreme example)
# load_hist_weight = [4, 2, 2, 1, 1, 1, 1]
# Start time for Overnight Charge. If "", disables writing this inverter register
# Be kind to the grid and set your own value that isn't "on the hour/half-hour" to stagger demand
start_time = "00:37"
# End time for Overnight Charge period. If "", disables writing this inverter register
end_time = "04:30"
# Delayed winter end time saves battery for morning peak. If "", disables writing this inverter register
end_time_winter = "06:30"
# Winter afternoon boost start and end times
boost_start = "13:03"
boost_finish = "16:44"
# Enable or disable all load management here
class LoadMgt:
enable = True
class Shelly:
"""Shelly switch definitions"""
em0_url = "http://192.168.1.21/emeter/0" # Energy meter for EV, detects IO Smart Charging sessions
sw1_url = "http://192.168.1.22/" # Switch for enabling loads during IO Smart Charging
sw2_url = "http://192.168.1.23/" # Switch for enabling loads during PV export - see Load1 below
# MiHome devices are used to activate various loads
class MiHome:
url = "https://mihome4u.co.uk/api/v1/subdevices/"
UserID = "XXXX"
key = "XXXX"
# This section defines the various loads and operating parameters
# Examples are provided for a Shelly switch and a MiHome switch
LOAD_CONFIG = {
"LoadPriorityOrder": [
"Load1",
"Load2"
],
"Load1": {
"DeviceName" : "Towel Rails",
"DeviceType" : "Shelly",
"DeviceID" : Shelly.sw2_url,
"EarlyStart" : "10:00",
"LateStart" : "14:00",
"FinishTime" : "16:00",
"MinOnTime" : 5,
"MinDailyTarget": 0,
"MaxDailyTarget": 60,
"MaxCO2" : 200,
"MinBattSoc" : 90,
"MaxTemp" : 25,
"PwrLoad" : 800,
"PwrStart" : 500,
"Hysteresis" : 250
},
"Load2": {
"DeviceName" : "Battery Charger",
"DeviceType" : "MiHome",
"DeviceID" : "249595",
"EarlyStart" : "09:00",
"LateStart" : "15:00",
"FinishTime" : "16:00",
"MinOnTime" : 5,
"MinDailyTarget": 15,
"MaxDailyTarget": 120,
"MaxCO2" : 300,
"MinBattSoc" : 90,
"MaxTemp" : 25,
"PwrLoad" : 40,
"PwrStart" : 30,
"Hysteresis" : 50
}
}
GE_Command_list = {
"data": [
{
"id": 17,
"name": "Enable AC Charge Upper % Limit",
"validation": "Value must be either true or false"
},
{
"id": 24,
"name": "Enable Eco Mode",
"validation": "Value must be either true or false"
},
{
"id": 28,
"name": "AC Charge 2 Start Time",
"validation": "Value format should be HH:mm. Use correct time range for hour and minutes"
},
{
"id": 29,
"name": "AC Charge 2 End Time",
"validation": "Value format should be HH:mm. Use correct time range for hour and minutes"
},
{
"id": 41,
"name": "DC Discharge 2 Start Time",
"validation": "Value format should be HH:mm. Use correct time range for hour and minutes"
},
{
"id": 42,
"name": "DC Discharge 2 End Time",
"validation": "Value format should be HH:mm. Use correct time range for hour and minutes"
},
{
"id": 47,
"name": "Inverter Max Output Active Power Percent",
"validation": "Value must be between 0 and 100"
},
{
"id": 53,
"name": "DC Discharge 1 Start Time",
"validation": "Value format should be HH:mm. Use correct time range for hour and minutes"
},
{
"id": 54,
"name": "DC Discharge 1 End Time",
"validation": "Value format should be HH:mm. Use correct time range for hour and minutes"
},
{
"id": 56,
"name": "Enable DC Discharge",
"validation": "Value must be either true or false"
},
{
"id": 64,
"name": "AC Charge 1 Start Time",
"validation": "Value format should be HH:mm. Use correct time range for hour and minutes"
},
{
"id": 65,
"name": "AC Charge 1 End Time",
"validation": "Value format should be HH:mm. Use correct time range for hour and minutes"
},
{
"id": 66,
"name": "AC Charge Enable",
"validation": "Value must be either true or false"
},
{
"id": 71,
"name": "Battery Reserve % Limit",
"validation": "Value must be between 4 and 100"
},
{
"id": 72,
"name": "Battery Charge Power",
"validation": "Value must be between 0 and 3000"
},
{
"id": 73,
"name": "Battery Discharge Power",
"validation": "Value must be between 0 and 3000"
},
{
"id": 75,
"name": "Battery Cutoff % Limit",
"validation": "Value must be between 4 and 100"
},
{
"id": 77,
"name": "AC Charge Upper % Limit",
"validation": "Value must be between 0 and 100"
},
{
"id": 83,
"name": "Restart Inverter",
"validation": "Value can only be 100"
},
{
"id": 258,
"name": "Force Off Grid",
"validation": "Value must be either true or false"
}
]
}