FC 140 - Restore

The restore function code saves and restores critical block values (e.g., totalizers, counters, timers) to and from nonvolatile random access memory (NVRAM). Tables 140-4 and 140-5 show NVRAM and checkpoint utilization. During normal execution after startup, the internal and output block data referenced by this block goes to NVRAM. After a module power loss or recovery, the block referenced by this function block restores to the last saved state. Saving the block data can be disabled by either boolean input (S2 and S3). Both inputs must be logic 1 for the save to occur.

 

Data restore can be selected upon power restore, mode changes to execute, or both. If the module is offline longer than the maximum downtime, an external timer can be used to trip a digital input on an IMCIS12, IMCIS22, IMQRS12, IMQRS22, IMDSI12, IMDSI13, IMDSI14, IMDSI15 or an IMDSI22 module to prevent a restore after the timer expires. The expired logic state for the digital input is configurable. The data restores to the saved value before the first execution cycle of the configuration. The restore function block must be located at a block number greater than the function block being restored (S1).

 

When restoring a multiple output block (e.g., M/A station function code 80), the lowest output number (N) of that block must be specified by S1.

 

 

 

Outputs:

Blk

Type

Description

N

B

No meaning, N must be greater than S1

 

 

Specifications:

Spec

Tune

Default

Type

Range

Description

S1

N

0

I

Note 1

Block address to be restored

S2

N

0

I

Note 1

Block address of save flag:

0 = no save

1 = save data to NVRAM if <S3> = 1

S3

N

0

I

Note 1

Block address of save permissive:

0 = disabled

1 = enabled

S4

N

0

I

00, 01, 10 or 11

Restore condition:

X0 = restore on power up

X1 = no restore on power up

0X = restore on mode changes

1X = no restore on mode changes

S5

N

0

I

0 - 63

I/O module address of timer input

S6

N

0

I

0 - 123

Point number of timer input:

 

unused

=

000

 

 

 

DSI

=

X0Z

=

Group A

(Z = 1 - 8)

 

=

X1Z

=

Group B

(Z = 1- 8)

CIS

=

X2Z

 

 

(Z = 1 - 3)

 

Expire logic state:

0YZ = logic 0

1YZ = logic 1

 

S7

N

0

I

Full

Spare

S8

Y

0.000

R

Full

Spare

S9

Y

0

I

Full

Spare

 

 

NOTES:

1. Maximum values are:9,998 for the BRC-100, IMMFP11/12 and 31,998 for the HAC

 

 

140.1   Specifications

 

S1

Block address of the block to be restored.

 

S2

Block address of the save flag. This specification is used in conjunction with <S3> to cause the internal and external output data to be saved to NVRAM every time the restore block executes while <S2> and <S3> equal one.

 

S3

Block address of the save permissive. The save permissive enables or disables the save flag input <S2>. Table 140-3 shows the save action dependent upon <S2> and <S3>.

 

                                  

 

S4

Restore condition. This specification determines which conditions cause the saved data in NVRAM to be restored to the internal and external outputs in RAM. The ones digit of S4 determines if the data is to be restored when a power up of the module occurs. The tens digit of S4 determines if the data is to be restored upon a mode change or module reset via the reset button.

 

X0 = restore on power up

X1 = no restore on power up

0X = restore on mode changes

1X = no restore on mode changes

 

S5

I/O module address of the timer input. This specification is the expander bus address of the digital or control I/O module that provides the timer input signal.

 

S6

Point number of the timer input. This specification defines the digital or control I/O module input point number of the time input signal. The timer input prevents the module from restoring outdated information after it has been powered down for an extended period of time. The hundreds digit of S6 defines the expired logic state when a time-out condition occurs.

 

unused

=

000

 

 

 

DSI

=

X0Z

=

Group A

(Z = 1 - 8)

 

=

X1Z

=

Group B

(Z = 1- 8)

CIS

=

X2Z

 

 

(Z = 1 - 3)

 

Expire logic state:

0YZ = logic 0

1YZ = logic 1

 

S7, S8 and S9

Spare.

 

 

140.2   Module Memory Utilization

 

NOTE: When the NVRAM module memory utilization of a function block being restored is modified (i.e., a function block which has a variable usage equation associated with it in Table 140-4 or 140-5), it is necessary to manually perform the following operation in the configuration mode:

 

  1. Modify S1 of the FC 140 function block to zero.

  2. Modify S1 of the FC 140 function block to re-reference the block address of the function block being restored.

 

This operation allows the FC 140 function block to recognize the NVRAM changes of the function block being restored and to then adjust itself accordingly. Failure to perform this operation will result in the module entering error mode when function block configuration has been completed.

 

To determine NVRAM module memory utilization, use Appendix B, in conjunction with the formula:

 

NVRAM = 40 + N

 

where:   

N = Applicable function code size from Tables 140-4 or 140-5. NVRAM is set to 46 when N is less than six.

 

 

NOTES:

1. Add 8 bytes to the byte size for BRC-300/400 controllers.

2. This function code is not supported by the IMMFP11/12.

 

 

 

NOTE:

1. This function code is not supported by the HAC01.

 

 

140.3   Memory Usage Equations

 

1.      14 + S5 x 4

 

2.      188 + S12 x b

where:

b = 1 (if S12 is positive)

- or -

b = 1024 (if S12 is negative)

 

3.      12 + 4 x (S21 + 5) + 4 x (S22 + 5)

 

4.      26 + 4 x S2

 

5.      156 + S13 x 56

 

6.      182 + S2 + (S8 x 16)

 

7.      10 + (S1 x 1024)

 

8.      248 + (S12 x b)

where:

b = 1 (if S12 is positive)

- or -

b = 1024 (if S12 is negative)

 

9.      60 + (S7 x 20)

 

10.    20 + [4 x ({5 + S21} + {5 + S22})]

 

11.    34 + (4 x S2)

 

12.     a + [b x (S4)] + [c x (n{S3})] + d

     where:

 

n{S3}

=

Number of modes selected for S3

if S2

=

0, 3, 10, or 11, then a = 106, b = 12, and c = 8

if S2

=

1, 2, 5, 6, 7, 9, 12, or 13, then a = 100, b = 10, and c = 4

if S2

=

4 or 8, then a = 128, b = 25, and c = 32

 

 

 

if    IMMFP11/12 or BRC-100, then d = 0

if    HAC, then d=4

 

 

 

 

13.     378 + (142 x S13)

 

 

140.4   Applications

 

Figure 140-1 shows an example of using function code 140. In the application, the moving average block (function code 165) calculates the average of the square root value at block 400. The moving average is calculated every 15 seconds and is calculated based on one hour’s worth of collected data. The average calculation is suspended whenever the quality of the analog input is bad.

 

The restore block (function code 140) insures that the hour’s worth of collected data is not lost in the event that the controller module loses power. The restore block is configured for restore on power up. The elapsed timer block controls the update rate of NVRAM data. The NVRAM data is saved once every 15 seconds.