Accelerator Independent Data Access / PVAccess 2.0
AIDA-PVA is the latest version of the AIDA framework. Built on top of EPICS 7 it enables client applications to programmatically access and manage any device or database on the SLAC Network using simple channel names.
|
key | field / method | description |
---|---|---|
any_type | The argument to ML can be a variable of any type. | |
builder | A Java class that allows you to build of requests before execution | |
dynamic | Any dynamically instantiated matlab type | |
fieldName | Within an AidaPvaStruct this is a field's name | |
exception | exception caught by a matlab try catch block | |
fieldValue | Within an AidaPvaStruct this is a field's value | |
jstruct | A Java structure that can be used as an argument or value | |
nturi | A special type of PVStructure that corresponds to the NTURI Normative Type | |
message | Custom message for handleExceptions | |
name | The name of a parameter / argument to the request. | |
nturi | A special type of PVStructure that corresponds to the NTURI Normative Type. | |
Object | A Java Object | |
PvaTable | A Java PvaTable object | |
size | Contains size of vectors in this table | |
labels | A Java Object [] array of Java Strings | |
get(name) | Method that will return a Java Object [] array of Java Objects for the named vector in this table. The objects are of the Java type of the column vector | |
pvName | The name of the Process Variable / EPICS channel that you'll be requesting data from | |
PVStructure | An EPICS data type conforming to the Normative Type specifications. (see Normative Types) | |
scalar | A scalar matlab type | |
type | An AIDA-PVA type from the list below: | |
AIDA_BOOLEAN | ||
AIDA_BYTE | ||
AIDA_SHORT | ||
AIDA_INTEGER | ||
AIDA_LONG | ||
AIDA_STRING | ||
AIDA_BOOLEAN_ARRAY | ||
AIDA_BYTE_ARRAY | ||
AIDA_SHORT_ARRAY | ||
AIDA_INTEGER_ARRAY | ||
AIDA_LONG_ARRAY | ||
AIDA_STRING_ARRAY | ||
AIDA_TABLE | ||
value | Any matlab scalar value or array you want to set the given Process Variable / channel, or request argument to. | |
void | No value is returned |
In functions, you need to use the aidapva
script to bring the aida-pva-client api into the function scope. From the commandline or in scripts this is not necessary.
In matlab 2012 you can't chain functions together so instead of writing this:
you have to write it on separate lines thus:
Matlab 2012 creates an exception message that includes much of the stack trace instead of just the short reason message that the original exception contains. Matlab 2020 contains the correct message. So instead of seeing this for errors:
You will see this in Matlab 2012
In matlab 2020 you can represent a string as as follows:
In matlab 2012 you can only use single quotes
return | function | parameters | description |
---|---|---|---|
void | aidapvainit | () | to initialise access to the AIDA-PVA framework. |
void | aidapvafninit | () | to initialise access to the AIDA-PVA framework for functions. Do not call this function directly, it is called automatically from aidapvainit.m |
void | aidapva | () | to bring aida-pva-client functions into a function's scope. Only used at the top of function definitions before calling any aida-pva-client functions. |
return | function | parameters | description |
---|---|---|---|
scalar, Object[], PvaTable | pvaGet | (pvName[, type]) | takes a pvName and an optional type and makes a data request |
dynamic | pvaGetM | (pvName[, type]) | takes a pvName and an optional type and makes a data request returning a matlab type directly |
e.g. PvaGetM
e.g. PvaGet
return | function | parameters | description |
---|---|---|---|
void, PvaTable | pvaSet | (pvName, value) | set() the pvName to the given value |
dynamic | pvaSetM | (pvName, value) | set() the pvName to the given value returning a matlab type directly |
e.g. pvaSet
e.g. pvaSetM
return | function | parameters | description |
---|---|---|---|
builder | pvaRequest | (pvName) | takes a pvName and creates a request builder |
builder | builder. with | (name, value/jstruct) | specifies a request parameter and its value |
builder | builder. returning | (type) | specified the type to return from the request |
scalar, Object[], PvaTable | builder. get | () | executes the get request |
void, PvaTable | builder. set | (value/jstruct) | executes the set request with the given value or jstruct |
nturi | builder. uri | () | to create an NTURI PVStructure (see Normative Types) for use with EPICS/AIDA-PVA data providers |
e.g. complex get request
e.g with returning
e.g. complex set request
e.g. another complex set request
e.g. use uri to obtain an NTURI for use with PvaClient
e.g. use uri to obtain an NTURI for use with EasyPVA
return | function | parameters | description |
---|---|---|---|
jstruct | AidaPvaStruct | () | to create a Java structure that can be passed to AIDA-PVA request builders as an argument. |
jstruct. put | (fieldName, fieldValue) | specifies a value for given field in the AidaPvaStruct |
e.g. creating a AidaPvaStruct Java structure for an argument or value
return | function | parameters | description |
---|---|---|---|
dynamic | ML | (any_type) | convert any parameters to dynamic matlab type |
e.g. ML data conversion of results
return | function | parameters | description |
---|---|---|---|
PVStructure | pvarpc | (nturi) | takes an NTURI and executes it using PvaClient |
e.g. pvarpc PvaClient executor example
return | function | parameters | description |
---|---|---|---|
PVStructure | ezrpc | (nturi) | takes an NTURI and executes it using EasyPVA |
e.g. ezrpc EasyPVA executor example
return | function | parameters | description |
---|---|---|---|
void | handleExceptions | (exception, [message]) | takes a matlab exception object, and an optional error message text and handles the error in a standard way |
EasyPVA and aida-pva-client propagate errors back from the Channel Provider to the matlab client however PvaClient does not.
You can write code to intercept error that occur and display a short message. We've provided a small function that does this for you.
All data returned from AIDA-PVA comes back in the form of a PVStructure. This PVStructure conforms to the Normative Type
specifications. Tables come back as a special type of Normative type, the NTTable. (see Normative Types).
When we convert this table data to a matlab structure the structure contains the following fields:
size
: integer size of the homogenous vectorslabels
: array of labels for the vectorsunits
: if available an array containing the units for the vectorsdescription
: if available an array containing the description for the vectorsvalues.<field>
: array containing the value of the specified field. e.g. table.values.names
contains an array of names
EasyPVA and PvaClient don't convert a returned NTTable to a matlab structure. But you can use the ML function to convert it for you.
e.g. Convert EasyPVA and PvaClient NTTables to matlab structure
These methods return tables in Java PvaTable format.
e.g. You can convert the response like this.
e.g. Or you can use the PvaTable directly like this.
When these functions return tables they are automatically formatted as matlab structures.
e.g.: Automatically generated matlab structures
In legacy AIDA types were coded using constant numbers from this table. Replace codes or types with the corresponding AIDA-PVA type.
Code | Legacy AIDA Type | AIDA-PVA Type |
---|---|---|
0 | STRUCT | AidaPvaStruct |
1 | BOOLEAN | AIDA_BOOLEAN |
2 | BYTE | AIDA_BYTE |
3 | CHAR | unsupported use AIDA_BYTE |
4 | DOUBLE | AIDA_DOUBLE |
5 | FLOAT | AIDA_FLOAT |
6 | LONG | AIDA_LONG |
7 | LONGDOUBLE | unsupported use AIDA_DOUBLE |
8 | LONGLONG | unsupported use AIDA_LONG |
9 | SHORT | AIDA_SHORT |
10 | STRING | AIDA_STRING |
11 | ULONG | unsupported use AIDA_LONG |
12 | ULONGLONG | unsupported use AIDA_LONG |
13 | USHORT | unsupported use AIDA_SHORT |
14 | WCHAR | unsupported use AIDA_BYTE |
15 | WSTRING | unsupported use AIDA_STRING |
51 | BOOLEANA | AIDA_BOOLEAN_ARRAY |
52 | BYTEA | AIDA_BYTE_ARRAY |
53 | CHARA | unsupported use AIDA_BYTE_ARRAY |
54 | DOUBLEA | AIDA_DOUBLE_ARRAY |
55 | FLOATA | AIDA_FLOAT_ARRAY |
56 | LONGA | AIDA_LONG_ARRAY |
57 | LONGDOUBLEA | unsupported use AIDA_DOUBLE_ARRAY |
58 | LONGLONGA | unsupported use AIDA_LONG_ARRAY |
59 | SHORTA | AIDA_SHORT_ARRAY |
60 | STRINGA | AIDA_STRING_ARRAY |
61 | ULONGA | unsupported use AIDA_LONG_ARRAY |
62 | ULONGLONGA | unsupported use AIDA_LONG_ARRAY |
63 | USHORTA | unsupported use AIDA_SHORT_ARRAY |
64 | WCHARA | unsupported use AIDA_BYTE_ARRAY |
65 | WSTRINGA | unsupported use AIDA_STRING_ARRAY |
99 | ANYA | unsupported |
General substitutions to apply in legacy AIDA code.
pattern | Migration Action/Replacement |
---|---|
import edu.stanford.slac.aida.lib.da.DaObject;
import edu.stanford.slac.aida.lib.da.*;
import edu.stanford.slac.aida.lib.util.common.*;
|
aidapva;
|
da = DaObject();
| Remove |
da.setParam('BEAM', 1);
|
builder = pvaRequest('KLYS:LI31:31:TACT');
builder = builder.with('BEAM', '1');
|
result=da.get(pvName,4);
|
result = ML(pvaRequest(pvName).returning(AIDA_DOUBLE).get());
or result = pvaGetM(pvName, AIDA_DOUBLE);
|
result.getAsDouble
|
result
|
result.getAsDoubles
|
result
|
values = result.get(4).getAsDoubles;
|
values = result.values.x;
|
value=DaValue(java.lang.Short(10));
result=da.setDaValue(channel, value);
|
result=pvaRequest(channel).set(10);
or result=pvaSet(channel, 10);
or (if the result is a table) result=pvaSetM(channel, 10);
|
IN:ST:ANCE//ATTRIBUTE
|
IN:ST:ANCE:ATTRIBUTE
|
The following source code is delivered in matlab under the ./src
directory
src/
aidapva.msrc/
aidapvainit.msrc/
aidapvafninit.msrc/
ezrpc.m - A script that can be called to make requests based on ezPVA has been created. Extracted from erpc.m.src/
handleExceptions.msrc/
ML.msrc/
pvaGet.msrc/
pvaGetM.msrc/
pvarpc.m - A script that can be called to make requests based on PvaClient has been created. Extracted from erpc.m.src/
toArray.m - To convert to an array. Do not call this directly use ML.m if necessary.