qmi.instruments.jpe.cpsc

Instrument driver for the JPE CPSC piezo stage controller.

Classes

JPE_CPSC(context, name, serial_number[, ...])

Instrument driver for the JPE CPSC piezo stage controller.

StatusPositionControl(ENABLED, FINISHED, ...)

A named tuple with status and position error information.

class qmi.instruments.jpe.cpsc.StatusPositionControl(ENABLED: int, FINISHED: int, INVALID_SP1: int, INVALID_SP2: int, INVALID_SP3: int, POS_ERROR1: int, POS_ERROR2: int, POS_ERROR3: int)

A named tuple with status and position error information.

ENABLED: int

Alias for field number 0

FINISHED: int

Alias for field number 1

INVALID_SP1: int

Alias for field number 2

INVALID_SP2: int

Alias for field number 3

INVALID_SP3: int

Alias for field number 4

POS_ERROR1: int

Alias for field number 5

POS_ERROR2: int

Alias for field number 6

POS_ERROR3: int

Alias for field number 7

count(value, /)

Return number of occurrences of value.

index(value, start=0, stop=9223372036854775807, /)

Return first index of value.

Raises ValueError if the value is not present.

class qmi.instruments.jpe.cpsc.JPE_CPSC(context: QMI_Context, name: str, serial_number: str, cpsp_dir: str = 'C:\\HardwareControl\\CPSC_v7.3.20201222')

Instrument driver for the JPE CPSC piezo stage controller.

Note that the piezo stage controller will only hold its actuator positions while the connection to the instrument is open. Closing the connection will automatically return the controller to its free state.

This driver communicates with the piezo stage controller via a helper program “cacli.exe”.

The helper program is a command-line Windows application. On Linux, it can run under Wine.

open() None

The ‘open()’ function override. Starts the correct os-specific helper program.

close() None

The ‘close()’ function override. Stops the helper program and closes the instrument.

get_idn() QMI_InstrumentIdentification

Read instrument type and version.

Returns:

QMI_InstrumentIdentification instance.

get_info_all_modules() List[str]

Get information about installed modules.

Returns:

Listing of module info

Return type:

modlist

get_info_module(address: int) str

Get information about given module.

Parameters:

address – 1 to 6. Address of module corresponding to controller slot.

Returns:

info string about given module

request_fail_safe_state(address: int) str

Reguest fail-safe state from a specific module. In practice - check for errors.

Parameters:

address – 1 to 6. Address of module corresponding to controller slot.

Returns:

the response error code string

move(address: int, direction: int, freq: int = 10, rss: int = 100, steps: int = 0, temp: int = 295, stage: str = 'CBS10-RLS', df: float = 1.0) None

Move an actuator with specific parameters

Parameters:
  • address – 1 to 6. Address of module corresponding to controller slot.

  • direction – 0 to 1. Direction of movement: set to 1 for positive movement and 0 (zero) for negative movement

  • freq – 1 to 600 Step frequency input. Value is in Hertz [Hz] (numerical values only).

  • rss – 1 to 100 (Relative) actuator step size parameter input. Value is a percentage [%] (numerical values only)

  • steps – 0 to 50000 Number of actuation steps. Range 0 to 50000, where 0 is used for infinite move (use STP command to stop actuator movement).

  • temp – 0 to 300 Set this parameter to the temperature of the environment in which the actuator is used. Input is in Kelvin [K] (numerical values only).

  • stage – Sets specific internal drive parameters for the type of actuator or system attached to that particular channel of that particular module set by [ADDR] and [CH].

  • df – Optional[float] - 0.1 to 3.0 Drive factor (numerical values only). In normal operating conditions, set this value to 1 (or 1.0).

stop(address: int) None

Stops movement of an actuator (MOV command), disables external input mode (EXT command) or disables scan mode (SDC command).

Parameters:

address – 1 to 6. Address of module corresponding to controller slot.

enable_scan_mode(address: int, value: int) None

Enables and sets the scan mode for CADM2.

Parameters:
  • address – 1 to 6. Address of module corresponding to controller slot.

  • value

    A numerical value in between 0 and 1023 (10-bit value) where zero represents ~0[V] output

    (-30[V] in respect to REF) and the maximum value represents ~150[V] output (+120[V] in respect to REF).

