javaioc marty kraimer epics collaboration meeting icalepcs october 13-14 2007

39
JavaIOC Marty Kraimer EPICS Collaboration Meeting ICALEPCS October 13-14 2007

Upload: rosaline-craig

Post on 26-Dec-2015

215 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: JavaIOC Marty Kraimer EPICS Collaboration Meeting ICALEPCS October 13-14 2007

JavaIOC

Marty KraimerEPICS Collaboration Meeting

ICALEPCS October 13-14 2007

Page 2: JavaIOC Marty Kraimer EPICS Collaboration Meeting ICALEPCS October 13-14 2007

October 2007 ICALEPCS/EPICS Meeting 2

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

Page 3: JavaIOC Marty Kraimer EPICS Collaboration Meeting ICALEPCS October 13-14 2007

October 2007 ICALEPCS/EPICS Meeting 3

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.

Page 4: JavaIOC Marty Kraimer EPICS Collaboration Meeting ICALEPCS October 13-14 2007

October 2007 ICALEPCS/EPICS Meeting 4

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

Page 5: JavaIOC Marty Kraimer EPICS Collaboration Meeting ICALEPCS October 13-14 2007

October 2007 ICALEPCS/EPICS Meeting 5

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!!

Page 6: JavaIOC Marty Kraimer EPICS Collaboration Meeting ICALEPCS October 13-14 2007

October 2007 ICALEPCS/EPICS Meeting 6

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.

Page 7: JavaIOC Marty Kraimer EPICS Collaboration Meeting ICALEPCS October 13-14 2007

October 2007 ICALEPCS/EPICS Meeting 7

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

Page 8: JavaIOC Marty Kraimer EPICS Collaboration Meeting ICALEPCS October 13-14 2007

October 2007 ICALEPCS/EPICS Meeting 8

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

Page 9: JavaIOC Marty Kraimer EPICS Collaboration Meeting ICALEPCS October 13-14 2007

October 2007 ICALEPCS/EPICS Meeting 9

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

Page 10: JavaIOC Marty Kraimer EPICS Collaboration Meeting ICALEPCS October 13-14 2007

October 2007 ICALEPCS/EPICS Meeting 10

Types Removed

Previously javaIOC had types link enum menu

link replaced by support for structure enum and menu replaced by enumerated

structure

Page 11: JavaIOC Marty Kraimer EPICS Collaboration Meeting ICALEPCS October 13-14 2007

October 2007 ICALEPCS/EPICS Meeting 11

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" />

Page 12: JavaIOC Marty Kraimer EPICS Collaboration Meeting ICALEPCS October 13-14 2007

October 2007 ICALEPCS/EPICS Meeting 12

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

Page 13: JavaIOC Marty Kraimer EPICS Collaboration Meeting ICALEPCS October 13-14 2007

October 2007 ICALEPCS/EPICS Meeting 13

alarmSeverity

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>

Page 14: JavaIOC Marty Kraimer EPICS Collaboration Meeting ICALEPCS October 13-14 2007

October 2007 ICALEPCS/EPICS Meeting 14

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

Page 15: JavaIOC Marty Kraimer EPICS Collaboration Meeting ICALEPCS October 13-14 2007

October 2007 ICALEPCS/EPICS Meeting 15

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

Page 16: JavaIOC Marty Kraimer EPICS Collaboration Meeting ICALEPCS October 13-14 2007

October 2007 ICALEPCS/EPICS Meeting 16

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.

Page 17: JavaIOC Marty Kraimer EPICS Collaboration Meeting ICALEPCS October 13-14 2007

October 2007 ICALEPCS/EPICS Meeting 17

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”

Page 18: JavaIOC Marty Kraimer EPICS Collaboration Meeting ICALEPCS October 13-14 2007

October 2007 ICALEPCS/EPICS Meeting 18

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

Page 19: JavaIOC Marty Kraimer EPICS Collaboration Meeting ICALEPCS October 13-14 2007

October 2007 ICALEPCS/EPICS Meeting 19

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

Page 20: JavaIOC Marty Kraimer EPICS Collaboration Meeting ICALEPCS October 13-14 2007

