Please ensure Javascript is enabled for purposes of website accessibility
Powered by Zoomin Software. For more details please contactZoomin

AVEVA™ Engineering

PML Procedures

  • Last UpdatedOct 29, 2024
  • 1 minute read

A PML procedure is a PML function that does not return a result.

A function is defined as a procedure by omitting the data type at the end of the 'define function' statement:

define function !!Area( !Length is REAL, !Width is REAL,

 !Result is REAL)

!Result = !Length * !Width

endfunction

Here you are using an output argument !Result to return the result rather than using a function return value.

The arguments to the !!Area procedure can be set as follows, and then the procedure invoked with the call command.

!SurfaceArea = REAL()

!Partlength = 7

!PartWidth = 6

call !!Area(!PartLength, !PartWidth, !SurfaceArea)

There will be an error if you attempt to assign the result of a PML procedure because there is no return value to assign. So for example you can say:

call !!Area(!PartLength, !PartWidth, !SurfaceArea)

!Answer = !SurfaceArea

But you cannot say:

!Answer =  !!Area
(!PartLength, !PartWidth, !SurfaceArea)

$* WRONG

The ( ) parentheses after the name of a procedure or function must always be present - even for procedures that do not need arguments:

define function !!Initialise()

 !TotalWeight = 0

 !!MaxWeight = 0

endfunction

call !!Initialise()

Although the call keyword is strictly speaking optional, its use is recommended with procedures.

Note:
As well as procedures, you can invoke a PML function that has a return value using call, in which case the function result value is discarded.

TitleResults for “How to create a CRG?”Also Available in