EPICS Flow of Control Marty Kraimer APS EPICS

  • Slides: 13
Download presentation
EPICS Flow of Control Marty Kraimer APS EPICS Flow of Control: EPICS Workshop at

EPICS Flow of Control Marty Kraimer APS EPICS Flow of Control: EPICS Workshop at IHEP, Beijing, August 2001 1

EPICS ARCHITECTURE PHYSICAL OPI IOC EPICS Flow of Control: EPICS Workshop at IHEP, Beijing,

EPICS ARCHITECTURE PHYSICAL OPI IOC EPICS Flow of Control: EPICS Workshop at IHEP, Beijing, August 2001 2

EPICS ARCHITECTURE LOGICAL EPICS IOC Application OPI Channel Access Client LAN Channel Access Server

EPICS ARCHITECTURE LOGICAL EPICS IOC Application OPI Channel Access Client LAN Channel Access Server Database Access and Scanning Record Device Driver Support Physical I/O EPICS Flow of Control: EPICS Workshop at IHEP, Beijing, August 2001 3

Summary u IOC Initialization u u Load various components Connect to hardware Start Channel

Summary u IOC Initialization u u Load various components Connect to hardware Start Channel Access Servers Record Processing u u u EPICS Hardware I/O monitor and control Post events for CA clients Channel Access u u Connect to channels Get/Put requests Monitor Requests Connection Management EPICS Flow of Control: EPICS Workshop at IHEP, Beijing, August 2001 4

IOC Initialization u ld u ioc. Core u xxx. App - device, driver, record

IOC Initialization u ld u ioc. Core u xxx. App - device, driver, record support db. Load. Database EPICS u Load database definition files for menus, recordtypes, devices, and drivers u db. Load. Records, db. Load. Templates Load record instance files u ioc. Init u u u u Dynamically link to record, device, and driver support Start general purpose tasks log server, task watchdog, callback, db. Ca, etc Initialize drivers Initialize records (two passes) and devices Start scan tasks Start access security Start Channel Access Servers EPICS Flow of Control: EPICS Workshop at IHEP, Beijing, August 2001 5

Record Processing: Common Part u Database Scanning calls db. Process u u u u

Record Processing: Common Part u Database Scanning calls db. Process u u u u Periodic I/O Interrupt Event Passive Skip if already active u u EPICS A lock set may have loops The record may be asynchronous Skip if the record is disabled Call record support process routine Linked records (input, output, forward) that are process passive are processed recursively EPICS Flow of Control: EPICS Workshop at IHEP, Beijing, August 2001 6

Process: Synchronous I/O u u Set PACT true (processing active) Perform I/O operation u

Process: Synchronous I/O u u Set PACT true (processing active) Perform I/O operation u u For hardware link call device support For database link u u linked records (except scalar NPP NMS input) are in a common lock set. recursive processing may happen u u u u inputs processed before data transfer outputs processed after data transfer For channel access link u u EPICS inputs are monitored outputs are handled via a separate task Check for record specific alarm conditions Call db_post_event for any fields that change because of record processing Request processing of forward link Set PACT false return EPICS Flow of Control: EPICS Workshop at IHEP, Beijing, August 2001 7

Process: Asynchronous I/O u Asynchronous Start (Called by db. Process) u u EPICS Set

Process: Asynchronous I/O u Asynchronous Start (Called by db. Process) u u EPICS Set PACT True Start I/O operation (normally via device support) return leaving PACT true Asynchronous Completion Record processing routine is called again u u u Complete I/O operation Check for record specific alarm conditions Call db_post_event for any fields that change because of record processing Request processing of forward link Set PACT false return EPICS Flow of Control: EPICS Workshop at IHEP, Beijing, August 2001 8

Channel Access u Search u u u UDP broadcast PVNAME on local subnet (buffered)

Channel Access u Search u u u UDP broadcast PVNAME on local subnet (buffered) Each IOC has a CA broadcast listener IOC that has PV sends UDP message back to client TCP connection between each client/server For each client IOC establishes following tasks u u u Server task (all communication except monitors) Event task which handles monitors, I. e. calls to db_post_event Get u u u EPICS Issue requests Wait for replies Put u u Issue put. No response except for errors May cause record processing EPICS Flow of Control: EPICS Workshop at IHEP, Beijing, August 2001 9

Channel Access continued u Add Event u u u Ask for monitor on PV

Channel Access continued u Add Event u u u Ask for monitor on PV (record. field) Monitors happen because of calls to db_post_event Put Notify u u EPICS Issue put and wait for completion Completion when all records complete processing Connection Management Automatic reconnect Access Security EPICS Flow of Control: EPICS Workshop at IHEP, Beijing, August 2001 10

Example CA Put Notify u u u u u EPICS Client issues put notify

Example CA Put Notify u u u u u EPICS Client issues put notify and flush IOC CA server accepts request db. Put. Notify is called db. Scan. Lock is called - Entire lock set is locked Value is written to record Record is processed (if passive and PP true in dbd file) A set of records may start and some complete processing db. Scan. Unlock is called When all records complete processing the CA server is notified The CA server sends a message back to the client EPICS Flow of Control: EPICS Workshop at IHEP, Beijing, August 2001 11

Example Asynchronous Devices u Serial and GPIB Devices u u u Are typically slow

Example Asynchronous Devices u Serial and GPIB Devices u u u Are typically slow Device support can NOT be synchronous Solution u u Create separate task to manage requests Device support is asynchronous u u u EPICS Async start queues a request to task When task completes request it notifys device support which causes asynchronous completion. Generic GPIB support is available Several Serial support options are available Now lets look at CA Put Notify example u Database has series of linked records reading gpib/serial values. u u rec 1 -> rec 2 -> rec 3 ->… What does CA Put Notify do? EPICS Flow of Control: EPICS Workshop at IHEP, Beijing, August 2001 12

CA put notify u EPICS The following is sequence of events u u u

CA put notify u EPICS The following is sequence of events u u u Client issues put notify request Server receives request db. Put. Notify is called u u u db. Scan. Lock is called Value is written to record rec 1 starts processing u u u u u dbscan. Unlock is called db. Put. Notify waits Sometime later u u Device support queuesrequest to separate task Record left with PACT true Task finishes request rec 1 has asynchronous completion rec 2 is processed and starts asynchronous phase … until all records in chain complete db. Put. Notify completes CA sends message back to client EPICS Flow of Control: EPICS Workshop at IHEP, Beijing, August 2001 13