Overview

Acronyms

TermDescription

AC

Alternate Current

ATCA

Advanced Telecommunications Computing Architecture

CPU

Central Processing Unit

EPICS

Experimental Physics and Industrial Control System

FPGA

Field Programmable Gate Array

IOC

Input Output Controller

LCLS

Linac Coherent Light Source

NC

Normal-Conducting

RF

Radio Frequency

SC

Super-Conducting

SHM

Shelf Manager

VMTG

VME-based Master Trigger Generator

Linac Locking System-Level Description

A high-level description of the linac locking system is captured in the page linked below:

Linac Locking - A System Level Overview

IOC & Firmware Description

The main objective of this project is to provide triggers to devices on the Super-Conducting (SC) line that are designed to operate on Normal-Conducting (NC) reference frequencies. 

The 2856MHz from Sector-10 is locked to the 2856MHz from Sector-2, but that doesn't necessarily hold true for their respective 476MHz signals.  To provide the triggers we want, we need to align the fiducials.  We need NC and SC timing to align at 71kHz so they can coordinate with the beam generation.  Two options: either design the VME-based Master Trigger Generator (VMTG) which drives the Fiducial Generator at 360Hz to trigger at 71kHz or slide the RF buckets until they align.  The LCLS VMTG samples the AC power line at the 71kHz subharmonic of its RF input and each 360Hz fiducial is coincident with 71kHz.  A TPR card processes both timing systems simultaneously and it measures the relative delay between the NC and SC 71kHz subharmonic.


(Diagram by Matt Weaver)


The idea is to trigger the SC timing system to follow the NC timing system.  The Timing Pattern Generator (TPG) card has 3 TTL inputs for external triggers.  The firmware has the capability to interpret those TTL signals for 1Hz, 60Hz or 360Hz or can also sample the power line to generate independent fiducials. 

IOC Deployment

In this section, we provide IOC deployment details such as the App hosting the Trigger Alignment IOC, as well as the IOC name and the assigned CPU in both Dev and Production. 

IOC Repository

The IOC is housed by the masterSource App.  The intended released tag in Production is R2.2.3.

IOC App NameApp Version
masterSourceR2.2.3

Deployment In Production

The configuration used in Production is seen below.

IOC NameCPU Name
sioc-sys0-ms12cpu-li20-ms01

Deployment In Dev

The configuration used in Dev is seen below.

IOC NameCPU Name (Intended)
sioc-b084-ms12cpu-b084-sp12

IOC Packages

List of required packages and associated versions.

Package NamePackage Version

cpsw/framework

R4.4.1

yaml-cpp

yaml-cpp-0.5.3_boost-1.64.0

boost

1.64.0

pcre

8.37

mrllrf/llrfLib

R1.1.0

timing/hpsTpr

R2.3.0

atca/commonATCA

R1.3.1

IOC Modules

List of required modules and associated versions.

Module NameModule Version

ATCACommon

R7.0.3.1-1.0

agilent53220A

R1.0.6

asyn

R4.39-1.0.1

autosave

R5.10-1.1.0

bkhAsyn

R0.4.6

caPutLog

R4.0-1.0.0

iocAdmin

R3.1.16-1.3.2

miscUtils

R2.2.5

modbus

R3.2-1.0.1

seq

R2.2.4-1.2

std

R3.2-1.0.5

streamdevice

R2.8.9-1.2.1

timingApi

R0.9

tprTrigger

R2.5.3-4.0-2

yamlLoader

R2.3.5

ycpswasyn

R3.3.6-1.0

IOC Bootup

In this section, a detailed description of the IOC bootup process is laid out.

Generic variable definition

First, define the usual environment variables in the startup script.

# ===========================================
#            ENVIRONMENT VARIABLES
# ===========================================
# Setup environment variables
epicsEnvSet("LOCATION","SYS0"         )   
epicsEnvSet("SYS_PV", "TPR:SYS0:MS12" )
epicsEnvSet("IOC_PV", "SIOC:SYS0:MS12")
epicsEnvSet("IOC",    "sioc-sys0-ms12")
epicsEnvSet("SUBSYS" ,"trigAlign"     )   
epicsEnvSet("SYS", "SYS0"             )   
epicsEnvSet("UNIT", "MS12"            )   

