Compare commits

..

4 Commits

Author SHA1 Message Date
16c78c5784 flake: Introduce PyThermostat scripts to devShell
Make executable Python scripts in the PyThermostat root available in the
development shell (e.g. thermostat_plot, thermostat_autotune,
thermostat_test).
2024-11-25 10:27:04 +08:00
9d218b3fa5 flake: Add pythermostat to PYTHONPATH in devshell
For easier testing of PyThermostat client code in the development shell,
so that the following is possible right in the repo root:

```
$ python
Python 3.11.9 (main, Apr  2 2024, 08:25:04) [GCC 13.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from pythermostat.client import Client
>>> c = Client()
>>>
```
2024-11-25 10:21:21 +08:00
11131deda2 README: Add PID Output Clamping section
Explains the need of having separate "max_i_pos/output_max" and
"max_i_neg/output_min" values; They serve different purposes.
2024-11-20 08:02:07 +08:00
764774fbce PyThermostat: Remove report mode in autotune.py 2024-11-18 17:47:33 +08:00
3 changed files with 24 additions and 4 deletions

View File

@ -239,6 +239,22 @@ of channel 0 to the PID algorithm:
output 0 pid
```
### PID output clamping
It is possible to clamp the PID algorithm output independently of channel output limits. This is desirable when e.g. there is a need to keep the current value above a certain threshold in closed-loop mode.
Note that the actual output will still ultimately be limited by the `max_i_pos` and `max_i_neg` values.
Set PID maximum output of channel 0 to 1.5 A.
```
pid 0 output_max 1.5
```
Set PID minimum output of channel 0 to 0.1 A.
```
pid 0 output_min 0.1
```
## LED indicators
| Name | Color | Meaning |

View File

@ -74,9 +74,9 @@
for program in ${self}/pythermostat/*.py; do
if [ -x $program ]; then
progname=`basename -s .py $program`
outname=$out/bin/$progname
outname=$out/bin/thermostat_$progname
echo "#!${pkgs.bash}/bin/bash" >> $outname
echo "exec python3 -m $progname \"\$@\"" >> $outname
echo "exec python -m $progname \"\$@\"" >> $outname
chmod 755 $outname
fi
done

View File

@ -1,5 +1,6 @@
import math
import logging
import time
from collections import deque, namedtuple
from enum import Enum
@ -236,13 +237,14 @@ def main():
tec = Client()
data = next(tec.report_mode())
data = tec.get_report()
ch = data[channel]
tuner = PIDAutotune(target_temperature, output_step,
lookback, noiseband, ch['interval'])
for data in tec.report_mode():
while True:
data = tec.get_report()
ch = data[channel]
@ -255,6 +257,8 @@ def main():
tec.set_param("output", channel, "i_set", tuner_out)
time.sleep(0.05)
tec.set_param("output", channel, "i_set", 0)