Add thermal chamber simulator stub

Defines ThermalChamberSim class with stub SCPI command handlers for
TEMP:SETPOINT, TEMP:ACTUAL?, and TEMP:STAB? commands.
This commit is contained in:
2025-05-02 23:33:16 +00:00
parent 7e1817430b
commit 539b7307df

View File

@@ -0,0 +1,95 @@
"""Virtual thermal chamber simulator.
This module implements a SCPI-based virtual thermal chamber that interfaces
with the physics engine to provide realistic temperature control simulation.
"""
from __future__ import annotations
from typing import TYPE_CHECKING
from py_dvt_ate.instruments.scpi import SCPICommand
from py_dvt_ate.simulation.virtual.base import BaseInstrument
if TYPE_CHECKING:
from py_dvt_ate.simulation.physics.engine import PhysicsEngine
class ThermalChamberSim(BaseInstrument):
"""Virtual thermal chamber simulator.
Simulates a thermal chamber with SCPI control interface. The chamber
temperature behaviour is driven by the physics engine.
SCPI Commands:
TEMP:SETPOINT <value> - Set target temperature in degrees C
TEMP:SETPOINT? - Query current setpoint
TEMP:ACTUAL? - Query actual chamber temperature
TEMP:STAB? - Query temperature stability (1=stable, 0=settling)
Attributes:
manufacturer: "PyDVTATE"
model: "TC-SIM-001"
"""
manufacturer = "PyDVTATE"
model = "TC-SIM-001"
serial_number = "TCSIM001"
firmware_version = "1.0.0"
# Stability threshold in degrees C
STABILITY_THRESHOLD = 0.5
def __init__(self, physics_engine: PhysicsEngine | None = None) -> None:
"""Initialise the thermal chamber simulator.
Args:
physics_engine: Reference to physics engine for temperature state.
"""
self._setpoint = 25.0 # Default setpoint
super().__init__(physics_engine)
def _setup_commands(self) -> None:
"""Register thermal chamber SCPI commands."""
self.register_command("TEMP:SETPOINT", self._handle_temp_setpoint)
self.register_command("TEMP:ACTUAL", self._handle_temp_actual)
self.register_command("TEMP:STAB", self._handle_temp_stab)
def reset(self) -> None:
"""Reset chamber to default state."""
self._setpoint = 25.0
if self._physics_engine is not None:
self._physics_engine.set_chamber_setpoint(self._setpoint)
def _handle_temp_setpoint(self, command: SCPICommand) -> str:
"""Handle TEMP:SETPOINT command/query.
Args:
command: Parsed SCPI command.
Returns:
Setpoint value for query, empty string for set command.
"""
raise NotImplementedError("TEMP:SETPOINT not yet implemented")
def _handle_temp_actual(self, command: SCPICommand) -> str:
"""Handle TEMP:ACTUAL? query.
Args:
command: Parsed SCPI command.
Returns:
Actual chamber temperature.
"""
raise NotImplementedError("TEMP:ACTUAL? not yet implemented")
def _handle_temp_stab(self, command: SCPICommand) -> str:
"""Handle TEMP:STAB? stability query.
Args:
command: Parsed SCPI command.
Returns:
"1" if stable, "0" if settling.
"""
raise NotImplementedError("TEMP:STAB? not yet implemented")