compressibility factor density natural gas properties American Gas Association AGA AGA-8 microcontroller chip MicroChip flow flowmeter computing
electronic calculation Report #8 detail characterization method
[Home]
[
The description of the AGA-8 coprocessor commands
1. General information about coprocessor work
The coprocessor executes account of a density and factor of a compressibility of natural gas. As a basic data the structure of gas (up to 21 components), temperature and pressure of gas is used. The account is made on a technique of
Detail characterization method indicated in the report AGA-8. For convenience of use the program of account is divided into three parts. Account of parameters dependent from structure of gas at first is executed. Then, the obtained parameters are used for account of parameters, dependent on temperature, which, in turn, together with significance of pressure are used in iterative procedures for deriving a density and factor of a compressibility of gas. Thus for want of modification only pressure need to be executed the last part of accounts, for want of modification of temperature - two last parts and only for want of modification of structure of gas are executed all parts of the program.2. Format of a command
The commands are transmitted by sendings of different length of the following format:
1 byte - # of a command
2 byte - common length of a sending in bytes
3 byte and further - data
Last byte - check total of a sending modulo 256.
Minimum length of a sending - 3 bytes.
The command can be sent only when the coprocessor is not occupied in accounts (READY has a high level). Otherwise, the command is not accepted or is ignored.
3. Format of a condition word
The coprocessor should answer each command after it fulfilment. On majority of commands the answer is the transfer of a condition word of the coprocessor.
Format of a word of a condition:
0 bits - are not used (= 0)
1 bit = 1 - the sending with structure of natural gas is accepted
2 bits = 1 - the account of parameters dependent on gas structure is made
3 bits = 1 - the account of parameters, dependent on temperature, is made
4 bits = 1 - the account of a density and factor of a compressibility is made
5 bits = 1 - the reception of a command is completed (is used by the program of the coprocessor)
6 bits - are not used
7 bits = 1 - error for want of reception or fulfilment of a command
4. Possible errors
If bit of an error is present, the word of a condition is followed by byte with number of an error. The following significances of errors are possible:
1 - Error of the check total in an accepted sending
2 - The number of a sending accepted byte, has exceeded, maximum allowed
3 - The number of a sending accepted byte, does not correspond indicated in byte 2
4 - Error in a format of a command
5 - Incorrect data in a command
6 - The data on structure of gas in the RAM of the coprocessor are spoilen
7 - The outcomes of account of parameters, dependent on structure, are spoilen
8 - The outcomes of account of parameters, dependent on temperature, are spoilen
9 - The number of iterations during account has exceeded maximum allowable, the error exceeds allowable (it is necessary to update structure, pressure, temperature)
10 - The pressure has negative dependence on a density (for want of pressure buildup a denseness decreases), it is necessary to check up basic data
12 - Is similar 9
13 - Error of a frame for want of reception of a command on the synchronous serial port
14 - Error of overfilling for want of reception on the synchronous serial port
5. Brief description of commands
|
# |
Purpose(assignment) |
Length |
The answer |
|
0 |
General coprocessor reset |
4 |
Is not present |
|
1 |
To transmit a word of a condition |
4 |
Condition |
|
2 |
To accept datas on structure of gas. The datas are transmitted in a format of 1 byte - a component #, 4 bytes - a component molar fraction. |
Up to 224 |
Condition |
|
3 |
To execute account of parameters, dependent on structure, |
4 |
Condition |
|
4 |
To accept datas on pressure and (option) to temperature and to execute account of a density and factor of a compressibility |
8 (13) |
Condition |
|
5 |
To transmit outcomes of calculation of a density and factor of a compressibility |
4 |
Condition |
|
6 |
To reset an indication of an error |
4 |
Condition |
Command 2.
The molar fraction of components can be as in percentage, or in shares. The program then all magnitude results to 1. The magnitude of molar shares are represented in a 32-bit format with a floating point. The contents each a component is transmitted in 5 bytes. First byte contains number a component in the correspondence with the report AGA - integer from 1 up to 21 in a binary form. The order of following of components in a sending has not significance. It is possible to transmit full structure of a mixture behind some sendings. Before fulfilment of a command 3 the correction of the contents already of transferred components is supposed.Before a sending of a command 2 it is recommended to execute a command 0 or hardware dumping of a chip for clearing before the entered magnitude of structure.
In reply to a command the word of a condition with stated bit 1 or with an indication of an error returns.
Command 3.
Before account the reduction of a fractions of components to 1 and replacement of transferred magnitude on indicated is executed. Therefore after fulfilment of this command it is impossible to modify magnitude of structure of separate components. The magnitude of parameters obtained in an outcome of account, are destroyed only for want of fulfilment of commands 0 and 2.Command 4.
The magnitude of temperature and pressure are represented in a 32-bit format with a floating point. Before significance of temperature the numeral ‘T’, and pressure - numeral ‘ P’ follows. The sequence of transfer has not significance. If the significance only of one parameter is transmitted, for second the previous significance is used.In reply to a command the word of a condition with the seted bits 3 and 4 or bit of an error returns.
Command 5.
The magnitude are transmitted in a 32-bit format for a floating point. Before significance of a density the numeral ‘D’, and factor of a compressibility - ‘ Z’ follows.Command 6.
If during work of the coprocessor there was an error, any command is ignored, and in the answer the word of a condition is issued. This command allows to reinstate normal work.In reply to a command the word of a condition returns.
; 32 bit floating point representation
; EXPONENT 8 bit biased exponent
; It is important to note that the use of biased exponents produces
; A unique representation of a floating point 0, given by
; EXP = HIGHBYTE = MIDBYTE = LOWBYTE = 0x00, with 0 being
; The only number with EXP = 0.
; HIGHBYTE 8 bit most significant byte of fraction in sign-magnitude representation,
; With SIGN = MSB, implicit MSB = 1 and radix point to the right of MSB
; MIDBYTE 8 bit middle significant byte of sign-magnitude fraction
; LOWBYTE 8 bit least significant byte of sign-magnitude fraction
; EXPONENT HIGHBYTE MIDBYTE LOWBYTE
; Xxxxxxxx S.xxxxxxx xxxxxxxx xxxxxxxx
; |
; RADIX
; POINT
[
HOME]
[
E-mail:
malezhyk@hotmail.com