Professional Documents
Culture Documents
Mansu Jung
Senior Application Consultant
www.aveva.com
Objectives
Copyright © 2015 AVEVA Solutions Limited and its subsidiaries. All rights reserved.
Contents
▪ Introduction to Dabacon
▪ PML Overview
▪ PML Objects
▪ Macros, Synonyms and Control Logic
▪ PML Functions
▪ Collections
▪ Miscellaneous
▪ Exercise
Copyright © 2015 AVEVA Solutions Limited and its subsidiaries. All rights reserved.
Introduction to
Dabacon
Copyright © 2015 AVEVA Solutions Limited and its subsidiaries. All rights reserved.
DABACON
Database system designed for AVEVA Plant and Marine
Copyright © 2015 AVEVA Solutions Limited and its subsidiaries. All rights reserved.
DABACON
▪ DABACON (DAtaBAse CONstructor) is the database
management system for both AVEVA Plant and Marine. It is
used to construct, navigate and interrogate a database
structure.
Copyright © 2015 AVEVA Solutions Limited and its subsidiaries. All rights reserved.
Dabacon elements can be
manipulated by users.
For example,
You could simply modify attributes of multiple elements at once
Or you could create your own utilities for effective design
Copyright © 2015 AVEVA Solutions Limited and its subsidiaries. All rights reserved.
Then how can you do all these?
You need to be familiar with
PML
Customisation language designed for AVEVA Plant and Marine
Copyright © 2015 AVEVA Solutions Limited and its subsidiaries. All rights reserved.
PML Overview
Copyright © 2015 AVEVA Solutions Limited and its subsidiaries. All rights reserved.
PML - Keywords
▪ PML1
– The first version of PML based on command syntax. String
based and provides IF statement, loops, variables & error
handling
▪ PML2
– Object oriented language extending the ability of PML. Use
of functions, objects and methods to process information
▪ PML .NET
– Provides the platform in PML to display and use objects
created in other .NET languages
▪ Forms
– Most applications are driven by forms and menus. Most
PML will be based on a form.
Copyright © 2015 AVEVA Solutions Limited and its subsidiaries. All rights reserved.
PML 1 style macros
Copyright © 2015 AVEVA Solutions Limited and its subsidiaries. All rights reserved.
Examples of Command Syntax
▪ To apply the standard enhance colour to the current element
– ENHANCE CE / UNENHANCE CE
▪ To apply colour 10 to element /PIPE
– ENHANCE /PIPE COL 10
▪ To draw an unnumbered graphic aid line
– AID LINE NUMBER 1 E0N0U0 TO E0N1000U1000
▪ To remove the graphical aid lines numbered as 1
– AID CLEAR LINE 1
▪ To relatively move the current element east by 1000mm
– BY E 1000
▪ To explicitly position the current element
– AT E0 N1000 U2000
Copyright © 2015 AVEVA Solutions Limited and its subsidiaries. All rights reserved.
Command Syntax Graphs
Copyright © 2015 AVEVA Solutions Limited and its subsidiaries. All rights reserved.
PML2 - A More Powerful Language
Copyright © 2015 AVEVA Solutions Limited and its subsidiaries. All rights reserved.
PML2 Jargon
Functions
Objects
Object Blocks
PMLLIB
.pmlfrm
Copyright © 2015 AVEVA Solutions Limited and its subsidiaries. All rights reserved.
Features Of PML2
Copyright © 2015 AVEVA Solutions Limited and its subsidiaries. All rights reserved.
Examples of object-orientated PML
Copyright © 2015 AVEVA Solutions Limited and its subsidiaries. All rights reserved.
Software Customisation Manual
Copyright © 2015 AVEVA Solutions Limited and its subsidiaries. All rights reserved.
PML Objects
Copyright © 2015 AVEVA Solutions Limited and its subsidiaries. All rights reserved.
Variables
▪ Named variables
– !variablename or !!variablename
– single ! Means a local variable (can only be seen in the current macro)
– double !! Means a global variable
Copyright © 2015 AVEVA Solutions Limited and its subsidiaries. All rights reserved.
Declaring Variables
Copyright © 2015 AVEVA Solutions Limited and its subsidiaries. All rights reserved.
Naming Conventions
Copyright © 2015 AVEVA Solutions Limited and its subsidiaries. All rights reserved.
Special Objects
Copyright © 2015 AVEVA Solutions Limited and its subsidiaries. All rights reserved.
PML Functions and Methods
Copyright © 2015 AVEVA Solutions Limited and its subsidiaries. All rights reserved.
PML1 Hierarchy
▪ PDMSUI Variable
▪ Set PDMSUI=C:\AVEVA\Plant\PDMS12.1.1\pdmsui’
$S CALLP=$M/%PDMSUI%/DES/PIPE/$s1
CALLP MPIPE
Copyright © 2015 AVEVA Solutions Limited and its subsidiaries. All rights reserved.
PML2 Functions, Forms and Objects
▪ PMLLIB Variable
▪ Set PMLLIB=C:\AVEVA\Plant\PDMS12.1.1\pmllib
pmllib
Copyright © 2015 AVEVA Solutions Limited and its subsidiaries. All rights reserved.
Exercise – Updating the Environment Variables
1 ▪ Extract the provided files into the folder a suitable folder, for
example C:\temp\
▪ Right –click on the icon that opens PDMS. Choose Open File Location
Copyright © 2015 AVEVA Solutions Limited and its subsidiaries. All rights reserved.
PML Objects
Copyright © 2015 AVEVA Solutions Limited and its subsidiaries. All rights reserved.
Example of PML objects available in PDMS
Copyright © 2015 AVEVA Solutions Limited and its subsidiaries. All rights reserved.
Example of PML objects available in PDMS
Copyright © 2015 AVEVA Solutions Limited and its subsidiaries. All rights reserved.
Why are PML objects used?
Copyright © 2015 AVEVA Solutions Limited and its subsidiaries. All rights reserved.
How is a PML object used?
Copyright © 2015 AVEVA Solutions Limited and its subsidiaries. All rights reserved.
Exercise – Creating an Object
define object GETELEMENTINFORMATION
member .element is DBREF
member .name is STRING
member .type is STRING
member .position is POSITION
endobject
Copyright © 2015 AVEVA Solutions Limited and its subsidiaries. All rights reserved.
Macros,
Synonyms and
Control Logic
To run a macro:
$M/%PDMSUI%\examples\simpleMac.mac
Copyright © 2015 AVEVA Solutions Limited and its subsidiaries. All rights reserved.
Finding examples of command syntax
▪ If you are not sure of the PDMS Commands you could use one
of the following to find some examples:
– DB Listings Utility
– $Q syntax
– Using standard product
– Reference Manuals
Copyright © 2015 AVEVA Solutions Limited and its subsidiaries. All rights reserved.
Communicating With AVEVA Products in PML
Copyright © 2015 AVEVA Solutions Limited and its subsidiaries. All rights reserved.
A Parameterised Macro
Copyright © 2015 AVEVA Solutions Limited and its subsidiaries. All rights reserved.
More on macros (1)
Copyright © 2015 AVEVA Solutions Limited and its subsidiaries. All rights reserved.
More on macros (2)
Copyright © 2015 AVEVA Solutions Limited and its subsidiaries. All rights reserved.
Variables
Copyright © 2015 AVEVA Solutions Limited and its subsidiaries. All rights reserved.
Setting PML 1 style variables
Copyright © 2015 AVEVA Solutions Limited and its subsidiaries. All rights reserved.
Setting PML 2 style variables
Copyright © 2015 AVEVA Solutions Limited and its subsidiaries. All rights reserved.
Expressions
Copyright © 2015 AVEVA Solutions Limited and its subsidiaries. All rights reserved.
Expression Operators – PML 1 style
▪ Expression operators
+ - / *
LT GT EQ NE LE GE
NOT AND OR
SIN COS TAN SQR POW NEGATE ASIN ACOS ATAN LOG
ALOG ABS INT NINT
!s = 30 * sin(45)
!t = pow(20,2) (raise 20 to the power 2 =400)
!f = (match(name of owner,’LPX’)gt 0)
Copyright © 2015 AVEVA Solutions Limited and its subsidiaries. All rights reserved.
Expression Operators – PML 2 style
!a = 45
!s = 30 * !a.sine()
!b = 20
!t = !b.power(2)
Copyright © 2015 AVEVA Solutions Limited and its subsidiaries. All rights reserved.
Operator Precidence
()
* /
+ -
EQ NE GT LT GE LE
NOT
AND
OR
60 * 2 / 3 + 5 = 45
60 *( 2 / ( 3 + 5)) = 15
Copyright © 2015 AVEVA Solutions Limited and its subsidiaries. All rights reserved.
PML 2 Expressions
For example:
Copyright © 2015 AVEVA Solutions Limited and its subsidiaries. All rights reserved.
Arrays
Copyright © 2015 AVEVA Solutions Limited and its subsidiaries. All rights reserved.
The & Concatenation Operator
!a = 64
!b = 32
!c = !a & !b
q var !c
!d = !a + !b
q var !d
Copyright © 2015 AVEVA Solutions Limited and its subsidiaries. All rights reserved.
Do loops (1)
▪ Example: DoLoop.mac
DO !loopCounter FROM 1 TO 10
!value = !loopCounter * 2
q var !loopCounter !value
ENDDO
Copyright © 2015 AVEVA Solutions Limited and its subsidiaries. All rights reserved.
Do loops (2)
▪ Example: DoBreak.mac
!n = 0
DO
!n = !n + 1
!value = POW(!n, 2)
q var !value
BREAK IF (!value GT 1000)
ENDDO
Copyright © 2015 AVEVA Solutions Limited and its subsidiaries. All rights reserved.
Do loops (3)
▪ Example: DoSkip.mac
DO !n FROM 1 TO 25
SKIP IF (!n LE 5) OR (!n GT 15)
q var !n
ENDDO
Copyright © 2015 AVEVA Solutions Limited and its subsidiaries. All rights reserved.
Do Loops (4)
DO !X INDICES !ARRAY
!X takes a number from 1 to !ARRAY size
ENDDO
Copyright © 2015 AVEVA Solutions Limited and its subsidiaries. All rights reserved.
Do Loops – Array Example
VAR !Zones COLL ALL ZONES FOR SITE
VAR !Names EVAL NAME FOR ALL FROM !Zones
q var !Names
DO !x VALUES !Names
q var !x
ENDDO
DO !x INDICES !Names
q var !Names[!x]
ENDDO
Copyright © 2015 AVEVA Solutions Limited and its subsidiaries. All rights reserved.
IF Statements (1)
▪ For example:
IF ( !Number LT 0 ) THEN
!Negative = TRUE
ENDIF
Copyright © 2015 AVEVA Solutions Limited and its subsidiaries. All rights reserved.
IF Statements (2)
▪ The ELSEIF commands are IF ($1 EQ 0) THEN
optional, once one of them $p Your value is zero
has been found to be TRUE,
any remaining are ignored. ELSEIF ($1 LT 0) THEN
$p Less than zero
▪ The ELSE commands are also
optional, you can be sure that ELSE
exactly one command within $p More than zero
the if construct will be
executed. ENDIF
▪ Example: NumCheck.mac
Copyright © 2015 AVEVA Solutions Limited and its subsidiaries. All rights reserved.
Errors & Error Handling
Copyright © 2015 AVEVA Solutions Limited and its subsidiaries. All rights reserved.
Example of Errors
Copyright © 2015 AVEVA Solutions Limited and its subsidiaries. All rights reserved.
Handling Errors
Copyright © 2015 AVEVA Solutions Limited and its subsidiaries. All rights reserved.
Example of Errors - Example
▪ Example: ErrorCheck.mac
NEW EQUI /ABCD
HANDLE (41, 8)
$p Need to be at a ZONE or below
ELSEHANDLE (41, 12)
$p That name has already been used. Names must be
unique
ELSEHANDLE ANY
$p Another error has occurred
ELSEHANDLE NONE
$p Everything OK. EQUI created
ENDHANDLE
Copyright © 2015 AVEVA Solutions Limited and its subsidiaries. All rights reserved.
Alert Objects (1)
Copyright © 2015 AVEVA Solutions Limited and its subsidiaries. All rights reserved.
Alert Objects (2)
Copyright © 2015 AVEVA Solutions Limited and its subsidiaries. All rights reserved.
Alert Objects (3)
▪ Confirm Alerts
!a = !!alert.confirm(|Are you sure!|)
Returns a ‘YES’ or ‘NO’ as a string
▪ Question Alerts
Copyright © 2015 AVEVA Solutions Limited and its subsidiaries. All rights reserved.
Alert Objects (4)
▪ Input Alerts
The first value is the prompt and the second is the default value.
Input alerts return a value as a string.
Copyright © 2015 AVEVA Solutions Limited and its subsidiaries. All rights reserved.
PML Functions
Copyright © 2015 AVEVA Solutions Limited and its subsidiaries. All rights reserved.
Creating a PML function
Copyright © 2015 AVEVA Solutions Limited and its subsidiaries. All rights reserved.
Using Functions with Arguments
Copyright © 2015 AVEVA Solutions Limited and its subsidiaries. All rights reserved.
Creating a PML Procedure
Copyright © 2015 AVEVA Solutions Limited and its subsidiaries. All rights reserved.
Using PML Procedures with Arguments
Copyright © 2015 AVEVA Solutions Limited and its subsidiaries. All rights reserved.
Using Object methods
Copyright © 2015 AVEVA Solutions Limited and its subsidiaries. All rights reserved.
The use of . and ()
!nameStrings = !name.split()
!nameStrings = !name.split(|%|)
Copyright © 2015 AVEVA Solutions Limited and its subsidiaries. All rights reserved.
Using Object methods (2)
!NumberOfNames = !NameStrings.Size()
Copyright © 2015 AVEVA Solutions Limited and its subsidiaries. All rights reserved.
Using Object methods (3)
!MyArray.Clear()
Copyright © 2015 AVEVA Solutions Limited and its subsidiaries. All rights reserved.
Using Object methods (4)
!NewArray = !OldArray.RemoveFrom(5,10)
Copyright © 2015 AVEVA Solutions Limited and its subsidiaries. All rights reserved.
Using Object methods (5)
!OldArray.RemoveFrom(5,10)
Copyright © 2015 AVEVA Solutions Limited and its subsidiaries. All rights reserved.
The !!CE Object (1)
!BranchHeadBore = !!CE.Hbore
!HeadPosition = !!CE.Hposition
!Easting = !HeadPosition.East
!PosWRTValve = !HeadPosition.WRT(!Valve)
Copyright © 2015 AVEVA Solutions Limited and its subsidiaries. All rights reserved.
The !!CE Object (2)
dbref.attributeName = PMLvariable
For example:
!dbref.name = '/PIPE-100'
!!CE.built = TRUE
Copyright © 2015 AVEVA Solutions Limited and its subsidiaries. All rights reserved.
The !!CE Object (3)
!pos = !!CE.position
q var !pos
!pos.Up = 2000
!!CE.position = !pos
q var !pos
Copyright © 2015 AVEVA Solutions Limited and its subsidiaries. All rights reserved.
Collections
Copyright © 2015 AVEVA Solutions Limited and its subsidiaries. All rights reserved.
EVALUATE command syntax – PML 1 style
var !volume eval (xlen * ylen * zlen) for ALL from !box
q var !volume
Copyright © 2015 AVEVA Solutions Limited and its subsidiaries. All rights reserved.
COLLECTION Object – PML 2
Copyright © 2015 AVEVA Solutions Limited and its subsidiaries. All rights reserved.
Evaluating results from a COLLECTION object
Copyright © 2015 AVEVA Solutions Limited and its subsidiaries. All rights reserved.
Miscellaneous
Copyright © 2015 AVEVA Solutions Limited and its subsidiaries. All rights reserved.
PML Publisher (2)
▪ Examples
– Single File
pmlencrypt raw.txt encrypted.txt
– Folder
pmlencrypt.exe -pmllib original_pmllib enc_pmllib
Copyright © 2015 AVEVA Solutions Limited and its subsidiaries. All rights reserved.
General Notes on PML (1)
▪ PML files are ASCII and can be created/edited in any basic text
editor
▪ PML 1 files are saved under PDMSUI folder and PML 2 under
the PMLLIB folder
▪ PML 2 objects have specific file extensions
(.pmlfnc, .pmlobj and .pmlfrm)
▪ If newly created, PML can be found by typing pml rehash all
▪ Once loaded,
objects can be reloaded by typing pml object reload OBJECT
▪ Once loaded,
forms can be reloaded by typing pml object reload FORM
Copyright © 2015 AVEVA Solutions Limited and its subsidiaries. All rights reserved.
General Notes on PML (2)
Copyright © 2015 AVEVA Solutions Limited and its subsidiaries. All rights reserved.
Q &A
Copyright © 2015 AVEVA Solutions Limited and its subsidiaries. All rights reserved.
Thank you
Copyright © 2015 AVEVA Solutions Limited and its subsidiaries. All rights reserved.