MockMTDomeController#

class lsst.ts.mtdomecom.MockMTDomeController(port, log, connect_callback=None, communication_error=False, timeout_error=False, keep_running=False)#

Bases: OneClientReadLoopServer

Mock MTDome Controller that talks over TCP/IP.

Parameters:
  • port (int) – TCP/IP port

  • log (logging.Logger) – The logger to use.

  • connect_callback (callable, optional) – The callback to use when a client connects.

  • communication_error (bool, optional) – Is there a communication error with the rotating part (True) or not (False)? This is for unit tests only. The default is False.

  • timeout_error (bool, optional) – Do command replies timeout of not? The default is False.

  • keep_running (bool, optional) – Make the server run forever? This is for unit tests only. The default is False.

Notes

There are six sub-systems that are under control:

  • AMCS: Azimuth Motion Control System

  • ApSCS: Aperture Shutter Control System

  • LCS: Louvers Control System

  • LWSCS: Light and Wind Screen Control System

  • MonCS: Monitoring Control System, which interfaces with the MTDome

    Interlock System

  • ThCS: Thermal Control System, which interfaces with the MTDome

    Environment Control System

To start the server:

ctrl = MockMTDomeController(…) await ctrl.start()

To stop the server:

await ctrl.stop()

Known Limitations:

  • Just a framework that needs to be implemented properly.

Attributes Summary

Methods Summary

close_louvers()

Close all louvers.

close_shutter()

Close the shutter.

config(system, settings)

Configure the lower level components.

crawl_az(velocity)

Crawl the dome.

crawl_el(velocity)

Crawl the light and windscreen.

determine_current_tai()

Determine the current TAI time.

exit_fault_az()

Exit AMCS from fault state.

exit_fault_el()

Exit LWSCS from fault state.

exit_fault_louvers()

Exit LCS from fault state.

exit_fault_shutter()

Exit ApSCS from fault state.

exit_fault_thermal()

Exit ThCS from fault state.

fans(speed)

Enable or disable the fans in the dome.

go_stationary_az()

Stop azimuth motion and engage the brakes.

go_stationary_el()

Stop elevation motion and engage the brakes.

go_stationary_louvers()

Stop louvers motion and engage the brakes.

go_stationary_shutter()

Stop shutter motion and engage the brakes.

home(direction)

Home the Aperture Shutter, which is the closed position.

inflate(action)

Inflate or deflate the inflatable seal.

move_az(position, velocity)

Move the dome.

move_el(position)

Move the light and windscreen.

open_shutter()

Open the shutter.

park()

Park the dome.

read_and_dispatch()

Read, parse, and dispatch one item of data.

request_and_send_status(llc, llc_name)

Request the status of the given Lower Level Component and write it to the requester.

reset_drives_az(reset)

Reset one or more AZ drives.

reset_drives_louvers(reset)

Reset one or more Louver drives.

reset_drives_shutter(reset)

Reset one or more Aperture Shutter drives.

restore()

Restore the default configuration of the lower level components.

set_degraded_az()

Set az operational mode to degraded (as opposed to normal).

set_degraded_el()

Set el operational mode to degraded (as opposed to normal).

set_degraded_louvers()

Set louvers operational mode to degraded (as opposed to normal).

set_degraded_monitoring()

Set monitoring operational mode to degraded (as opposed to normal).

set_degraded_shutter()

Set shutter operational mode to degraded (as opposed to normal).

set_degraded_thermal()

Set thermal operational mode to degraded (as opposed to normal).

set_louvers(position)

Set the positions of the louvers.

set_normal_az()

Set az operational mode to normal (as opposed to degraded).

set_normal_el()

Set el operational mode to normal (as opposed to degraded).

set_normal_louvers()

Set louvers operational mode to normal (as opposed to degraded).

set_normal_monitoring()

Set monitoring operational mode to normal (as opposed to degraded).

set_normal_shutter()

Set shutter operational mode to normal (as opposed to degraded).

set_normal_thermal()

Set thermal operational mode to normal (as opposed to degraded).

set_temperature(temperature)

Set the preferred temperature in the dome.

set_zero_az()

Take the current position of the dome as zero.

start(**kwargs)

Start the TCP/IP server.

start_or_stop_thcs_if_necessary()

status_amcs()

Request the status from the AMCS lower level component and write it in reply.

status_apscs()

Request the status from the ApSCS lower level component and write it in reply.

status_cbcs()

Request the status from the CBCS lower level component and write it in reply.

status_cscs()

Request the status from the Calibration Screen and write it in reply.

status_lcs()

Request the status from the LCS lower level component and write it in reply.

status_llc()

Request the status from the LLC system and write it in reply.

status_lwscs()

Request the status from the LWSCS lower level component and write it in reply.

status_moncs()

Request the status from the MonCS lower level component and write it in reply.

status_rad()

