pwrrt
index
/data0/x7-0-0/rls/os_linux/hw_x86_64/exp/exe/pwrrt.so

ProviewR Runtime Python API
 
The runtime Python API contains a number of classes and functions
to get information about the objects in the ProviewR runtime database.
There are function to find objects and investigate their relationship
to other objects and to examine the structure and content of the objects.
There are also functions to set up subscriptions to continuously get new
updates of attribute values.
 
The API contains the classes
 
Oid       object in the runtime database.
Aref      attribute in the runtime database.
Sub       subscription.
Cid       class.
Tid       type.
ADef      attribute definition
Appl      application class
 
Type help(pwrrt.Oid), help(pwrrt.Aref) etc to get more information about
these classes.

 
Classes
       
builtins.object
ADef
Appl
Aref
Cid
Oid
Sub
Tid

 
class ADef(builtins.object)
    Proview attribute definition
 
  Methods defined here:
__init__(self, /, *args, **kwargs)
Initialize self.  See help(type(self)) for accurate signature.
__repr__(self, /)
Return repr(self).
__str__(self, /)
Return str(self).
cid()
Get the class identity for the attribute definition object.
 
Returns
-------
Returns the class identity as an integer value.
elements()
Get number of elements of the attribute.
 
Returns
-------
Returns the number of elements.
flags()
Get flags word of the attribute.
 
Returns
-------
Returns the flags as an integer value.
name()
Get the name of the attribute.
 
Returns
-------
Returns a string with the attribute name.
 
Example
-------
c = pwrrt.Cid('$PlantHier')
for adef in c.attributes():
  print adef.name()
'Description'
'DefGraph'
...
offset()
Get offset of the attribute.
 
Returns
-------
Returns an integer value with the offset.
size()
Get size of the attribute.
 
Returns
-------
Returns an integer value with the size.
typeref(...)
offset()
--
 
Get TypeRef of the attribute.
 
Returns
-------
Returns an integer value with the TypeRef.

Static methods defined here:
__new__(*args, **kwargs) from builtins.type
Create and return a new object.  See help(type) for accurate signature.

 
class Appl(builtins.object)
    ProviewR runtime application. See pwrrt.application()
 
  Methods defined here:
__init__(self, /, *args, **kwargs)
Initialize self.  See help(type(self)) for accurate signature.
__repr__(self, /)
Return repr(self).
__str__(self, /)
Return str(self).
log(severity, text)
Log to the Proview logfile (System messages).
 
Arguments
---------
severity  String
  Message severity. Can be 'info', 'warning', 'error' or 'fatal'.
 
text      String
  Text to log.
 
Example
-------
a.log('fatal', 'Application terminating.')
quit()
mainloop()
Application mainloop. Calls the open callback function att start. Then
the scan callback function is called cyclically with the specified scantime.
Finally the close callback function is called as shutdown.
 
Example
-------
def open_cb():
  print 'Startup up'
 
def close_cb():
  print 'Closing down'
 
def scan_cb():
  print 'Scanning'
 
a = pwrrt.Appl('MyAppl','Nodes-DemoNode-Apps-MyAppl', 61, 1,
               open_cb, scan_cb, close_cb, None)
a.mainloop()
setStatus(status)
Set application status. The status argument is a string with one of the
following values
'none'           No status (0)
'applerror'      Application error
'applfatal'      Application fatal error
'applwarning'    Application warinng
'applinfo'       Application info
'applstartup'    Application starting up
'applrun'        Application running
'applterm'       Application terminated
 
Example
-------
def open_cb():
  a.setStatus('applrun')
 
def close_cb():
  a.setStatus('applterm')
 
def scan_cb():
  a.setStatus('applrun')
 
a = pwrrt.Appl('MyAppl','Nodes-DemoNode-Apps-MyAppl', 60, 1,
               open_cb, scan_cb, close_cb, None)
a.mainloop()

Static methods defined here:
__new__(*args, **kwargs) from builtins.type
Create and return a new object.  See help(type) for accurate signature.

 
class Aref(builtins.object)
    Proview runtime object
 
  Methods defined here:
