-
-
Notifications
You must be signed in to change notification settings - Fork 762
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
Refactor green share calculation #4760
Conversation
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.
Hi @naltatis,
Ich habe alles einmal im Detail durchgelesen und kann erstmal nichts negatives finden.
Auch wenn ich noch keinen sehr großen Einblick in die EVCC Architektur habe.
Ein Punkt den ich anmerken könnte:
- Refactoring wenn möglich entweder "Form" oder "Function".
In dem Fall wären zwei Commits mega. Ein Commit der alles Verschiebt, aber kein Verhalten ändert (Tests bleiben gleich). Und ein zweiter Commit der auf den Greenshare umstellt. Das macht das Review einfacher und reduziert Fehler.
@andig rein damit? |
// greenShare returns the percentage of self produced energy currently used at the site. 0 = full-grid; 1 = full pv/battery. | ||
func (site *Site) greenShare() float64 { | ||
batteryDischarge := math.Max(0, site.batteryPower) | ||
batteryCharge := math.Min(0, site.batteryPower) * -1 |
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.
:= -...
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.
Magst die komplizierte Minusrechnung noch anpassen?
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.
ping
savings.go
tosite.go
to make result reusable in savings, telemetry and sessions (later)greenShare
value0
means currently no self-produced energy used1
means all usage is covered by pv or battery