A low level library for communicating with the Stanford Research Systems PTC10 Programmable Temperature Controller via Ethernet.
- Query identification string
- Read the current value of a specific sensor or output channel
- Read all channel values in a single query
- Retrieve names of all active channels
- Return values as a dictionary mapping channel name to current value
- Compatible with both serial and Ethernet connections
- Python 3.8+
- Install base class from https://github.com/COO-Utilities/hardware_device_base
pip install .ptc10/
├── __init__.py
├── ptc10.py
└── README.md
import ptc10
# Ethernet example
ptc = ptc10.PTC10()
ptc.connect("192.168.29.150", 23)
# Identify controller
print("Device ID:", ptc.identify())
# Read a specific item
print("Temp at 3A:", ptc.get_atomic_value("3A"))
# Read all values
print("All values:", ptc.get_all_values())
# Channel name to value map
print("Named outputs:", ptc.get_named_output_dict())
ptc.close()Connects to PTC10.
Closes the connection to the controller
Returns the device identification string.
Queries the most recent value of a single channel. Example: "3A", "Out1".
Returns a list of values for all available channels. Sensors out of range return float('nan').
Returns the channel names in the same order as get_all_values().
Returns a dictionary mapping each channel name to its latest value.
- All messages must end in
\n(linefeed). This is handled automatically by the connection class. - Commands like
3A?,Out1?,getOutput?, andgetOutputNames?follow the PTC10 manual. - Invalid channels or disconnected sensors will return
NaN.
Below is a class diagram of the added methods and attributes for the SRS PTC10. See the README for the hardware_device_base module for the inherited methods and attributes.
classDiagram
class PTC10 {
+socket sock
_clear_socket()
query() str
identify() str
validate_channel_name() bool
get_all_values() List[float]
get_channel_names() List[str]
get_named_output_dict() Dict[str, float]
}