use_external_input(address: int, direction: int, freq: int = 10, rss: int = 100, temp: int = 295, stage: str = 'CBS10-RLS', df: float = 1.0) None

To use the CADM2 in Flexdrive mode, it is required to set the module in external (analog) input mode prior to using Flexdrive.

Parameters:
  • address – 1 to 6. Address of module corresponding to controller slot.

  • direction – 0 to 1. Direction of movement: set to 1 for positive movement and 0 (zero) for negative movement

  • freq – 1 to 600 Step frequency input. Value is in Hertz [Hz] (numerical values only).

  • rss – 1 to 100 (Relative) actuator step size parameter input. Value is a percentage [%] (numerical values only)

  • temp – 0 to 300 Set this parameter to the temperature of the environment in which the actuator is used. Input is in Kelvin [K] (numerical values only).

  • stage – Sets specific internal drive parameters for the type of actuator or system attached to that particular channel of that particular module set by [ADDR] and [CH].

  • df – 0.1 to 3.0 Drive factor (numerical values only). In normal operating conditions, set this value to 1 (or 1.0).

get_current_position(address: int, chan: int, stage: str = 'CBS10-RLS') float

Get current position of a Resistive Linear Sensor (RLS) connected to a specific channel [CH] of the RSM module. :param address: 1 to 6. Address of module corresponding to controller slot. :param chan: 1 to 3. Specific channel number. :param stage: stage name, e.g. “CLA2601”, default “CBS10-RLS”.

Raises:

QMI_InstrumentException – If the response cannot be cast into a float.

Returns:

Current position in [m].

Return type:

cur_pos

get_current_position_of_all_3_channels(address: int, stage: str = 'CBS10-RLS') List[float]

Get current position of all three channels of the RSM module.

Parameters:
  • address – 1 to 6. Address of module corresponding to controller slot.

  • stage – stage name, e.g. “CLA2601”, default “CBS10-RLS”.

Raises:

QMI_InstrumentException – If (one of the) response entries cannot be cast into a float.

Returns:

current positions in [m].

Return type:

cur_pos

set_negative_end_stop(address: int, chan: int) None

Set the current position of a Resistive Linear Sensor (RLS) connected to channel [CH] of the RSM to be the negative end-stop.

Parameters:
  • address – 1 to 6. Address of module corresponding to controller slot.

  • chan – 1 to 3. Specific channel number.

set_positive_end_stop(address: int, chan: int) None

Set the current position of a Resistive Linear Sensor (RLS) connected to channel [CH] of the RSM to be the positive end-stop.

Parameters:
  • address – 1 to 6. Address of module corresponding to controller slot.

  • chan – 1 to 3. Specific channel number.

read_negative_end_stop(address: int, chan: int, stage: str = 'CBS10-RLS') float

Read the current value of the negative end-stop parameter set for a specific channel [CH] of an RSM.

Parameters:
  • address – 1 to 6. Address of module corresponding to controller slot.

  • chan – 1 to 3. Specific channel number.

  • stage – Stage name, e.g. “CLA2601”, default “CBS10-RLS”.

Raises:

QMI_InstrumentException – If the response cannot be cast into a float.

Returns:

The current value of the parameter in [m].

Return type:

cur_val

read_positive_end_stop(address: int, chan: int, stage: str = 'CBS10-RLS') float

Read the current value of the positive end-stop parameter set for a specific channel [CH] of an RSM.

Parameters:
  • address – 1 to 6. Address of module corresponding to controller slot.

  • chan – 1 to 3. Specific channel number.

  • stage – stage name, e.g. “CLA2601”, default “CBS10-RLS”.

Raises:

QMI_InstrumentException – If the response cannot be cast into a float.

Returns:

the current value of the parameter in [m].

Return type:

cur_val

reset_end_stops(address: int, chan: int)

Reset the current values of the negative and positive end-stop parameters set for a specific channel [CH] of an RSM.

Parameters:
  • address – 1 to 6. Address of module corresponding to controller slot.

  • chan – 1 to 3. Specific channel number.

set_excitation_duty_cycle(address: int, duty: int) None

Set the duty cycle of the sensor excitation signal of the RSM.

