BREAKING: PID Refactor #68
@ -77,8 +77,8 @@ class PIDAutotune:
|
|||||||
"""
|
"""
|
||||||
divisors = self._tuning_rules[tuning_rule]
|
divisors = self._tuning_rules[tuning_rule]
|
||||||
kp = self._Ku * divisors[0]
|
kp = self._Ku * divisors[0]
|
||||||
ki = divisors[1] * self._Ku / self._Pu / 0.12
|
ki = divisors[1] * self._Ku / self._Pu
|
||||||
kd = divisors[2] * self._Ku * self._Pu * 0.12
|
kd = divisors[2] * self._Ku * self._Pu
|
||||||
return PIDAutotune.PIDParams(kp, ki, kd)
|
return PIDAutotune.PIDParams(kp, ki, kd)
|
||||||
|
|
||||||
def run(self, input_val, time_input):
|
def run(self, input_val, time_input):
|
||||||
@ -114,9 +114,9 @@ class PIDAutotune:
|
|||||||
|
|
||||||
# set output
|
# set output
|
||||||
if (self._state == PIDAutotuneState.STATE_RELAY_STEP_UP):
|
if (self._state == PIDAutotuneState.STATE_RELAY_STEP_UP):
|
||||||
self._output = self._initial_output + self._outputstep
|
|
||||||
elif self._state == PIDAutotuneState.STATE_RELAY_STEP_DOWN:
|
|
||||||
self._output = self._initial_output - self._outputstep
|
self._output = self._initial_output - self._outputstep
|
||||||
|
elif self._state == PIDAutotuneState.STATE_RELAY_STEP_DOWN:
|
||||||
|
self._output = self._initial_output + self._outputstep
|
||||||
|
|
||||||
# respect output limits
|
# respect output limits
|
||||||
self._output = min(self._output, self._out_max)
|
self._output = min(self._output, self._out_max)
|
||||||
@ -223,7 +223,7 @@ def main():
|
|||||||
# Thermostat channel
|
# Thermostat channel
|
||||||
channel = 0
|
channel = 0
|
||||||
# Target temperature of the autotune routine, celcius
|
# Target temperature of the autotune routine, celcius
|
||||||
target_temperature = 30
|
target_temperature = 20
|
||||||
# Value by which output will be increased/decreased from zero, amps
|
# Value by which output will be increased/decreased from zero, amps
|
||||||
output_step = 1
|
output_step = 1
|
||||||
# Reference period for local minima/maxima, seconds
|
# Reference period for local minima/maxima, seconds
|
||||||
|
@ -3,7 +3,6 @@ use uom::si::{
|
|||||||
f64::{
|
f64::{
|
||||||
ElectricPotential,
|
ElectricPotential,
|
||||||
ElectricalResistance,
|
ElectricalResistance,
|
||||||
ElectricCurrent,
|
|
||||||
ThermodynamicTemperature,
|
ThermodynamicTemperature,
|
||||||
Time,
|
Time,
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user