How to deal with compound which composition is very very bit

How to deal with compound which composition is very very bit

Postby bcbooo » 25 April 2016, 12:50

Recently I am doing some simulation works in Aspen Plus environment, and the process involes my self Unit Operations. But the inlet material stream mixture is very special, one of the compounds is very very bit in the mixture, it's mole fraction is about 1E(-20).

As you know, my self Unit Operation needs to get the composition through CAPE-OPEN interfaces from the inlet material stream. The composition is passed from GetOverallProperty interface method as a double VARAINT format, but the double format in C++ does not support so many decimals, so is there some mechanism to deal with this problem? Any response will be appreciated, thank you!
bcbooo
 
Posts: 66
Joined: 22 November 2012, 06:41
Location: China

Re: How to deal with compound which composition is very very

Postby jasper » 25 April 2016, 13:30

Can you elaborate on the issue? There are some 16 digits in the double precision number, but that should not be a problem to tell the difference between 1.00000000000001e-20 and 1.00000000000002e-20, which are both represented fine by a double precision number.
User avatar
jasper
 
Posts: 1128
Joined: 24 October 2012, 15:33
Location: Spain

Re: How to deal with compound which composition is very very

Postby bcbooo » 26 April 2016, 02:25

Double format gives 15–17 significant decimal digits precision, so if the compound's composition is 0.00000 00000 00000 00003, so it's difficulat to represent it accurately by double format. So how to deal it?
bcbooo
 
Posts: 66
Joined: 22 November 2012, 06:41
Location: China

Re: How to deal with compound which composition is very very

Postby jasper » 26 April 2016, 05:56

It is not a fixed point number. It is a floating point number. So it is not represented by 0.00000 00000 00000 00003 but it is represented by 3e-20 (well - the binary equivalent thereof). So 3.123456789e-20 is not a problem, this is a number with 10 (out of about 16 possible) digits.

On the other hand, 1.0 - 0.00000 00000 00000 00003 will not show the correct difference, as this would be 0.99999999999999999997, which has 20 digits. Instead, the answer would be (the nearest binary representation of) 1.0.

So as long as you are not adding or subtracting numbers that are 20 orders of magnitude apart, there should not be a problem with precision in this case.
User avatar
jasper
 
Posts: 1128
Joined: 24 October 2012, 15:33
Location: Spain

Re: How to deal with compound which composition is very very

Postby bcbooo » 26 April 2016, 06:24

Ohhh Jasper you are so erudite, thank you very much!
bcbooo
 
Posts: 66
Joined: 22 November 2012, 06:41
Location: China


Return to Unit Operations

Who is online

Users browsing this forum: No registered users and 1 guest

cron