ProSoft Technology PTQ-AFC User Manual

Page 127

Advertising
background image

PTQ-AFC ♦ Modicon Quantum Platform

Quick Start

Liquid and Gas Flow Computer for Hydrocarbon Products

User Manual

ProSoft Technology, Inc.

Page 127 of 259

June 23, 2011

Also in these procedures:

a) The expression "AND 0x0000FFFF" means "take the low-order 16 bits of

the result, discarding all other higher-order bits"; it is equivalent to "(non-
negative) remainder upon dividing by 65536" (A traditionally negative
remainder that would result from dividing a negative dividend by 65536
must be made positive by subtracting its absolute value from 65536)

b) The operator ":=" means "assignment"; that is, "assign" the expression on

the right to the object on the left by calculating the value of the expression
on the right and making the object on the left assume that value. The
operator "==" means "is equal to".

c) Words in all caps and the other arithmetic operators have their expected

meanings.

d) Text enclosed in brackets ("[ ]") are comments only.

Procedure (A): Calculate event number from record position.
1

Calculate number of events on file.

events_on_file := ( next_event - oldest_event ) AND 0x0000FFFF

2

Determine whether desired record is on file.

IF ( my_record < 0 OR my_record

 events_on_file ) THEN

[record is not on file]

EXIT this procedure

3

Calculate age of desired record.

event_age := ( next_record - my_record )

IF ( event_age

 0 ) THEN

event_age := event_age + number_of_records

4

Calculate event number of desired record.

event_number := ( next_event - event_age ) AND 0x0000FFFF

Procedure (B): Calculate record position from event number.
1

Calculate number of events on file.

events_on_file := ( next_event - oldest_event ) AND 0x0000FFFF

2

Calculate age of desired event.

event_age := ( next_event - my_event ) AND 0x0000FFFF

3

Determine whether desired event is on file.

IF ( event_age == 0 OR event_age > events_on_file ) THEN

[event is not on file]

EXIT this procedure

4

Calculate record position of desired event.

record_position := ( next_position - event_age )

IF ( record_position < 0 ) THEN

record_position := record_position + number_of_records

Procedure (C): Calculate Modbus address of record from record position.
1

Calculate number of events on file.

events_on_file := ( next_event - oldest_event ) AND 0x0000FFFF

2

Determine whether desired record is on file.

Advertising
This manual is related to the following products: