PPCL Guidelines

This section discusses the following topics:

Writing PPCL Programs

Entering PPCL Program Lines

Keep in mind the following guidelines when writing program lines.

Program Names

Program names should follow the same naming conventions as point names. This includes using a naming hierarchy that breaks the name into sections and moves from global to specific. The program name hierarchy is listed below.

Each program has a name. Two different programs in your building system cannot have the same name, even if they reside in different field panels.

The program name can contain a maximum of 30 characters, uppercase and lowercase letters, numbers, periods and spaces. You can use any ASCII character except the following: ? * [ ] { } |.

Using Subroutines

A subroutine is a group of statements that perform a specific task more than once during each pass of the program. If the same operation is performed several times during one pass of the program, you can use a subroutine instead of writing duplicate sections of program code. Every time that particular operation is performed, control is transferred to the subroutine.

Subroutines allow for a smaller amount of program code. In addition, if you need to change the code, you can change the code at one place rather than having to search for multiple occurrences of the same code. Subroutines also help set programming standards that define where functionality is placed in the program. If you use an established block of code and you do not change the line numbers, then that subroutine will always be placed in the same location in a program.

In order to get the most use out of a subroutine, you should determine if the subroutine will be accessed enough times through one pass of the program. The following table helps you determine when it is beneficial to use a subroutine. To use the table, determine how many lines of code a subroutine will contain (excluding the RETURN statement) and how many times it will be called through one pass of the program. If the result is NO, then it is more efficient not to use a subroutine. If the result is EVEN, then there is no benefit for either method. If the result is YES, then it is more efficient to use a subroutine.

Subroutine
Characteristics

1 Line

2 Lines

3 Lines

4 Lines +

1 Call

No

No

No

No

2 Calls

No

No

Even

Yes

3 Calls

No

No

Yes

Yes

4 Calls +

No

Yes

Yes

Yes

Define Command

To reduce the amount of typing in the Program Editor, you can use the DEFINE command to act as a shorthand for the system name.

For the point Bld01.Ahu01.RAF, the example below uses A01 to represent the Bld01.Ahu01 part of the name in the program.

00230 DEFINE(A01,Bld01.Ahu01)

00240 IF (SECND1 .GT. 15) THEN ON ("%A01%.RAF") ELSE OFF ("%A01%.RAF")

Using the DEFINE command saves you time because you can enter fewer characters whenever you use the name of a point in a PPCL statement. When the program compiles, %A01% is substituted with the text string it represents (Bld01.Ahu01), thus forming the complete system name.

Comment Lines

A comment line is information that is written into the program but is not interpreted as a program command. The compiler will skip over the comment line during compilation. It is recommended that you use comment lines to describe the functionality of sections of code. Comment lines are especially helpful for describing subroutines and areas of program code that are difficult to understand.

To enter a comment line in a program, enter a program line number followed by the letter C to identify the comment and then at least one tab or space. It is recommended that you develop and use a line numbering scheme for comment lines (for example, all comment lines could be odd-numbered lines).

Example Comment Line

00035 C This section of the program handles subroutines.