forked from M-Labs/thermostat
Compare commits
4 Commits
d815a9ae55
...
16c78c5784
Author | SHA1 | Date | |
---|---|---|---|
16c78c5784 | |||
9d218b3fa5 | |||
11131deda2 | |||
764774fbce |
16
README.md
16
README.md
@ -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 |
|
||||
|
26
flake.nix
26
flake.nix
@ -63,12 +63,24 @@
|
||||
version = "0.0.0";
|
||||
src = "${self}/pythermostat";
|
||||
|
||||
propagatedBuildInputs =
|
||||
with pkgs.python3Packages; [
|
||||
numpy
|
||||
matplotlib
|
||||
];
|
||||
propagatedBuildInputs = with pkgs.python3Packages; [
|
||||
numpy
|
||||
matplotlib
|
||||
];
|
||||
};
|
||||
|
||||
pythermostat-dev-wrappers = pkgs.runCommandNoCC "pythermostat-dev-wrappers" { } ''
|
||||
mkdir -p $out/bin
|
||||
for program in ${self}/pythermostat/*.py; do
|
||||
if [ -x $program ]; then
|
||||
progname=`basename -s .py $program`
|
||||
outname=$out/bin/thermostat_$progname
|
||||
echo "#!${pkgs.bash}/bin/bash" >> $outname
|
||||
echo "exec python -m $progname \"\$@\"" >> $outname
|
||||
chmod 755 $outname
|
||||
fi
|
||||
done
|
||||
'';
|
||||
in
|
||||
{
|
||||
packages.x86_64-linux = {
|
||||
@ -90,11 +102,15 @@
|
||||
openocd
|
||||
dfu-util
|
||||
rlwrap
|
||||
pythermostat-dev-wrappers
|
||||
]
|
||||
++ (with python3Packages; [
|
||||
numpy
|
||||
matplotlib
|
||||
]);
|
||||
shellHook = ''
|
||||
export PYTHONPATH=`git rev-parse --show-toplevel`/pythermostat:$PYTHONPATH
|
||||
'';
|
||||
};
|
||||
|
||||
formatter.x86_64-linux = nixpkgs.legacyPackages.x86_64-linux.nixfmt-rfc-style;
|
||||
|
8
pythermostat/autotune.py
Normal file → Executable file
8
pythermostat/autotune.py
Normal file → Executable 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)
|
||||
|
||||
|
||||
|
0
pythermostat/plot.py
Normal file → Executable file
0
pythermostat/plot.py
Normal file → Executable file
0
pythermostat/test.py
Normal file → Executable file
0
pythermostat/test.py
Normal file → Executable file
Loading…
Reference in New Issue
Block a user