MockModel¶
- class lsst.ts.m2com.MockModel(log=None, inclinometer_angle=90, telemetry_interval=0.05)¶
Bases:
object
Mock Model class.
- Parameters:
- log
logging.Logger
or None, optional A logger. If None, a logger will be instantiated. (the default is None)
- inclinometer_angle
float
, optional Inclinometer angle in degree. (the default is 90)
- telemetry_interval
float
, optional Telemetry interval in second. (the default is 0.05, which means 20 Hz)
- log
- Attributes:
- log
logging.Logger
A logger.
- control_open_loop
MockControlOpenLoop
Open-loop control.
- control_closed_loop
MockControlClosedLoop
Closed-loop control.
- telemetry_interval
float
Telemetry interval in second.
- inclination_source
MTM2.InclinationTelemetrySource
Source of the inclination.
- communication_power_on
bool
Communication power is on or not.
- motor_power_on
bool
Motor power is on or not.
- in_position
bool
M2 assembly is in position or not.
- error_cleared
bool
Error is cleared or not.
- mtmount_in_position
bool
MTMount in position or not.
- script_engine
MockScriptEngine
Script engine to run the binary script.
- log
Attributes Summary
Updated digital input when the communication power is on.
Default digital input defined with the enum 'DigitalInput'.
Updated digital input when the motor power is on.
Default digital output defined with the enum 'DigitalOutput'.
Mirror radial motion limit (in mm).
Mirror motion limit in the optical direction (in mm).
Methods Summary
balance_forces_and_steps
([force_rms, ...])Balance the forces and steps.
Clear the errors.
configure
(config_dir, lut_path)Do the configuration.
enable_open_loop_max_limit
(status)Enable the maximum limit of open-loop control.
fault
()Fault the model.
Get the default mirror position.
Get the value of digital input that represents the current state of the system.
Get the value of digital output.
Get the telemetry data.
handle_position_mirror
(mirror_position_set_point)Handle positining the mirror.
The actuator force is out of limit or not.
reset_breakers
(power_type)Reset the breakers.
select_inclination_source
(source)Select the inclination source.
set_inclinometer_angle
(angle)Set the angle of inclinometer.
switch_force_balance_system
(status)Switch the force balance system.
Attributes Documentation
- digital_input_communication¶
Updated digital input when the communication power is on.
- digital_input_default¶
Default digital input defined with the enum ‘DigitalInput’.
- digital_input_motor¶
Updated digital input when the motor power is on.
- digital_output_default¶
Default digital output defined with the enum ‘DigitalOutput’.
- position_limit_radial¶
Mirror radial motion limit (in mm).
- position_limit_z¶
Mirror motion limit in the optical direction (in mm).
Methods Documentation
- balance_forces_and_steps(force_rms=0.5, force_per_cycle=5, update_steps=True)¶
Balance the forces and steps.
This function will check the actuators are in position or not and udpate the self.in_position. If the closed-loop control is running, it will do the force dynamics based on the “force_per_cycle” to try to balance the forces of actuators. In addition, it will try to make sure the internal data in open-loop and closed-loop controls are consistent.
- Parameters:
- force_rms
float
, optional Force rms variation in Newton. (default is 0.5)
- force_per_cycle
float
, optional Force per cycle to apply in Newton. (the default is 5)
- update_steps
bool
, optional If True, update the steps based on the force change. Otherwise, no update. This takes a significant CPU usage (np.linalg.inv()). (the default is True)
- force_rms
- Returns:
bool
True if the steps had been updated according to the force change. Otherwise, False.
- Raises:
RuntimeError
When the open-loop and closed-loop controls are running at the same time.
- clear_errors()¶
Clear the errors.
- configure(config_dir, lut_path)¶
Do the configuration.
- Parameters:
- config_dir
pathlib.PosixPath
Configuration directory.
- lut_path
str
Look-up table (LUT) path.
- config_dir
- enable_open_loop_max_limit(status)¶
Enable the maximum limit of open-loop control.
- fault()¶
Fault the model.
- get_default_mirror_position()¶
Get the default mirror position.
- Returns:
dict
Default mirror position. The key is axis.
- get_digital_input()¶
Get the value of digital input that represents the current state of the system.
- Returns:
- digital_input
int
Value of the digital input.
- digital_input
- get_digital_output()¶
Get the value of digital output.
- Returns:
- digital_output
int
Value of the digital output.
- digital_output
- handle_position_mirror(mirror_position_set_point)¶
Handle positining the mirror.
- Parameters:
- mirror_position_set_point
dict
Dictionary with the same format as
self.mirror_position
.
- mirror_position_set_point
- Returns:
bool
True if succeeds. Otherwise, False.
- Raises:
- RuntimeError
Requested position outside of radial limits.
- RuntimeError
Requested position out of limits.
- RuntimeError
Failed to position the mirror.
- is_actuator_force_out_limit()¶
The actuator force is out of limit or not.
By default, return the judgement based on the open-loop control. If the closed-loop control is running, return the result based on it.
- Returns:
bool
True if the actuator force is out of limit. Otherwise, False.
- reset_breakers(power_type)¶
Reset the breakers.
- select_inclination_source(source)¶
Select the inclination source.
- Parameters:
- source
int
Inclination source based on the enum: MTM2.InclinationTelemetrySource.
- source