Parameters:
  • address – 1 to 6. Address of module corresponding to controller slot.

  • duty – Value is in [%] and can be set to 0 (zero) or from 10 to (default) 100.

read_excitation_duty_cycle(address: int) int

Read the duty cycle of the sensor excitation signal of the RSM.

Parameters:

address – 1 to 6. Address of module corresponding to controller slot.

Raises:

QMI_InstrumentException – If the response cannot be cast into an int.

Returns:

Response value is in [%].

Return type:

cur_val

save_rsm_settings(address: int) None

Store the current values of the following parameters of the RSM to the non-volatile memory of the controller: excitation duty cycle (EXS), negative end stop (MIS) and positive end-stop (MAS).

Parameters:

address – 1 to 6. Address of module corresponding to controller slot.

get_current_counter_value(address: int, chan: int) int

Request the counter valuea of a Cryo Optical Encoder (COE) connected to a specific channel [CH] of the OEM2 module.

Parameters:
  • address – 1 to 6. Address of module corresponding to controller slot.

  • chan – 1 to 3. Specific channel number.

Raises:

QMI_InstrumentException – If the response cannot be cast into an int.

Returns:

Response value is in [counter ticks].

Return type:

cur_val

reset_counter_value(address: int, chan: int) None

Resets the counter (to zero) for a specific cryo optical encoder connected to a specific channel [CH] of the OEM2 module.

Parameters:
  • address – 1 to 6. Address of module corresponding to controller slot.

  • chan – 1 to 3. Specific channel number.

get_current_encoder_signal_value(address: int, chan: int) int

Request the (raw) encoder signal value of a Cryo Optical Encoder (COE) connected to a specific channel [CH] of the OEM2 module.

Parameters:
  • address – 1 to 6. Address of module corresponding to controller slot.

  • chan – 1 to 3. Specific channel number.

Raises:

QMI_InstrumentException – If the response cannot be cast into an int.

Returns:

Return value is a (unitless) number between [0] and [255].

Return type:

cur_val

auto_oem_calibration(address: int, chan: int, cadm2_address: int, temp: int, stage: str = 'CBS10-RLS') None

Command to initiate an automatic calibration procedure for a specific encoder connected to channel [CH] of an OEM2.

Parameters:
  • address – 1 to 6. Address of module corresponding to controller slot.

  • chan – 1 to 3. Specific channel number.

  • cadm2_address – 1 to 6. Address of module corresponding to CADM2 slot.

  • temp – 0 to 300 Set this parameter to the temperature of the environment in which the actuator is used. Input is in Kelvin [K] (numerical values only).

  • stage – stage name, e.g. “CLA2601”, default “CBS10-RLS”.

request_calibration_values(address: int, chan: int) List[int]

Request the Detector Gain setting [GAIN], Upper Threshold value [UT] and Lower Threshold value [LT] set to a specific channel [CH] of the OEM2 module.

Parameters:
  • address – 1 to 6. Address of module corresponding to controller slot.

  • chan – 1 to 3. Specific channel number.

Raises:

QMI_InstrumentException – If (one of the) response entries cannot be cast into an int.

Returns:

Three values in between [1] and [255].

Return type:

cal_vals

set_detector_gain(address: int, chan: int, gain: int) None

Set a Detector Gain [GAIN] for a specific channel [CH] of the OEM2 module.

Parameters:
  • address – 1 to 6. Address of module corresponding to controller slot.

  • chan – 1 to 3. Specific channel number.

  • gain – a value in between [1] and [255].

set_upper_threshold(address: int, chan: int, ut: int) None

Set a Detector Upper Threshold value [UT] for a specific channel [CH] of the OEM2 module.

Parameters:
  • address – 1 to 6. Address of module corresponding to controller slot.

  • chan – 1 to 3. Specific channel number.

  • ut – a value in between [1] and [255]. Must be higher than Lower Threshold [LT] value.

set_lower_threshold(address: int, chan: int, lt: int) None

Set a Detector Lower Threshold value [LT] for a specific channel [CH] of the OEM2 module.

Parameters:
  • address – 1 to 6. Address of module corresponding to controller slot.

  • chan – 1 to 3. Specific channel number.

  • lt – a value in between [1] and [255]. Must be lower than Upper Threshold [UT] value.

