log pid loop
All checks were successful
Build .deb on release / Build-Deb (push) Successful in 1m51s

This commit is contained in:
Alex Janka 2024-01-22 14:10:24 +11:00
parent dd7711eafd
commit b48f00b798
3 changed files with 6 additions and 4 deletions

2
Cargo.lock generated
View file

@ -2573,7 +2573,7 @@ dependencies = [
[[package]]
name = "tesla-charge-controller"
version = "1.0.16"
version = "1.0.17"
dependencies = [
"async-channel",
"chrono",

View file

@ -1,6 +1,6 @@
[package]
name = "tesla-charge-controller"
version = "1.0.16"
version = "1.0.17"
edition = "2021"
license = "MITNFA"
description = "Controls Tesla charge rate based on solar charge data"

View file

@ -115,11 +115,13 @@ impl PidLoop {
} else {
0.
};
let new_target = ((config.pid_controls.proportional_gain * error)
let offset = ((config.pid_controls.proportional_gain * error)
+ (config.pid_controls.derivative_gain * derivative))
+ (charge_state.charge_amps as f64)
+ extra_offsets;
let new_target = offset + (charge_state.charge_amps as f64);
log::warn!("pid loop: wants to go {offset}, to {new_target}");
self.previous_error = error;
let new_target_int = new_target.round() as i64;