Title: NIFS DC Software CDR
1Detector Controller Software Design
2Overview and Changes Since CoDR
- EPICS database design completed - Capfast
diagrams - Refined DC software architecture
- Persisting with thin-layer EPICS model
- Control tasks now written in SNL
- Processing tasks written in C
- Interface between DC tasks and EPICS with C
class - NIFS image processing for quick-look display
- Data file format specified
- Processor acquired Synergy SGM5
3DC EPICS Databases - Capfast Diagrams
- Based on CICS and GMOS DC designs
- Hierarchy of APPLY records
- Lower level APPLY attached to groups of CADs
with similar function - System reboot, init, test, park, and debug
- SDSU setup setupSDSU, initSDSU,
idleSDSU, rdmSDSU, and wrmSDSU - Observe sequence setup seqIdle and seqRun
- Data processing setup dataIdle, setDhsInfo, and
dataRun - Observe observe, abort, and stop
- No operation verify, endVerify, guide,
endGuide, endObserve, pause, continue, and
datum - Matching CAR records for each CAD
4DC EPICS Databases - Capfast Diagrams
- CADs that result in an action being performed
use the CADPLUS record for incrementing a start
counter - Start counter monitored by SNL for command
activation - Action commands are
- System reboot, init, test, and park
- SDSU initSDSU, idleSDSU, rdmSDSU, and wrmSDSU
- Observe observe, abort, and stop
- Simple CAD SNAM routines
- Set CAD parameters using calls to C set
methods - START directives trigger CAD START links
- SAD based on CICS
- Grouped SIR records with similar function
- Currently 63 SIRs
5Detector Controller Architecture
- Control
- Transfers commands
- Handles CAR records
- Starts Slave and Data
- Instantiates parameter and status objects
- Monitors status
- Slave
- Instantiates SDSU
- Starts Readout
- Monitors observation
- Readout
- Performs readout
- Processes data
- Data
- Interfaces with DHS
- Transfers data
6Detector Controller Design Approach
- Thin-layer EPICS design
- SNL to monitor EPICS DB
- C class objects for parameters and status
- C class object for EPICS database access
7Detector Controller Design Approach
- Thin-layer EPICS design
- SNL to monitor EPICS DB
- C class objects for parameters and status
- C class object for EPICS database access
- RSAA C Camera Class
- Use in both NIFS and CICADA
- Interface with EPICS hidden in C classes
8Thin-layer EPICS Design
9Thin-layer EPICS Design Parameter Class
- hash dictionary of parameters with attributes
- parameter string (unique key)
- attributes string name,
- short dataType,
- Validity vType,
- string dbName,
- void dbAddr,
- T value,
- int nValid,
- T valid
10Thin-layer EPICS Design Parameter Class
- hash dictionary of parameters with attributes
- parameter string (unique key)
- attributes string name,
- short dataType,
- Validity vType,
- string dbName,
- void dbAddr,
- T value,
- int nValid,
- T valid
- database access class
- EPICS variant - uses dbNameToAddr
- CICADA variant uses simple address offset
11Thin-layer EPICS Design Parameter Class Use
- Instantiating the class
- dcStatus new Parameter(epicsDB)
12Thin-layer EPICS Design Parameter Class Use
- Instantiating the class
- dcStatus new Parameter(epicsDB)
- Adding a parameter
- dcStatus-gtadd(name, dbName, dbAddr,
defValue vType, nValid, valid) - Hash entry, then calls set method for defValue
13Thin-layer EPICS Design Parameter Class Use
- Instantiating the class
- dcStatus new Parameter(epicsDB)
- Adding a parameter
- dcStatus-gtadd(name, dbName, dbAddr,
defValue vType, nValid, valid) - Hash entry, then calls set method for defValue
- Setting a parameters value
- dcStatus -gtset(name , value)
- Hash lookup, validity checking then database put
14Thin-layer EPICS Design Parameter Class Use
- Instantiating the class
- dcStatus new Parameter(epicsDB)
- Adding a parameter
- dcStatus-gtadd(name, dbName, dbAddr,
defValue vType, nValid, valid) - Hash entry, then calls set method for defValue
- Setting a parameters value
- dcStatus -gtset(name , value)
- Hash lookup, validity checking then database put
- Getting a parameters value
- value dcStatus -gtget(name)
- Hash lookup then database get
15Thin-layer EPICS Design Advantages of Parameter
Class
- No NIFS context, therefore could be reused
- Access to EPICS database hidden in access class
- Access to EPICS contained in small specific code
segment - Simplicity build once and then forget
16RSAA C Camera Class
- Camera - common camera operations
- SDSU - common SDSU operations
- SDSU_IR - SDSU infra red operations
- NIFS - specific NIFS operations
- Simulation - simulate different camera types
17Inter-Process Communication
- SNL
- Monitors START directive of CADs
- Updates CAR and SAD records
- Starts/Stops VxWorks tasks
- Slave Message Queue
- Commands from SNL to Slave task
- ISR Message Queue
- Messages from SDSU ISR with readout progress
and command responses - DataBuffer Semaphore
- Controls read/write access to pixel databuffer
18Detector Controller - Implementation Detail
Control Tasks dc_ss
- Startup
- Starts when IOC boots
- Starts an initialization sequence
- Initializing
- Received Init sequence
- Starts Slave and Data tasks
- Running
- Monitors INIT and REBOOT CADs
- Increments heartbeat counter
- Resetting
- Resets running system in response toINIT command
19Detector Controller - Implementation Detail
Control Tasks obs_ss
- Manages states associated with an observation
- Obs Init
- Starts when IOC boots
- Initializes observing SAD records
- Idle
- Monitors OBSERVE CAD, sets SAD and CARrecords
- Acq
- Monitors STOP and ABORT CADs while
inacquisition mode, sets SAD and CAR records - Acq/Rdout
- Monitors STOP and ABORT CADs while reading out,
sets SAD and CAR records
20Detector Controller - Implementation Detail
Control Tasks SDSU_ss
- Manages initialization, testing and parkingof
SDSU controller electronics - SDSU Init
- Starts when IOC boots
- Initializes SDSU SAD records
- Idle
- Monitors TEST, PARK and SETUPCads, sets SAD and
CAR records - Test,Park,Setup
- Handles ABORT and done states
21Detector Controller - Implementation Detail
Slave Task
- Initializing
- Received Init sequence
- Instantiates Camera object
- Runs SDSU2-IR initialization
- Ready
- Awaits messages from Control
- Configuring
- Performs Configure sequence
- Preparing
- Received Observe sequence
- Starts Readout task
- Monitoring
- Monitors exposure
- Handles Abort and completion
22Detector Controller - Implementation Detail
Readout Task
- Initializing
- Starts SDSU-2 exposure
- Organizes buffer space
- Integrating
- Awaits messages from ISR
- Processing
- Readout mode processing
- Unravels data
- NIFS image processing
- Passes semaphore to Data
- Cleanup
- Cleans up after exposure and exits
23Detector Controller - Implementation Detail
Data Task
- Initializing
- Connects to DHS
- Ready
- Awaits semaphore from Readout
- Preparing
- Sets up DHS data structures
- Releases semaphore
- Transferring
- Transfers data to DHS
24Detector Controller - Implementation Detail Image
Processing
- Pixel unraveling
- Readout methods linear fitting, Fowler
sampling, and double-correlated sampling - Saturated pixel detection (for linear fitting
method) - Cosmic ray detection (for linear fitting method)
- Linearity correction
- Quick look display spatial image formation
- for object acquisition (flip mirror in)
- for dispersed spectrum (grating)
25Passage of the Observe Command
- OCS sets up all observing parameters
- OCS marks OBSERVE CAD then issues START
directive to DC via IS - Parameters verified, command accepted
26Passage of the Observe Command
- OCS sets up all observing parameters
- OCS marks OBSERVE CAD then issues START
directive to DC via IS - Parameters verified, command accepted
- SNL code detects START counter update, sets
observeC CAR BUSY - Observe command passed to Slave
27Passage of the Observe Command
- OCS sets up all observing parameters
- OCS marks OBSERVE CAD then issues START
directive to DC via IS - Parameters verified, command accepted
- SNL code detects START counter update, sets
observeC CAR BUSY - Observe command passed to Slave
- Slave starts Readout, which initiates SDSU
exposure
28Passage of the Observe Command
- OCS sets up all observing parameters
- OCS marks OBSERVE CAD then issues START
directive to DC via IS - Parameters verified, command accepted
- SNL code detects START counter update, sets
observeC CAR BUSY - Observe command passed to Slave
- Slave starts Readout, which initiates SDSU
exposure - SDSU DSP code triggers an ISR periodically as
each NDR progresses - ISR notifies Readout that data are ready
29Passage of the Observe Command
- OCS sets up all observing parameters
- OCS marks OBSERVE CAD then issues START
directive to DC via IS - Parameters verified, command accepted
- SNL code detects START counter update, sets
observeC CAR BUSY - Observe command passed to Slave
- Slave starts Readout, which initiates SDSU
exposure - SDSU DSP code triggers an ISR periodically as
each NDR progresses - ISR notifies Readout that data are ready
- Readout performs data processing required after
each NDR - Semaphore raised by Readout when data are ready
for transfer
30Passage of the Observe Command
- OCS sets up all observing parameters
- OCS marks OBSERVE CAD then issues START
directive to DC via IS - Parameters verified, command accepted
- SNL code detects START counter update, sets
observeC CAR BUSY - Observe command passed to Slave
- Slave starts Readout, which initiates SDSU
exposure - SDSU DSP code triggers an ISR periodically as
each NDR progresses - ISR notifies Readout that data are ready
- Readout performs data processing required after
each NDR - Semaphore raised by Readout when data are ready
for transfer - Data takes semaphore, moves data into DHS data
structures - Data releases semaphore, sends data to DHS and
quick look displays
31Passage of the Observe Command
- OCS sets up all observing parameters
- OCS marks OBSERVE CAD then issues START
directive to DC via IS - Parameters verified, command accepted
- SNL code detects START counter update, sets
observeC CAR BUSY - Observe command passed to Slave
- Slave starts Readout, which initiates SDSU
exposure - SDSU DSP code triggers an ISR periodically as
each NDR progresses - ISR notifies Readout that data are ready
- Readout performs data processing required after
each NDR - Semaphore raised by Readout when data are ready
for transfer - Data takes semaphore, moves data into DHS data
structures, - Data releases semaphore, sends data to DHS and
quick look displays - Steps 7 through 12 repeated until exposure
completes - Finally, full data sent to DHS for permanent
storage
32Detector Controller - Implementation Detail Data
File Format
- FITS files with 16 data extensions.
- For each detector quadrant
- spectral data 1k x 1k floating point pixels
- variance data 1k x 1k floating point pixels
- quality data 1k x 1k bytes
- reference data typically 1k x 32 floating
point pixels - 16.5 MB per file
33Processing Timeline for Linear Fitting Readout
- Minimum integrate read cycle is 5s
- Full image processing prototyped at 3.9s
- DHS transfer and quick look display at 2.8MB/s
gt 5.9s - Overlap processing with transfer use double
buffering - Drop NDR transfers if pipeline gets behind
34Detector Controller Performance Data Transfer
- Worst case requirement is 3.3MB/s
- DHS can run at least 2.8MB/s
- Quick-look display can run at 2MB/s
Unlikely to run as low as 5s period between NDRs
35Detector Controller - CPU
- Synergy SVGM5
- Single 400MHz G4 processer
- Altivec
- 512MB RAM
- on-board 100BaseT ethernet
Enough CPU and RAM with headroom
36Project Plan Update Since CoDR
37Summary of Issues
- Data processing how much on IOC?
- Required for engineering and commissioning
- Little extra effort or CPU