28
© 2019 AVEVA Group plc and its subsidiaries. All rights reserved.

© 2019 AVEVA Group plc and its subsidiaries. All rights ... AWC NA... · Basic Commands in PML 1 TTY Mode (non graphics) PMLLIB / PMLUI / MACROS Area PML Code Types Codes Examples

  • Upload
    others

  • View
    45

  • Download
    8

Embed Size (px)

Citation preview

Page 1: © 2019 AVEVA Group plc and its subsidiaries. All rights ... AWC NA... · Basic Commands in PML 1 TTY Mode (non graphics) PMLLIB / PMLUI / MACROS Area PML Code Types Codes Examples

© 2019 AVEVA Group plc and its subsidiaries. All rights reserved.

Page 2: © 2019 AVEVA Group plc and its subsidiaries. All rights ... AWC NA... · Basic Commands in PML 1 TTY Mode (non graphics) PMLLIB / PMLUI / MACROS Area PML Code Types Codes Examples

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

Page 3: © 2019 AVEVA Group plc and its subsidiaries. All rights ... AWC NA... · Basic Commands in PML 1 TTY Mode (non graphics) PMLLIB / PMLUI / MACROS Area PML Code Types Codes Examples

© 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

Page 4: © 2019 AVEVA Group plc and its subsidiaries. All rights ... AWC NA... · Basic Commands in PML 1 TTY Mode (non graphics) PMLLIB / PMLUI / MACROS Area PML Code Types Codes Examples

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.

Page 5: © 2019 AVEVA Group plc and its subsidiaries. All rights ... AWC NA... · Basic Commands in PML 1 TTY Mode (non graphics) PMLLIB / PMLUI / MACROS Area PML Code Types Codes Examples

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.

Page 6: © 2019 AVEVA Group plc and its subsidiaries. All rights ... AWC NA... · Basic Commands in PML 1 TTY Mode (non graphics) PMLLIB / PMLUI / MACROS Area PML Code Types Codes Examples

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

Page 7: © 2019 AVEVA Group plc and its subsidiaries. All rights ... AWC NA... · Basic Commands in PML 1 TTY Mode (non graphics) PMLLIB / PMLUI / MACROS Area PML Code Types Codes Examples

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

Page 8: © 2019 AVEVA Group plc and its subsidiaries. All rights ... AWC NA... · Basic Commands in PML 1 TTY Mode (non graphics) PMLLIB / PMLUI / MACROS Area PML Code Types Codes Examples

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

Page 9: © 2019 AVEVA Group plc and its subsidiaries. All rights ... AWC NA... · Basic Commands in PML 1 TTY Mode (non graphics) PMLLIB / PMLUI / MACROS Area PML Code Types Codes Examples

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

Page 10: © 2019 AVEVA Group plc and its subsidiaries. All rights ... AWC NA... · Basic Commands in PML 1 TTY Mode (non graphics) PMLLIB / PMLUI / MACROS Area PML Code Types Codes Examples

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

Page 11: © 2019 AVEVA Group plc and its subsidiaries. All rights ... AWC NA... · Basic Commands in PML 1 TTY Mode (non graphics) PMLLIB / PMLUI / MACROS Area PML Code Types Codes Examples

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

Page 12: © 2019 AVEVA Group plc and its subsidiaries. All rights ... AWC NA... · Basic Commands in PML 1 TTY Mode (non graphics) PMLLIB / PMLUI / MACROS Area PML Code Types Codes Examples

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

Page 13: © 2019 AVEVA Group plc and its subsidiaries. All rights ... AWC NA... · Basic Commands in PML 1 TTY Mode (non graphics) PMLLIB / PMLUI / MACROS Area PML Code Types Codes Examples

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

Page 14: © 2019 AVEVA Group plc and its subsidiaries. All rights ... AWC NA... · Basic Commands in PML 1 TTY Mode (non graphics) PMLLIB / PMLUI / MACROS Area PML Code Types Codes Examples

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

