diff options
| author | s-ol <s+removethis@s-ol.nu> | 2024-03-13 22:20:41 +0000 |
|---|---|---|
| committer | s-ol <s+removethis@s-ol.nu> | 2024-03-13 22:20:41 +0000 |
| commit | 7777ed4567f465473a4eafcf6ec8c53a7b469af6 (patch) | |
| tree | 5bf4920c29bb985019cbee3bd44a0e204ab5f515 | |
| parent | web: add crosshair (diff) | |
| download | t937-serial-7777ed4567f465473a4eafcf6ec8c53a7b469af6.tar.gz t937-serial-7777ed4567f465473a4eafcf6ec8c53a7b469af6.zip | |
simulator: simulate simultaneous heat/cool state
| -rw-r--r-- | simulator/__init__.py | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/simulator/__init__.py b/simulator/__init__.py index 3924499..e81ae9a 100644 --- a/simulator/__init__.py +++ b/simulator/__init__.py @@ -89,16 +89,14 @@ class DummyOven: self.cool = None def step(self): + rate = -2 if self.heat is not None: - targets = [350, 350, 100] - rate = 12 * self.heat - elif self.cool is not None: - rate = -8 * self.cool - else: - rate = -4 + rate += 12 * self.heat + if self.cool is not None: + rate -= 8 * self.cool for i, temp in enumerate(self.temps): - mult = random.uniform(0.7, 1) if i < 2 else 0.01 + mult = random.uniform(0.5, 1) if i < 2 else 0.05 temp = temp + rate * mult self.temps[i] = max(24, min(temp, 350)) |
