Compare commits

..

5 Commits

Author SHA1 Message Date
36d80ebdff PyThermostat: Add entry points for runnables
Forms a more convienient interface.
2024-11-25 10:07:30 +08:00
09300b5d44 PyThermostat: Add main function to plot.py 2024-11-25 10:07:30 +08:00
9743dca775 PyThermostat: Move scripts into subfolder
As Thermostat Python scripts are not single-file Python modules and
should be packaged inside PyThermostat.
2024-11-25 10:07:20 +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
6 changed files with 27 additions and 8 deletions

View File

@ -239,6 +239,22 @@ of channel 0 to the PID algorithm:
output 0 pid 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 ## LED indicators
| Name | Color | Meaning | | Name | Color | Meaning |

View File

@ -13,7 +13,7 @@ When tuning Thermostat PID parameters, it is helpful to view the temperature, PI
To use the Python real-time plotting utility, run To use the Python real-time plotting utility, run
```shell ```shell
python pythermostat/plot.py python pythermostat/pythermostat/plot.py
``` ```
![default view](./assets/default%20view.png) ![default view](./assets/default%20view.png)
@ -49,7 +49,7 @@ A PID auto tuning utility is provided in the PyThermostat library. The auto tuni
To run the auto tuning utility, run To run the auto tuning utility, run
```shell ```shell
python pythermostat/autotune.py python pythermostat/pythermostat/autotune.py
``` ```
After some time, the auto tuning utility will output the auto tuning results, below is a sample output After some time, the auto tuning utility will output the auto tuning results, below is a sample output

View File

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

View File

@ -11,12 +11,11 @@ setup(
packages=find_packages(), packages=find_packages(),
entry_points={ entry_points={
"gui_scripts": [ "gui_scripts": [
"thermostat_plot = plot:main", "thermostat_plot = pythermostat.plot:main",
], ],
"console_scripts": [ "console_scripts": [
"thermostat_autotune = autotune:main", "thermostat_autotune = pythermostat.autotune:main",
"thermostat_test = test:main", "thermostat_test = pythermostat.test:main",
] ]
}, },
py_modules=["autotune", "plot", "test"],
) )