pidcontroller
PIDController class for TRICICLE PIDcontroller-UI instance.
Classes
|
SCPIInstrument implementation for NI CompactRIO-based DCS interlock in OPMD. |
PIDController
- class icicle.pidcontroller.PIDController(*args, **kwargs)
Bases:
SCPIInstrument
SCPIInstrument implementation for NI CompactRIO-based DCS interlock in OPMD.
Communicates with interlock GUI - the latter provides (currently read-only) access to some registers and computed values within FPGA and GUI.
- __init__(resource='TCPIP::localhost::19898::SOCKET', sim=False, outputs=4)
- Parameters:
resource – VISA Resource address. See VISA docs for more info.
outputs – How many relays this interlock device has. Defaults to 4.
- CHANNELS = 99
- COM_RESET = ''
Instrument Reset SCPI command.
- MEASURE_TYPES = {'CONTROL': 'Controlled parameter', 'SPEED': 'Speed parameter', 'TEMPERATURE': 'Input value', 'TEMPERATURE_SETPOINT': 'Setpoint'}
- class MeasureChannel(*args, **kwargs)
Bases:
MeasureChannel
MeasureChannel implementation for the ITkDCSInterlock.
- property status
- Returns:
Connection?
- Return type:
int
- property value
Performs measurement and returns value.
- Returns:
measured value.
- Return type:
float
- SETTINGS = {'CONTROL': {'QUERY': 'CONT? {:d}', 'parser': <function numeric_float>, 'verifier': <function is_integer.<locals>._is_integer>}, 'HIGH_LIMIT': {'QUERY': 'OUTP:LIM:HIGH {:d}', 'SET': 'OUTP:LIM:HIGH {:d} {:f}', 'parser': <function numeric_float>, 'verifier': (<function is_integer.<locals>._is_integer>, <function is_numeric.<locals>._is_numeric>)}, 'IDENTIFIER': {'QUERY': '*IDN?'}, 'KD': {'QUERY': 'PARA:KD? {:d}', 'SET': 'PARA:KD {:d} {:f}', 'parser': <function numeric_float>, 'verifier': (<function is_integer.<locals>._is_integer>, <function is_numeric.<locals>._is_numeric>)}, 'KI': {'QUERY': 'PARA:KI? {:d}', 'SET': 'PARA:KI {:d} {:f}', 'parser': <function numeric_float>, 'verifier': (<function is_integer.<locals>._is_integer>, <function is_numeric.<locals>._is_numeric>)}, 'KP': {'QUERY': 'PARA:KP? {:d}', 'SET': 'PARA:KP {:d} {:f}', 'parser': <function numeric_float>, 'verifier': (<function is_integer.<locals>._is_integer>, <function is_numeric.<locals>._is_numeric>)}, 'LOW_LIMIT': {'QUERY': 'OUTP:LIM:LOW {:d}', 'SET': 'OUTP:LIM:LOW {:d} {:f}', 'parser': <function numeric_float>, 'verifier': (<function is_integer.<locals>._is_integer>, <function is_numeric.<locals>._is_numeric>)}, 'STATE': {'QUERY': 'STAT? {:d}', 'SET': 'STAT {:d} {:d}', 'parser': <function numeric_bool>, 'verifier': (<function is_integer.<locals>._is_integer>, <function truthy.<locals>._truthy>)}, 'TEMPERATURE': {'QUERY': 'VAL? {:d}', 'parser': <function numeric_float>, 'verifier': <function is_integer.<locals>._is_integer>}, 'TEMPERATURE_SETPOINT': {'QUERY': 'SETP? {:d}', 'SET': 'SETP {:d} {:f}', 'parser': <function numeric_float>, 'verifier': (<function is_integer.<locals>._is_integer>, <function is_numeric.<locals>._is_numeric>)}}
Settings dictionary with all Set/Query SCPI combinations.
- TIMEOUT = 10000
Ethernet link timeout.
- class TemperatureChannel(*args, **kwargs)
Bases:
TemperatureChannel
TemperatureChannel implementation for PIDController.
- 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:
Dummy status.
- property temperature
- Returns:
currently set channel temperature.
- Return type:
float
- query_channel(setting, channel, **kwargs)
Query setting on instrument for output channel.
- Parameters:
setting – key in class dictionary SETTINGS.
channel – output to set this setting on.
no_lock – override acquire_lock (e.g. if lock already taken by function that query_channel-call is nested within).
attempts – how many retries to give set command.
- Returns:
data returned by device for given query.
- set_channel(setting, channel, *value, **kwargs)
Set setting on instrument to value for output channel, and read-back using equivalent query().
- Parameters:
setting – key in class dictionary SETTINGS.
channel – channel to set this setting on.
value – target value for setting.
no_lock – override acquire_lock (e.g. if lock already taken by function that set_channel-call is nested within).
attempts – how many retries to give set command.
- Returns:
read-back value if query() available, else whether number of bytes written during set() meets expectation
- status(channel, **kwargs)
Check status of relay.
- Parameters:
channel – relay to be checked.
no_lock – override acquire_lock (e.g. if lock already taken by function that status-call is nested within).
attempts – how many retries to give set command.
- Returns:
status of output.
- validate_channel(channel, raise_exception=True)
Check if an output exists on this device.
- Parameters:
channel – channel number to validate as an output.