beautypg.com

Micromod MOD: 1800P - MOD 30ML Identity Module (Version 2) Algorithms, Tables and Sequential Logic Functions User Manual

Page 24

background image

Logic Functions - Book 2

EXPRESSION BLOCK

8-16

In this example, all variables are on the same scan rate. If the variables have different scan
rates, the historian loop can include some expression blocks to average or sample the faster
variables so all variables are trended at the same resolution and time base. Alternately, the
entire historian can be run at the fastest frequency. The number of samples in each trend
cycle in this example is kept less than 30 to fit conveniently on the LCP screen for display of a
trend. More or fewer averages can be included in a given trend cycle as required, and the
number and size of the trend cycles can be adjusted. Trends can be based on sample
averages, maximums or minimums, based on the expression block.

A typical Analog Historian/Trending Loop is shown below. The instantaneous value is passed
back in the "bucket Brigade" of Trend Cycle 1. The application engineer specifies how many
buckets to put in the brigade (note the execution order). The last block (that is the block
holding the oldest variable) is the first block in the loop to run.

TREND CYCLE 1

Loop Execution

Every 5 sec.

TREND CYCLE 2

Loop Execution

Every Minute

EX-1

EX-18-2

EX-19

EX-20

Out=In

AI

EX-1

EX-28-2

EX-29

EX-30

Out=

Σ

In/20

TREND CYCLE 3

Loop Execution

Every 15 Minutes

EX-1

EX-22-2

EX-23

EX-24

Out=

Σ

In/15

TREND CYCLE 4

Loop Execution

Every Hour

EX-1

EX-22-2

EX-23

EX-24

Out=

Σ

In/4

First

15 Blocks

Only

First

4 Blocks

Only

Trend Cycle 2 is constructed the same way, except the first block (the one holding the most
current value) is an averaging block that takes the average of several blocks in the Trend
Cycle 1 "bucket brigade." This block can include logic to correct its output if one or more of
the input variables from the prior trend cycle contain "bad Quality" data flags. The process
repeats for Trend Cycle 3 and for as many trend cycles as are needed.

8.2.6

Example 2: Using IF-THEN-ELSE Statements in Expression Blocks

IF-THEN-ELSE statements make it much easier to write readable expressions for sequence
logic. For example, if you want an expression block to identify which of three tanks is the
lowest to determine which will be filled next, you could use the following formula in an
expression block:

If (L1If (L2If (L3