stoner_measurement.instruments.simulated.SimulatedTemperatureController¶
- class stoner_measurement.instruments.simulated.SimulatedTemperatureController(transport=None, protocol=None)[source]¶
Bases:
TemperatureControllerSimple simulated temperature controller.
- get_capabilities() ControllerCapabilities[source]¶
Return the static capability descriptor for this controller driver.
- Returns:
Descriptor advertising the number of inputs, loops, and which optional feature groups are supported.
- Return type:
Examples
>>> caps = tc.get_capabilities() >>> caps.num_loops 1 >>> caps.has_ramp True
- get_heater_output(loop: int) float[source]¶
Return the heater output percentage for control loop.
- Parameters:
loop (int) – Control loop number (1-based).
- Returns:
Heater output as a percentage (0–100 %).
- Return type:
(float)
- Raises:
ConnectionError – If the transport is not open.
Examples
>>> tc.get_heater_output(1) 50.0
- get_heater_range(loop: int) int[source]¶
Return the current heater range index for control loop.
The meaning of the returned index is instrument-specific. A value of
0conventionally means “heater off”.Drivers that support reading the heater range should override this method. The default implementation raises
NotImplementedError.- Parameters:
loop (int) – Control loop number (1-based).
- Returns:
Current heater range index.
- Return type:
(int)
- Raises:
NotImplementedError – If the driver does not support reading the heater range.
ConnectionError – If the transport is not open.
Examples
>>> tc.get_heater_range(1) 0
- get_input_channel(loop: int) str[source]¶
Return the sensor channel currently assigned to control loop.
- Parameters:
loop (int) – Control loop number (1-based).
- Returns:
Channel identifier of the sensor driving this loop.
- Return type:
(str)
- Raises:
ConnectionError – If the transport is not open.
Examples
>>> tc.get_input_channel(1) 'A'
- get_loop_mode(loop: int) ControlMode[source]¶
Return the active control mode for loop.
- Parameters:
loop (int) – Control loop number (1-based).
- Returns:
Current control mode of the loop.
- Return type:
- Raises:
ConnectionError – If the transport is not open.
Examples
>>> tc.get_loop_mode(1) <ControlMode.CLOSED_LOOP: 'closed_loop'>
- get_pid(loop: int) PIDParameters[source]¶
Return the PID parameters for control loop.
- Parameters:
loop (int) – Control loop number (1-based).
- Returns:
Current proportional, integral and derivative gain values.
- Return type:
- Raises:
ConnectionError – If the transport is not open.
Examples
>>> tc.get_pid(1) PIDParameters(p=50.0, i=1.0, d=0.0)
- get_ramp_enabled(loop: int) bool[source]¶
Return
Trueif setpoint ramping is enabled for loop.- Parameters:
loop (int) – Control loop number (1-based).
- Returns:
Truewhen the ramp function is active.- Return type:
(bool)
- Raises:
ConnectionError – If the transport is not open.
Examples
>>> tc.get_ramp_enabled(1) False
- get_ramp_rate(loop: int) float[source]¶
Return the setpoint ramp rate for loop in Kelvin per minute.
- Parameters:
loop (int) – Control loop number (1-based).
- Returns:
Ramp rate in Kelvin per minute.
- Return type:
(float)
- Raises:
ConnectionError – If the transport is not open.
Examples
>>> tc.get_ramp_rate(1) 5.0
- get_ramp_state(loop: int) RampState[source]¶
Return the current ramp state for loop.
The default implementation infers the state from
get_ramp_enabled(); override in subclasses that can query the actual hardware ramp state directly.- Parameters:
loop (int) – Control loop number (1-based).
- Returns:
RAMPINGwhen the ramp function is active,IDLEotherwise.- Return type:
- Raises:
ConnectionError – If the transport is not open.
Examples
>>> tc.get_ramp_state(1) <RampState.IDLE: 'idle'>
- get_sensor_status(channel: str) SensorStatus[source]¶
Return the validity/range status of the sensor on channel.
- Parameters:
channel (str) – Sensor channel identifier (instrument-specific, e.g.
"A").- Returns:
Current validity and range status of the sensor reading.
- Return type:
- Raises:
ConnectionError – If the transport is not open.
Examples
>>> tc.get_sensor_status("A") <SensorStatus.OK: 'ok'>
- get_setpoint(loop: int) float[source]¶
Return the current setpoint for control loop in Kelvin.
- Parameters:
loop (int) – Control loop number (1-based).
- Returns:
Setpoint temperature in Kelvin.
- Return type:
(float)
- Raises:
ConnectionError – If the transport is not open.
Examples
>>> tc.get_setpoint(1) 300.0
- get_temperature(channel: str) float[source]¶
Return the current temperature for channel in Kelvin.
- Parameters:
channel (str) – Sensor channel identifier (instrument-specific, e.g.
"A").- Returns:
Current temperature in Kelvin.
- Return type:
(float)
- Raises:
ConnectionError – If the transport is not open.
Examples
>>> tc.get_temperature("A") 300.0
- identify() str[source]¶
Return the instrument identification string (
*IDN?).Sends the standard IEEE 488.2
*IDN?query and returns the response. Instruments that do not support*IDN?should override this method.- Returns:
Identification string returned by the instrument.
- Return type:
(str)
- Raises:
ConnectionError – If the transport is not open.
Examples
>>> from stoner_measurement.instruments.transport import NullTransport >>> from stoner_measurement.instruments.protocol import ScpiProtocol >>> from stoner_measurement.instruments.base_instrument import BaseInstrument >>> t = NullTransport(responses=[b"ACME,Model1,SN001,v1.0\n"]) >>> instr = BaseInstrument(t, ScpiProtocol()) >>> instr.connect() >>> instr.identify() 'ACME,Model1,SN001,v1.0' >>> instr.disconnect()
- set_heater_range(loop: int, range_: int) None[source]¶
Set the heater range for control loop.
The meaning of range_ is instrument-specific. A value of
0conventionally means “heater off”.- Parameters:
- Raises:
ConnectionError – If the transport is not open.
- set_input_channel(loop: int, channel: str) None[source]¶
Assign sensor channel as the input for control loop.
- Parameters:
- Raises:
ConnectionError – If the transport is not open.
ValueError – If channel is not a valid sensor input for this instrument.
- set_loop_mode(loop: int, mode: ControlMode) None[source]¶
Set the control mode for loop.
- Parameters:
loop (int) – Control loop number (1-based).
mode (ControlMode) – Desired control mode.
- Raises:
ConnectionError – If the transport is not open.
ValueError – If mode is not supported by this loop on this instrument.
- set_pid(loop: int, p: float, i: float, d: float) None[source]¶
Set the PID parameters for control loop.
- Parameters:
- Raises:
ConnectionError – If the transport is not open.
ValueError – If any gain value is outside the instrument’s valid range.
- set_ramp_enabled(loop: int, enabled: bool) None[source]¶
Enable or disable setpoint ramping for loop.
- Parameters:
- Raises:
ConnectionError – If the transport is not open.
- set_ramp_rate(loop: int, rate: float) None[source]¶
Set the setpoint ramp rate for loop.
- Parameters:
- Raises:
ConnectionError – If the transport is not open.
ValueError – If rate is negative or exceeds the instrument’s maximum.
- set_setpoint(loop: int, value: float) None[source]¶
Set the target temperature for control loop.
- Parameters:
- Raises:
ConnectionError – If the transport is not open.
ValueError – If value is outside the instrument’s valid range.