Upload
others
View
45
Download
8
Embed Size (px)
Citation preview
© 2019 AVEVA Group plc and its subsidiaries. All rights reserved.
Presented by:
Session ID: EPC-28
PML Quick tips and tricksLearning how to create small codes to extract great results
© 2019 AVEVA Group plc and its subsidiaries. All rights reserved.
Thiago Oliveira, Latin America Technical Manager
November 14th 2019
© 2019 AVEVA Group plc and its subsidiaries. All rights reserved.
Introduction
Basic Commands in PML 1
TTY Mode (non graphics)
PMLLIB / PMLUI / MACROS Area
PML Code Types
Codes Examples
Menu Additions
Introduction
• PML Language – Used in Dabacon Products
• PML 1
• Macros and simple commands
• PML 2
• More structured codes (objects, forms, functions)
• PMLLIB Folder
• PML.NET
• More complex and powerful codes
• Integration with .NET Platform
© 2019 AVEVA Group plc and its subsidiaries. All rights reserved.
Basics Commands in PML 1
Claim / Unclaim
– Required to change elements in Dabacon DBs
– Implicit / Explicit Claimlist Databases
– Unclaiming Elements
– Claim by “Dead” users
© 2019 AVEVA Group plc and its subsidiaries. All rights reserved.
Basics Commands in PML 1
© 2019 AVEVA Group plc and its subsidiaries. All rights reserved.
Claim / Unclaim
– Syntax
• 1st part: Action CLAIM / UNCLAIM
• 2nd part: Action Element Ce / “type” / next / prev / last
• 3rd part: Element Hierarchy or Members Hier / mem
• Ex: claim ce hier
• Ex: unclaim pipe mem
• Ex: claim bran
Help pml: $q
– Ex.: claim $q
Basics Commands in PML 1
© 2019 AVEVA Group plc and its subsidiaries. All rights reserved.
New / Delete
– Sintaxe:
• 1st part: Action NEW / DELETE
• 2nd part: Element Type “type”
– Ex: new PIPE
– Ex: delete STRU
- Ex: new SITE /My-Site
Basics Commands in PML 1
© 2019 AVEVA Group plc and its subsidiaries. All rights reserved.
Collections
– Syntax:
• 1st component: PML Variable → var !varName
• 2nd component: Action → COLLECT / APPEND COLLECT
• 3rd component: What to collect → “TYPE” / (“TYPE1” “TYPE2” ...)
• 4th component: Filter → PML
– Main Filters: » Text: matchwild / occurs / etc
» Attributes: pa pos / pl bore / hei / etc
– Operators: » Bigger than: gt » Bigger or Equal: ge
» Less than: lt » Less or Equal: le
» Equal: eq » Different: ne
• 5ª component: Where to collect → for ce / for site / for /SiteName / etc
Basics Commands in PML 1
© 2019 AVEVA Group plc and its subsidiaries. All rights reserved.
Collections
– Examples:
• Var !pipeSites collect all site with matchwild(name,’*PIPING’)
• Var !pipeSites coll all site with purpose eq ‘PIPE’
• Var !membersAaSpec coll all bran mem with matchwild(name of spec of spref,’*Aa*’) for pipe
• Var !equi coll all equi with :idStatus gt 1 for /Equipments
• Var !WorldbranMem coll all bran mem
• Var !allElements coll all
Basics Commands in PML 1
© 2019 AVEVA Group plc and its subsidiaries. All rights reserved.
Collections
– Examples:
• Var !pipeElem collect all with matchwild(name,’*PIPING’) and type eq ‘PIPE’
• Var !pipeElem coll all PIPE with matchwild(name,’*PIPING’)
• Var !pipeElem coll all PIPE with matchwild(name,’*PIPING’) for /SITE1 /SITE2
Queries from Collections: Q VAR !pipeElem
Evaluating Collection Arrays: Var !pipeElemName eval name for all from !pipeElem
Time consuming!!
TTY Mode
© 2019 AVEVA Group plc and its subsidiaries. All rights reserved.
> Faster (much faster!!)
> used in Batch call or CMD
> Doesn’t support graphical interface:
– Forms
–“!!alert.” commands:
• !!alert.message()
• !!alert.error()
• !!alert.warning()
• !!alert.input()
• etc
Need to consider the use of HANDLE/ENDHANDLE statements!
!!alert.message(‘Message to User’)
Handle any
-- to handle TTY mode execution
endhandle
TTY Mode
© 2019 AVEVA Group plc and its subsidiaries. All rights reserved.
Sintaxe
– 1st component: batch call to access PDMS/E3D/Engineering etc
call “batchFilePath.bat”
– 2nd component: TTY mode
– 3rd component: Project
– 4th component: USER/PASSWORD
– 5th component: /MDB
– 6th component: $M “macro”
– Ex:
set dir="C:\Program Files (x86)\AVEVA\Administration1.6.0\admin.bat"
call %dir% tty APS SYSTEM/XXXXXX /ALL $m/D:\BASE_DE_CUSTOMIZACOES\PML\AVEVA\admin\macroTTY_Example.pmlmac
TTY Mode
© 2019 AVEVA Group plc and its subsidiaries. All rights reserved.
PDMSWait Feature
➢ Call Several macros in a single batch file
➢ Sort many macros calls in a single batch file
➢ Enable that a specific routine starts its execution only by the conclusion of a
preliminary routine
TTY Mode
© 2019 AVEVA Group plc and its subsidiaries. All rights reserved.
PDMSWait Feature - Syntax
➢ Required Environment Variable: PDMS_CONSOLE_IDENTIFIER como %RANDOM%
➢ In the macro following blank line, add the PDMSWait call:
➢ call C:\Program Files (x86)\AVEVA\Everything3D2.10\PDMSWait
PDMSWait Feature – Examples
TTY Mode
© 2019 AVEVA Group plc and its subsidiaries. All rights reserved.
PDMSWait Feature – Examples
TTY Mode
© 2019 AVEVA Group plc and its subsidiaries. All rights reserved.
PDMSWait Feature – Examples
PMLLIB / PMLUI / Macro Areas
© 2019 AVEVA Group plc and its subsidiaries. All rights reserved.
• PMLLIB → set of macros, pml objects, pml functions and pml forms (PML 2)
• PDMSUI → set of macros and PML 1 objects that build menus in many
modules for Dabacon applications
• It is possible to set several PMLLIBs e PDMSUIs
– Ex: Set PMLLIB=address1 address2 etc
• PML.INDEX
• PML REHASH ALL
• Q EVAR PMLLIB
• Q EVAR PMLUI
PML Code Types
© 2019 AVEVA Group plc and its subsidiaries. All rights reserved.
• Macros
▪ Are not required to be in PMLLIB or PMLUI
▪ Normally make the link between the user and complex codes
▪ Script structure
▪ Call Syntax: $m macroAddress
▪ File Extension: none (but it is a good practice to use .pmlmac)
▪ It can receive parameters:
▪ $m macroAddress parameter1 parameter2 etc
▪ Inside the macro it is possible to receive the input parameters
▪ !para1 = $1
▪ !para2 = $2
PML Code Types
© 2019 AVEVA Group plc and its subsidiaries. All rights reserved.
• Functions
▪ Are required to be in PMLLIB or PMLUI
▪ Have a more organized structure of receiving and generating parameters
▪ General Format
define function !!functionName()
CODE
endfunction
▪ Call Syntax: !!functionName()
▪ File Extension: .pmlfnc
PML Code Types
© 2019 AVEVA Group plc and its subsidiaries. All rights reserved.
• Objects
▪ Are required to be in PMLLIB or PMLUI
▪ Have a more organized structure of receiving and generating parameters and procedures related to
a specific class▪ General Format
define object objectName
member .attribute1 is Real
member .attribute2 is Stringendfunction
define method .objectName()
endmethod
define method .procedure1()
CODE
endmethod
Object Definition
Constructor Method Definition
Procedures Definitions
PML Code Types
© 2019 AVEVA Group plc and its subsidiaries. All rights reserved.
• Objects
▪ Call: !objectVariable = object objectName()
▪ It can receive many parameters during the call▪ !objectVariable = object objectName(!parameter1, ‘text’,430, true)
▪ It can receive many parameters during the definition
▪ define method .objectName(!a is Array, !b is String, !c is Real, !d is Boolean)
▪ Object’s Attributes can be accessed as its procedures
▪ !objectVariable = object objectName()
▪ !firstAttribute = !objectVariable.attribute1
▪ !objectVariable.procedure1()
▪ Extension: .pmlobj
PML Code Types
© 2019 AVEVA Group plc and its subsidiaries. All rights reserved.
• Forms
▪ Are required to be in PMLLIB or PMLUI
▪ Are pretty similar to Objects. The main difference is that they result in a Graphical User Interface
▪ General Format
setup form !!formName
member .attribute1 is Real
member .attribute2 is String
FORM Gadgets
exit
define method .formName()
endmethod
define method .procedure1()
CODE
endmethod
Form Definition
Constructor Method Definition
Procedures Definitions
PML Code Types
© 2019 AVEVA Group plc and its subsidiaries. All rights reserved.
• Forms
▪ Call: show !!formName
▪ Killing a form: kill !!formName
▪ Hiding a form: hide !!formName
▪ Extension: .pmlfrm
▪ TIP: !!PMLFORMS
PML Code Types
© 2019 AVEVA Group plc and its subsidiaries. All rights reserved.
• Forms
▪ Call: show !!formName
▪ Killing a form: kill !!formName
▪ Hiding a form: hide !!formName
▪ Extension: .pmlfrm
▪ TIP: !!PMLFORMS
Codes Examples
© 2019 AVEVA Group plc and its subsidiaries. All rights reserved.
• Collecting elements for current element and creating a file with the results
!type = 'PIPE'
!macroAddress = 'c:\aveva\report.txt'
Var !elements coll all $!type for ce
!file = object file(!macroAddress)
!file.writefile('overwrite',!elements)
Syscom 'start $!macroAddress'
Codes Examples
© 2019 AVEVA Group plc and its subsidiaries. All rights reserved.
• Iterating in an equipment array after collecting and executing some actions
!type = 'EQUI'
Var !elements coll all $!type for ce
Do !eachEqui values !elements
markdb
$!eachEqui
!name = name
!name = !name + '-NEW-INFORMATION'
name $!name
Enddo
Menu Additions
© 2019 AVEVA Group plc and its subsidiaries. All rights reserved.
linkedin.com/company/aveva
@avevagroup
ABOUT AVEVA
AVEVA is a global leader in engineering and industrial software driving digital transformation across the entire asset and operational l ife cycle of capital -intensive industries.
The company’s engineering, planning and operations, asset performance, and monitoring and control solutions deliver proven results to over 16,000 customers across the globe. Its customers are supported by the largest industrial software ecosystem, including 4,200 partners and 5,700 certified developers. AVEVA is headquartered in Cambridge, UK, with over 4,400 employees at 80 locations in over 40 countries.
aveva.com
© 2019 AVEVA Group plc and its subsidiaries. All rights reserved.