save_detector_settings(address) None
Store Detector Gain [GAIN], Detector Upper Threshold value [UT] and Detector Lower Threshold value [LT]

values in nonvolatile memory.

Parameters:

address – 1 to 6. Address of module corresponding to controller slot.

enable_servodrive(stage1: str, freq1: int, stage2: str, freq2: int, stage3: str, freq3: int, df: int, temp: int) None

Enable servo drive control loop.

Parameters:
  • stage1 – Sets specific internal drive parameters for the type of actuator or system attached to that particular channel of that particular module set by [ADDR] and [CH].

  • freq1 – 1 to 600 Step frequency input. Value is in Hertz [Hz] (numerical values only).

  • stage2 – Sets specific internal drive parameters for the type of actuator or system attached to that particular channel of that particular module set by [ADDR] and [CH].

  • freq2 – 1 to 600 Step frequency input. Value is in Hertz [Hz] (numerical values only).

  • stage3 – Sets specific internal drive parameters for the type of actuator or system attached to that particular channel of that particular module set by [ADDR] and [CH].

  • freq3 – 1 to 600 Step frequency input. Value is in Hertz [Hz] (numerical values only).

  • df – 0.1 to 3.0 Drive factor (numerical values only). In normal operating conditions, set this value to 1 (or 1.0).

  • temp – 0 to 300 Set this parameter to the temperature of the environment in which the actuator is used. Input is in Kelvin [K] (numerical values only).

disable_servodrive() None

Disable servo drive control loop.

move_to_setpoint(sp1: float, sp2: float, sp3: float, enable_abs_pos: int) None

Move actuators to a set point position.

Parameters:
  • sp1 – setpoint value in [m] for linear, in [rad] for rotational type actuators.

  • sp2 – setpoint value in [m] for linear, in [rad] for rotational type actuators.

  • sp3 – setpoint value in [m] for linear, in [rad] for rotational type actuators.

  • enable_abs_pos – 1 to enable absolute positioning, otherwise set to 0 (zero).

emergency_stop() None

Immediate stop of all actuators. The control loop will be aborted and the actuators will stop at their current location.

force_unlock() None

Forcefully unlock the remote object.

This unlocks the object, regardless of who owns the lock. This allows you to unlock an object if the locking proxy has been destroyed without unlocking.

Use this with care.

Do not override this stub method in subclasses. It has already been implemented in QMI_RpcProxy.

classmethod get_category() str | None

Return the optional name of the category this object belongs to.

A category name is a free-form string that has no special significance. Its purpose is to distinguish between groups of RPC objects that fulfill similar roles.

get_name() str

Return the name of this object.

Returns:

name attribute.

get_signals() list[SignalDescription]

Return a list of signals that can be published by this object.

Returns:

List consisting of qmi_signals attributes.

get_status_position_control() StatusPositionControl

This command receives a (comma-separated) list with status and position error information. The list is then turned into a named tuple which is returned.

Returns:

[ENABLED] [FINISHED] [INVALID SP1] [INVALID SP2] [INVALID SP3] [POS ERROR1] [POS ERROR2] [POS ERROR3]

is_locked() bool

Query if the remote object is locked.

Do not override this stub method in subclasses. It has already been implemented in QMI_RpcProxy.

is_open() bool

Return True if the instrument is open (ready for interaction).

lock(timeout: float = 0.0, lock_token: str | None = None) bool

Lock the remote object. If timeout is given, try every 0.1s within the given timeout value. The remote object can be locked with an optional custom lock token by giving a string into lock_token keyword argument.

If successful, this proxy is the only proxy that can invoke RPC methods on the remote object; other proxies will receive an “object is locked” response. The return value indicates if the lock was granted; a denied lock means the object was already locked by another proxy.

Do not override this stub method in subclasses. It has already been implemented in QMI_RpcProxy.

release_rpc_object() None

Give a warning if the instrument is removed while still open.

unlock(lock_token: str | None = None) bool

Unlock the remote object.

Without optional parameters, this is only allowed by the proxy that initially locked the object. By giving the lock token as an input parameter, the specific object locked by this token can be unlocked. The return value indicates if the unlocking was successful.

Do not override this stub method in subclasses. It has already been implemented in QMI_RpcProxy.