390 likes | 403 Views
Marty Kraimer EPICS Collaboration Meeting ICALEPCS October 13-14 2007. JavaIOC. Overview. Brief review of JavaIOC features types link, enum, and menu gone JavaIOC Data Model Generic structures and recordTypes Support – All support is generic PortDriver – JavaIOC version of asyn.
E N D
Marty Kraimer EPICS Collaboration Meeting ICALEPCS October 13-14 2007 JavaIOC
ICALEPCS/EPICS Meeting Overview • Brief review of JavaIOC features • types link, enum, and menu gone • JavaIOC Data Model • Generic structures and recordTypes • Support – All support is generic • PortDriver – JavaIOC version of asyn
ICALEPCS/EPICS Meeting JavaIOC Features • Rich Set of Data Types • Smart soft real-time Database • Record Instances can be processed. • Any field can optionally have support. • Connect to Hardware or other records. • Defines Data Model • General Purpose Clients can easily find data. • Generic Support can easily find data. • Rich set of record/structures and support.
ICALEPCS/EPICS Meeting Implemented • PV (Process Variable) Database • XML Parsers: DBD and Record Instance • Record Processing/Scanning/Monitoring • Channel Access Local • COSYLab: CA Server for CSS/V3 clients • Generic record/structures and support • PortDriver – JavaIOC ASYN Support • SWTSHELL: GUI iocshell
ICALEPCS/EPICS Meeting Not Implemented • Remote Channel Access • JavaIOC client <-> JavaIOC server • JavaIOC client <-> V3 server • VDCT: Visual Database Configuration Tool • Access security • Error logging • ??? • Lots to do!!
ICALEPCS/EPICS Meeting PV Database • Field types • Primitive: all Java primitives except char • boolean, byte, short, int, long, float, double • string: implemented as a Java String • structure: has fields. Each field can be any type • array: has elementType which can be any type • Complex Structures fully supported • Introspection and Data interfaces:Provide access to any field.
ICALEPCS/EPICS Meeting PV Introspection • Introspection Interfaces, i.e. no data • Field: Methods: getType, getFieldName, ... • Array: extends Field: Method: getElementType • Structure: extends Field • Methods: getFields, getStructureName • FieldFactory • Implements introspection interfaces • Can be extended but probably not necessary
ICALEPCS/EPICS Meeting PV Data Interfaces • PVField: Base for data: Methods: getField, ... • PVBoolean,...,PVString : Methods: get,put • PVArray: Base for array data interfaces • PVBooleanArray,...,PVArrayArray : Methods get,put • PVStructure provides access to a structure. • PVRecord provides access to a record instance. • PVDataFactory • Default implementation. • Any PVField can be replaced. Often useful • ConvertFactory: Convert between data types
ICALEPCS/EPICS Meeting XML Parsers • DBD - Database Definitions • structure • recordType - A top level structure • create – defines factory that replaces default data implementation. • support – defines a factory that implements support for a field. • DB - Record Instance • Macro Substitution and Include
ICALEPCS/EPICS Meeting Types Removed • Previously javaIOC had types • link • enum • menu • link replaced by support for structure • enum and menu replaced by enumerated structure
<structure name = "enumerated" createName = "enumerated" > <field name = "index" type = "int" /> <field name = "choice" type = "string" /> <field name = "choices" type = "array" elementType = "string" /> </structure> <create name = "enumerated" factoryName = "org.epics.ioc.create.EnumeratedFactory" /> Enumerated structure ICALEPCS/EPICS Meeting
ICALEPCS/EPICS Meeting enumerated • An enumerated structure has fields • index – an int that selects one of choices • choice – a string that is the current choice • choices – an array of strings • The enumerated create • Replaces the default implementation • A put to index also changes choice • A put to choice also changes index
An enumerated structure with default choices <structure name="alarmSeverity" createName = "enumerated" > <field name = "index" type = "int" /> <field name = "choice" type = "string" /> <field name = "choices" type = "array" elementType = "string" default = "none minor major invalid" /> </structure> alarmSeverity ICALEPCS/EPICS Meeting
ICALEPCS/EPICS Meeting Java IOC Database • Has a set of record instances. • Each record and field is accessed via interfaces. • Each instance can be processed • Periodically scanned • Event scanned • Passively scanned: by client or other record • Factories: Data and Introspection
ICALEPCS/EPICS Meeting PV Naming • EPICS pvname is <record>.field • JavaIOC is <record>.name.name. ... • name can be field name or a property • Some examples • <record>.value<record>.value.display.limit.low<powerSupply>.power.value<psArray>.supply[0].power.value
ICALEPCS/EPICS Meeting JavaIOC Data Model • Simple: All related data appears together in a structure • Intended for Client tools and for Support • Field name can be a property name • A null structure(no fields and no support) is not a property. • If a structure has a field named “value” than every other field is a property unless it is a null structure.
ICALEPCS/EPICS Meeting Finding Properties • PVField provides method findProperty • PVField findProperty(String fieldName); • Two examples for fieldName are: • “value” • “supply[0].power.value” • If pvField refers to the value field than • “display” • “display.limit.low”
ICALEPCS/EPICS Meeting Generic structure/recordType • The JavaIOC now has DBD definitions for • Each primitive type • An array with a primitive element type • A structure and recordType for each • Record instances can • Just hold data • Be an input record, an output record, etc • The structure versions are for device records
ICALEPCS/EPICS Meeting structure/recordType double • XML definitions on next two slides • Follows JavaIOC Data Model • recordType double is defined. It can: • Just holds data • Be an input or output or both • Be an analog input or analog output • Structure double is defined • It can be embeded in other recordTypes • Building block for “device” records
<?xml version="1.0" ?> <DBDefinition> <field name = "value" type = "double" /> <field name = "alarm" type = "structure"/> <field name = "timeStamp" type = "structure" /> <field name = "input" type = "structure" /> <field name = "valueAlarm" type = "structure" /> <field name = "output" type = "structure" /> <field name = "display" type = "structure" /> <field name = "control" type = "structure" /> <field name = "history" type = "structure" /> </DBDefinition> doubleCommon.xml ICALEPCS/EPICS Meeting
<?xml version="1.0" ?> <DBDefinition> <structure name = "double" supportName = "generic" > <include href = "doubleCommon.xml" /> </structure> <recordType name = "double" supportName = "generic" > <include href = "common.xml" /> <include href = "doubleCommon.xml" /> <field name = "supportArray" type = "array" elementType = "structure" supportName = "supportArray" /> </recordType> </DBDefinition> doubleRecord.xml ICALEPCS/EPICS Meeting
ICALEPCS/EPICS Meeting Fields in doubleCommon • value has type double • All other fields are a null structure • A record instance can override • If not overridden than NOT a property • Following two slides show example • The definition of display • An example record instance
<structure name = "display"> <field name = "description" type = "string" /> <field name = "format" type = "string" /> <field name = "units" type = "string" /> <field name = "resolution" type = "int" /> <field name = "limit" type = "structure" structureName = "doubleLimit" /> </structure> display.xml ICALEPCS/EPICS Meeting
Note that example.value will have property display. <record name = "example" type = “double” > <display structureName = “display”> <units>volts</units> <limit> <low>0.0</low> <high>10.0</high> </limit> </display> </structure> record instance ICALEPCS/EPICS Meeting
ICALEPCS/EPICS Meeting Support Overview • Implements record processing semantics • Each record instance has support • Each field of a record instance can optionally have support • Support should always be as generic as possible • Look for required fields and ignore all others • If required fields not found don’t start
ICALEPCS/EPICS Meeting generic support • Is often the default support • Supports both recordType and structure • Algorithm • For each field that has support call it. • Each support must complete before support for the next field is called. • If any support does not report success don’t call any more support.
ICALEPCS/EPICS Meeting Analog Input Example • The recordType is double • Input has structureName linearConvert • This has fields including value and input • The default support is generic • The following support is used • generic • linearConvertInput • pdrvInt32Input
pdrvInt32Input puts input.value; linearConvertInput puts value. <record name = "ai" type = "double" > <input structureName = "linearConvertInput"> <input supportName = "pdrvInt32Input" structureName = "pdrvSupport"> <portName>aPortDriver</portName> <addr>0</addr> <timeout>.2</timeout> <size>20</size> </input> <linearConvert> <engUnitsLow>0.0</engUnitsLow> <engUnitsHigh>10.0</engUnitsHigh> </linearConvert> </input> </record> Analog Input Instance ICALEPCS/EPICS Meeting
ICALEPCS/EPICS Meeting Analog Input Semantics • The generic support for ai calls the support for field input • The generic support for input • Calls the pdrvInt32Support • It puts a value into input.value • Calls the linearConvertInput support • It gets a value from input.value, converts it to engineering units, and puts the result into ai.value
ICALEPCS/EPICS Meeting powerSupply Example • This is an example of a “device” record • Only new support is powerSupplyCurrent • It gets power.value and voltage.value • From these it computes the current • Puts the current into current.value
<?xml version="1.0" ?> <DBDefinition> <field name = "power" type = "structure" structureName = "double" /> <field name = "voltage" type = "structure" structureName = "double" /> <field name = "current" type = "structure" structureName = "double" /> <field name = "alarm" type = "structure"/> <field name = "timeStamp" type = "structure" /> </DBDefinition> powerSupplyCommon.xml ICALEPCS/EPICS Meeting
<?xml version="1.0" ?> <DBDefinition> <structure name = "powerSupply" supportName = "generic" > <include href = "powerSupplyCommon.xml" /> </structure> <recordType name = "powerSupply" supportName = "generic" > <include href = "common.xml" /> <include href = "powerSupplyCommon.xml" /> <field name = "supportArray" type = "array" elementType = "structure" supportName = "supportArray" /> </recordType> <support name = "powerSupplyCurrent" factoryName = "org.epics.ioc.support.PowerSupplyFactory" /> </DBDefinition> powerSupplyRecord.xml ICALEPCS/EPICS Meeting
<record name = "ps" type = "powerSupply" > <voltage> <!-- do something to get voltage --> </voltage> <current> <input supportName = "powerSupplyCurrent" /> </current> </record> powerSupplyExample.xml ICALEPCS/EPICS Meeting
The following defines a recordType that can hold an array of powerSupply <?xml version="1.0" ?> <DBDefinition> <recordType name = "powerSupplyArray" supportName = "generic" > <include href = "common.xml" /> <!-- instance must each element a powerSupply structure --> <field name = "supply" type = "array” elementType = “structure”/> <field name = "alarm" type = "structure"/> <field name = "timeStamp" type = "structure" /> </recordType> powerSupplyArray ICALEPCS/EPICS Meeting
<record name = "psArray" type = "powerSupplyArray" > <supply capacity = “2”> <value structureName = “powerSupply” > <!-- do something to get voltage --> <current> <input supportName = "powerSupplyCurrent" /> </current> </value> <value structureName = “powerSupply” > <!-- do something to get voltage --> <current> <input supportName = "powerSupplyCurrent" /> </current> </value> </supply> </record> psArrayExample.xml ICALEPCS/EPICS Meeting
ICALEPCS/EPICS Meeting Finding Fields • A V3 client could ask for • ai.value • ai.input.value • ps.power.value • ps.current.value • ps.voltage.value • psArray.supply[0].power.value • psArray.supply[1].current.value
ICALEPCS/EPICS Meeting portDriver • Same functionality as asyn • AsynManager does not exist • Methods moved to User, Port, or Device • Easier to understand: Code and Doc • See javaDoc for org.epics.ioc.pdrv • NOT Ready for use • NO real drivers have been implemented • STREAMS not implemented • devGpib will not be implemented
Interface User { public static final int REASON_SIGNAL = -1; User duplicateUser(QueueRequestCallback queueRequestCallback); Port connectPort(String portName); void disconnectPort(); Port getPort(); Device connectDevice(int addr); void disconnectDevice(); Device getDevice(); void queueRequest(QueuePriority queuePriority); void cancelRequest(); Status lockPort(); void unlockPort(); void setMessage(String message); String getMessage(); void setTimeout(double timeout); double getTimeout(); User.java ICALEPCS/EPICS Meeting
void setDeviceDriverPvt(Object deviceDriverPvt); Object getDeviceDriverPvt(); void setUserPvt(Object userPvt); Object getUserPvt(); void setReason(int reason); int getReason(); void setAuxStatus(int auxStatus); int getAuxStatus(); void setInt(int value); int getInt(); void setDouble(double value); double getDouble(); void setString(String value); String getString(); } User.java continued ICALEPCS/EPICS Meeting