Smurf Timing Card Agent

The Smurf Timing Card Agent monitors several diagnostic EPICS registers from SLAC’s timing software.

usage: python3 agent.py [-h] [--timeout TIMEOUT] [--sleep-time SLEEP_TIME]
                        [--use-monitor]

Agent Options

--timeout

Timeout for epics caget calls

Default: 3.0

--sleep-time

Time to sleep between loop iterations

Default: 30.0

--use-monitor

Use the epics monitored value. If False, will re-poll for every get call.

Default: False

Configuration File Examples

Below are configuration examples for the ocs config file and for the docker-compose service.

OCS Site Config

Below is an example of an agent configuration block for the ocs-site-config file:

{'agent-class': 'SmurfTimingCardAgent',
 'instance-id': 'smurf-timing-card',
 'arguments': [
    '--timeout', 3,
    '--sleep-time', 30,
    # '--use-monitor',
 ]},

Note the --use-monitor argument is commented out because this should be False by default.

Docker Compose

Below is an example of the docker-compose service for the timing card agent:

ocs-smurf-timing-card:
    image: simonsobs/socs:latest
    <<: *log-options
    network_mode: host
    hostname: ocs-docker
    container_name: ocs-smurf-timing-card
    volumes:
        - ${OCS_CONFIG_DIR}:/config
    environment:
        - EPICS_CA_ADDR_LIST=127.255.255.255
        - EPICS_CA_MAX_ARRAY_BYTES=80000000
        - INSTANCE_ID=smurf-timing-card

Description

This agent uses EPICS to monitor several diagnostic registers of the SMuRF timing card software. More detail on the TPG PVs can be found here if you have access to the SLAC confluence.

Descriptions for the PVs monitored here (pulled directly from the SLAC confluence page) are:

PV

Description

TPG:SMRF:1:COUNTPLL

PLL Change Counter

TPG:SMRF:1:COUNT186M

186 MHz counter

TPG:SMRF:1:COUNTSYNCERR

Sync Error Counter

TPG:SMRF:1:COUNTINTV

Interval Counter

TPG:SMRF:1:COUNTBRT

Base Rate Trigger Counter

TPG:SMRF:1:COUNTTXCLK

Tx Clock Counter

TPG:SMRF:1:DELTATXCLK

Delta Tx Clock

TPG:SMRF:1:RATETXCLK

TX Clock Rate

Agent API

class socs.agents.smurf_timing_card.agent.SmurfTimingCardAgent(agent, args)[source]

Agent to monitor diagnostic variables for the SMuRF Timing Card.

run()[source]

Process – Main loop for the timing card. This queries diagnostic PVs and publishes data.

Notes

An example of the session data:

>>> response.session['data']
   {'COUNT186M': 1671196546,
    'COUNTBRT': 480000,
    'COUNTINTV': 122879999,
    'COUNTPLL': 1,
    'COUNTSYNCERR': 4,
    'COUNTTXCLK': 1461994265,
    'DELTATXCLK': 15416942,
    'RATETXCLK': 123.33553599999999,
    'timestamp': 1678983237.832111}