__eq__(self, value, /)
Return self==value.
__ge__(self, value, /)
Return self>=value.
__gt__(self, value, /)
Return self>value.
__init__(self, /, *args, **kwargs)
Initialize self.  See help(type(self)) for accurate signature.
__le__(self, value, /)
Return self<=value.
__lt__(self, value, /)
Return self<value.
__ne__(self, value, /)
Return self!=value.
__repr__(self, /)
Return repr(self).
__str__(self, /)
Return str(self).
arefStr()
Get attribute reference as a string.
 
Returns
-------
Returns a string with the attribute reference.
 
Example
-------
o = pwrrt.attribute('H1-Dv1.ActualValue')
print a.arefStr()
'_A0.1.200.3:334(_T0.2:0.111.1)[88.4]'
fullName()
Get the full name of the attribute.
Returns the full attribute name, including volume and path.
 
Returns
-------
Returns a string with the full attribute name.
 
Example
-------
a = pwrrt.attribute('H1-H2-Dv1.ActualValue')
print a.fullName()
name()
Get the name of the attribute.
Returns the last segment of the object and attribute name, without
 the path.
 
Returns
-------
Returns a string with the attribute name.
 
Example
-------
a = pwrrt.attribute('H1-H2-Dv1.ActualValue')
print a.name()
setValue(value, publicwrite)
Set the value of an attribute.
Set is only permitted if a user with RtWrite or System privileges
is logged in, or if the attribute is an attribute with public write
permissions. In this case the public write argument should be set to 1.
 
Implemented for attributes and array of attributes of type 
Boolean, Int8, UInt8, Int16, UInt16, Int32, UInt32, Int64, UInt64, Float32, Float64,
Enum, Mask, Status, NetStatus, String, Text, Time, DeltaTime, Objid and AttrRef.
 
Arrays are set with Lists or Tuples. The size of the List or Tuple has to match
the size of the array.
 
Arguments
---------
value         Arbitrary type
  Value to set into attribute.
publicwrite   Optional Integer
  1 if value is set to an attribute with public write permissions.
 
Example
-------
pwrrt.login('pwrp', 'somepassword')
a = pwrrt.attribute('H1-H2-Dv1.ActualValue')
a.setValue(1)
 
a2 = pwrrt.attribute('H1-H2-A1.TempArray')
a2.setValue([21.0,23.3,23.3,22.3,22.0])
subscribe()
Set up a subscription on an attribute.
 
Returns
-------
Returns a Sub object for the subscription.
 
Example
-------
a = pwrrt.object('H1-H2-Dv1.ActualValue')
sub = a.subscribe()
print sub.value()
tid()
Get attribute type.
 
Returns
-------
Returns a Tid object for the type.
 
Example
-------
a = pwrrt.attribute('H1-Dv1.ActualValue')
t = o.tid()
print t.fullName()
value()
Get the value of an attribute.
 
Implemented for attributes and array of attributes of type 
Boolean, Int8, UInt8, Int16, UInt16, Int32, UInt32, Int64, UInt64, Float32, Float64,
Enum, Mask, Status, NetStatus, String, Text, Time, DeltaTime, Objid and AttrRef.
 
Returns
-------
Returns the value of the attribute.
For arrays, a Tuple with the values are returned
 
Example
-------
a = pwrrt.attribute('H1-Dv1.ActualValue')
print a.value()

Static methods defined here:
__new__(*args, **kwargs) from builtins.type
Create and return a new object.  See help(type) for accurate signature.

Data and other attributes defined here:
__hash__ = None

 
class Cid(builtins.object)
    Proview runtime class
 
  Methods defined here:
__eq__(self, value, /)
Return self==value.
__ge__(self, value, /)
Return self>=value.
__gt__(self, value, /)
Return self>value.
__init__(self, /, *args, **kwargs)
Initialize self.  See help(type(self)) for accurate signature.
__le__(self, value, /)
Return self<=value.
__lt__(self, value, /)
Return self<value.
__ne__(self, value, /)
Return self!=value.
__repr__(self, /)
Return repr(self).
__str__(self, /)
Return str(self).
attrObject()
Get the first instance of the class, including attribute objects.
 
