Skip to content

Commit 6b2c955

Browse files
authored
Merge pull request #201 from reserve85/dev_min_point
add POWERMETER_MIN_POINT functionality
2 parents b3c8efa + bc3cc8d commit 6b2c955

4 files changed

Lines changed: 54 additions & 4 deletions

File tree

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
# Changelog
22

3+
## V1.94
4+
### script
5+
* add script functionality for a super high priority limit change if your powermeter falls below POWERMETER_MIN_POINT (https://github.com/reserve85/HoymilesZeroExport/issues/200)
6+
### config
7+
* add `[CONTROL]`: `POWERMETER_MIN_POINT`
8+
* add `[COMMON]`: `ON_GRID_FEED_FAST_LIMIT_DECREASE`
9+
310
## V1.93
411
### script
512
* support script for intermediate meter (https://github.com/reserve85/HoymilesZeroExport/issues/197)

HoymilesZeroExport.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
# along with this program. If not, see <http://www.gnu.org/licenses/>.
1616

1717
__author__ = "Tobias Kraft"
18-
__version__ = "1.93"
18+
__version__ = "1.94"
1919

2020
import requests
2121
import time
@@ -1435,8 +1435,10 @@ def CreateDTU() -> DTU:
14351435
while True:
14361436
CONFIG_PROVIDER.update()
14371437
on_grid_usage_jump_to_limit_percent = CONFIG_PROVIDER.on_grid_usage_jump_to_limit_percent()
1438+
on_grid_feed_fast_limit_decrease = CONFIG_PROVIDER.on_grid_feed_fast_limit_decrease()
14381439
powermeter_target_point = CONFIG_PROVIDER.get_powermeter_target_point()
14391440
powermeter_max_point = CONFIG_PROVIDER.get_powermeter_max_point()
1441+
powermeter_min_point = CONFIG_PROVIDER.get_powermeter_min_point()
14401442
powermeter_tolerance = CONFIG_PROVIDER.get_powermeter_tolerance()
14411443
if powermeter_max_point < (powermeter_target_point + powermeter_tolerance):
14421444
powermeter_max_point = powermeter_target_point + powermeter_tolerance + 50
@@ -1464,6 +1466,14 @@ def CreateDTU() -> DTU:
14641466
if RemainingDelay > 0:
14651467
time.sleep(RemainingDelay)
14661468
break
1469+
elif (powermeterWatts < powermeter_min_point) and on_grid_feed_fast_limit_decrease:
1470+
newLimitSetpoint = PreviousLimitSetpoint + powermeterWatts - powermeter_target_point
1471+
newLimitSetpoint = ApplyLimitsToSetpoint(newLimitSetpoint)
1472+
SetLimit(newLimitSetpoint)
1473+
RemainingDelay = CastToInt((LOOP_INTERVAL_IN_SECONDS / POLL_INTERVAL_IN_SECONDS - x) * POLL_INTERVAL_IN_SECONDS)
1474+
if RemainingDelay > 0:
1475+
time.sleep(RemainingDelay)
1476+
break
14671477
else:
14681478
time.sleep(POLL_INTERVAL_IN_SECONDS)
14691479

HoymilesZeroExport_Config.ini

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,7 @@
1919
# ---------------------------------------------------------------------
2020

2121
[VERSION]
22-
VERSION = 1.93
23-
22+
VERSION = 1.94
2423
[SELECT_DTU]
2524
# --- define your DTU (only one) ---
2625
USE_AHOY = false
@@ -268,6 +267,8 @@ POLL_INTERVAL_IN_SECONDS = 1
268267
# if your powermeter exceeds POWERMETER_MAX_POINT: immediatelly set the limit to predefined percent of HOY_MAX_WATT (if you have more than one inverter it´s the sum of all HOY_MAX_WATT)
269268
# value = 0 disables the feature. Values are possible from [0 to 100]
270269
ON_GRID_USAGE_JUMP_TO_LIMIT_PERCENT = 100
270+
# if your powermeter falls below POWERMETER_MIN_POINT: immediatelly decrease the limit
271+
ON_GRID_FEED_FAST_LIMIT_DECREASE = false
271272
# max difference between Limit and real output power in % of HOY_MAX_WATT (100 = disabled)
272273
MAX_DIFFERENCE_BETWEEN_LIMIT_AND_OUTPUTPOWER = 100
273274
# enable logging to file
@@ -299,6 +300,9 @@ POWERMETER_TOLERANCE = 25
299300
# if your powermeter jumps over this point, the limit will be increased instantly. it is like a "super high priority limit change".
300301
# if you defined ON_GRID_USAGE_JUMP_TO_LIMIT_PERCENT > 0, then the limit will jump to the defined percent when reaching this point.
301302
POWERMETER_MAX_POINT = 0
303+
# POWERMETER_MIN_POINT is the minimum power of your powermeter for the normal "regulation loop".
304+
# if your powermeter jumps under this point, the limit will be reduced instantly. it is like a "super high priority limit change".
305+
POWERMETER_MIN_POINT = -600
302306

303307
# List of INVERTERS, based on COMMON/COUNT
304308
[INVERTER_1]

config_provider.py

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,25 @@ def get_powermeter_max_point(self):
2525
If you defined ON_GRID_USAGE_JUMP_TO_LIMIT_PERCENT > 0, then the limit will jump to the defined percent when reaching this point.
2626
"""
2727
pass
28+
29+
def get_powermeter_min_point(self):
30+
"""
31+
The minimum power of your powermeter for the normal "regulation loop".
32+
if your powermeter jumps under this point and ON_GRID_FEED_FAST_LIMIT_DECREASE = true, the limit will be reduced instantly. it is like a "super high priority limit change".
33+
"""
34+
pass
2835

2936
def on_grid_usage_jump_to_limit_percent(self):
3037
"""
3138
If the powermeter jumps over the max point, the limit will be increased to this percent of the powermeter value.
3239
"""
3340
pass
41+
42+
def on_grid_feed_fast_limit_decrease(self):
43+
"""
44+
If the powermeter falls below the min point, the limit will be immediatelly decreased.
45+
"""
46+
pass
3447

3548
def get_powermeter_tolerance(self):
3649
"""
@@ -85,12 +98,18 @@ def get_powermeter_target_point(self):
8598

8699
def get_powermeter_max_point(self):
87100
return self.config.getint('CONTROL', 'POWERMETER_MAX_POINT')
101+
102+
def get_powermeter_min_point(self):
103+
return self.config.getint('CONTROL', 'POWERMETER_MIN_POINT')
88104

89105
def get_powermeter_tolerance(self):
90106
return self.config.getint('CONTROL', 'POWERMETER_TOLERANCE')
91107

92108
def on_grid_usage_jump_to_limit_percent(self):
93109
return self.config.getint('COMMON', 'ON_GRID_USAGE_JUMP_TO_LIMIT_PERCENT')
110+
111+
def on_grid_feed_fast_limit_decrease(self):
112+
return self.config.getboolean('COMMON', 'ON_GRID_FEED_FAST_LIMIT_DECREASE')
94113

95114
def get_min_wattage_in_percent(self, inverter_idx):
96115
return self.config.getint('INVERTER_' + str(inverter_idx + 1), 'HOY_MIN_WATT_IN_PERCENT')
@@ -152,8 +171,10 @@ def cast_value(is_inverter_value, key, value):
152171
else:
153172
logger.error(f"Unknown inverter key {key}")
154173
else:
155-
if key in ['powermeter_target_point', 'powermeter_max_point', 'powermeter_tolerance', 'on_grid_usage_jump_to_limit_percent']:
174+
if key in ['powermeter_target_point', 'powermeter_max_point', 'powermeter_min_point', 'powermeter_tolerance', 'on_grid_usage_jump_to_limit_percent']:
156175
return int(value)
176+
elif key in ['on_grid_feed_fast_limit_decrease']:
177+
return bool(value)
157178
else:
158179
logger.error(f"Unknown common key {key}")
159180

@@ -185,11 +206,17 @@ def get_powermeter_target_point(self):
185206
def get_powermeter_max_point(self):
186207
return self.common_config.get('powermeter_max_point')
187208

209+
def get_powermeter_min_point(self):
210+
return self.common_config.get('powermeter_min_point')
211+
188212
def get_powermeter_tolerance(self):
189213
return self.common_config.get('powermeter_tolerance')
190214

191215
def on_grid_usage_jump_to_limit_percent(self):
192216
return self.common_config.get('on_grid_usage_jump_to_limit_percent')
217+
218+
def on_grid_feed_fast_limit_decrease(self):
219+
return self.common_config.get('on_grid_feed_fast_limit_decrease')
193220

194221
def get_min_wattage_in_percent(self, inverter_idx):
195222
if inverter_idx >= len(self.inverter_config):
@@ -226,8 +253,10 @@ def __init__(self, mqtt_broker, mqtt_port, client_id, mqtt_username, mqtt_passwo
226253
self.reset_topic = reset_topic
227254
self.target_point = None
228255
self.max_point = None
256+
self.min_point = None
229257
self.tolerance = None
230258
self.on_grid_usage_jump_to_limit_percent = None
259+
self.on_grid_feed_fast_limit_decrease = None
231260
self.min_wattage_in_percent = []
232261
self.normal_wattage = []
233262
self.reduce_wattage = []

0 commit comments

Comments
 (0)