Repository navigation
Dynamic load feature #2702
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Dynamic load feature #2702
Changes from 1 commit
aebe6ca
5264e8d
7877af9
c76c0de
f48cd12
8f7b075
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -12,7 +12,7 @@ | |||||||||||||||||||||||||||||||||
| import traceback | ||||||||||||||||||||||||||||||||||
| from datetime import datetime, timedelta | ||||||||||||||||||||||||||||||||||
| from multiprocessing import Pool, cpu_count | ||||||||||||||||||||||||||||||||||
| from config import PREDICT_STEP, TIME_FORMAT | ||||||||||||||||||||||||||||||||||
| from config import PREDICT_STEP, TIME_FORMAT, MINUTE_WATT | ||||||||||||||||||||||||||||||||||
| from utils import calc_percent_limit, dp0, dp1, dp2, dp3, dp4, remove_intersecting_windows, calc_percent_limit | ||||||||||||||||||||||||||||||||||
| from prediction import Prediction, wrapped_run_prediction_single, wrapped_run_prediction_charge, wrapped_run_prediction_charge_min_max, wrapped_run_prediction_export, wrapped_run_prediction_charge_min_max | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
|
|
@@ -36,6 +36,38 @@ def get(self): | |||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| class Plan: | ||||||||||||||||||||||||||||||||||
| def dynamic_load(self): | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| # Last period load analysis | ||||||||||||||||||||||||||||||||||
| self.load_last_status = "baseline" | ||||||||||||||||||||||||||||||||||
| if self.load_last_period > self.battery_rate_max_discharge * MINUTE_WATT / 1000: | ||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||
| self.load_last_status = "high" | ||||||||||||||||||||||||||||||||||
| elif (self.load_last_period < self.battery_rate_max_discharge * 0.9 * MINUTE_WATT / 1000) and (self.load_last_period < self.car_charging_threshold * 0.9): | ||||||||||||||||||||||||||||||||||
|
Comment on lines
+39
to
+44
|
||||||||||||||||||||||||||||||||||
| def dynamic_load(self): | |
| # Last period load analysis | |
| self.load_last_status = "baseline" | |
| if self.load_last_period > self.battery_rate_max_discharge * MINUTE_WATT / 1000: | |
| self.load_last_status = "high" | |
| elif (self.load_last_period < self.battery_rate_max_discharge * 0.9 * MINUTE_WATT / 1000) and (self.load_last_period < self.car_charging_threshold * 0.9): | |
| LOW_LOAD_FACTOR = 0.9 | |
| def dynamic_load(self): | |
| # Last period load analysis | |
| self.load_last_status = "baseline" | |
| if self.load_last_period > self.battery_rate_max_discharge * MINUTE_WATT / 1000: | |
| self.load_last_status = "high" | |
| elif (self.load_last_period < self.battery_rate_max_discharge * self.LOW_LOAD_FACTOR * MINUTE_WATT / 1000) and (self.load_last_period < self.car_charging_threshold * self.LOW_LOAD_FACTOR): |
Copilot
AI
Sep 28, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The magic number 30 (representing a 30-minute period) appears multiple times. Consider defining it as a named constant (e.g., SLOT_DURATION_MINUTES = 30) to improve maintainability.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The magic number 8000 for page size should be defined as a named constant (e.g.,
GE_API_PAGE_SIZE = 8000) to improve maintainability and make it easier to adjust if needed.