Writing a Channel Access Client in EPICS Bob Dalesio, April 5, 2000.

Slides:



Advertisements
Similar presentations
MQ Series Cross Platform Dominant Messaging sw – 70% of market Messaging API same on all platforms Guaranteed one-time delivery Two-Phase Commit Wide EAI.
Advertisements

MPI Message Passing Interface
1 1999/Ph 514: Channel Access Concepts EPICS Channel Access Concepts Bob Dalesio LANL.
EPICS Base R and beyond Andrew Johnson Computer Scientist, AES Controls Group.
Channel Access Protocol Andrew Johnson Computer Scientist, AES Controls Group.
9-12 Oct 2000PCaPAC 2000, DESY Hamburg Epics to TINE translator Matthias Clausen, DESY Hamburg Phil Duval, DESY Hamburg Zoltan Kakucs, DESY Hamburg.
16 - Nov. 2000EPICS Workshop Oak Ridge1 Epics to TINE translator Matthias Clausen, DESY Hamburg Phil Duval, DESY Hamburg Zoltan Kakucs, DESY Hamburg.
Client Server Model The client machine (or the client process) makes the request for some resource or service, and the server machine (the server process)
1 School of Computing Science Simon Fraser University CMPT 300: Operating Systems I Ch 4: Threads Dr. Mohamed Hefeeda.
V4 – Executive Summary 1.Provide online add/delete of I/O to support continuous operation. 2.Provide redundant control of remote I/O to support improved.
1 I/O Management in Representative Operating Systems.
OPC Overview OPC Device Support (PLC Gateway for 3.14) Ralph Lange – EPICS Collaboration Meeting at SLAC, April 2005.
Fundamentals of Python: From First Programs Through Data Structures
Experimental Physics and Industrial Control System (EPICS) Alarm Handler (ALH) Bob Dalesio, August 14, 1999.
Chapter 4: Threads Adapted to COP4610 by Robert van Engelen.
Experimental Physics and Industrial Control System (EPICS) Overview Bob Dalesio, Dec, 2002.
ORNL is managed by UT-Battelle for the US Department of Energy EPICS State Notation Language (SNL), “Sequencer” Kay Kasemir, SNS/ORNL Many slides from.
JavaIOC Marty Kraimer EPICS Collaboration Meeting ICALEPCS October
Chapter 4: Threads. 4.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts Threads A thread (or lightweight process) is a basic unit of CPU.
EPICS Meeting 29 th April - 3 rd May© 2013 Helmholtz-Zentrum BerlinCarsten Winkler.
1 Experimental Physics and Industrial Control System (EPICS) Database Bob Dalesio, May 31,2010.
Experimental Physics and Industrial Control System (EPICS) Database Bob Dalesio, June 27,2001.
Ralph Lange: OPC Gateway (Device Support) OPC Gateway (Device Support) Ralph Lange – EPICS Collaboration Meeting March SSRF.
J. Hill. Overview  Introduction  LANSCE Requirements  EPICS Event Queue  Event Queue Upgrade  Milestones.
Experimental Physics and Industrial Control System (EPICS) Overview Bob Dalesio, June 24, 2001.
Experimental Physics and Industrial Control System (EPICS) Overview Bob Dalesio, May 11, 2000.
‘ActiveX’ CA Server (… and Client) Oct Kay-Uwe Kasemir, LANL.
Making LabVIEW look like an IOC Kay-Uwe Kasemir, LANL May 2002.
10/20/2015J-PARC1 Control Room Accelerator Physics Channel Access – Connection to Hardware Through EPICS Getting Information directly from the Control.
1 Channel Access Concepts – EPICS Training – K.Furukawa – Mar EPICS Channel Access Concepts Kazuro Furukawa, KEK, ( ) (Bob Dalesio, LANL,
1 2009: Channel Access EPICS Channel Access Andy Foster Observatory Sciences Limited.
1 Lecture 5 (part2) : “Interprocess communication” n reasons for process cooperation n types of message passing n direct and indirect message passing n.
EPICS Access from Python Geoff Savage DØ Workshop Thursday June 22, 2000.
NT Kernel CS Spring Overview Interrupts and Exceptions: Trap Handler Interrupt Request Levels and IRT DPC’s, and APC’s System Service Dispatching.
3.14 Work List IOC Core Channel Access. Changes to IOC Core Online add/delete of record instances Tool to support online add/delete OS independent layer.
Source: Operating System Concepts by Silberschatz, Galvin and Gagne.
What is Eclipse? Official Definition: Eclipse Evolution
Writing a Channel Access Client in EPICS Bob Dalesio, April 5, 2000.
1 Writing Channel Access Clients–EPICS Training – K.Furukawa – Mar EPICS Writing Channel Access Clients Kazuro Furukawa, KEK, ( ) (Marty.
EPICS Release 3.15 Bob Dalesio May 19, Features for 3.15 Support for large arrays - done for rsrv in 3.14 Channel access priorities - planned to.
Silberschatz, Galvin and Gagne ©2013 Operating System Concepts – 9 th Edition Chapter 4: Threads.
Writing EPICS Channel Access Clients in Python Geoff Savage March 2003.
1 1999/Ph 514: Flow of Control EPICS Flow of Control Marty Kraimer APS.
Control System Overview J. Frederick Bartlett Fermilab June 1,1999.
EPICS to TANGO Translator Rok Šabjan on behalf of Rok Štefanič Presented at ICALEPCS, Knoxville, October.
Source Controller software Ianos Schmidt The University of Iowa.
EPICS Release 3.15 Bob Dalesio May 19, Features for 3.15 Support for large arrays Channel access priorities Portable server replacement of rsrv.
Connecting LabVIEW to EPICS network
B. Dalesio, N. Arnold, M. Kraimer, E. Norum, A. Johnson EPICS Collaboration Meeting December 8-10, 2004 Roadmap for IOC.
1 Channel Access Concepts – IHEP EPICS Training – K.F – Aug EPICS Channel Access Concepts Kazuro Furukawa, KEK (Bob Dalesio, LANL)
1 EPICS Flow of Control: EPICS Workshop at IHEP, Beijing, August 2001 EPICS Flow of Control Marty Kraimer APS.
Netprog: Client/Server Issues1 Issues in Client/Server Programming Refs: Chapter 27.
Control System Overview J. Frederick Bartlett Fermilab June 1,1999.
Controls Group New Channel Access Nameserver Presented by Karen White for Joan Sage.
An Introduction to Epics/Tango Steve Hunt Alceli EPICS Meeting 2008 INFN Legnaro 15 Oct 17:15.
Using COTS Hardware with EPICS Through LabVIEW – A Status Report EPICS Collaboration Meeting Fall 2011.
CMSC 421 Spring 2004 Section 0202 Part II: Process Management Chapter 5 Threads.
MQ Series Cross Platform Dominant Messaging sw – 70% of market
JavaIOC Overview and Update
Chapter 4: Threads.
SLAC USA Marty Kraimer and Matej Sekoranja
Issues in Client/Server Programming
Channel Archiver Kay-Uwe Kasemir, LANL
MQ Series Cross Platform Dominant Messaging sw – 70% of market
Writing a Channel Access Client in EPICS
Channel Access Concepts
EPICS: Experimental Physics and Industrial Control System
Chapter 4: Threads.
Channel Access Concepts
Chapter 13: I/O Systems “The two main jobs of a computer are I/O and [CPU] processing. In many cases, the main job is I/O, and the [CPU] processing is.
Presentation transcript:

Writing a Channel Access Client in EPICS Bob Dalesio, April 5, 2000

Outline Channel Access in the EPICS Architecture Channel Access Client Overview Channel Access Clients – synchronous client –composite data structures –buffering for efficiency –asynchronous connection handling –asynchronous monitoring

Many tools are available in the EPICS tool-kit EPICS tools are connected via the Channel Access client/server libraries Server Interfaces: Process Database Gateway (CA-Client - GDD Library - Portable server on Solaris) Client Interfaces Process Database Links Sequential Control Language Data Visualization Packages Data Analysis Packages Modeling and Automation Packages

Distributed Software Architecture ca-server process DB dev support ca-client CDEV vxWorks, UNIX WindowsNT, VMS UNIX ca-clientCORBA ACE vxWorks WindowsNT Solaris ca-server 3.13 vxWorks only 3.14 vxWorks, Solaris, RTMS, LINUX

Mapping Fields of Records to Channels (Process Variables) AI: Name SCAN VAL STATACK SEVRACKT HOPREGU LOPR HIHIHHSV HIGHHSV LOWLSV LOLOLLSV Channel Access Client: Connect to “Name” Add Event to alarm change monitor change archive change Make data type request Value Status & Severity Time Stamp Display and Control Information Channel Access Client: Connect to “AI ” AI.VAL AI.STAT AI.SEVR AI.TS AI.HOPR AI.LOPR AI.EGU Connect to AI.SCAN AI.SCAN AI.STAT AI.SEVR AI.TS # Choices List of choices

Channel Access Client/Server Libraries Sequencer Channel Access Client LAN/WAN Operator Interface Channel Access Client Database Links Channel Access Client Channel Access Server EPICS Process Database Client: Provides read/write connections to any subsystem on the network with a channel access server Server: Provides read/write connections to information in this node to any client on the network through channel access client calls Services: Dynamic Channel Location, Get, Put, Monitor Access Control, Connection Monitoring, Automatic Reconnect Conversion to client types, Composite Data Structures Platforms: UNIX, vxWorks, VMS, Windows NT TCP/IP & UDP

Simple Channel Access Client #include main ( int argc, char **argv){ dbr_double_t data; chid mychid; ca_task_initialize();/* ca initialization */ /* find the specified channel */ ca_search_and_connect(argv[1],&mychid,NULL,NULL); ca_pend_io(5.0);/* synchronous completion of search */ /* get the value */ ca_get(DBR_DOUBLE,mychid,(void *)& data); ca_pend_io(5.0);/* synchronous completion of get */ }

Channel Access ‘PUTS’ ca_put a request is placed in the local queue - program control returns immediately in the server - the new value is a cached put ca_put_callback a request is placed in the local queue - program control returns immediately client is notified when the put and all related record processing is complete in the server - these new values are queued ca_sg_put a request is placed in the local queue after all of the ca_sg_puts are queued - ca_sg_block is issued program control waits until all puts and related record processing completes client is notified when each put and all related record processing is complete in the server - these new values are queued

Data Type Conversions in Channel Access DBR _STRING, _DOUBLE, _FLOAT, _LONG, _CHAR, _ENUM Data type conversions are performed in the server Endian and floating point conversions are done in the client Polite clients requests data in native type and perform necessary conversion on the client side

Composite Data Structures Requests can be made for data related to the value field: Float, Short, Int Long, Char…. status, severity, time stamp, alarm limits, display limits, control limits String status, severity, time stamp, max string length Enumerated status, severity, time stamp, max string length, choices, #choices Example Request: struct dbr_ctrl_enumdata; ca_get(DBR_CTRL_ENUM,mychid,(void *)&data);

Accessing Composite Data Structures Many fields are fetched from the data store in one access: struct dbr_ctrl_floatdata; struct dbr_ctrl_float*pdata = &data; ca_get(DBR_CTRL_FLOAT,mychid,(void *)pdata); printf(“%d %d\n”,pdata->status, pdata->severity); printf(“%d %d\n”,pdata->stamp.secPastEpoch, pdata->stamp.nsec); printf(“%f %f\n”,pdata->high_display_limit,pdata->low_display_limit); printf(“%f %f\n”,pdata->high_warning_limit,pdata->low_warning_limit); printf(“%f %f\n”,pdata->high_alarm_limit,pdata->low_alarm_limit); printf(“%f %f\n”,pdata->high_control_limit,pdata->low_control_limit); printf(“%f %s\n”,pdata->value, pdata->units); *Refer to db_access.h for structures...

Making Efficient Use of Synchronous Channel Access Calls Buffer up requests before flushing the buffer and waiting for the result. … ca_search(chan_nam1,&chid1); ca_search(chan_nam2,&chid2); ca_search(chan_nam3,&chid3); ca_pend_io(1.0); ca_get(DBR_DOUBLE, chid1,(void *)&data1) ca_get(DBR_DOUBLE,chid2,(void *)&data2); ca_get(DBR_DOUBLE,chid3,(void *)&data3); ca_pend_io(1.0);

Asynchronous Name Resolution dbConnectionHandler( struct connection_handler_argsarg) { if (ca_state(arg.chid) != cs_conn) ….this channel is newly disconnected else….this channel is newly connected } main()... ca_search_and_connect(name,&chid1,dbConnectionHandler,(void *)NULL); ca_pend_event(.001);/* in this case - this is only a buffer flush */ }

Asynchronous Data Notification dbConnectionHandler( struct connection_handler_argsarg) { if (ca_state(arg.chid) != cs_conn) ….this channel is newly disconnected{ return; else{….this channel is newly connected ca_add_array_event(dbf_type_to_DBR_STS(ca_field_type(arg.chid)), ca_element_count(arg.chid), arg.chid, caEventHandler,0,0.0,0.0,0.0,(evid *)NULL); }

Asynchronous Data Notification - 2 caEventHandler( struct event_handler_argsarg) { if (arg.status != ECA_NORMAL) return; switch (arg.type){ case(DBR_STS_STRING): case(DBR_STS_SHORT): case(DBR_STS_FLOAT): case(DBR_STS_ENUM): case(DBR_STS_CHAR): case(DBR_STS_LONG): case(DBR_STS_DOUBLE): default: }

Error Checking Error codes and error related macros are in caerr.h SEVCHK will exit on errors it deems irrecoverable ECA_NORMAL means the exchange was initiated successfully SEVCHK exit behavior can be replaced with your own exception handler ca_add_exception_event(…..) example: status = ca_array_put(data_type,channel_id,pvalue); SEVCHK(status,”additional info in error message”);

Caching vs. Queuing An event handler can either take its actions in the event handler - queuing all data is handled degradation mode is longer delays Place data into an intermediate buffer and have an alternate thread handle the data caching data can be overwritten degradation mode is intermediate data is discarded note that buffer in IOC will overwrite the last monitor on the queue when a buffer overflows in the IOC

Channel Access Notes ca_repeater needs to be run once on each workstation in the database, –a deadband of 0 posts a monitor on any change –a deadband of -1 posts monitors on every scan read cadef.h, caerr.h and db_access.h before writing a channel access client it is most efficient to use native data types and handle data conversions in the client program

Channel Access Environment Variables Evironment Variable NameRange Default EPICS_CA_ADDR_LIST{n.n.n.n n.n.n.n n.n.n.n …} None EPICS_CA_AUTO_ADDR_LIST{YES,NO} YES EPICS_CA_CONN_TMOr > 0.1 seconds 30.0 EPICS_CA_BEACON_PERIODr > 0.1 seconds 15.0 EPICS_CA_REPEATER_PORTi > EPICS_CA_SERVER_PORTi > EPICS_TS_MIN_WEST-720 <= i <=