October 2007 ICALEPCS/EPICS Meeting 20

doubleCommon.xml

<?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>

Page 21: JavaIOC Marty Kraimer EPICS Collaboration Meeting ICALEPCS October 13-14 2007

October 2007 ICALEPCS/EPICS Meeting 21

doubleRecord.xml

<?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>

Page 22: JavaIOC Marty Kraimer EPICS Collaboration Meeting ICALEPCS October 13-14 2007

October 2007 ICALEPCS/EPICS Meeting 22

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

Page 23: JavaIOC Marty Kraimer EPICS Collaboration Meeting ICALEPCS October 13-14 2007

October 2007 ICALEPCS/EPICS Meeting 23

display.xml

<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>

Page 24: JavaIOC Marty Kraimer EPICS Collaboration Meeting ICALEPCS October 13-14 2007

October 2007 ICALEPCS/EPICS Meeting 24

record instance

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>

Page 25: JavaIOC Marty Kraimer EPICS Collaboration Meeting ICALEPCS October 13-14 2007

October 2007 ICALEPCS/EPICS Meeting 25

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

Page 26: JavaIOC Marty Kraimer EPICS Collaboration Meeting ICALEPCS October 13-14 2007

October 2007 ICALEPCS/EPICS Meeting 26

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.

Page 27: JavaIOC Marty Kraimer EPICS Collaboration Meeting ICALEPCS October 13-14 2007

October 2007 ICALEPCS/EPICS Meeting 27

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

Page 28: JavaIOC Marty Kraimer EPICS Collaboration Meeting ICALEPCS October 13-14 2007

October 2007 ICALEPCS/EPICS Meeting 28

Analog Input Instance

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>

Page 29: JavaIOC Marty Kraimer EPICS Collaboration Meeting ICALEPCS October 13-14 2007

October 2007 ICALEPCS/EPICS Meeting 29

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

Page 30: JavaIOC Marty Kraimer EPICS Collaboration Meeting ICALEPCS October 13-14 2007

October 2007 ICALEPCS/EPICS Meeting 30

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

Page 31: JavaIOC Marty Kraimer EPICS Collaboration Meeting ICALEPCS October 13-14 2007

October 2007 ICALEPCS/EPICS Meeting 31

powerSupplyCommon.xml

<?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>

Page 32: JavaIOC Marty Kraimer EPICS Collaboration Meeting ICALEPCS October 13-14 2007

October 2007 ICALEPCS/EPICS Meeting 32

powerSupplyRecord.xml

<?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>

Page 33: JavaIOC Marty Kraimer EPICS Collaboration Meeting ICALEPCS October 13-14 2007

October 2007 ICALEPCS/EPICS Meeting 33

powerSupplyExample.xml

<record name = "ps" type = "powerSupply" > <voltage> <!-- do something to get voltage --> </voltage> <current> <input supportName = "powerSupplyCurrent" /> </current></record>

Page 34: JavaIOC Marty Kraimer EPICS Collaboration Meeting ICALEPCS October 13-14 2007

October 2007 ICALEPCS/EPICS Meeting 34

powerSupplyArray

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>

Page 35: JavaIOC Marty Kraimer EPICS Collaboration Meeting ICALEPCS October 13-14 2007

October 2007 ICALEPCS/EPICS Meeting 35

psArrayExample.xml

<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>

Page 36: JavaIOC Marty Kraimer EPICS Collaboration Meeting ICALEPCS October 13-14 2007

October 2007 ICALEPCS/EPICS Meeting 36

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

Page 37: JavaIOC Marty Kraimer EPICS Collaboration Meeting ICALEPCS October 13-14 2007

October 2007 ICALEPCS/EPICS Meeting 37

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

Page 38: JavaIOC Marty Kraimer EPICS Collaboration Meeting ICALEPCS October 13-14 2007

October 2007 ICALEPCS/EPICS Meeting 38

User.javaInterface 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();

Page 39: JavaIOC Marty Kraimer EPICS Collaboration Meeting ICALEPCS October 13-14 2007

October 2007 ICALEPCS/EPICS Meeting 39

User.java continued

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();}