# Support Large Arrays/Waveforms; Number in Bytes
# The default max size for a channel access array is 16Kb
epicsEnvSet("EPICS_CA_MAX_ARRAY_BYTES", "80000000")

Common setup

Load dbd and IOC health/monitoring records.  Also, set up autosave and load the LCLS access configuration file.  Finally, copy the archive file in $IOC_DATA to enable record archiving.

## Load dbd
dbLoadDatabase("dbd/masterSource.dbd", 0, 0)
masterSource_registerRecordDeviceDriver(pdbbase)

## Environment variables
epicsEnvSet("ENGINEER", "MATT WEAVER")
epicsEnvSet("STREAM_PROTOCOL_PATH", "${TOP}/db")
## Tag log messages with IOC name
epicsEnvSet("EPICS_IOC_LOG_CLIENT_INET", "${IOC}")

## Load records
# **** Load iocAdmin databases to support IOC Health and monitoring ****
dbLoadRecords("db/iocAdminSoft.db", "IOC=${IOC_NAME}")
dbLoadRecords("db/iocAdminScanMon.db", "IOC=${IOC_NAME}")
dbLoadRecords("db/iocRelease.db", "IOC=${IOC_NAME}")

## Autosave initialization
< $(TOP)/iocBoot/common/autosave_init.cmd

## Channel Access Security:
# This is required if you use caPutLog.
# Set access security file
# Load common LCLS Access Configuration File
< ${ACF_INIT}

## Update archive pv list in ${IOC_DATA}
system("cp $(TOP)/archive/${IOC}.archive ${IOC_DATA}/${IOC}/archive/")

Autosave initialization

Tell the IOC where to find the list of record names and where they will be autosaved.  Also, restore previously autosaved values.

# =====================================================================
# Load database for autosave status
# =====================================================================
dbLoadRecords("db/save_restoreStatus.db", "P=${IOC_NAME}:")
                                                                                                                                                   
# ============================================================
# If all PVs don't connect continue anyway
# ============================================================
save_restoreSet_IncompleteSetsOk(1)

# ============================================================
# created save/restore backup files with date string
# useful for recovery.
# ============================================================
save_restoreSet_DatedBackupFiles(1)

# ============================================================
# Where to find the list of PVs to save
# ============================================================
set_requestfile_path("${IOC_DATA}/${IOC}/autosave-req")

# ============================================================
# Where to write the save files that will be used to restore
# ============================================================
set_savefile_path("${IOC_DATA}/${IOC}/autosave")

# ============================================================
# Prefix that is use to update save/restore status database
# records
# ============================================================
save_restoreSet_status_prefix("${IOC_NAME}:")

## Restore datasets
set_pass0_restoreFile("info_positions.sav")
set_pass1_restoreFile("info_positions.sav")

set_pass0_restoreFile("info_settings.sav")
set_pass1_restoreFile("info_settings.sav")


Besides the auto-generated record names for autosave, copy the manually generated list of records to be autosaved and restore their previously autosaved values.

# Copy over the manual settings request file
system("cp $(TOP)/autosave/${IOC}.req ${IOC_DATA}/${IOC}/autosave-req/")

# Load manual settings from autosave
set_pass0_restoreFile("${IOC}.sav")
set_pass1_restoreFile("${IOC}.sav")

Database loading

Load the relevant trigger alignment records.

# ===========================================
#               DB LOADING
# ===========================================
# Driver DB
dbLoadRecords("db/trigAlignAsynDriver.db", "DEVICE=${SYS_PV},PORT=trigAlignPort")

# Load database for autosave status
dbLoadRecords("db/save_restoreStatus.db", "P=${IOC_PV}:")

# Load sequence admin
dbLoadRecords("db/devSeqCar.db","SIOC=${IOC_PV}")

