Skip to content

Commit 010d6d8

Browse files
authored
distillation solver fix (#1295)
* update * update model * update * update
1 parent aa9ccd1 commit 010d6d8

File tree

3 files changed

+523
-513
lines changed

3 files changed

+523
-513
lines changed

src/main/java/neqsim/process/equipment/distillation/Condenser.java

+57-2
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,34 @@ public class Condenser extends SimpleTray {
2424
double duty = 0.0;
2525
boolean totalCondenser = false;
2626
Splitter mixedStreamSplitter = null;
27+
private boolean separation_with_liquid_reflux = false;
28+
private double reflux_value;
29+
private String reflux_unit;
30+
31+
/**
32+
* Checks if the separation process involves liquid reflux.
33+
*
34+
* @return {@code true} if the separation process involves liquid reflux, {@code false} otherwise.
35+
*/
36+
public boolean isSeparation_with_liquid_reflux() {
37+
return separation_with_liquid_reflux;
38+
}
39+
40+
/**
41+
* Sets the separation with liquid reflux parameters.
42+
*
43+
* @param separation_with_liquid_reflux a boolean indicating if separation with liquid reflux is
44+
* set
45+
* @param value the value of the reflux
46+
* @param unit the unit of the reflux value
47+
*/
48+
public void setSeparation_with_liquid_reflux(boolean separation_with_liquid_reflux, double value,
49+
String unit) {
50+
this.refluxIsSet = separation_with_liquid_reflux;
51+
this.separation_with_liquid_reflux = separation_with_liquid_reflux;
52+
this.reflux_value = value;
53+
this.reflux_unit = unit;
54+
}
2755

2856
/**
2957
* <p>
@@ -110,13 +138,29 @@ public StreamInterface getProductOutStream() {
110138
*/
111139
@Override
112140
public StreamInterface getLiquidOutStream() {
113-
if (totalCondenser) {
114-
return new Stream("", mixedStreamSplitter.getSplitStream(0));
141+
if (totalCondenser || separation_with_liquid_reflux) {
142+
return mixedStreamSplitter.getSplitStream(0);
115143
} else {
116144
return super.getLiquidOutStream();
117145
}
118146
}
119147

148+
/**
149+
* {@inheritDoc}
150+
*
151+
* <p>
152+
* getLiquidOutStream.
153+
* </p>
154+
*/
155+
public StreamInterface getLiquidProductStream() {
156+
if (separation_with_liquid_reflux) {
157+
return mixedStreamSplitter.getSplitStream(1);
158+
} else {
159+
return null;
160+
}
161+
}
162+
163+
120164
/** {@inheritDoc} */
121165
@Override
122166
public void run(UUID id) {
@@ -147,6 +191,17 @@ public void run(UUID id) {
147191
UUID oldID = getCalculationIdentifier();
148192
super.run(id);
149193
setCalculationIdentifier(oldID);
194+
} else if (separation_with_liquid_reflux) {
195+
super.run(id);
196+
Stream liquidstream = new Stream("temp liq stream", mixedStream.getFluid().phaseToSystem(1));
197+
liquidstream.run();
198+
if (liquidstream.getFlowRate("kg/hr") < this.reflux_value) {
199+
liquidstream.setFlowRate(this.reflux_value + 1, this.reflux_unit);
200+
liquidstream.run();
201+
}
202+
mixedStreamSplitter = new Splitter("splitter", liquidstream, 2);
203+
mixedStreamSplitter.setFlowRates(new double[] {this.reflux_value, -1}, this.reflux_unit);
204+
mixedStreamSplitter.run();
150205
} else {
151206
SystemInterface thermoSystem2 = streams.get(0).getThermoSystem().clone();
152207
// System.out.println("total number of moles " +

0 commit comments

Comments
 (0)