Prime-Cam ACU Controller Interface

ACU-interface agent lives within the PCS-DAQ system and communicates with OCS-TCS-ACU components of the telescope. The primary objective of the agent is to capture the 200Hz UDP position data stream from ACU and writing into PCS HK files. The agent also executes ACU commands via http requests and performs various types of scans. In addition, it has the ability to store 1Hz InfluxDB data stream and telescope/scan summary and status for live monitoring purposes.

usage: python3 agent.py [-h] [--acu-config ACU_CONFIG] [--no-processes]
                        [--device DEVICE]

Agent Options

--acu-config

Default: “/work/pcam_ocs/ocs/agents/acu_interface/acu_config.yaml”

--no-processes

Default: False

--device

Default: “acu-sim”

Dependencies

Todo

Add installation of soaculib library and any additional dependencies

Configuration File Examples

Below are configuration examples for the ocs config file and for running the Agent in a docker container.

OCS Site Config

To configure the ACU Agent we need to add a block to the ocs configuration file. An example configuration block using all availabile arguments is below:

{'agent-class': 'ACUAgent',
      'instance-id': 'acu',
      'arguments': [['--acu-config', 'acu_config.yaml'],
                       ['--device', 'acu-sim']]}

Docker Compose

We also require a configuration in the docker compose file for the agent, an example configuration of the agent is shown below:

ocs-acu:
  image: "acu-interface-agent"
  build: /path/to/agent/dockerfile/directory/
  hostname: ccat-docker
  environment:
    - INSTANCE_ID=acu
    - LOGLEVEL=info
    - SITE_HUB=ws://127.0.0.1:8001/ws
    - SITE_HTTP=http://127.0.0.1:8001/call
  volumes:
    - ${OCS_CONFIG_DIR}:/config:ro
    - /path/to/workspace/with/acu-config/file/:/work:ro
    - /path/to/certificate/directory/:/tls:ro
  network_mode: "host"

ACU Configuration

Additionally, we need a configuration file for the ACU interface settings. An example block configuration is shown below:

devices:
   # ACU simulator
   'acu-sim':
     #Address of the "remote" interface
     'base_url': 'https://127.0.0.1:5600'
     #Local interface IP addr
     'interface_ip': "172.17.0.1"

     # Sleep time to wait for motion to end.
     'motion_waittime': 1.0
     # List of streams to configure.
     'streams':
       'main':
         'acu_name': 'PositionBroadcast'
         'port': 5601
         'schema': 'v0'
     # Certificates
     'certs':
       'server_cert': '/tls/server.cert.pem'
       'client_cert': '/tls/client.cert.pem'
       'client_key': '/tls/client.key.pem'
       'verify': False
stream_schemas:
 v0:
   format: '<Lddddddddddd'
   fields: ['Day', 'Time', 'Azimuth', 'Elevation', 'AzEncoder',
           'ElEncoder', 'AzCurrent1', 'AzCurrent2', 'AzCurrent3',
           'AzCurrent4', 'ElCurrent1', 'ElCurrent2']

datasets:
 ccat:
   'default_dataset': 'ccat'
   'datasets':
     - ['ccat',       'DataSets.StatusCCatDetailed8100']
     - ['general',    'DataSets.StatusGeneral8100']
     - ['extra',      'DataSets.StatusExtra8100']
     - ['third',      'DataSets.Status3rdAxis']
     - ['faults',     'DataSets.StatusDetailedFaults']
     - ['pointing',   'DataSets.CmdPointingCorrection']
     - ['spem',       'DataSets.CmdSPEMParameter']
     - ['weather',    'DataSets.CmdWeatherStation']
     - ['azimuth',    'Antenna.SkyAxes.Azimuth']
     - ['elevation',  'Antenna.SkyAxes.Elevation']

Description

Antenna Control Unit (ACU) is a specialized computer responsible for moving the telescope platform and capturing the readout of encoder measurements. This system lives within the centrally managed CCAT Telescope Control System (TCS). Within the Prime-Cam DAQ framework, an interface agent commuincates with the ACU to execute telescope movement for observation scans and writes the position data stream into G3 files in the PCS HK database.

Agent API

# Autoclass the Agent from docstrings

class pcs.agents.acu_interface.agent.ACUAgent(agent, config, device='acu_sim', startup=False)[source]

Interface agent to send pointing commands to ACU and acquire UDP data streams.

Parameters:
  • config (str) – The configuration file for the ACU containing settings parameters.

  • device (str) – Name of the ACU device, default is ‘acu_sim’ for ACU simulator.

  • startup (bool) – If True, immediately start the main monitoring processes for status and UDP data.

broadcast(auto_enable=True)[source]

Process - Read UDP data from the port specified by self.acu_config, decode it, and publish to HK feeds. Full resolution (200 Hz) data are written to feed “acu_udp_stream” while 1 Hz decimated are written to “acu_broadcast_influx”. The 1 Hz decimated output are also stored in session.data.

Parameters:

auto_enable (bool) – If True, the Process will try to configure and (re-)enable the UDP stream if at any point the stream seems to drop out.

go_to(az, el)[source]

Task - Move the telescope to a particular point (azimuth, elevation) in Preset mode. When motion has ended and the telescope reaches the preset point, it returns to Stop mode and ends.

Parameters:
  • az (float) – destination angle for the azimuth axis

  • el (float) – destination angle for the elevation axis

az_scan()[source]

az_scan(start_time, turnaround_time, elevation, speed, num_scans, azimuth_range)

Task - Send telescope on an azimuth scan at a constant elevation. It can be executed at a future time with set speed and number of scan cycles.

Parameters:
  • scan_params (dict) – Azimuth scan parameters with the following fields in the dictionary:

  • {start_time (float) –

    time in future to begin scan,

    in format %Y-%m-%dT%H:%M:%SZ

    turnaround_time (float): time to change scan direction in seconds elevation (float): elevation of telescope in deg speed (float): speed of scan in degrees/second num_scans (int): numbers of cycles of the azimuth scan azimuth_range (list): list with 2 floats containing range of azimuth }

fromfile_scan(scan_filename)[source]
Task - Send scan commands for a predefined arbitrary path which

consists of sequence of points stored in a text file. Currently, scan points in only ‘Horizon’ coordinate system is implemented.

Parameters:

scan_filename (str) – path of the file containing pair of az,el points in each line that the scan patter will go through.

Agent Setup Guide

Todo

Add installation and setup guide on how to launch the TCS-ACU system and run example scan and readout capture.