@@ -24,6 +24,49 @@ public class Standard_ASTM_D6377 extends neqsim.standards.Standard {
24
24
double TVP = 1.0 ;
25
25
double referenceTemperature = 37.8 ;
26
26
String referenceTemperatureUnit = "C" ;
27
+ String methodRVP = "VPCR4" ; // RVP_ASTM_D6377 // RVP_ASTM_D323_73_79 //
28
+ // RVP_ASTM_D323_82 // VPCR4_no_water // VPCR4
29
+
30
+ private double VPCR4_no_water = 0.0 ;
31
+ private double VPCR4 = 0.0 ;
32
+ private double RVP_ASTM_D6377 = 0.0 ;
33
+ private double RVP_ASTM_D323_73_79 = 0.0 ;
34
+ private double RVP_ASTM_D323_82 = 0.0 ;
35
+
36
+ /**
37
+ * Gets the method used for measuring Reid Vapor Pressure (RVP).
38
+ *
39
+ * The method can be one of the following:
40
+ * <ul>
41
+ * <li>RVP_ASTM_D6377</li>
42
+ * <li>RVP_ASTM_D323_73_79</li>
43
+ * <li>RVP_ASTM_D323_82</li>
44
+ * <li>VPCR4</li>
45
+ * </ul>
46
+ *
47
+ * @return the method used for RVP measurement.
48
+ */
49
+ public String getMethodRVP () {
50
+ return methodRVP ;
51
+ }
52
+
53
+ /**
54
+ * Sets the method used for measuring Reid Vapor Pressure (RVP).
55
+ *
56
+ * The method should be one of the following:
57
+ * <ul>
58
+ * <li>RVP_ASTM_D6377</li>
59
+ * <li>RVP_ASTM_D323_73_79</li>
60
+ * <li>RVP_ASTM_D323_82</li>
61
+ * <li>VPCR4</li>
62
+ * </ul>
63
+ *
64
+ * @param methodRVP the method to set for RVP measurement.
65
+ */
66
+ public void setMethodRVP (String methodRVP ) {
67
+ this .methodRVP = methodRVP ;
68
+ }
69
+
27
70
28
71
/**
29
72
* <p>
@@ -59,31 +102,24 @@ public void calculate() {
59
102
logger .error (ex .getMessage (), ex );
60
103
}
61
104
62
- RVP = this .thermoSystem .getPressure ();
63
- }
105
+ VPCR4 = this .thermoSystem .getPressure ();
106
+ RVP_ASTM_D6377 = 0.834 * VPCR4 ;
107
+ RVP_ASTM_D323_82 = (0.752 * (100.0 * this .thermoSystem .getPressure ()) + 6.07 ) / 100.0 ;
64
108
65
- // old method for RVP
66
- public void calculate2 () {
67
- this .thermoSystem .setTemperature (referenceTemperature , "C" );
68
- this .thermoSystem .setPressure (ThermodynamicConstantsInterface .referencePressure );
69
- this .thermoOps = new ThermodynamicOperations (thermoSystem );
70
- try {
71
- this .thermoOps .bubblePointPressureFlash (false );
72
- } catch (Exception ex ) {
73
- logger .error (ex .getMessage (), ex );
109
+ SystemInterface fluid1 = this .thermoSystem .clone ();
110
+ if (fluid1 .hasComponent ("water" )) {
111
+ fluid1 .removeComponent ("water" );
112
+ fluid1 .init (0 );
74
113
}
75
-
76
- TVP = this .thermoSystem .getPressure ();
77
- double liquidVolume = thermoSystem .getVolume ();
78
-
79
- this .thermoSystem .setPressure (TVP * 0.9 );
80
114
try {
81
- this .thermoOps .TVflash (liquidVolume * 4.0 );
115
+ // ASTM D323 -08 method is used for this property calculation. It is defined at the pressure
116
+ // at 100°F (37.8°C) at which 80% of the stream by volume is vapor at 100°F. In
117
+ this .thermoOps .TVfractionFlash (0.8 );
82
118
} catch (Exception ex ) {
83
119
logger .error (ex .getMessage (), ex );
84
120
}
85
-
86
- RVP = ( 0.752 * ( 100.0 * this . thermoSystem . getPressure ()) + 6.07 ) / 100.0 ;
121
+ VPCR4_no_water = this . thermoSystem . getPressure ();
122
+ RVP_ASTM_D323_73_79 = VPCR4_no_water ;
87
123
}
88
124
89
125
/** {@inheritDoc} */
@@ -102,11 +138,14 @@ public String getUnit(String returnParameter) {
102
138
@ Override
103
139
public double getValue (String returnParameter , java .lang .String returnUnit ) {
104
140
if (returnParameter == "RVP" ) {
105
- neqsim .util .unit .PressureUnit presConversion = new neqsim .util .unit .PressureUnit (RVP , "bara" );
141
+ double RVPlocal = getValue ("RVP" );
142
+ neqsim .util .unit .PressureUnit presConversion =
143
+ new neqsim .util .unit .PressureUnit (RVPlocal , "bara" );
106
144
return presConversion .getValue (returnUnit );
107
145
}
108
146
if (returnParameter == "TVP" ) {
109
- neqsim .util .unit .PressureUnit presConversion = new neqsim .util .unit .PressureUnit (TVP , "bara" );
147
+ neqsim .util .unit .PressureUnit presConversion =
148
+ new neqsim .util .unit .PressureUnit (getValue ("TVP" ), "bara" );
110
149
return presConversion .getValue (returnUnit );
111
150
} else {
112
151
return RVP ;
@@ -116,7 +155,27 @@ public double getValue(String returnParameter, java.lang.String returnUnit) {
116
155
/** {@inheritDoc} */
117
156
@ Override
118
157
public double getValue (String returnParameter ) {
119
- return RVP ;
158
+ if (returnParameter .equals ("RVP" )) {
159
+ switch (methodRVP ) {
160
+ case "RVP_ASTM_D6377" :
161
+ return RVP_ASTM_D6377 ;
162
+ case "RVP_ASTM_D323_73_79" :
163
+ return RVP_ASTM_D323_73_79 ;
164
+ case "VPCR4" :
165
+ return VPCR4 ;
166
+ case "RVP_ASTM_D323_82" :
167
+ return RVP_ASTM_D323_82 ;
168
+ case "VPCR4_no_water" :
169
+ return VPCR4_no_water ;
170
+ default :
171
+ return VPCR4 ;
172
+ }
173
+ } else if (returnParameter .equals ("TVP" )) {
174
+ return TVP ;
175
+ } else {
176
+ logger .error ("returnParameter not supported.. " + returnParameter );
177
+ return 0.0 ;
178
+ }
120
179
}
121
180
122
181
/**
@@ -146,10 +205,14 @@ public static void main(String args[]) {
146
205
testSystem .addComponent ("ethane" , 0.006538 );
147
206
testSystem .addComponent ("propane" , 0.006538 );
148
207
testSystem .addComponent ("n-pentane" , 0.545 );
208
+ testSystem .addComponent ("water" , 0.00545 );
149
209
testSystem .setMixingRule (2 );
150
210
testSystem .init (0 );
151
211
Standard_ASTM_D6377 standard = new Standard_ASTM_D6377 (testSystem );
152
212
standard .calculate ();
153
213
System .out .println ("RVP " + standard .getValue ("RVP" , "bara" ));
214
+ standard .setMethodRVP ("RVP_ASTM_D323_73_79" );
215
+ standard .calculate ();
216
+ System .out .println ("RVP_ASTM_D323_73_79 " + standard .getValue ("RVP" , "bara" ));
154
217
}
155
218
}
0 commit comments