Request the status from the RAD lower level component and write it in reply.

status_thcs()

Request the status from the ThCS lower level component and write it in reply.

stop_az()

Stop all dome motion.

stop_el()

Stop all light and windscreen motion.

stop_louvers()

Stop the motion of all louvers.

stop_shutter()

Stop the motion of the shutter.

write_reply(**data)

Write the data appended with the commandId.

Attributes Documentation

LONG_DURATION = 20#
SLOW_NETWORK_SLEEP = 10.0#

Methods Documentation

async close_louvers()#

Close all louvers.

Return type:

None

async close_shutter()#

Close the shutter.

Returns:

The estimated duration of the execution of the command.

Return type:

float

async config(system, settings)#

Configure the lower level components.

Parameters:
  • system (str) – The name of the system to configure.

  • settings (dict) –

    An array containing a single dict with key,value pairs for all the parameters that need to be configured. The structure is:

    [
        {
          "Parameter1_name": Value,
          "Parameter2_name": Value,
          ...
        }
      ]
    

    It is assumed that the values of the configuration parameters are validated to lie within the limits before being passed on to this function. It is assumed that all configuration parameters are present and that their values represent the value to set even unchanged.

Return type:

None

async crawl_az(velocity)#

Crawl the dome.

Parameters:

velocity (float) – The velocity, in rad/sec, to crawl at.

Returns:

The estimated duration of the execution of the command.

Return type:

float

async crawl_el(velocity)#

Crawl the light and windscreen.

Parameters:

velocity (float) – The velocity, in rad/sec, to crawl at.

Returns:

The estimated duration of the execution of the command.

Return type:

float

async determine_current_tai()#

Determine the current TAI time.

This is done in a separate method so a mock method can replace it in unit tests.

Return type:

None

async exit_fault_az()#

Exit AMCS from fault state.

Return type:

None

async exit_fault_el()#

Exit LWSCS from fault state.

Return type:

None

async exit_fault_louvers()#

Exit LCS from fault state.

Return type:

None

async exit_fault_shutter()#

Exit ApSCS from fault state.

Return type:

None

async exit_fault_thermal()#

Exit ThCS from fault state.

Return type:

None

async fans(speed)#

Enable or disable the fans in the dome.

Parameters:

speed (float) – The speed of the fans [%].

Return type:

None

async go_stationary_az()#

Stop azimuth motion and engage the brakes. Also disengage the locking pins if engaged.

Returns:

The estimated duration of the execution of the command.

Return type:

float

async go_stationary_el()#

Stop elevation motion and engage the brakes. Also disengage the locking pins if engaged.

Returns:

The estimated duration of the execution of the command.

Return type:

float

async go_stationary_louvers()#

Stop louvers motion and engage the brakes.

Return type:

None

async go_stationary_shutter()#

Stop shutter motion and engage the brakes.

Returns:

The estimated duration of the execution of the command.

Return type:

float

async home(direction)#

Home the Aperture Shutter, which is the closed position.

This is necessary in case the ApSCS (Aperture Shutter Control System) was shutdown with the Aperture Shutter not fully open or fully closed.

Parameters:

direction (OpenClose) – The direction to home the aperture shutter to.

Returns:

The estimated duration of the execution of the command.

Return type:

float

async inflate(action)#

Inflate or deflate the inflatable seal.

Parameters:

action (str) – ON means inflate and OFF deflate the inflatable seal.

Return type:

None

async move_az(position, velocity)#

Move the dome.

Parameters:
  • position (float) – Desired azimuth, in radians, in range [0, 2 pi)

  • velocity (float) – The velocity, in rad/sec, to start crawling at once the position has been reached.

Returns:

The estimated duration of the execution of the command.

Return type:

float

async move_el(position)#

Move the light and windscreen.

Parameters:

position (float) – Desired elevation, in radians, in range [0, pi/2)

Returns:

duration – The estimated duration of the execution of the command.

Return type:

float

async open_shutter()#

Open the shutter.

Returns:

The estimated duration of the execution of the command.

Return type:

float

async park()#

Park the dome.

Returns:

The estimated duration of the execution of the command.

Return type:

float

async read_and_dispatch()#

Read, parse, and dispatch one item of data.

Subclasses need to implement this method such that it reads and parses data and then dispatches handling the data to a method suitable for the subclass. Methods that might be helpful include: :rtype: None

  • read_json to read json-encoded data

  • read_str to read terminated strings

  • read_into to read binary structs

async request_and_send_status(llc, llc_name)#

Request the status of the given Lower Level Component and write it to the requester.

Parameters:
  • llc (BaseMockStatus) – The Lower Level Component status to request the status from.

  • llc_name (str) – The name of the Lower Level Component.

Return type:

None

async reset_drives_az(reset)#

Reset one or more AZ drives.

Parameters:

reset (list`[`int]) – Desired reset action to execute on each AZ drive: 0 means don’t reset, 1 means reset.

