psi_coldbox
Classes
|
|
|
Exceptions
PSIColdbox
- class icicle.psi_coldbox.PSIColdbox(*args, **kwargs)
Bases:
Instrument
- __init__(resource, off_on_disconnect=False, clientID='coldbox', username='', password='', init=False, sim=False)
Instrument Constructor.
Constructs lock.
- CONTROL_VOLTAGE = 0.0
- DEFAULT_PIN_MAP = {0: 'VIN', 1: 'VOFS', 2: 'VDDA_ROC0', 3: 'VDDD_ROC0', 4: 'VDDA_ROC1', 5: 'VDDD_ROC1', 6: 'VDDA_ROC2', 7: 'VDDD_ROC2', 8: 'VDDA_ROC3', 9: 'VDDD_ROC3'}
- MEASURE_TYPES = {'SPEED': 'Can not be measured, this is required by TemperatureChannel', 'TEMPERATURE': 'Temperature of the peltier (degC)', 'VOLTAGE': 'Can not be measured, this is required by MeasureChannel'}
- MODE = 1
- class MeasureChannel(instrument, channel, measure_type, unit='')
Bases:
MeasureChannel
- property pin_map
- query_all()
- property status
- Returns:
channel status. If not implemented in channel, returns
0xDEAD
.- Return type:
bool
- property value
Performs measurement and returns value.
- Returns:
measured value.
- Return type:
float
- PID_KD = 0.25
- PID_KI = 0.015
- PID_KP = 0.17
- PID_MAX = 12
- PID_MIN = -4
- SETTINGS = {'CONTROL_VOLTAGE': {'FIND': 'ControlVoltage_Set', 'QUERY': 'get ControlVoltage_Set', 'SET': 'set ControlVoltage_Set {}', 'channel': True, 'default': 0.0, 'type': <class 'float'>, 'verifier': <function is_numeric.<locals>._is_numeric>}, 'DEW_POINT': {'FIND': 'DP', 'POS': 4, 'QUERY': 'get DP', 'READ': 'Env', 'type': <class 'float'>}, 'DISKSPACE': {'ASSERT': 'D', 'POS': 6, 'READ': 'VAR', 'type': <class 'int'>}, 'DP': {'FIND': 'DP', 'POS': 4, 'QUERY': 'get DP', 'READ': 'Env', 'type': <class 'float'>}, 'ERROR': {'FIND': 'Error', 'QUERY': 'get Error', 'READ': 'Error', 'channel': True, 'type': <class 'int'>}, 'FLOW': {'ASSERT': 'F', 'POS': 7, 'READ': 'VAR', 'type': <class 'int'>}, 'FLUSH': {'FIND': 'valve0', 'POS': 8, 'QUERY': 'get valve0', 'READ': 'Env', 'SET': 'set valve0 {}', 'default': 'off', 'type': <class 'int'>, 'verifier': <function is_in.<locals>._is_in>}, 'FLUSH_TOGGLE': {'FIND': 'valve0', 'POS': 8, 'QUERY': 'get valve0', 'READ': 'Env', 'SET': 'cmd valve0', 'type': <class 'int'>}, 'INTERLOCK': {'ASSERT': 'I', 'POS': 5, 'READ': 'VAR', 'type': <class 'int'>}, 'LID': {'ASSERT': 'L', 'POS': 4, 'READ': 'VAR', 'type': <class 'int'>}, 'MODE': {'FIND': 'Mode', 'QUERY': 'get Mode', 'SET': 'set Mode {}', 'channel': True, 'default': 1, 'type': <class 'int'>, 'verifier': <function is_in.<locals>._is_in>}, 'N2_THROTTLE': {'ASSERT': 'T', 'POS': 8, 'READ': 'VAR', 'SET': 'cmd throttleN2{}', 'default': 'Off', 'type': <class 'int'>, 'verifier': <function is_in.<locals>._is_in>}, 'PELTIER_CURRENT': {'FIND': 'Peltier_I', 'QUERY': 'get Peltier_I', 'channel': True, 'type': <class 'float'>}, 'PELTIER_POWER': {'FIND': 'Peltier_P', 'QUERY': 'get Peltier_P', 'channel': True, 'type': <class 'float'>}, 'PELTIER_RESISTANCE': {'FIND': 'Peltier_R', 'QUERY': 'get Peltier_R', 'channel': True, 'type': <class 'float'>}, 'PELTIER_VOLTAGE': {'FIND': 'Peltier_U', 'QUERY': 'get Peltier_U', 'channel': True, 'type': <class 'float'>}, 'PID_KD': {'FIND': 'PID_kd', 'QUERY': 'get PID_kd', 'SET': 'set PID_kd {}', 'channel': True, 'default': 0.25, 'type': <class 'float'>, 'verifier': <function is_numeric.<locals>._is_numeric>}, 'PID_KI': {'FIND': 'PID_ki', 'QUERY': 'get PID_ki', 'SET': 'set PID_ki {}', 'channel': True, 'default': 0.015, 'type': <class 'float'>, 'verifier': <function is_numeric.<locals>._is_numeric>}, 'PID_KP': {'FIND': 'PID_kp', 'QUERY': 'get PID_kp', 'SET': 'set PID_kp {}', 'channel': True, 'default': 0.17, 'type': <class 'float'>, 'verifier': <function is_numeric.<locals>._is_numeric>}, 'PID_MAX': {'FIND': 'PID_Max', 'QUERY': 'get PID_Max', 'SET': 'set PID_Max {}', 'channel': True, 'default': 12, 'type': <class 'float'>, 'verifier': <function is_numeric.<locals>._is_numeric>}, 'PID_MIN': {'FIND': 'PID_Min', 'QUERY': 'get PID_Min', 'SET': 'set PID_Min {}', 'channel': True, 'default': -4, 'type': <class 'float'>, 'verifier': <function is_numeric.<locals>._is_numeric>}, 'POWER': {'FIND': 'PowerState', 'QUERY': 'get PowerState', 'SET': 'cmd Power_{}', 'channel': True, 'type': <class 'int'>, 'verifier': <function is_in.<locals>._is_in>}, 'REFERENCE_VOLTAGE': {'FIND': 'Ref_U', 'QUERY': 'get Ref_U', 'channel': True, 'type': <class 'float'>}, 'RELATIVE_HUMIDITY': {'FIND': 'RH', 'POS': 3, 'QUERY': 'get RH', 'READ': 'Env', 'type': <class 'float'>}, 'REL_HUMIDITY': {'FIND': 'RH', 'POS': 3, 'QUERY': 'get RH', 'READ': 'Env', 'type': <class 'float'>}, 'RH': {'FIND': 'RH', 'POS': 3, 'QUERY': 'get RH', 'READ': 'Env', 'type': <class 'float'>}, 'RINSE': {'FIND': 'valve1', 'POS': 9, 'QUERY': 'get valve1', 'READ': 'Env', 'SET': 'set valve1 {}', 'default': 'off', 'type': <class 'int'>, 'verifier': <function is_in.<locals>._is_in>}, 'RINSE_TOGGLE': {'FIND': 'valve1', 'POS': 9, 'QUERY': 'get valve1', 'READ': 'Env', 'SET': 'cmd valve1', 'type': <class 'int'>}, 'RUNTIME': {'POS': 7, 'READ': 'Env', 'type': <class 'int'>}, 'SOFTWARE_VERSION': {'FIND': 'GetSWVersion', 'QUERY': 'cmd GetSWVersion', 'channel': True, 'type': <class 'str'>}, 'SUPPLY_CURRENT': {'FIND': 'Supply_I', 'QUERY': 'get Supply_I', 'channel': True, 'type': <class 'float'>}, 'SUPPLY_POWER': {'FIND': 'Supply_P', 'QUERY': 'get Supply_P', 'channel': True, 'type': <class 'float'>}, 'SUPPLY_VOLTAGE': {'FIND': 'Supply_U', 'QUERY': 'get Supply_U', 'channel': True, 'type': <class 'float'>}, 'TEMPERATURE_AIR': {'FIND': 'Temp', 'POS': 1, 'QUERY': 'get Temp', 'READ': 'Env', 'type': <class 'float'>}, 'TEMPERATURE_BOX': {'FIND': 'Temp', 'POS': 1, 'QUERY': 'get Temp', 'READ': 'Env', 'type': <class 'float'>}, 'TEMPERATURE_MEASURED': {'FIND': 'Temp_M', 'QUERY': 'get Temp_M', 'channel': True, 'type': <class 'float'>}, 'TEMPERATURE_SET': {'FIND': 'Temp_Set', 'QUERY': 'get Temp_Set', 'SET': 'set Temp_Set {}', 'channel': True, 'default': 15.0, 'type': <class 'float'>, 'verifier': <function is_numeric.<locals>._is_numeric>}, 'TEMPERATURE_WATER': {'FIND': 'Temp_W', 'QUERY': 'get Temp_W', 'channel': True, 'type': <class 'float'>}, 'THROTTLE_N2': {'ASSERT': 'T', 'POS': 8, 'READ': 'VAR', 'SET': 'cmd throttleN2{}', 'default': 'Off', 'type': <class 'int'>, 'verifier': <function is_in.<locals>._is_in>}, 'VOLTAGE': {'FIND': 'ControlVoltage', 'QUERY': 'get ControlVoltage_Set', 'SET': 'set ControlVoltage_Set {}', 'channel': True, 'default': 0.0, 'type': <class 'float'>, 'verifier': <function is_numeric.<locals>._is_numeric>}, 'VOLTAGE_PROBE': {'FIND': 'vprobe', 'QUERY': 'get vprobe', 'channel': True, 'type': <class 'str'>}}
- SMALL_DELAY = 1
- TEMPERATURE = 15.0
- class TemperatureChannel(instrument, channel, measure_temperature, measure_speed)
Bases:
TemperatureChannel
TemperatureChannel implementation for TECs.
- property speed
- Returns:
currently set speed current.
- Return type:
float
- property state
- Returns:
whether this power channel is on or off (True/False).
- Return type:
bool
- property status
- Returns:
Measurement Status Register value.
- property temperature
- Returns:
currently set channel temperature.
- Return type:
float
- clear_error(channel)
- connected()
- execute(command)
- get_pin_map()
- interlocked()
- load_variables_from_icicle(channel=0)
- load_variables_from_tec(channel=0)
- off(channel=0)
OFF template - should be implemented to turn off device or channel.
- on(channel=0)
ON template - should be implemented to turn on device or channel.
- query(setting, channel=0)
QUERY template - should be implemented to query device state.
- read(setting, channel=0)
- reboot(channel)
- reset(*args, **kwargs)
RESET template - should be implemented to reset device.
- save_variables_on_tec(channel=0)
- set(setting, value, channel=0)
SET template - should be implemented to set and query back device state.
- validate_channel(channel, raise_exception=True)
Check if a channel exists on this device.
- Parameters:
channel – Channel number to validate as an output.
PSIColdboxClient
- class icicle.psi_coldbox.PSIColdboxClient(hostname, clientID='coldbox', port=1883, username='', password='', ssl=False, off_on_disconnect=False)
Bases:
MQTTClient
- __init__(hostname, clientID='coldbox', port=1883, username='', password='', ssl=False, off_on_disconnect=False)
Initialises a MQTT client instance and sets default connect and disconnect callbacks.
- Parameters:
clientID – Unique client ID string used when connecting to the broker. If clientID is zero length or None, then one will be randomly generated.
- TIMEOUT = 20000
- connect()
Connects the client to a broker.
- Parameters:
broker – Hostname or IP address of the remote broker.
port – Network port of the server host to connect to. Defaults to 1883.
username – Sets username for broker authentification. Defaults to None.
password – Sets password for broker authentification. Defaults to None.
- disconnect()
- publish(msg)
Sends a message from the client to the broker.
- Parameters:
topic – A string specifiying the topic the message should be published on.
msg – A string specifying the message to send. Passing an int or float will result in the message being converted to a string.
- publish_and_receive(msg, receive_msg) str
- receive(receive_msg) str
- subscribe(topic)
Subscribes the client to a topic and sets a default message callback.
- Parameters:
sub – A string specifying the topic to subscribe to.
callback – F-string specifying the on_message callback for the subscribed topic. If None the global on_message callback will be set to f”Received ‘{msg.payload.decode()}’ from ‘{msg.topic}’”. Defaults to None.
- unsubscribe(topic)
ConnectionError
- icicle.psi_coldbox.ConnectionError()
Unspecified run-time error.
SettingError
- icicle.psi_coldbox.SettingError()
Common base class for all non-exit exceptions.