Adding Multiple Blocks

The Generate Wizard lets you add many similar blocks to the database quickly, saving development time. You simply select the type of block you want to create and the block names you want to use.

For the block type, you can select an existing or a new block. This selection determines the specific values assigned to each block created. For example, when you select a new block, the Wizard creates blocks with default values. However, when you select an existing block, the Wizard creates blocks with values of the selected block. This option lets you create many similar blocks quickly without having to reconfigure them later.

When specifying the block names, you must enter a prefix, suffix, starting number, ending number, and increment value. The Generate Wizard uses this information to systematically assign names to the blocks it creates. For example, the following values create blocks with the names F1T1 through F20T1.

Prefix

Starting number

Ending number

Increment

Suffix

F

1

20

1

T1

The Generate Wizard cannot create a block with a name that already exists. If the information you specify results in an existing block name, the Wizard skips that block and continues on to the next one.

Using the Generate Wizard, you also have the option of customizing up to 5 fields. Customizing these fields lets you fine tune the block's configuration. For example, if you need to create 50 Digital Input blocks, each one will have a different I/O address. You can use the Generate Wizard to assign these addresses if they occur in a sequential order.

You can customize a field by selecting it and entering a prefix, suffix, starting number, ending number, and increment value. The Wizard handles this information identically to the block name values you entered. If the resulting sequence of field values ends before the Wizard creates all the new blocks, the sequence repeats from the beginning. For example, suppose you want to create 10 Analog Input blocks, AI1 through AI10 and you customize the I/O address of each block with the following information:

Prefix

Starting number

Ending number

Increment

Suffix

N

10

50

10

:7

The blocks receive the following addresses:

Block

Address

AI1

N10:7

AI2

N20:7

AI3

N30:7

AI4

N40:7

AI5

N50:7

AI6

N10:7

AI7

N20:7

AI8

N30:7

AI9

N40:7

AI10

N50:7

You also have the option of enabling the Use Custom Format check box. When you enable this check box, the Wizard lets you enter multiple patterns for the five fields you have selected. A pattern acts as a programming statement for generating a range of numeric or string values. The following table lists the syntax for each type of pattern.

Pattern Types

Type

Syntax

Example

Numeric

<start:end:increment>

where start is the initial value of the pattern,

end is the ending value, and

increment is the amount to add to the current pattern value.

<1:10:1> generates a range of numbers from 1 to 10.

<1:20:3> generates the numbers 1,4,7,10,13,16, and 19.

Alphanumeric List

<"string1", "string2",... "string">

where string1 is the first string,

string2 is the second string, and

string is the last string.

Each string must be enclosed in quotation marks.

<"A", "B", "C", "D">

<"Area A", "Area B", "Area C">

<"Pump 1", "Pump 2", "Pump 3">

Literals

string

where string is up to 40 alphanumeric characters.

Alarms

Elapsed Time

Analog Input

Constants

"string"

where string is up to 40 alphanumeric characters, including the quotation marks.

"Curr Value > 100"

"I/O Addr < 500"

"PLC:N7:"<766:780:1>"/15"

Notice that the difference between literals and constants is minor. Both are strings and can be up 40 characters. However, quotation marks (" ") are required for constants when the string contains any mark of punctuation or non-alphanumeric symbol such as an angle bracket or a colon. If the string contains only numbers or letters, the quotation marks are optional.

Also notice that negative and floating point numbers are not supported within patterns. You can generate these types of numbers by enclosing a minus sign or a decimal point in quotation marks outside of the pattern. Negative increments are not supported. Consider the following examples:

The pattern...

Yields the result...

"-"<1:10:1>

-1 -2 -3 -4 -5 -6 -7 -8 -9 -10

<1:5:1>"."<"5">

1.5 2.5 3.5 4.5 5.5

By combining different pattern types, you can generate a wide range of block field entries. For example, if you want to customize the Description field for a group of blocks, you could enter a pattern such as Alarm Status from Area <"A", "B", "C">. Notice that the text outside the pattern does not require quotation marks.

 

See Also

How Do I...