Files
brewpi/components/sensor/tempSensorSim.py
T
jensandClaude Sonnet 4.6 17ca79da1a Simplify Pot: drop gain/theta params, seed initial temp from ambient
[Pot] - removed the gain (efficiency) factor and the separate
"theta" initial-temperature param; Pot now starts at theta_amb and
set_power()/get_power() operate on p_in directly. Added
set_ambient_temperature() for live ambient updates. Dropped the
now-unused "theta"/"gain" keys from Model/Plant in config.json.sim
and config.json.templ (also fixes a JSON syntax error in
config.json.templ: trailing commas left over after removing "gain"
made Model/Plant fail to parse).
[Sensor] - fix missing space in TempSensorSim.temperature()'s
offset/variance expression (cosmetic, no behavior change).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-19 18:32:28 +02:00

20 lines
494 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)