simulation
SimModeCMBase Class
- class ska_mid_cbf_fhs_common.testing.simulation.SimModeCMBase(*args: Any, attr_change_callback: Callable[[str, Any], None] | None = None, attr_archive_callback: Callable[[str, Any], None] | None = None, **kwargs: Any)[source]
Bases:
TaskExecutorComponentManagerA base class for FHS device simulation mode component managers. FHS device instances can make use component managers that inherit from this class and FhsSimMode-derived mixins to simulate their own behaviour.
SimModeCMBase-derived simulation mode component managers should initialize to default behaviour and supply an interface matching the one expected of the genuine component manager that is being replaced; property getter methods are used to return attribute_overrides values instead of expected attributes, and functools.partial is used to override LRC submit_task methods with sim_command, which submits a generic LRC task that pulls from command_overrides values to generate expected behaviour.
Initialize default attribute and command overrides.
Requires only logger, communication_state_callback and component_state_callback arguments for BaseComponentManager initialization.
- get_attribute_override(attr_name)[source]
Return specified attribute override from queue
- Parameters:
attribute – specified attribute to return the value of
- get_command_override(command)[source]
Return specified command override from queue
- Parameters:
command – specified command to return the value of
- sim_command(*args: Any, task_callback: Callable, command_name: str, **kwargs: Any) tuple[TaskStatus, str][source]
Submit simulated command operation method to task executor queue. Along with the submitted _sim_command thread, provides the ability to modify LRC behaviour asynchronously to the device, thus approaching a truer, more tunable simulation of LRCs.
- Parameters:
task_callback (
Callable) – Callback function to update task statuscommand_name (
str) – name of the command to be simulated
- Returns:
A tuple containing a return code and a string message indicating status. The message is for information purpose only.
- Return type:
tuple[TaskStatus, str]
- start_communicating(*args, **kwargs) None[source]
Simulate basic start_communicating behaviour. Updates communication state and power state.
SimModeObsCMBase Class
- class ska_mid_cbf_fhs_common.testing.simulation.SimModeObsCMBase(*args: Any, **kwargs: Any)[source]
Bases:
SimModeCMBaseA base class for FHS observing device simulation mode component managers.
Initialize default obs device attribute and command overrides.
- abort_commands(task_callback: TaskCallbackType | None = None) tuple[TaskStatus, str][source]
Abort all tasks queued & running.
- Parameters:
task_callback (
TaskCallbackType | None, optional) – callback to be called whenever the statusNone. (of the task changes. Default is)
FhsSimMode Class
- class ska_mid_cbf_fhs_common.testing.simulation.FhsSimMode(self: tango._tango.Device_6Impl, klass: tango._tango.DeviceClass, name: str, description: str = 'A Tango device', state: tango._tango.DevState = <DevState.UNKNOWN: 13>, status: str = 'Not initialised')[source]
Bases:
DeviceA base simulation mode mixin class for Mid.CBF FHS devices.
Adds the simOverrides attribute which allows for overriding device behaviour when in simulation mode when used alongside SimModeCMBase-derived component managers.
- TangoClassClass
alias of
FhsSimModeClass
- TangoClassName = 'FhsSimMode'
- simOverrides
Attribute value overrides (JSON dict)
FhsObsSimMode Class
- class ska_mid_cbf_fhs_common.testing.simulation.FhsObsSimMode(self: tango._tango.Device_6Impl, klass: tango._tango.DeviceClass, name: str, description: str = 'A Tango device', state: tango._tango.DevState = <DevState.UNKNOWN: 13>, status: str = 'Not initialised')[source]
Bases:
FhsSimModeA base simulation mode mixin class for Mid.CBF FHS observing devices.
- TangoClassClass
alias of
FhsObsSimModeClass
- TangoClassName = 'FhsObsSimMode'
- simOverrides
Attribute value overrides (JSON dict)