Returns:

The estimated duration of the execution of the command.

Return type:

float

Notes

This is necessary when exiting from FAULT state without going to Degraded Mode since the drives don’t reset themselves. The number of values in the reset parameter is not validated.

async reset_drives_louvers(reset)#

Reset one or more Louver drives.

Parameters:

reset (list`[`int]) – Desired reset action to execute on each Louver drive: 0 means don’t reset, 1 means reset.

Return type:

None

Notes

This is necessary when exiting from FAULT state without going to Degraded Mode since the drives don’t reset themselves. The number of values in the reset parameter is not validated.

async reset_drives_shutter(reset)#

Reset one or more Aperture Shutter drives.

Parameters:

reset (list`[`int]) – Desired reset action to execute on each Aperture Shutter drive: 0 means don’t reset, 1 means reset.

Return type:

None

Notes

This is necessary when exiting from FAULT state without going to Degraded Mode since the drives don’t reset themselves. The number of values in the reset parameter is not validated.

async restore()#

Restore the default configuration of the lower level components.

Return type:

None

async set_degraded_az()#

Set az operational mode to degraded (as opposed to normal).

Return type:

None

async set_degraded_el()#

Set el operational mode to degraded (as opposed to normal).

Return type:

None

async set_degraded_louvers()#

Set louvers operational mode to degraded (as opposed to normal).

Return type:

None

async set_degraded_monitoring()#

Set monitoring operational mode to degraded (as opposed to normal).

Return type:

None

async set_degraded_shutter()#

Set shutter operational mode to degraded (as opposed to normal).

Return type:

None

async set_degraded_thermal()#

Set thermal operational mode to degraded (as opposed to normal).

Return type:

None

async set_louvers(position)#

Set the positions of the louvers.

Parameters:

position (array of float) – An array of positions, in percentage with 0 meaning closed and 100 fully open, for each louver. A position of -1 means “do not move”.

Return type:

None

async set_normal_az()#

Set az operational mode to normal (as opposed to degraded).

Return type:

None

async set_normal_el()#

Set el operational mode to normal (as opposed to degraded).

Return type:

None

async set_normal_louvers()#

Set louvers operational mode to normal (as opposed to degraded).

Return type:

None

async set_normal_monitoring()#

Set monitoring operational mode to normal (as opposed to degraded).

Return type:

None

async set_normal_shutter()#

Set shutter operational mode to normal (as opposed to degraded).

Return type:

None

async set_normal_thermal()#

Set thermal operational mode to normal (as opposed to degraded).

Return type:

None

async set_temperature(temperature)#

Set the preferred temperature in the dome.

Parameters:

temperature (float) – The temperature, in degrees Celsius, to set.

Return type:

None

async set_zero_az()#

Take the current position of the dome as zero. This is necessary as long as the racks, pinions and encoders on the drives have not been installed yet to compensate for slippage of the drives.

Returns:

The estimated duration of the execution of the command.

Return type:

float

async start(**kwargs)#

Start the TCP/IP server.

Parameters:

**kwargs (dict [str, typing.Any]) – Additional keyword arguments for asyncio.start_server, beyond host and port.

Return type:

None

async start_or_stop_thcs_if_necessary()#
Return type:

None

async status_amcs()#

Request the status from the AMCS lower level component and write it in reply.

Return type:

None

async status_apscs()#

Request the status from the ApSCS lower level component and write it in reply.

Return type:

None

async status_cbcs()#

Request the status from the CBCS lower level component and write it in reply.

Return type:

None

async status_cscs()#

Request the status from the Calibration Screen and write it in reply.

Return type:

None

async status_lcs()#

Request the status from the LCS lower level component and write it in reply.

Return type:

None

async status_llc()#

Request the status from the LLC system and write it in reply.

Return type:

None

async status_lwscs()#

Request the status from the LWSCS lower level component and write it in reply.

Return type:

None

async status_moncs()#

Request the status from the MonCS lower level component and write it in reply.

Return type:

None

async status_rad()#

Request the status from the RAD lower level component and write it in reply.

Return type:

None

async status_thcs()#

Request the status from the ThCS lower level component and write it in reply.

Return type:

None

async stop_az()#

Stop all dome motion.

Returns:

The estimated duration of the execution of the command.

Return type:

float

async stop_el()#

Stop all light and windscreen motion.

Returns:

The estimated duration of the execution of the command.

Return type:

float

async stop_louvers()#

Stop the motion of all louvers.

Return type:

None

async stop_shutter()#

Stop the motion of the shutter.

Returns:

The estimated duration of the execution of the command.

Return type:

float

async write_reply(**data)#

Write the data appended with the commandId.

The non-negative, non-zero commandId is contained in the incoming data, for which this method writes a reply, and is copied as is.

Parameters:

data (Any) – The data to write.

Return type:

None