[Sensor] - replace TempSensorSim's hardcoded k_noise with configurable temp_offset/variance, accept **kwargs on Max31865 too so both sensors share a constructor signature usable from TempSensorFactory.create() [Temp Controller] - low-pass filter the backward-difference heat-rate estimate (alpha=0.1) in both temp_controller.py and temp_controller_smith.py instead of using the raw, noisy derivative [Pot] - drop kn from demo_pot.py's params, matching the unused-field removal already made to pot.py itself Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
20 lines
493 B
Python
20 lines
493 B
Python
from components import ATemperatureSensor
|
|
import numpy as np
|
|
|
|
|
|
class TempSensorSim(ATemperatureSensor):
|
|
def name(self):
|
|
return "FakeTemp"
|
|
|
|
def __init__(self, temp_offset=0.0, variance=0.0, **kwargs):
|
|
ATemperatureSensor.__init__(self)
|
|
self.temp_set = 19.99
|
|
self.offset = temp_offset
|
|
self.variance = variance
|
|
|
|
def set_fake_temp(self, temp):
|
|
self.temp_set = temp
|
|
|
|
def temperature(self):
|
|
return self.temp_set + self.offset+ self.variance * np.random.normal(0, 1) / np.sqrt(12.0)
|