MockControlOpenLoop¶
- class lsst.ts.m2com.MockControlOpenLoop¶
Bases:
object
Mock open-loop control.
- Attributes:
- inclinometer_angle
float
Inclinometer angle in degree.
- open_loop_max_limit_is_enabled
bool
The maximum limit of open-loop control is enabled or not.
- is_running
bool
The open-loop control is running or not.
- actuator_steps
numpy.ndarray [int]
Current positions of the actuator in steps referenced to the home position.
- inclinometer_angle
Attributes Summary
Methods Summary
calculate_forces_to_positions
(forces)Calculate the forces to positions.
calculate_forces_to_steps
(forces)Calculate the forces to steps.
calculate_steps_to_forces
(steps)Calculate the steps to forces.
correct_inclinometer_angle
(angle[, offset])Correct the inclinometer's value and make sure to limit the resulting value to the indicated range: (-270, 90).
Get the actuator positions in millimeter.
get_forces_mirror_weight
(angle)Get the forces that bear the weight of mirror.
The actuator force is out of limit or not.
move_actuator_steps
(actuators, steps)Move the actuator steps.
pause
()Pause the movement.
read_file_static_transfer_matrix
(filepath[, ...])Read the file of static transfer matrix (the size is 78 x 78).
resume
()Resume the movement.
run_steps
(steps)Run the steps.
start
(actuators, displacement, unit)Start the movement.
stop
()Stop the movement.
update_actuator_steps
(actuator_steps)Update the current actuator steps referenced to the home position.
Attributes Documentation
- STEP_TO_MM = 1.9967536601e-05¶
Methods Documentation
- calculate_forces_to_positions(forces: ndarray[Any, dtype[float64]]) ndarray[Any, dtype[float64]] ¶
Calculate the forces to positions.
This is just an extension of self.calculate_forces_to_steps().
- Parameters:
- forces
numpy.ndarray
Actuator forces in Newton.
- forces
- Returns:
numpy.ndarray
Actuator positions in millimeter.
- calculate_forces_to_steps(forces: ndarray[Any, dtype[float64]]) ndarray[Any, dtype[int64]] ¶
Calculate the forces to steps.
This is the reverse of self.calculate_steps_to_forces().
- Parameters:
- forces
numpy.ndarray
Actuator forces in Newton.
- forces
- Returns:
numpy.ndarray [int]
Actuator steps.
- calculate_steps_to_forces(steps: ndarray[Any, dtype[int64]]) ndarray[Any, dtype[float64]] ¶
Calculate the steps to forces.
This function is translated from vendor’s original LabVIEW code. The static transfer matrix is used to simlulate the force change of actuator’s movement.
- Parameters:
- steps
numpy.ndarray [int]
Actuator steps.
- steps
- Returns:
numpy.ndarray
Actuator forces in Newton.
- correct_inclinometer_angle(angle: float, offset: float = 0.94) float ¶
Correct the inclinometer’s value and make sure to limit the resulting value to the indicated range: (-270, 90).
This function is translated from vendor’s original LabVIEW code. The hard-coded range is related to the configuration of inclinometer in the mirror assembly.
- get_actuator_positions() ndarray[Any, dtype[float64]] ¶
Get the actuator positions in millimeter.
- Returns:
numpy.ndarray
Actuator positions in millimeter.
- get_forces_mirror_weight(angle: float) ndarray[Any, dtype[float64]] ¶
Get the forces that bear the weight of mirror.
This function is translated from vendor’s original LabVIEW code. This is just an estimation of forces.
- Parameters:
- angle
float
Inclinometer angle in degree.
- angle
- Returns:
- forces
numpy.ndarray
Forces to support the mirror in Newton.
- forces
- is_actuator_force_out_limit() tuple[bool, list, list] ¶
The actuator force is out of limit or not. The result will depend on self.open_loop_max_limit_is_enabled.
- move_actuator_steps(actuators: list[int] | numpy.ndarray[Any, numpy.dtype[numpy.int64]], steps: int | list[int] | numpy.ndarray[Any, numpy.dtype[numpy.int64]]) None ¶
Move the actuator steps.
- Parameters:
- actuators
list [int]
ornumpy.ndarray [int]
Actuator IDs to do the movement.
- steps
int
,list [int]
ornumpy.ndarray [int]
Actuator steps to move.
- actuators
- Raises:
ValueError
When the data type is not integer.
RuntimeError
When the actuator force is out of limit.
- read_file_static_transfer_matrix(filepath: str | pathlib.Path, skiprows: int = 7) None ¶
Read the file of static transfer matrix (the size is 78 x 78).
This file comes from the vender’s original project used in the simulation purpose.
- Parameters:
- filepath
str
orpathlib.PosixPath
File path of the static transfer matrix.
- skiprows
int
, optional Number of lines to skip (int) at the start of the file. (the default is 7)
- filepath
- resume() None ¶
Resume the movement.
- Raises:
RuntimeError
When the movement is done.
- run_steps(steps: int) None ¶
Run the steps.
If the requested displacement is done or the actuator force is out of limit, the value of self.is_running will change to False.
- Parameters:
- steps
int
Absolute steps (>=0) to move. The internal calculation will consider the direction of target displacement by itself.
- steps
- Raises:
RuntimeError
When the actuators are not running.
ValueError
When the steps is less than 0.
- start(actuators: list[int], displacement: int | float, unit: ActuatorDisplacementUnit) None ¶
Start the movement.
- Parameters:
- actuators
list [int]
Actuator IDs to do the movement.
- displacement
int
orfloat
Displacement to move.
- unitenum
ActuatorDisplacementUnit
Unit of the displacement.
- actuators
- Raises:
RuntimeError
When the actuators are moving.
ValueError
When no actuators are selected.
- update_actuator_steps(actuator_steps: ndarray[Any, dtype[int64]]) None ¶
Update the current actuator steps referenced to the home position.
- Parameters:
- actuator_steps
numpy.ndarray [int]
New current positions of the actuator in steps.
- actuator_steps
- Raises:
ValueError
When the length of actuators does not match.
ValueError
When the data type is not integer.