Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added improved TEG in gas calculation #388

Draft
wants to merge 11 commits into
base: master
Choose a base branch
from
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,32 @@ public double calcY0() {
return y0;
}

/**
* <p>
* calcY0TEG.
* </p>
*
* @return a double
*/
public double calcY0TEG() {
// double fugacityWaterLiquid =
// mixedStream.getThermoSystem().getPhase(1).getFugacity("water");
// double xrel =
// mixedStream.getFluid().getPhase(0).getComponent("water").getx()/solventInStream.getFluid().getPhase(0).getComponent("water").getx();
// double y0 =
// xrel*fugacityWaterLiquid/(mixedStream.getFluid().getPhase(0).getComponent("water").getFugacityCoefficient()*mixedStream.getFluid().getPressure());
// double oldTemp = mixedStream.getTemperature();
// mixedStream.setTemperature(solventInStream.getTemperature(),"K");
// mixedStream.getFluid().init(1);
double fugCoefRef =
mixedStream.getThermoSystem().getPhase(1).getComponent("TEG").getFugacityCoefficient();
double y0TEG = solventInStream.getFluid().getPhase(0).getComponent("TEG").getx() * fugCoefRef
/ (mixedStream.getThermoSystem().getPhase(0).getComponent("TEG").getFugacityCoefficient());
// mixedStream.setTemperature(oldTemp, "K");
// mixedStream.getFluid().init(2);
return y0TEG;
}

/**
* <p>
* calcNumberOfTheoreticalStages.
Expand Down Expand Up @@ -325,7 +351,6 @@ public double calcNTU(double y0, double y1, double yb, double ymix) {
@Override
public void run(UUID id) {
try {
double y1 = 0.0;
// double yN = gasInStream.getThermoSystem().getPhase(0).getComponent("water").getx();
mixedStream.setThermoSystem((streams.get(0).getThermoSystem().clone()));
mixedStream.getThermoSystem().setNumberOfPhases(2);
Expand All @@ -350,6 +375,9 @@ public void run(UUID id) {
double absorptionEffiency = calcEa();

double y0 = calcY0();
double y0TEG = calcY0TEG();

double y1 = 0.0;
if (isSetWaterInDryGas) {
y1 = waterInDryGas;
setNumberOfTheoreticalStages(2.0);
Expand All @@ -362,6 +390,10 @@ public void run(UUID id) {
double yMean = mixedStream.getThermoSystem().getPhase(0).getComponent("water").getx();
double molesWaterToMove =
(yMean - y1) * mixedStream.getThermoSystem().getPhase(0).getNumberOfMolesInPhase();
double yMeanTEG = mixedStream.getThermoSystem().getPhase(0).getComponent("TEG").getx();
double molesTEGToMove =
(y0TEG - yMeanTEG) * mixedStream.getThermoSystem().getPhase(0).getNumberOfMolesInPhase();

// System.out.println("Lean TEG to absorber "
// +solventInStream.getFlowRate("kg/hr"));

Expand All @@ -374,14 +406,14 @@ public void run(UUID id) {
newMixedStream.setName("test");
newMixedStream.getThermoSystem().addComponent("water", -molesWaterToMove, 0);
newMixedStream.getThermoSystem().addComponent("water", molesWaterToMove, 1);
newMixedStream.getThermoSystem().addComponent("TEG", molesTEGToMove, 0);
newMixedStream.getThermoSystem().addComponent("TEG", -molesTEGToMove, 1);
newMixedStream.getThermoSystem().initBeta();
newMixedStream.getThermoSystem().init_x_y();
newMixedStream.getThermoSystem().init(2);
mixedStream = newMixedStream;
mixedStream.setCalculationIdentifier(id);

// stream.getThermoSystem().display();

SystemInterface tempSystem = mixedStream.getThermoSystem().clone();
SystemInterface gasTemp = tempSystem.phaseToSystem(tempSystem.getPhases()[0]);
gasTemp.init(2);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -547,7 +547,9 @@ public void runTEGProcessTest() {
operations.add(makeupTEG);
operations.add(makeupMixer);
operations.add(resycleLeanTEG);
// operations.run();
operations.run();
dehydratedGas.getFluid().display();
dehydratedGas.getFluid().display();
}

@Test
Expand Down