PyThermostat: Modify PIDAutotune for GUI usage #162
@ -18,6 +18,7 @@ class PIDAutotuneState(Enum):
|
|||||||
STATE_RELAY_STEP_DOWN = auto()
|
STATE_RELAY_STEP_DOWN = auto()
|
||||||
STATE_SUCCEEDED = auto()
|
STATE_SUCCEEDED = auto()
|
||||||
STATE_FAILED = auto()
|
STATE_FAILED = auto()
|
||||||
|
STATE_READY = auto()
|
||||||
|
|||||||
|
|
||||||
|
|
||||||
class PIDAutotune:
|
class PIDAutotune:
|
||||||
@ -57,6 +58,21 @@ class PIDAutotune:
|
|||||||
self._Ku = 0
|
self._Ku = 0
|
||||||
self._Pu = 0
|
self._Pu = 0
|
||||||
|
|
||||||
|
def set_param(self, target, step, noiseband, sampletime, lookback):
|
||||||
|
self._setpoint = target
|
||||||
|
self._outputstep = step
|
||||||
|
self._out_max = step
|
||||||
|
self._out_min = -step
|
||||||
|
self._noiseband = noiseband
|
||||||
|
self._inputs = deque(maxlen=round(lookback / sampletime))
|
||||||
|
|
||||||
|
def set_ready(self):
|
||||||
|
self._state = PIDAutotuneState.STATE_READY
|
||||||
|
self._peak_count = 0
|
||||||
|
|
||||||
|
def set_off(self):
|
||||||
|
self._state = PIDAutotuneState.STATE_OFF
|
||||||
|
|
||||||
def state(self):
|
def state(self):
|
||||||
"""Get the current state."""
|
"""Get the current state."""
|
||||||
return self._state
|
return self._state
|
||||||
|
Loading…
Reference in New Issue
Block a user
Inconsistent string delimiter.
Can't it just use
auto()
anyway?Actually yes, switched to
auto()
in force-push to828648ed76
.Then I believe #71 would be unnecessary since the string values aren't used anywhere.
Also just realised this highlights the verbosity of the
STATE_
prefix.Refactored in force-push to
869922c928
.