sorry theo u have to do more work
All checks were successful
Build .deb on release / Build-Deb (push) Successful in 1m50s
All checks were successful
Build .deb on release / Build-Deb (push) Successful in 1m50s
This commit is contained in:
parent
9bee9f93a2
commit
13b892ca7e
2
Cargo.lock
generated
2
Cargo.lock
generated
|
@ -2573,7 +2573,7 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "tesla-charge-controller"
|
name = "tesla-charge-controller"
|
||||||
version = "1.0.18"
|
version = "1.0.19"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"async-channel",
|
"async-channel",
|
||||||
"chrono",
|
"chrono",
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
[package]
|
[package]
|
||||||
name = "tesla-charge-controller"
|
name = "tesla-charge-controller"
|
||||||
version = "1.0.18"
|
version = "1.0.19"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
license = "MITNFA"
|
license = "MITNFA"
|
||||||
description = "Controls Tesla charge rate based on solar charge data"
|
description = "Controls Tesla charge rate based on solar charge data"
|
||||||
|
|
|
@ -110,17 +110,17 @@ impl PidLoop {
|
||||||
let error = pl_state.battery_voltage - pl_state.target_voltage;
|
let error = pl_state.battery_voltage - pl_state.target_voltage;
|
||||||
let derivative = (error - self.previous_error) / delta_time;
|
let derivative = (error - self.previous_error) / delta_time;
|
||||||
let config = access_config();
|
let config = access_config();
|
||||||
|
|
||||||
let extra_offsets = if pl_state.internal_load_current > 1. {
|
let extra_offsets = if pl_state.internal_load_current > 1. {
|
||||||
1.
|
1.
|
||||||
} else {
|
} else {
|
||||||
0.
|
0.
|
||||||
};
|
};
|
||||||
let offset = ((config.pid_controls.proportional_gain * error)
|
|
||||||
+ (config.pid_controls.derivative_gain * derivative))
|
|
||||||
+ extra_offsets;
|
|
||||||
|
|
||||||
let new_target = offset + (charge_state.charge_amps as f64);
|
let new_target = ((config.pid_controls.proportional_gain * error)
|
||||||
log::warn!("pid loop: wants to go {offset}, to {new_target}");
|
+ (config.pid_controls.derivative_gain * derivative))
|
||||||
|
+ extra_offsets
|
||||||
|
+ (charge_state.charge_amps as f64);
|
||||||
|
|
||||||
self.previous_error = error;
|
self.previous_error = error;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue