fixed duplicate class declaration

This commit is contained in:
2026-06-30 16:38:51 +02:00
parent 6547478d00
commit 8ca4e4d803
2 changed files with 7 additions and 6 deletions
-1
View File
@@ -9,7 +9,6 @@ from contextlib import contextmanager
class HendiException(Exception):
pass
class HendiCtrl:
class HendiCtrl:
def __init__(self, port, speed):
self.ser = serial.Serial(port, speed)
+7 -5
View File
@@ -69,7 +69,7 @@ def _infer_heatrate_soll_set(samples):
return max(candidates, default=1.0) or 1.0
def run_replay(samples, pid_params, heatrate_soll_set, plant_params, ambient, max_power, dt):
def run_replay(samples, pid_params, heatrate_soll_set, plant_params, ambient, max_power, heater_efficiency, dt):
"""Closed-loop simulation: controller drives plant, plant feeds temp back.
The plant is seeded at the real starting temperature from the log so the
@@ -94,7 +94,7 @@ def run_replay(samples, pid_params, heatrate_soll_set, plant_params, ambient, ma
tc.set_heatrate_soll(heatrate_soll_set)
tc.process()
power_watts = max(0.0, tc.get_power() * max_power)
power_watts = max(0.0, tc.get_power() * max_power * heater_efficiency)
plant.set_power(power_watts)
out.append({
@@ -186,6 +186,8 @@ def main():
help='Heat loss coefficient [W/(kg·K)] (default: %(default)s)')
parser.add_argument('--plant-Td', type=float, default=30.0, metavar='s',
help='Transport delay [s] (default: %(default)s)')
parser.add_argument('--heater-efficiency', type=float, default=1.0, metavar='0-1',
help='Fraction of rated heater power delivered to the plant (default: %(default)s)')
for section, prefix in (('Hold', 'hold'), ('Heat', 'heat'), ('Cool', 'cool')):
for gain in ('kp', 'ki', 'kd', 'kt'):
@@ -234,15 +236,15 @@ def main():
print('Log: {} ({} samples, dt={:.1f} s)'.format(name, len(samples), dt))
print('Power: max={:.0f} W'.format(max_power))
print('Rate: heatrate_soll_set={:.2f} K/min'.format(rate_soll))
print('Plant: M={M} kg C={C} J/kgK L={L} W/kgK Td={Td} s ambient={amb} °C'.format(
amb=ambient, **plant_params))
print('Plant: M={M} kg C={C} J/kgK L={L} W/kgK Td={Td} s ambient={amb} °C heater_efficiency={eff}'.format(
amb=ambient, eff=args.heater_efficiency, **plant_params))
print('Params: {}'.format('overridden' if any_override else 'from config'))
print()
for section in ('Hold', 'Heat', 'Cool'):
p = pid_params[section]
print(' {}: kp={kp} ki={ki} kd={kd} kt={kt}'.format(section, **p))
replay = run_replay(samples, pid_params, rate_soll, plant_params, ambient, max_power, dt)
replay = run_replay(samples, pid_params, rate_soll, plant_params, ambient, max_power, args.heater_efficiency, dt)
plot_replay(samples, replay, name, max_power, params_label)
plt.show()