Returns
-------
Returns an Aref object for the first instance of the class.
 
Example
-------
cid = pwrrt.Cid('Di')
a = cid.attrObject()
while a:
  print a.fullName()
  a = cid.nextAttrObject(a)
attrObjects()
Get all instances of the class, including attribute objects.
 
Returns
-------
Returns tuple of Aref object for all instance of the class.
 
Example
-------
cid = pwrrt.Cid('Di')
for a in cid.attrObjects():
  print a.fullName()
attributes()
Get all attributes defined in the class.
 
Returns
-------
Returns tuple of ADef objects for all the defined attributes in
the class.
 
Example
-------
cid = pwrrt.Cid('$PlantHier')
for adef in cid.attributes():
  print adef.name(), adef.offset(), adef.size()
fullName()
Get the full name of the class object.
 
Returns
-------
Returns a string with the class name.
 
Example
-------
c = pwrrt.Cid('$PlantHier')
print c.fullName()
'pwrs:Class-$PlantHier'
name()
Get the name of the class.
 
Returns
-------
Returns a string with the class name.
 
Example
-------
c = pwrrt.Cid('$PlantHier')
print c.name()
'$PlantHier'
nextAttrObject(attribute)
Get the next instance of the class, including attribute objects.
 
Arguments
---------
attribute  Aref object
  An Aref object for the previous instance.
 
Returns
-------
Returns an Aref object for the next instance of the class.
 
Example
-------
cid = pwrrt.Cid('Di')
a = cid.attrObject()
while a:
  print a.fullName()
  a = cid.nextAttrObject(a)
nextObject(object)
Get the next instance of the class.
 
Arguments
---------
object  Oid object
  An Oid object for the previous instance.
 
Returns
-------
Returns an Oid object for the next instance of the class.
 
Example
-------
cid = pwrrt.Cid('$PlantHier')
o = cid.object()
while o:
  print o.fullName()
  o = cid.nextObject(o)
object()
Get the first instance of the class.
The object() method only gets whole objects and doesn't include
attribute objects (see attrObject()).
 
Returns
-------
Returns an Oid object for the first instance of the class.
 
Example
-------
cid = pwrrt.Cid('$PlantHier')
o = cid.object()
while o:
  print o.fullName()
  o = cid.nextObject(o)
objects()
Get all instances of the class.
 
Returns
-------
Returns tuple of Oid object for all instance of the class.
 
Example
-------
cid = pwrrt.Cid('$PlantHier')
for o in cid.objects():
  print o.fullName()

Static methods defined here:
__new__(*args, **kwargs) from builtins.type
Create and return a new object.  See help(type) for accurate signature.

Data and other attributes defined here:
__hash__ = None

 
class Oid(builtins.object)
    ProviewR runtime object
 
The Oid object represents a ProviewR object.
 
  Methods defined here:
__eq__(self, value, /)
Return self==value.
__ge__(self, value, /)
Return self>=value.
__gt__(self, value, /)
Return self>value.
__init__(self, /, *args, **kwargs)
Initialize self.  See help(type(self)) for accurate signature.
__le__(self, value, /)
Return self<=value.
__lt__(self, value, /)
Return self<value.
__ne__(self, value, /)
Return self!=value.
__repr__(self, /)
Return repr(self).
__str__(self, /)
Return str(self).
attribute(attributeName)
Get an attribute within the object.
 
Arguments
---------
attributeName String
  Name of attribute.
 
Returns
-------
Returns an Aref object for the attribute.
 
Example
-------
o = pwrrt.object('H1-Dv1')
a = o.attribute('ActualValue')
print a.value()
child()
Get first child of the object.
 
Returns
-------
Returns an Oid object for the first child.
 
Example
-------
o = pwrrt.object('H1-H2')
child = o.child()
while child:
  print child.name()
  child = child.next()
children()
Get all children of the object.
 
Returns
-------
Returns a tuple containg Oid objects for all children of the object.
 
Example
-------
o = pwrrt.object('H1-H2')
for child in o.children()
  print child.name()
