360 likes | 445 Views
AIDA Accelerator Integrated Data Access. Stanford Linear Accelerator Center Ron MacKenzie, George McIntyre* Judy Rock, Robert Sass, James Silva, Greg White 8th October 2002. *Independent consultant. Contents. The Problem The Chosen Architecture The directory service AIDA API
E N D
AIDAAccelerator Integrated Data Access Stanford Linear Accelerator Center Ron MacKenzie, George McIntyre* Judy Rock, Robert Sass, James Silva, Greg White 8th October 2002 *Independent consultant
Contents The Problem The Chosen Architecture The directory service AIDA API AIDA Query Specification (AQS) Examples Future
The Problem The Problem • How do you use CORBA to … • … allow access to over 3 million individual data attributes distributed throughout thousands of control systems from any client application • … make this access mind numbingly simple • … make it lightning fast • … allow complex queries that manipulate, constrain and relate of any of these attributes
The Problem AIDA Priorities • Integrated • Important not to impose our framework on the application • Speed • 1-4ms/simple type round trip including network • Simplicity • Three methods for most functions • Focused around Data access • Get • Set • Monitor
Contents The Problem The Chosen Architecture The directory service AIDA API AIDA Query Specification (AQS) Examples Future
The Chosen Architecture AIDA Architecture AIDA Network Client Server AIDA Directory Service AIDA Data Provider AIDA (Da API) AIDA DA Service Devices
The Chosen Architecture AIDA in CORBA AIDA Transport Oracle DB ORB Client Application Devices DP Service Da Server Da API Dp API Name Server AidaObject Static IDL Skeleton ORB Interface Dynamic invocation AidaObject IDL Stub Dynamic invocation DaServer IDL Stub DaServer Static IDL Skeleton Name Server Static IDL Skeleton Name Server IDL Stub Object Adapter
The Chosen Architecture AIDA Architecture • Directory Service is the key • Location found by URL • All AIDA participants Bootstrap by finding the Directory Service first • Services register with the Directory service when they come on line as authorised handlers of a named set of service requests for a particular group(s) of clients • The Directory service can now respond correctly to all clients in the relevant group (including DA) with this service’s interface
The Chosen Architecture AIDA Architecture • Clients can call a service via the DA • Can ask the DA to parse and compile queries as well as reconstitution of results • Clients can call the Service directly • Clients can parse and compile a target reference so that • It is validated for correctness and its structure is determined • All service references are resolved so that data access can be ultra rapid
Contents The Problem The Chosen Architecture The directory service AIDA API AIDA Query Specification (AQS) Examples Future
Directory Service Directory Service Schema • Name//attribute • Can map to one or more service chain • Transformation syntax • Based on regex and • Takes chains of sed like arguments • Different transforms for each servers may be specified • Data Provider is called in series "chained" -
Directory Service Directory Service Schema • Maps flat name spaces (eg EPICS) to single hierarchical name space. • Eg Attribute //VAL.HIST or //MODEL.TWISS.X.BETA • //VAL references the EPICS data provider. • //VAL.HIST references the Archiver data provider • //MODEL.* gets all model parameters from MODEL data provider • Visibility of Data Providers and AIDA Servers based on Group • Production • Development • New servers • Meta Data • Optional type and length • If not supplied they need to be discovered by the data provider (e.g. history must discover length), but for instance the slc database data provider must be given the length in order to make an acquisition.
Directory Service Map Flat namespace to heirachical • We make each property accessible as part of a hierarchical namespace Instantaneous Value Devices HB60.DCCT.SUMY//VAL HB60.DCCT.SUMY//VAL.HIST DB Historical Data FLAT NAMESPACES AIDA HEIRACHICAL NAMESPACE
Directory Service Query Execution Chains Client Client Server DA 1 AIDA Data Provider AIDA (Da API) Devices 2 1 Simple transform of query for immediate target DP DP DS 3 2. Query is translated into a new query for the intermediate service provider 3 3. The query is sent from this service provider along the chain(s) to the eventual DPs who each have their own specific message
Directory Service Collections Dp Server implementation AIDA Client AIDA Name Service INSTANCE//ATTRIBUTE INSTANCE//ATTRIBUTE SERVICE(INSTANCE//ATTRIBUTE) Complex structure or array Dp Server implementation AIDA Client AIDA Name Service INSTANCE//ATTRIBUTE1 INSTANCE//ATTRIBUTE SERVICE(INSTANCE//ATTRIBUTE) INSTANCE//ATTRIBUTE2 Complex structure or array One or more Services Dp Server implementation1 AIDA Client AIDA Name Service INSTANCE//ATTRIBUTE1 INSTANCE//ATTRIBUTE SERVICE1(INSTANCE//ATTRIBUTE1) SERVICE2(INSTANCE//ATTRIBUTE2) Dp Server implementation2 INSTANCE//ATTRIBUTE2 Arrows show mapping
Directory Service Collections Complex structure or array One or more Services Dp Server implementation1 AIDA Client AIDA Name Service INSTANCE//ATTRIBUTE1 INSTANCE//ATTRIBUTE1 SERVICE1(INSTANCE//ATTRIBUTE1) INSTANCE//ATTRIBUTE2 SERVICE2(INSTANCE//ATTRIBUTE2) Dp Server implementation2 INSTANCE//ATTRIBUTE2 Arrows show mapping
Contents The Problem The Chosen Architecture The directory service AIDA API AIDA Query Specification (AQS) Examples Future
API AIDA Da API • DaObject • Various constructors • Various get/set methods • setParam • DaReference • Various constructors • Various get/set methods • setParam • compile • Note: automatic therefore unnecessary if constructed with a DaObject • setTarget • Note: Normally set with constructor • getType/Count • setType/Count
API AIDA Common API • For Clients • DaValue • Various methods to set, extract and convert data • _DaObject,_DaObjectBase • Never used directly by clients this provides the transport for client DaObjects • For Servers • DaValue • Various methods to set, extract and convert data • _PersistentDaObject, _PersistentDaObjectBase • AIDA Transport used in Servers • Various helper classes for extra help parsing and using AQS for use in Servers
API Mapping Types - simple AIDA Client AIDA Da API CORBA Dp Server implementation byte get_byte(query) byte get_byte(query) Object get(query, type) byte long get_long(query) long get_long(query) long double get_double(query) double get_double(query) double Byte Long Double Boolean boolean get_boolean(query) boolean get_boolean(query) boolean
API Mapping Types - arrays AIDA Client AIDA Da API CORBA Dp Server implementation byte get_bytea(query) byte get_bytea(query) Object [] geta(query, type) sequence of byte long get_longa(query) long get_longa(query) sequence of long double get_doublea(query) double get_doublea(query) sequence of double Byte[] Long[] Double[] String[] boolean get_booleana(query) boolean get_booleana(query) sequence of boolean
API Mapping Types - Any AIDA Client AIDA Da API CORBA Dp Server implementation Any get_any(query) Any get_any(query) Any getAny(query) Any Any Any
API Mapping Types - DaValue AIDA Client AIDA Da API CORBA Dp Server implementation DaValue getDaValue(query) Any get_any(query) DaValue getDaValue(query) Any Call local methods in DaValue to extract structured data Any (DaValue.toAny())
Contents The Problem The Chosen Architecture The directory service AIDA API AIDA Query Specification (AQS) Examples Future
AQS AIDA Query Syntax query ::= <simple_query> | <user_defined_structure> simple_query ::= <target_string>[ <aida_symbol_spec> ] target_string ::= <string> // [ <attribute> ] attribute ::= <string> { . <string> } [ range_specification ] range_specification ::= [ <string_range> | <numerical_range> | <bound> ] { <range_specification> } string_range ::= <string> { , <string> } numerical_range ::= <bound> [ - [ <bound> ] ] | - [ <bound> ] bound ::= 0 | <positive_integer> | <aida_symbol> user_defined_structure ::= <complex_query> { , <complex_query> } complex_query ::= [ <string> = ] { <query>}
AQS AIDA Query Syntax (Symbols) aida_symbol_spec ::= <aida_symbol> | ( <aida_symbol> + <string> ) | ( <string> + <aida_symbol> ) |( <aida_symbol> - <string> ) | ( <string> - <aida_symbol> ) aida_symbol ::= # <aida_keyword> aida_keyword ::= LENGTH | TYPE | NAME
Contents The Problem The Chosen Architecture The directory service AIDA API AIDA Query Specification (AQS) Examples Future
Examples AIDA coding – Simplest example DaObject da = new DaObject(); Double v = (Double)da.get("TEST://VAL1", DaValue.Type.DOUBLE);
Examples AIDA coding – Reference example Float v; DaObject da = new DaObject(); DaReference r = new DaReference("TEST://VAL2", da); r.setType(DaValue.Type.FLOAT); for (int i=0; i< 1000 ; i++) v = (Float)da.get(r);
Examples AIDA coding – Parameter & DaValue example DaObject da = new DaObject(); da.setParam("STARTTIME", "2001-09-06 12:04"); da.setParam("ENDTIME", "2001-09-06 12:10"); DaValue v = da.getDaValue("TEST://VAL3"); // if v contains an array of Doubles If ( !v.IsEmpty() ) { Double [] ad = new Double [v.size()]; v.copyInto(ad); … }
Examples AIDA coding – Complex Query Example DaObject da = new DaObject(); String target = “current={TEST://VAL},last4={TEST://VAL.HIST[(#LENGTH-4)-]}"; DaValue v = da.getDaValue(target); System.out.println( "\t=" + v.toString() );
Contents The Problem The Chosen Architecture The directory service AIDA API AIDA Query Specification (AQS) Examples Future
Future Future • After finishing current development effort • Add • Asynchronous support • Global notion of time and timestamps • Method invocation
http://www.slac.stanford.edu/grp/cd/soft/aida Thank You Stanford Linear Accelerator Center Ron MacKenzie, George McIntyre* Judy Rock, Robert Sass, James Silva, Greg White 10th October 2002 *Independent consultant
Performance for transmission of an Any Same Host (slcs1) Different Host (slcsun1-slcs1) ValueType Wrapping union Orbacus Optimization OFF ValueType Wrapping union Orbacus Optimization ON CORBA Any