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>
This commit is contained in:
2026-06-19 18:32:28 +02:00
co-authored by Claude Sonnet 4.6
parent 5ae73cce57
commit 17ca79da1a
4 changed files with 11 additions and 33 deletions
+8 -10
View File
@@ -8,9 +8,7 @@ class Pot(APlant):
self.e = 0
self.x = 0
# Plant power gain (efficiency)
self.gain = params['gain']
self.p_pot = 0
# Plant specific thermal capacity [W*s/(kg*K)]
self.C = params['C']
@@ -27,18 +25,16 @@ class Pot(APlant):
self.Td = params['Td']
# Plant temperature [°C]
self.temp = params['theta']
self.temp = theta_amb
# Ambient temperature [°C]
self.theta_amb = theta_amb
# Set power [W]
self.power_set = 0
self.p_in = 0
# Plant delay [s]
self.delay = delay.Delay(dt, self.Td, 0)
self.p_in = 0
self.p_pot = 0
def initial(self, temp):
self.temp = temp
@@ -47,7 +43,6 @@ class Pot(APlant):
pass
def process(self):
self.p_in = self.gain * self.power_set
self.delay.put(self.p_in)
p_loss = self.L * self.M * (self.temp - self.theta_amb)
@@ -58,11 +53,14 @@ class Pot(APlant):
def is_activated(self):
return True
def set_ambient_temperature(self, theta_amb):
self.theta_amb = theta_amb
def set_power(self, power):
self.power_set = power
self.p_in = power
def get_power(self):
return round(self.power_set, 1)
return round(self.p_in, 1)
def get_temperature(self):
return self.temp
+1 -1
View File
@@ -16,4 +16,4 @@ class TempSensorSim(ATemperatureSensor):
self.temp_set = temp
def temperature(self):
return self.temp_set + self.offset+ self.variance * np.random.normal(0, 1) / np.sqrt(12.0)
return self.temp_set + self.offset + self.variance * np.random.normal(0, 1) / np.sqrt(12.0)