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:
- log
logging.Logger
A logger.
- host
str
, optional Host address. (the default is “localhost”)
- port_command
int
, optional Command port to connect. (the default is 50010)
- port_telemetry
int
, optional Telemetry port to connect. (the default is 50011)
- timeout_connection
int
orfloat
, optional Connection timeout in second. (the default is 10)
- timeout_in_second
float
, 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)
- log
- Attributes:
- log
logging.Logger
A logger.
- is_csc_commander
bool
Commandable SAL component (CSC) is the commander or not.
- local_modeenum
LocalMode
Local model.
- is_closed_loop
bool
Closed-loop control is on or not.
- signal_control
SignalControl
Signal to report the control status.
- signal_status
SignalStatus
Signal to report the updated status of system.
- signal_config
SignalConfig
Signal to send the configuration.
- signal_script
SignalScript
Signal to send the script progress.
- system_status
dict
System status.
- fault_manager
FaultManager
Fault manager to record the system error.
- utility_monitor
UtilityMonitor
Utility monitor to monitor the utility status.
- controller
lsst.ts.m2com.ControllerCell
Controller to do the TCP/IP communication with the servers of M2 cell.
- duration_refresh
int
Duration to refresh the data in milliseconds.
- log
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 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.
The system is in the Enabled state and closed-loop control or not.
The system is in the Enabled state and open-loop control or not.
Reboot the cell controller.
report_config
(**kwargs)Report the configuration defined in
Config
class.Report the control status.
report_script_progress
(progress)Report the script progress.
reset_breakers
(power_type)Reset the breakers.
Reset errors.
Save the rigid body position.
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
- async command_actuator(command, actuators=None, target_displacement=0, unit=ActuatorDisplacementUnit.Millimeter)¶
Run the actuator command.
- Parameters:
- commandenum
lsst.ts.m2com.CommandActuator
Actuator command.
- actuators
list [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_displacement
float
orint
, optional Target displacement of the actuators. (the default is 0)
- unitenum
lsst.ts.m2com.ActuatorDisplacementUnit
, optional Displacement unit. (the default is ActuatorDisplacementUnit.Millimeter)
- commandenum
- 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_name
str
or None, optional Name of the script. (the default is None)
- commandenum
- 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:
- status
bool
Enable the maximum limit or not.
- status
- Raises:
RuntimeError
Not in the open-loop control.
- get_actuator_default_status(status)¶
Get the default actuator status.
- async 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.
- 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_control_status()¶
Report the control status.
- report_script_progress(progress)¶
Report the script progress.
- Parameters:
- progress
int
Progress of the script execution (0-100%).
- progress
- async reset_breakers(power_type)¶
Reset the breakers.
- Parameters:
- power_typeenum
lsst.ts.m2com.PowerType
Power type.
- power_typeenum
- 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:
- idx
int
Bit index that begins from 0, which should be >= 0.
- idx
- 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:
- 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:
- Raises:
ValueError
Status name is not in the list.