Stephanie Allison LCLS IOC Meeting [email protected] 18, 2008, Jan 21, 2011
Beam Synchronous Acquisition for IOC Engineers
Definition/RequirementsCurrent Implementation (based on SLC BPM Acq)
Code - MikeZ, Debbie, Mods/Test - saa
Other Ways to Do BSAEVR IOC Setup Steps to Add BSA FunctionalityMatlab Interface – see Mike Zelazny
Stephanie Allison LCLS IOC Meeting [email protected] 18, 2008, Jan 21, 2011
Definition/RequirementsAcquire all beam-dependent scalars across multiple IOCs on the same pulse over multiple pulses of a certain kind (not just x-pulses-in-a-row) up to 120Hz.Acquire up to 2800 values per scalar in one acquisition request.Each value of the 2800 values can be an average of up to 1000 values.Each acquisition request can specify:
Beam code (defines project, 1 = LCLS) Machine conditions of interest – rate, TS, permits, etc Maximum severity which data is considered good
Provide constant 1HZ beam-synchronous data for channel archiver and displays (reduce network load without losing synchronicity).
Stephanie Allison LCLS IOC Meeting [email protected] 18, 2008, Jan 21, 2011
Current ImplementationThree Parts to BSA:
User request for an acquisition done by CA client.Data gathering done on the EVG and EVR IOCsWhen gathering is finished, access of prepared data waiting on IOCs done by CA clients, with checks for a good acquisition. Only the data gathering part is discussed in this talk.
Stephanie Allison LCLS IOC Meeting [email protected] 18, 2008, Jan 21, 2011
IOC Data Gathering
Data gathering part consists of the following actions:EDEF (acquisition definition) setup and start request done on the EVG IOC.360hz checking on the EVG IOC with user notification when finished.360hz requests (acquisition control) sent by the EVG IOC to all EVR IOCs via fast fiber optic link.Data checking, averaging, and array update per scalar record per request on the EVR IOCs.
For 120hz acquisition, data on EVR IOC must be available within 7.3 msec after beam or it will be lost. EDEF will finish with arrays that are not complete if this time budget cannot be met.For an acquisition at full beam rate (ie, 120hz), if data is acquired at a lower rate (ie, 10hz), the array will not be complete. Use rate-limit bits as-needed when setting up the EDEF.Implementation uses EPICS record processing.
EVR
IOC
EVG
PNET
IOC
BPM FEETriggers
Timing Crate
BPM Crate
Data
CA Client
EDEF Flags, Pattern, etc
EDEF Setup CA Client
BSA Data
Data Acquisition Across IOCs
…
EVR IOC1Acq #1
…
EVR IOC2Acq #1
…
Acq #20
…
Acq #20
… …
All arrays have 2800 values
…
…
Acq #1
…
Acq #20
…
EVG IOC
Scalar data – X, Y, TMIT, Phase, Amplitude, PMT, Position, Bunch Length
Pattern 1
nth element
of all arrays for acq #1 is
on the same pulse.
Scalar 1
…
Acq #1
…
Acq #20
…
Scalar n
…
Scalar 1
…
EVR Event Time Line – 4 Fiducials/120Hz Beam
F2 F1 F00 2.8 5.6
360Hz Fiducial
Time (msec)
B0
9.3F3
8.3
B3
Process Pn-3 pattern, advance pipeline
(n-3->n-2->n-1->n), and prepare BSA based
on the n records
120Hz BEAM
L3 L3 L0L3
1.0
BPM Records Ready
BPM BSA
Records Done
All B3 BSA
MUST be finished
before F0
Slower GADCs Ready
Slower GADC BSA Done
Stephanie Allison LCLS IOC Meeting [email protected] 18, 2008, Jan 21, 2011
Implementation – EVG IOC 360Hz TaskThe 360hz event task wakes up on interrupt from the PNET module. One of its many duties is to check for a match between the new pulse’s pattern and beam code and each active EDEFs. It keeps a count of the number of measurements and the number of values in the current average per EDEF. Masks are prepared:
Pattern matchAverage doneNew request (clear history) Bad data severity
A detail - pulse information is pipelined - the new pulse is actually for 3 pulses ahead.For the current pulse, for each EDEF that matches, if the average is done, the pattern (5 “modifier” 32bit integers) and pulse ID are stored in arrays for that EDEF that match the arrays provided by the EVR IOCs for scalar data.
Stephanie Allison LCLS IOC Meeting [email protected] 18, 2008, Jan 21, 2011
Implementation – EVG-to-EVR 360Hz Data Transfer
8-bit Event C
ode
8-bit MP
S D
ata(S
hared Data B
us)
8-bit Event B
uffer
8-bit Event C
ode
8-bit Event C
ode
8-bit MP
S D
ata(S
hared Data B
us)
8-bit Event B
uffer
8-bit Event C
ode
. . .. . .
EVG EVR
8-bit Event C
ode
8-bit MP
S D
ata(S
hared Data B
us)
8-bit Event B
uffer
8-bit Event C
ode
8-bit Event C
ode
8-bit Event C
odeTime (nsec)
8.4 16.8 25.2 33.6 42.0 50.4 58.8 65.28-bit E
vent Buffer
8-bit MP
S D
ata(S
hared Data B
us)
EDEF bit masks included in 360Hz data sent by EVG to EVR. EVR IOC caches the data on data interrupt. The EVR IOC 360Hz event task is activated on the next fiducial interrupt (event code 1) and it copies the data to the end of the pipeline and then moves up the
pipeline. The data are then available to BSA record processing done later in the same pulse.
EVR IOC BSA Record Processing (TORO example)SCAN=IO Intr, PRIO=HIGH
TORO EFTMITao Record
Checks timestamps,averages good values,
finds RMS, counts # good values
in the average,
TORO TMIT ai Record
LCLS Time
Stamps
FLNK
FLNK
TMIT1 bsa Record:Provides data for compress records,resets compress
records,updates diagnostics
TMIT1HSTcompress Record
VAL, SEVR/STAT, TIME via DOL
FLNK
VAL, TIME, RES
FLNK
TMITCNT1HSTcompress Record
TMITRMS1HSTcompress Record
CNT, TIME,RES
RMS, TIME, RES
Arrays used by BSA CA client:
EDEF Masks,Time
Stamps360Hz Data
BSAData
scanIoRequest
SCAN=IO Intr, PRIO=HIGH
.
.
.TMIT2 to TMITF2
20 sets of records total
Implementation – EVG IOC – Global Event Display
Implementation – EVG IOC – All EDEF Diag DisplayPut new app name in
reserve record – edefReserve sequence
will assign next available EDEF number
“STEAL 1H” app is using EDEF 10 until freed by the app –
“STEAL 1H” can do multiple acqs
System EDEFs are reserved and setup
at EVG IOC boot and never freed.
15 user-defined requests at one time,
is this enough? Issue – apps that
crash before freeing.
Implementation – EVG IOC – EDEF Diag Display
Beam code describes project, 1 = LCLS (0=any beam code – good for testing)
Turn “ON” when ready. EVG IOC 360Hz event task will turn “OFF” when finished. Turn
back “ON” to flush and restart the acq.
Define # in each average, # measurements, severity at or above which data is not included in average. Forever
option used by system EDEFs.
Set machine conditions – values acquired only on
pulses where ALL inclusion conditions are true AND NO exclusion condition is true
Push “Release EDEF” to free this EDEF number. Name and user will be blanked out.
Push “Reset Data” to blank out all BSA data arrays.
Implementation – EVG IOC – EDEF Mask Diag Display
Choose conditions that define the pulses of interest. Only pulses with these conditions will provide values to the acquisition. The edefMask sequence on the EVG IOC creates the masks used by the 360Hz event task.
Condition (bit) names same as the SLC Database (PNBN) and ordered alphabetically in new
records by the edefMask sequence.
EVR IOC BSA Record Processing – Event Device Display
EVR IOC BSA Record Proc – Event Device Diag Display
EVR IOC BSA Record Processing – BSA Diag Display
Copied from EDEF diag
display
RMS zero when # avg is 1
Last 100 values of value
Stephanie Allison LCLS IOC Meeting [email protected] 18, 2008, Jan 21, 2011
Other Ways to Implement BSABuffer and stream all data and pattern to big relational database without losses like may happen with channel access. Clients acquire all data from all IOCs using CA with extra logic to watch for missing data when at higher rates (IOC CA server runs at low priority).In both cases, clients do their own pattern checking, timestamp validation, averaging, RMS, etc.
Stephanie Allison LCLS IOC Meeting [email protected] 18, 2008, Jan 21, 2011
EVR IOC Setup to Add BSA FunctionalitySet up the EVR and pattern databases using steps documented in LCLS Event System:
http://www.slac.stanford.edu/grp/lcls/controls/global/subsystems/timing/lclsEventHowTo.ppt README file from the event module.
Modify ai record providing data:Add FLNK to BSA ao record (ie, FLNK=<device>:EFTMIT)Set TSE to event code that triggers the acquisition. Currently not needed for 120hz records (3.14.8.2) but required for rate-limited records (and newer versions of base).Make sure lockset containing ai record is not too big. Use dblsr tool.If SCAN=I/O Intr or Event, set PRIO=HIGH. If SCAN=Passive, make sure any record that links to the ai record is running at high priority.If SCAN=Event, set EVNT to event code that you want to trigger the ai record. Note that all event codes come well before beam.
Stephanie Allison LCLS IOC Meeting [email protected] 18, 2008, Jan 21, 2011
EVR IOC Setup to add BSAAdd group of BSA Records per device:
Provide a substitutions file (i.e., IOC-IN20-BP01bsa.substitutions) with a line per device. Use one of the following databases from the event module.
bsaBPMSEdef.db – BPMsbsaTOROEdef.db – ToroidsbsaFARCEdef.db – Faraday CupsbsaBLENEdef.db – Bunch Length MonitorsbsaPMTEdef.db – Photo-Multiplier TubesbsaWIREEdef.db – Wire Scan PositionsbsaAMPLEdef.db – LLRF AmplitudesbsaPHASEdef.db – LLRF PhasesbsaATTREdef.db – Any device – this file has a lot of macros
Stephanie Allison LCLS IOC Meeting [email protected] 18, 2008, Jan 21, 2011
BSA Diagnostics DisplayRelated display buttons for each EDEF are provided from the per-device event device diagnostics page. Or add these buttons to your own displays somewhere. Each button can use one of the following displays in $EDM/event:
evnt_bsa_bpm.edl – BPMs (X,Y,TMIT)evnt_bsa_dev.edl – Toroids and other 1 scalar devices evnt_bsa_llrf.edl – LLRF (Phase and Amplitude)evnt_bsa_ws.edl – Wire Scanners (PMTs and position)
Stephanie Allison LCLS IOC Meeting [email protected] 18, 2008, Jan 21, 2011
Testing BSATest that the ai record is properly timestamped.
camonitor <ai record> <ioc>:PATTERN.L <ioc>:PATTERN.C
Reserve an EDEF and check the .NUSE of the resultant waveforms.In the lab where hardware and hardware triggers may not be available but there is a functioning EVG and fiber link to your EVR, test BSA with a simulated ai record by setting fields on the ai record:
SCAN=EventEVNT=<event code of interest>PRIO=HIGHRemember to set the VME IRQ of the event code of interest from the EVR display.
Stephanie Allison LCLS IOC Meeting [email protected] 18, 2008, Jan 21, 2011
Add BSA to ClientsLet High-Level-App group know when the device supports BSA. They can help you test that it’s working.Consider adding the “1H” (1Hz system EDEF) BSA PVs to channel archiver instead of your input PVs which update at a higher rate. All “1H” PVs in the archive will then be synchronous.Consider using the “1H” BSA PVs on higher level EDM displays remembering that these PVs freeze at the last good value when beam goes away. May want to add something to indicate beam-ness or color-code based on the severity of the higher-rate input PV.