1 1999/Ph 514: Portable CA Server EPICS Portable Channel Access Server Marty Kraimer.

Slides:



Advertisements
Similar presentations
Operator overloading redefine the operations of operators
Advertisements

1 1999/Ph 514: Channel Access Concepts EPICS Channel Access Concepts Bob Dalesio LANL.
Channel Access Enhancements J. Hill. R3.14 Enhancements Large array support in the portable server –nearly complete –a priority for SNS Port syntax for.
1 Portable CA Server – EPICS Training – K.Furukawa – Mar EPICS Portable Channel Access Server Kazuro Furukawa, KEK, ( ) (Marty Kraimer, APS,
Controls Group New Channel Access Nameserver Joan Sage 12/4/01.
A U.S. Department of Energy Office of Science Laboratory Operated by The University of Chicago Argonne National Laboratory Office of Science U.S. Department.
9-12 Oct 2000PCaPAC 2000, DESY Hamburg Epics to TINE translator Matthias Clausen, DESY Hamburg Phil Duval, DESY Hamburg Zoltan Kakucs, DESY Hamburg.
Middleware Technologies compiled by: Thomas M. Cosley.
 2008 Pearson Education, Inc. All rights reserved Introduction to Classes and Objects.
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.
 2008 Pearson Education, Inc. All rights reserved Introduction to Classes and Objects.
Introduction to Classes and Objects CS-2303, C-Term Introduction to Classes and Objects CS-2303 System Programming Concepts (Slides include materials.
Chapter 4: Threads Adapted to COP4610 by Robert van Engelen.
Kazuro Furukawa, KEK, Jul Jacva and JCA / CAJ EPICS Workshop 2006, VECC, India 1 Java and JCA / CAJ Kenneth Evans, Jr. October 12, 2004 Part of the.
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.
History Server & API Christopher Larrieu Jefferson Laboratory.
Imperial College Tracker Slow Control & Monitoring.
OLE for Process Control. Talk Outline u OPC Overview u What is OPC? u Why OPC at CERN? u OPC functionality and architecture? u OPC Data Access u Access.
CGS 3763 Operating Systems Concepts Spring 2013 Dan C. Marinescu Office: HEC 304 Office hours: M-Wd 11: :30 AM.
Java CGI Lecture notes by Theodoros Anagnostopoulos.
Extending OpenLDAP Luke Howard PADL Software Pty Ltd Copyright © 2003 PADL Software Pty Ltd. All rights reserved. PADL is a registered trademark of PADL.
Chapter 1: Introducing JAVA. 2 Introduction Why JAVA Applets and Server Side Programming Very rich GUI libraries Portability (machine independence) A.
REVIEW On Friday we explored Client-Server Applications with Sockets. Servers must create a ServerSocket object on a specific Port #. They then can wait.
CS212: Object Oriented Analysis and Design Lecture 6: Friends, Constructor and destructors.
NMED 3850 A Advanced Online Design January 12, 2010 V. Mahadevan.
‘ActiveX’ CA Server (… and Client) Oct Kay-Uwe Kasemir, LANL.
Chapter 6 Server-side Programming: Java Servlets
SEMINOR. INTRODUCTION 1. Middleware is connectivity software that provides a mechanism for processes to interact with other processes running on multiple.
OS2- Sem ; R. Jalili Introduction Chapter 1.
Jožef Stefan Institute Oct. 8-9, 2005ACS 2005 Workshop Comparison of EPICS and ACS M. Plesko – JSI and Cosylab, in collaboration with Phil Duval, DESY.
EPICS Access from Python Geoff Savage DØ Workshop Thursday June 22, 2000.
Chapter 6 Introduction to Defining Classes. Objectives: Design and implement a simple class from user requirements. Organize a program in terms of a view.
Writing a Channel Access Client in EPICS Bob Dalesio, April 5, 2000.
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 Channel Access Version Four Motivating FactorsMotivating Factors Solicitations from the audienceSolicitations from the audience.
EPICS sequencer update Greg White / William Lupton / EPICS ‘99 SLAC, May 27, 1999.
08 Encapsulation and Abstraction. 2 Contents Defining Abstraction Levels of Abstraction Class as Abstraction Defining a Java Class Instantiating a Class.
Silberschatz, Galvin and Gagne  2002 Modified for CSCI 399, Royden, Operating System Concepts Operating Systems Lecture 14 Threads 2 Read Ch.
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.
1 Classes II Chapter 7 2 Introduction Continued study of –classes –data abstraction Prepare for operator overloading in next chapter Work with strings.
1 Java Server Pages A Java Server Page is a file consisting of HTML or XML markup into which special tags and code blocks are inserted When the page is.
CSE 332: C++ pointers, arrays, and references Overview of Pointers and References Often need to refer to another object –Without making a copy of the object.
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.
Control System Overview J. Frederick Bartlett Fermilab June 1,1999.
Controls Group New Channel Access Nameserver Presented by Karen White for Joan Sage.
Portable CA Server Update ApplicationsApplications PortabilityPortability BugsBugs Directory ServerDirectory Server Future of GDDFuture of GDD ReliabilityReliability.
OOP, Inheritance and Polymorphism Lecture 6. Object relations  Inheritance is ‘a kind of’, ‘a type of’ e.g. a revolver is a type of gun  Aggregation.
CS 440 Database Management Systems Stored procedures & OR mapping 1.
Wir schaffen Wissen – heute für morgen PSI,2. Oktober 2016 Paul Scherrer Institut Portable Channel Access Server in Python Xiaoqiang Wang Controls Talk.
Michael Thomas and Conlog.
Michael Thomas and Conlog.
Creational Pattern: Prototype
Review: Two Programming Paradigms
Advanced Operating Systems
Portable Channel Access Server
Programming with Shared Memory
Portable Channel Access Server
Object-Oriented Programming
Programming with Shared Memory
Writing a Channel Access Client in EPICS
Channel Access Concepts
Chapter 5 Architectural Design.
Portable Channel Access Server
Functions Reasons Concepts Passing arguments to a function
Channel Access Concepts
Introduction to Classes and Objects
Presentation transcript:

1 1999/Ph 514: Portable CA Server EPICS Portable Channel Access Server Marty Kraimer

2 1999/Ph 514: Portable CA Server EPICS Overview u What is the Portable Channel Access Server? The Portable Server consists of a C++ library with a simple class interface. u Purpose of the Server library Using the simple interface to the library, a developer can create a Channel Access server tool that can interact with the EPICS database as well as other applications. u Example ca servers u Channel access gateway u Directory server u Fault logger APT HPRF u KECK instruments u KEKB gateway to LINAC control system u SLAC gateway to SLAC control system u Gateways to other control systems at DESY

3 1999/Ph 514: Portable CA Server EPICS Overview (cont.) u Advantages of a Server Tool u Your application becomes an EPICS server tool u Your data become EPICS process variables u MEDM and other EPICS tools can interact with your application u Talk purpose u Describe the server interface u Show simple C++ example server

4 1999/Ph 514: Portable CA Server EPICS Basic Concepts u Server Tool u Developer creates a channel access server tool u Provides interface classes and methods required by the server library u Server Tool Functions u Creates/deletes server instance u Responds to client requests u PV search u Attach/detach request u Read/write requests u Posts change of state events u Server Library u C++ library with simple class interface u Calls the C++ server interface functions u Developer only needs to know server interface u Hides complexity of channel access u Available in EPICS base u Runs on Unix, WIN32, and VMS

5 1999/Ph 514: Portable CA Server EPICS Basic Concepts (cont.) u Process Variable (PV) u Variable which server tool keeps track of u Server tool provides clients with current value when requested (read request) u Server tool changes current value upon client request (write request) u Server tool can inform client when the current value changes (monitoring) u Has attributes (e.g. alarm limits, operating range) which server tool keeps track of u Channel u A connection between a client and a PV u Each client establishes a separate connection to the PV

6 1999/Ph 514: Portable CA Server EPICS C++ Server Interface u 9 classes comprise the Portable Server API u Server class, caServer u Process variable class, casPV u pvExistReturn u pvAttachReturn u Channel class, casChannel u casAsyncPVExistIO u casAsyncCreatePVIO u casAsyncReadIO u casAsyncWriteIO. u The first four classes are required to implement the server tool u The channel class and the asynchronous IO classes can be used to add more functionality u Each class has several member functions which server tool must define

7 1999/Ph 514: Portable CA Server EPICS caServer Class  Every server tool must include a class derived from the caServer class u Defines maximum length of a PV name u Defines debug level determining amount of output printed u Determines maximum number of simultaneous IO operations allowed u Informs the server library if a PV is associated with the server tool  Attaches a PV when a client wishes to establish a connection u Server tool must provide implementations of the virtual functions u pvExistTest() u pvAttach()

8 1999/Ph 514: Portable CA Server EPICS Example Server  Server definition class myServer : public caServer { public: myServer(unsigned pvCountIn,char *nameIn); virtual ~myServer(void); virtual pvExistReturn pvExistTest(const casCtx& c, const char* pvname); virtual pvAttachReturn pvAttach(const casCtx& c, const char* pvname); private: friend class myPV; myPV *mypv; char *pvName; int pvNameLength; gdd* value; }; u Server creation int main(int argc, char* argv[]){ myServer* server; int forever=1; if(argc<2) { fprintf(stderr,"Usage: %s pvName\n",argv[0]); return -1; } server = new myServer(1,argv[1]); osiTime delay(1000u,0u); while(forever) { fileDescriptorManager.process(delay); } return 0; }

9 1999/Ph 514: Portable CA Server EPICS pvExistTest pvExistReturn pvExistTest(const casCtx &ctx, const char *pPVAliasName) u Response to a client CA search u The server tool may accept multiple PV name aliases for the same PV. u The request is allowed to complete asynchronously (server tool uses asynchronous IO classes). u Server tool passes ctx to asynchronous completion constructors u Return values (class pvExistReturn) u return pverExistsHere;  Server has PV u return pverDoesNotExistHere;  Server does not know of this PV u return pverAsynchCompletion;  Deferred result

/Ph 514: Portable CA Server EPICS pvAttach pvAttachReturn pvAttach (const casCtx &ctx, const char *pPVAliasName) u Called when client wishes to attach to PV u Allowed to complete asynchronously  Server tool must detect attempts to create a 2nd PV with the same name u Return values (class pvAttachReturn)  return pPV; Success (pass by pointer) u return PV; Success (pass by ref)  return S_casApp_pvNotFound; No PV by that name here  return S_casApp_noMemory; No resources to create pv  return S_casApp_asyncCompletion; Deferred completion  return S_casApp_postponeAsyncIO; Too many simultaneous IO operations

/Ph 514: Portable CA Server EPICS Example Server Methods myServer::myServer(unsigned pvCountIn,char *nameIn) { pvNameLength = strlen(nameIn); pvName = new char [pvNameLength+1]; strcpy(pvName,nameIn); value = new gddScalar(appvalue,aitEnumFloat64); value->reference(); value->put(0); value->setStatSevr(0,0); mypv = new myPV(*this,pvName); } pvExistReturn myServer::pvExistTest(const casCtx&, const char* name) { if(strncmp(name,pvName,pvNameLength)==0) return pverExistsHere; return pverDoesNotExistHere; } pvAttachReturn myServer::pvAttach(const casCtx&,const char* name) { if(strncmp(name,pvName,pvNameLength)==0) return *mypv; return NULL; } myserver::~myserver(void) { delete [] pvName; value->unreference(); delete mypv; }

/Ph 514: Portable CA Server EPICS casPV Class u Responds to read/write PV requests u Server must implement the virtual functions u read()  write() u Responds to a request for a PV monitor u Server implements the virtual functions u interestRegister() u interestDelete()  Calls postEvent() u Other important functions u getName() u bestExternalType() u beginTransaction(),endTransaction() u destroy() u Do nothing default implementations exist. u Server tool need not implement those functions it does not want.

/Ph 514: Portable CA Server EPICS Example casPV Class Definition class myPV : public casPV { public: myPV(myServer& serverIn,char* nameIn); virtual ~myPV(void); virtual void destroy(void); virtual caStatus read(const casCtx &, gdd &prototype); virtual caStatus write(const casCtx &, gdd &dd); virtual aitEnum bestExternalType(void) const; virtual caStatus interestRegister(void); virtual void interestDelete(void); virtual const char *getName() const; private: myServer& server; char *pvName; int interest; };

/Ph 514: Portable CA Server EPICS Example casPV Methods myPV::myPV (myServer& svrIN,char * nameIn): server(svrIN),interest(0) { pvName = new char [strlen(nameIn)+1]; strcpy(pvName,nameIn); } caStatus myPV::read(const casCtx&, gdd &dd) { dd.put(server.value); return S_casApp_success; } caStatus myPV::write(const casCtx&, gdd &dd) { aitFloat64 newValue; dd.get(&newValue, aitEnumFloat64); server.value->put(newValue); if (interest) postEvent(server.valueEventMask,*value); return S_casApp_success; }

/Ph 514: Portable CA Server EPICS Example casPV Methods (cont.) aitEnum myPV::interestRegister(void) { interest =1; return S_casApp_success; } void myPV::interestDelete(void) { interest = 0; } const char *myPV::getName() const { return pvName; } aitEnum myPV::bestExternalType() const { return aitEnumFloat64; } myPV::~myPV(void){delete [] pvName;} void myPV::destroy(void) { }

/Ph 514: Portable CA Server EPICS Data Types u Channel Access client request types DBR types defined in db_access.h e.g. DBR_STS_CHAR, DBR_GR_DOUBLE u EPICS database native types DBF types defined in db_access.h e.g. DBF_DOUBLE, DBF_STRING,... u Server has two types which describe data u Architecture Independent Type (AIT) defined in aitTypes.h u aitInt8aitUint8aitInt16 u aitUint16aitFloat32aitFloat64 u aitEnum16aitIndexaitPointer u aitStatus u Application type defined in gddAppTable.h u e.g. precision, limits, status u GDD library converts data from one type to another

/Ph 514: Portable CA Server EPICS Writing Your Own Server Tool u Next steps u Try existing samples u Study sample code u Study casdef.h u Read documentation

/Ph 514: Portable CA Server EPICS Documentation On-line documents at LANL u Portable Server Tutorial u Portable Server Reference u A Server-Level API for EPICS (paper) u Channel Access Server Update (slides)