cid()
Get object class.
 
Returns
-------
Returns a Cid object for the class.
 
Example
-------
o = pwrrt.object('H1-Dv1')
c = o.cid()
print c.fullName()
fullName()
Get the full name of the object.
Returns the full object name, including volume and path.
 
Returns
-------
Returns a string with the full object name.
 
Example
-------
o = pwrrt.object('H1-H2')
print o.fullName()
name()
Get the name of the object.
Returns the last segment of the object name, without the path.
 
Returns
-------
Returns a string with the object name.
 
Example
-------
o = pwrrt.object('H1-H2')
print o.name()
next()
Get the next sibling of the object.
 
Returns
-------
Returns an Oid object for the sibling. If no next sibling exist, a
None object is returned.
 
Example
-------
o = pwrrt.object('H1-H2')
child = o.child()
while (child):
  print child.name()
  child = child.next()
oidStr()
Get object identity as a string.
 
Arguments
---------
format Optional String
  If not supplied oix is in decimal form.
  'hex' oix in hexadecimal.
  'file' for hex file format.
 
Returns
-------
Returns a string with the object identity.
 
Example
-------
o = pwrrt.object('H1-Dv1')
print o.oidStr()
'_O0.1.200.3:334'
parent()
Get the parent of the object.
 
Returns
-------
Returns an Oid object for the parent.
 
Example
-------
o = pwrrt.object('H1-H2')
parent = o.parent()
print parent.name()

Static methods defined here:
__new__(*args, **kwargs) from builtins.type
Create and return a new object.  See help(type) for accurate signature.

Data and other attributes defined here:
__hash__ = None

 
class Sub(builtins.object)
    ProviewR subscription. See pwrrt.subscribe()
 
  Methods defined here:
__init__(self, /, *args, **kwargs)
Initialize self.  See help(type(self)) for accurate signature.
__repr__(self, /)
Return repr(self).
__str__(self, /)
Return str(self).
close()
Close subscription.
setValue(value)
Set the value of the subscribed attribute.
Only subscriptions to local attributes can be set.
 
Implemented for attributes of type 
Boolean, Int8, UInt8, Int16, UInt16, Int32, UInt32, Int64, UInt64, Float32, Float64,
Enum, Mask, Status, NetStatus, String, Text, Time, DeltaTime, Objid and AttrRef.
 
Arguments
---------
value   Arbitrary type
  The value to set into the subscribed attribute. Only subscriptions
  to local objects can be set.
value()
Get the value of the subscribed attribute.
 
Implemented for attributes and array of attributes of type 
Boolean, Int8, UInt8, Int16, UInt16, Int32, UInt32, Int64, UInt64, Float32, Float64,
Enum, Mask, Status, NetStatus, String, Text, Time, DeltaTime, Objid and AttrRef.
 
Returns
-------
Returns the subscription value.
For arrays a Tuple of the values are returned.

Static methods defined here:
__new__(*args, **kwargs) from builtins.type
Create and return a new object.  See help(type) for accurate signature.

 
class Tid(builtins.object)
    Proview runtime class
 
  Methods defined here:
__eq__(self, value, /)
Return self==value.
__ge__(self, value, /)
Return self>=value.
__gt__(self, value, /)
Return self>value.
__init__(self, /, *args, **kwargs)
Initialize self.  See help(type(self)) for accurate signature.
__le__(self, value, /)
Return self<=value.
__lt__(self, value, /)
Return self<value.
__ne__(self, value, /)
Return self!=value.
__repr__(self, /)
Return repr(self).
__str__(self, /)
Return str(self).
fullName()
Get the full name of the type object.
 
Returns
-------
Returns a string with the full type name.
 
Example
-------
a = pwrrt.attribute('H1-H2-Dv1.ActualValue')
tid = a.tid()
print tid.fullName()
'pwrs:Type-$Boolean'
name()
Get the name of the type.
 
Returns
-------
Returns a string with the type name.
 
Example
-------
a = pwrrt.attribute('H1-H2-Dv1.ActualValue')
tid = a.tid()
print tid.name()
'$Boolean'

