#### trimixdiver1

##### Well-Known Member

Im looking for a formula that will give me the pressure to carbonate to, I will have the Temp of the tank and will know what volumes I want.

Thanks!!!

- Thread starter trimixdiver1
- Start date

Im looking for a formula that will give me the pressure to carbonate to, I will have the Temp of the tank and will know what volumes I want.

Thanks!!!

with P in PSIG and T in °F is a pretty good (rmse = 0.01 Vol; peak error -0.044 Vols @37 °F, 10 psig, 3.27 Vols) fit to the ASBC table.

- Thread Starter
- #3

Formula isnt working, program says an error

- Thread Starter
- #5

Thanks, will try tomorrow

- Thread Starter
- #6

((R1096 + 14.695) * (0.01821 + (0.090115 ** (-(R1090 - 32) / 43.11)))) - 0.003342

This is how it lays out in my PLC

r1096 is pressure

r1090 is temperature

still not correct.

Also Im trying to input the volumes and output the pressure. Im not great with long equations, thanks

This is how it lays out in my PLC

r1096 is pressure

r1090 is temperature

still not correct.

Also Im trying to input the volumes and output the pressure. Im not great with long equations, thanks

Getting pressure from volume and temperature is a simple matter of solving for P

P = (V + 0.003342)/(0.01821 + 0.090115*exp( -(T-32)/43.11) ) -14.695

- Thread Starter
- #8

((R1096 + 0.003342) / (0.01821 + (0.090115 * (2.718282 ** (-(R1090 - 32) / 43.11))))) - 14.695

R1096 is Vols

R1090 is Temp

Im so lost right now.....

Here is a copy of the DoMore PLC instructions

The Math Raise to a Power operator ( ** ) will calculate the result of a base raised to the power of an exponent. The result of this calculation will always be a Real (floating point) value and should be placed in a Real memory location to preserve the fractional portion. This is especially important if the exponent is negative or if the exponent is a Real value,

Any value raised to the 0 power is 1. The value 0 raised to any power is 0. Note: 0 raised to the 0 power is 1.

The base and exponent can be any mix of signed integers, unsigned integers, real (floating point) numbers or discrete values. They can be any numeric or discrete memory location or any numeric or discrete structure member.

Traditional math precedence rules are used to solve the math expression. The use of parentheses to remove any ambiguity in the processing order is encouraged.

Refer to the examples below:

Signed Integers: assume D1 = 2 and D2 = 3

D0 = D1 ** D2

D0 = 2 ** 3

D0 = 8

Both the base and the exponent are integer memory locations.

The result is placed in an integer memory location.

D0 = (D1 ** D2) ** D1

D0 = (2 ** 3) ** 2

D0 = 8 ** 2

D0 = 64

The base and exponents are integer memory locations.

The result is placed in an integer memory location.

D0 = D1 ** (D2 ** D1)

D0 = 2 ** (3 ** 2)

D0 = 2 ** 8

D0 = 256

The base and exponents are integer memory locations.

The use of parentheses specifies the order of operation which yields a different result than the same values above.

The result is placed in an integer memory location.

R0 = D1 ** 0.5

R0 = 2 ** 0.5

R0 = 1.414

The base is an integer memory locations, the exponent is a Real constant.

The exponent is non-integer, which will generate a non-integer result. Place the result in a Real memory location to preserve the fractional portion.

The result is placed in a Real memory location.

R0 = D1 ** -3

R0 = 2 ** -3

R0 = 0.1250

The base is an integer memory locations, the exponent is an integer constant.

The exponent is negative, which will generate a non-integer result. Place the result in a Real memory location to preserve the fractional portion.

The result is placed in a Real memory location.

Numeric Structure Members: assume D1 = 10 and Timer T0.Acc = 5ms

D0 = D1 ** T0.Acc

D0 = 10 ** 5

D0 = 100000

The base is an integer memory location, the exponent is a structure member.

The .Acc member of a Timer structure contains the amount of time in milliseconds that has accumulated in a Timer.

The result is placed in an integer memory location.

Casting Numeric Values: assume DLV2000 and DLV2001 as a 32-bit Real = 123.45

R0 = DLV2000:RD ** 2

R0 = 123.45 ** 2

R0 = 15239.9

The base is using the 'Real and DWord' cast operators, the exponent is an integer constant.

The result is placed in a floating point memory location.

