Model

class lsst.ts.m2gui.Model(log, host='localhost', port_command=50010, port_telemetry=50011, timeout_connection=10, timeout_in_second=0.05, is_simulation_mode=False)

Bases: object

Model class of the application.

Parameters:
loglogging.Logger

A logger.

hoststr, optional

Host address. (the default is “localhost”)

port_commandint, optional

Command port to connect. (the default is 50010)

port_telemetryint, optional

Telemetry port to connect. (the default is 50011)

timeout_connectionint or float, optional

Connection timeout in second. (the default is 10)

timeout_in_secondfloat, optional

Time limit for reading data from the TCP/IP interface (sec). (the default is 0.05)

is_simulation_mode: `bool`, optional

True if running in simulation mode. (the default is False)

Attributes:
loglogging.Logger

A logger.

is_csc_commanderbool

Commandable SAL component (CSC) is the commander or not.

local_modeenum LocalMode

Local model.

is_closed_loopbool

Closed-loop control is on or not.

signal_controlSignalControl

Signal to report the control status.

signal_statusSignalStatus

Signal to report the updated status of system.

signal_configSignalConfig

Signal to send the configuration.

signal_scriptSignalScript

Signal to send the script progress.

system_statusdict

System status.

fault_managerFaultManager

Fault manager to record the system error.

utility_monitorUtilityMonitor

Utility monitor to monitor the utility status.

controllerlsst.ts.m2com.ControllerCell

Controller to do the TCP/IP communication with the servers of M2 cell.

duration_refreshint

Duration to refresh the data in milliseconds.

Methods Summary

add_error(error)

Add the error.

clear_error(error)

Clear the error.

command_actuator(command[, actuators, ...])

Run the actuator command.

command_script(command[, script_name])

Run the script command.

connect()

Connect to the M2 controller.

disconnect()

Disconnect from the M2 controller.

enable_open_loop_max_limit(status)

Enable the maximum limit in open-loop control.

get_actuator_default_status(status)

Get the default actuator status.

go_to_position(x, y, z, rx, ry, rz)

Go to the position.

is_enabled_and_closed_loop_control()

The system is in the Enabled state and closed-loop control or not.

is_enabled_and_open_loop_control()

The system is in the Enabled state and open-loop control or not.

reboot_controller()

Reboot the cell controller.

report_config(**kwargs)

Report the configuration defined in Config class.

report_control_status()

Report the control status.

report_script_progress(progress)

Report the script progress.

reset_breakers(power_type)

Reset the breakers.

reset_errors()

Reset errors.

save_position()

Save the rigid body position.

set_bit_digital_status(idx)

Set the bit value of digital status.

set_home()

Set the home position.

update_connection_information(host, ...)

Update the connection information.

update_system_status(status_name, new_status)

Update the system status.

Methods Documentation

add_error(error)

Add the error.

Parameters:
errorint

Error code.

clear_error(error)

Clear the error.

Parameters:
errorint

Error code.

async command_actuator(command, actuators=None, target_displacement=0, unit=ActuatorDisplacementUnit.Millimeter)

Run the actuator command.

Parameters:
commandenum lsst.ts.m2com.CommandActuator

Actuator command.

actuatorslist [int] or None, optional

Selected actuators to do the movement. If the empty list [] is passed, the function will raise the RuntimeError. (the default is None)

target_displacementfloat or int, optional

Target displacement of the actuators. (the default is 0)

unitenum lsst.ts.m2com.ActuatorDisplacementUnit, optional

Displacement unit. (the default is ActuatorDisplacementUnit.Millimeter)

Raises:
RuntimeError

No actuator is selected.

RuntimeError

Not in the enabled state with open-loop control.

async command_script(command, script_name=None)

Run the script command.

Parameters:
commandenum lsst.ts.m2com.CommandScript

Script command.

script_namestr or None, optional

Name of the script. (the default is None)

Raises:
RuntimeError

Not in the enabled state.

async connect()

Connect to the M2 controller.

Raises:
RuntimeError

There is the connection with the M2 controller already.

async disconnect()

Disconnect from the M2 controller.

async enable_open_loop_max_limit(status)

Enable the maximum limit in open-loop control.

Parameters:
statusbool

Enable the maximum limit or not.

Raises:
RuntimeError

Not in the open-loop control.

get_actuator_default_status(status)

Get the default actuator status.

Parameters:
statusany

Default status.

Returns:
collectiondict

Collection of default actuator status.

async go_to_position(x, y, z, rx, ry, rz)

Go to the position.

Parameters:
xfloat

Position x in um.

yfloat

Position y in um.

zfloat

Position z in um.

rxfloat

Rotation x in arcsec.

ryfloat

Rotation y in arcsec.

rzfloat

Rotation z in arcsec.

Raises:
RuntimeError

Not in the closed-loop control.

is_enabled_and_closed_loop_control()

The system is in the Enabled state and closed-loop control or not.

Returns:
bool

True if the system is in the Enabled state and closed-loop control. Otherwise, False.

is_enabled_and_open_loop_control()

The system is in the Enabled state and open-loop control or not.

Returns:
bool

True if the system is in the Enabled state and open-loop control. Otherwise, False.

async reboot_controller()

Reboot the cell controller.

Raises:
RuntimeError

Not in the standby state with local control.

report_config(**kwargs)

Report the configuration defined in Config class.

Parameters:
**kwargsdict

Configuration key-value pairs. The available keys are defined in Config class.

Returns:
configConfig

Configuration.

Raises:
KeyError

Key name does not exist in the Config class.

report_control_status()

Report the control status.

report_script_progress(progress)

Report the script progress.

Parameters:
progressint

Progress of the script execution (0-100%).

async reset_breakers(power_type)

Reset the breakers.

Parameters:
power_typeenum lsst.ts.m2com.PowerType

Power type.

async reset_errors()

Reset errors.

async save_position()

Save the rigid body position.

async set_bit_digital_status(idx)

Set the bit value of digital status.

Parameters:
idxint

Bit index that begins from 0, which should be >= 0.

Raises:
RuntimeError

Not in the diagnostic state.

async set_home()

Set the home position.

update_connection_information(host, port_command, port_telemetry, timeout_connection)

Update the connection information.

Parameters:
hoststr

Host address.

port_commandint

Command port to connect.

port_telemetryint

Telemetry port to connect.

timeout_connectionint or float

Connection timeout in second.

Raises:
RuntimeError

There is the connection with the M2 controller already.

ValueError

When the command port equals to the telemetry port.

update_system_status(status_name, new_status)

Update the system status.

Parameters:
status_namestr

Status name. It must be in the keys of self.system_status.

new_statusbool

New status.

Raises:
ValueError

Status name is not in the list.