Page 15: © 2019 AVEVA Group plc and its subsidiaries. All rights ... AWC NA... · Basic Commands in PML 1 TTY Mode (non graphics) PMLLIB / PMLUI / MACROS Area PML Code Types Codes Examples

TTY Mode

© 2019 AVEVA Group plc and its subsidiaries. All rights reserved.

PDMSWait Feature – Examples

Page 16: © 2019 AVEVA Group plc and its subsidiaries. All rights ... AWC NA... · Basic Commands in PML 1 TTY Mode (non graphics) PMLLIB / PMLUI / MACROS Area PML Code Types Codes Examples

TTY Mode

© 2019 AVEVA Group plc and its subsidiaries. All rights reserved.

PDMSWait Feature – Examples

Page 17: © 2019 AVEVA Group plc and its subsidiaries. All rights ... AWC NA... · Basic Commands in PML 1 TTY Mode (non graphics) PMLLIB / PMLUI / MACROS Area PML Code Types Codes 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

Page 18: © 2019 AVEVA Group plc and its subsidiaries. All rights ... AWC NA... · Basic Commands in PML 1 TTY Mode (non graphics) PMLLIB / PMLUI / MACROS Area PML Code Types Codes Examples

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

Page 19: © 2019 AVEVA Group plc and its subsidiaries. All rights ... AWC NA... · Basic Commands in PML 1 TTY Mode (non graphics) PMLLIB / PMLUI / MACROS Area PML Code Types Codes Examples

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

Page 20: © 2019 AVEVA Group plc and its subsidiaries. All rights ... AWC NA... · Basic Commands in PML 1 TTY Mode (non graphics) PMLLIB / PMLUI / MACROS Area PML Code Types Codes Examples

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

Page 21: © 2019 AVEVA Group plc and its subsidiaries. All rights ... AWC NA... · Basic Commands in PML 1 TTY Mode (non graphics) PMLLIB / PMLUI / MACROS Area PML Code Types Codes Examples

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

Page 22: © 2019 AVEVA Group plc and its subsidiaries. All rights ... AWC NA... · Basic Commands in PML 1 TTY Mode (non graphics) PMLLIB / PMLUI / MACROS Area PML Code Types Codes Examples

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

Page 23: © 2019 AVEVA Group plc and its subsidiaries. All rights ... AWC NA... · Basic Commands in PML 1 TTY Mode (non graphics) PMLLIB / PMLUI / MACROS Area PML Code Types Codes Examples

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

Page 24: © 2019 AVEVA Group plc and its subsidiaries. All rights ... AWC NA... · Basic Commands in PML 1 TTY Mode (non graphics) PMLLIB / PMLUI / MACROS Area PML Code Types Codes Examples

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

Page 25: © 2019 AVEVA Group plc and its subsidiaries. All rights ... AWC NA... · Basic Commands in PML 1 TTY Mode (non graphics) PMLLIB / PMLUI / MACROS Area PML Code Types Codes Examples

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'

Page 26: © 2019 AVEVA Group plc and its subsidiaries. All rights ... AWC NA... · Basic Commands in PML 1 TTY Mode (non graphics) PMLLIB / PMLUI / MACROS Area PML Code Types Codes Examples

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

Page 27: © 2019 AVEVA Group plc and its subsidiaries. All rights ... AWC NA... · Basic Commands in PML 1 TTY Mode (non graphics) PMLLIB / PMLUI / MACROS Area PML Code Types Codes Examples

Menu Additions

© 2019 AVEVA Group plc and its subsidiaries. All rights reserved.

Page 28: © 2019 AVEVA Group plc and its subsidiaries. All rights ... AWC NA... · Basic Commands in PML 1 TTY Mode (non graphics) PMLLIB / PMLUI / MACROS Area PML Code Types Codes Examples

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.