DLV memory locations are 16-bit Unsigned used by external DirectLOGIC devices. In this example a remote DirectLOGIC CPU has written a 32-bit floating point value into two successive DLV memory locations. Using the :RD cast operator will interpret the 32-bit value in DLV2000 and DLV2001 as a REAL number.

R1096 is Vols

R1090 is Temp

Im so lost right now.....

Here is a copy of the DoMore PLC instructions

The Math Raise to a Power operator ( ** ) will calculate the result of a base raised to the power of an exponent. The result of this calculation will always be a Real (floating point) value and should be placed in a Real memory location to preserve the fractional portion. This is especially important if the exponent is negative or if the exponent is a Real value,

Any value raised to the 0 power is 1. The value 0 raised to any power is 0. Note: 0 raised to the 0 power is 1.

The base and exponent can be any mix of signed integers, unsigned integers, real (floating point) numbers or discrete values. They can be any numeric or discrete memory location or any numeric or discrete structure member.

Traditional math precedence rules are used to solve the math expression. The use of parentheses to remove any ambiguity in the processing order is encouraged.

Refer to the examples below:

Signed Integers: assume D1 = 2 and D2 = 3

D0 = D1 ** D2

D0 = 2 ** 3

D0 = 8

Both the base and the exponent are integer memory locations.

The result is placed in an integer memory location.

D0 = (D1 ** D2) ** D1

D0 = (2 ** 3) ** 2

D0 = 8 ** 2

D0 = 64

The base and exponents are integer memory locations.

The result is placed in an integer memory location.

D0 = D1 ** (D2 ** D1)

D0 = 2 ** (3 ** 2)

D0 = 2 ** 8

D0 = 256

The base and exponents are integer memory locations.

The use of parentheses specifies the order of operation which yields a different result than the same values above.

The result is placed in an integer memory location.

R0 = D1 ** 0.5

R0 = 2 ** 0.5

R0 = 1.414

The base is an integer memory locations, the exponent is a Real constant.

The exponent is non-integer, which will generate a non-integer result. Place the result in a Real memory location to preserve the fractional portion.

The result is placed in a Real memory location.

R0 = D1 ** -3

R0 = 2 ** -3

R0 = 0.1250

The base is an integer memory locations, the exponent is an integer constant.

The exponent is negative, which will generate a non-integer result. Place the result in a Real memory location to preserve the fractional portion.

The result is placed in a Real memory location.

Numeric Structure Members: assume D1 = 10 and Timer T0.Acc = 5ms

D0 = D1 ** T0.Acc

D0 = 10 ** 5

D0 = 100000

The base is an integer memory location, the exponent is a structure member.

The .Acc member of a Timer structure contains the amount of time in milliseconds that has accumulated in a Timer.

The result is placed in an integer memory location.

Casting Numeric Values: assume DLV2000 and DLV2001 as a 32-bit Real = 123.45

R0 = DLV2000:RD ** 2

R0 = 123.45 ** 2

R0 = 15239.9

The base is using the 'Real and DWord' cast operators, the exponent is an integer constant.

The result is placed in a floating point memory location.

DLV memory locations are 16-bit Unsigned used by external DirectLOGIC devices. In this example a remote DirectLOGIC CPU has written a 32-bit floating point value into two successive DLV memory locations. Using the :RD cast operator will interpret the 32-bit value in DLV2000 and DLV2001 as a REAL number.

•print ((2.73175 + 0.003342) / (0.01821 + (0.090115 * (2.718282 ^(-(40 - 32) / 43.11))))) - 14.695

it returns 14.695 which is the correct answer. IOW you have an instruction which, as far as I can tell, is correct. The instructions you posted confirm this. The only thing I can think of the variables you are passing are not floating point numbers.

I don't know what else I can advise here. You have a formula which compilers can understand. Perhaps you could break it down into smaller parts, trying each one out in Excel, for example.

- Thread Starter
- #10

((R1096 + 0.003342) / (0.01821 + (0.090115 * (2.718282 ^ (-(R1090 - 32) / 43.11))))) - 14.695

With

R1096 = 2.75

R1090= 32.0

I get -0.920851

My numbers are REAL

Dont know whats going on?

With

R1096 = 2.75

R1090= 32.0

I get -0.920851

My numbers are REAL

Dont know whats going on?

- Thread Starter
- #12

Got it!! the ^ should be ** for my compiler

Thanks!!!

Thanks!!!

- Replies
- 7

- Views
- 1K

- Replies
- 3

- Views
- 2K