Static methods defined here:
__new__(*args, **kwargs) from builtins.type
Create and return a new object.  See help(type) for accurate signature.

Data and other attributes defined here:
__hash__ = None

 
Functions
       
application(name, applobject, anix, scantime, open_cb, scan_cb, close_cb, userobject)
Create an application
 
-----------
Arguments
---------
name        String
  Application name.
applobject  String
  Application object in the node hierarchy.
anix        Integer
  Application index (errh_eAnix). A value between 61 and 110.
scantime    Float
  Scan time.
open_cb     Function
  Callback function called at startup.
scan_cb     Function
  Callback function called cyclically with the scantime.
close_cb   Function
  Callback function called at shutdown.
userobject Object
  An object that is supplied to the callback functions.
 
Example
-------
def open_cb():
  print 'Startup up'
 
def close_cb():
  print 'Closing down'
 
def scan_cb():
  print 'Scanning'
 
a = pwrrt.application('MyAppl','Nodes-DemoNode-Apps-MyAppl', 61, 1,
                      open_cb, scan_cb, close_cb, None)
a.mainloop()
attribute(attributeName)
Get an attribute.
 
Arguments
---------
attributeName String
  Name of the attribute.
 
Returns
-------
Returns an Aref object for the attribute.
 
Example
-------
a = pwrrt.attribute('Demo-Ge-Dynamics-DigLowColor-Dv1.ActualValue')
value = a.value()
getMsg(...)
getMsg(sts)
Convert a status to a string.
Arguments
---------
sts Status
  A proview status value.
 
Returns
-------
Returns the corresponding string.
 
Example
-------
msg = pwrrt.getMsg(sts)
getPriv()
Returns the current privileges
 
Returns
-------
Returns an integer with the current privileges.
 
Example
-------
priv = pwrrt.getPriv()
getSevEvents(...)
Get history events
getSevEventsDataFrame(...)
Get history events data frame
getSevEventsItemList(...)
Get events history item list
getSevItemData(...)
Get history data
getSevItemList(...)
Get history item list
getSevItemsDataFrame(...)
Get history data frame
getSevItemsDataFrameD(...)
Get history data frame discrete
getUser()
Returns the current user
 
Returns
-------
Returns a string with the user.
 
Example
-------
user = pwrrt.getUser()
init(name)
Attach ProviewR runtime.
 
Arguments
---------
name String
  Name of application.
 
Example
-------
pwrrt.init('my_py')
login(username, password)
Login as a ProviewR user. This is usually done to gain write access
to attributes in the database. The privileges RtWrite or System is
required for write access.
 
Arguments
---------
username
  Name of a user defined in the ProviewR user database.
 
password
  Password for the user.
 
Example
-------
pwrrt.login('pwrp', 'mypassword')
logout()
Logout from the previously logged in user.
The privileges will return to RtRead.
 
Example
-------
pwrrt.logout()
object(objectName)
Get an object.
 
Arguments
---------
objectName Optional String
  Name of the object. If not supplied the first root object is returned.
 
Returns
-------
Returns an Oid object for the object.
 
Example
-------
o = pwrrt.object('Demo-Ge-Dynamics')
print o.fullName()
subscribe(attributeName)
Set up an subscription
 
Arguments
---------
attributeName String
  Name of the attribute to subscribe to.
 
Returns
-------
Returns a Sub object for the subscription.
 
Example
-------
sub = pwrrt.subscribe('Demo-Ge-Dynamics-DigLowColor-Dv1.ActualValue')
value = sub.value()
volume(volumeName)
Get volume
 
Arguments
---------
volumeName Optional String
  Name of the volume. If not supplied the first volume is returned.
 
Returns
-------
Returns an Oid object for the volume object.
 
Example
-------
vol = pwrrt.volume('VolPwrDemo')
for o in vol.children():
  print o.fullName()
volumes()
Get all volumes.
 
Returns
-------
Returns a tuple with Oid objects for allt the volumes.
 
Example
-------
for v in pwrrt.volumes():
  print v.name()

 
Data
        FRAME_OPTIONS_CONDITION = 1