Asyn driver configuration

Initialize and configure the trigger alignment Asyn driver to interface with the FPGA registers.

# ===========================================
#              DRIVER SETUP
# ===========================================
trigAlignAsynDriverConfigure("trigAlignPort","/dev/tprb")

epicsThreadSleep(5.)

Archiver list

A complete list of the records to archive is provided below.

(base) skoufis@aird-b50-srv01  (master) $ cat archive/sioc-sys0-ms12.archive 
# archive_iocAdmin Archive template
# Format:
# <PVNAME> <PERIOD> [ monitor ]

# Archive these values only when they change
SIOC:SYS0:MS12:APP_DIR 30 monitor 
SIOC:SYS0:MS12:APP_DIR1 30 monitor 
SIOC:SYS0:MS12:APP_DIR2 30 monitor 
SIOC:SYS0:MS12:CA_CLNT_CNT 1 monitor 
SIOC:SYS0:MS12:CA_CONN_CNT 1 monitor 
SIOC:SYS0:MS12:EPICS_VERS 30 monitor
SIOC:SYS0:MS12:FD_CNT 1 monitor 
SIOC:SYS0:MS12:FD_FREE 1 monitor 
SIOC:SYS0:MS12:FD_MAX 1 monitor 
SIOC:SYS0:MS12:HOSTNAME 30 monitor
SIOC:SYS0:MS12:KERNEL_VERS 30 monitor
SIOC:SYS0:MS12:RECORD_CNT 10 monitor
SIOC:SYS0:MS12:START_CNT 30 monitor
SIOC:SYS0:MS12:STARTTOD 30 monitor
SIOC:SYS0:MS12:ST_SCRIPT 30 monitor 
SIOC:SYS0:MS12:ST_SCRIPT1 30 monitor 
SIOC:SYS0:MS12:ST_SCRIPT2 30 monitor 
SIOC:SYS0:MS12:SUSP_TASK_CNT 30 monitor 
SIOC:SYS0:MS12:SYSRESET 30 monitor 

# Archive these values at the specified rate
SIOC:SYS0:MS12:SYS_CPU_LOAD 10
SIOC:SYS0:MS12:LOAD 10 
SIOC:SYS0:MS12:MEM_BLK_FREE 10 
SIOC:SYS0:MS12:MEM_FREE 10 
SIOC:SYS0:MS12:MEM_USED 10 
SIOC:SYS0:MS12:UPTIME 3600 

IOC initialization

Initialize the IOC and logging capability.

# ===========================================
#               IOC INIT
# ===========================================
iocInit()

# ===========================================
#               CAPUTLOG
# ===========================================
# Turn on caPutLogging:
# Log values only on change to the iocLogServer:
caPutLogInit("${EPICS_CA_PUT_LOG_ADDR}")
caPutLogShow(2)

Autosave start

Start the autosave process. 

# ===========================================
#               AUTOSAVE
# ===========================================
# Autosave start
< $(TOP)/iocBoot/common/autosave_start.cmd

EPICS Records

A complete list of the Trigger Alignment IOC Process Variables (PVs) --along with their revision dates, following feedback from the naming team-- can be found in the page linked below.

Linac Locking - Trigger Alignment IOC PVs [sioc-sys0-ms12]

Displays

There are no displays for this IOC.

Deliverables

The released software will be made available in the main IOC release area post-deployment (Dev: /afs/slac/g/lcls/epics/iocTop/masterSource/, Production:/usr/local/lcls/epics/iocTop/masterSource/).  See below for the specific repositories and tags.

Software Release

See software release details below.

RepositoryVersionIOC Name
masterSourceR2.2.3sioc-sys0-ms07, sioc-b084-ms07 (11.5MHz)
masterSourceR2.2.3sioc-sys0-ms08, sioc-b084-ms08 (476MHz)

Firmware Release

See firmware release details below.

RepositoryURLVersion
slaclab / EvrLockhttps://github.com/slaclab/evr-card-g2/releases/tag/v2.2.0v2.2.0

References 

  • No labels