Skip to content

Commit

Permalink
added improved TEG in gas calculation
Browse files Browse the repository at this point in the history
  • Loading branch information
EvenSol authored and asmfstatoil committed Jul 22, 2022
1 parent 20c2b25 commit b327341
Show file tree
Hide file tree
Showing 2 changed files with 147 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,33 @@ 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 @@ -600,4 +627,111 @@ public void setWaterInDryGas(double waterInDryGasInput) {
public void isSetWaterInDryGas(boolean isSetwaterInDryGas) {
this.isSetWaterInDryGas = isSetwaterInDryGas;
}


/** {@inheritDoc} */
@Override
public void run() {
try {
double y0 = 0.0, y1 = 0.0, y0TEG=0.0;
// double yN = gasInStream.getThermoSystem().getPhase(0).getComponent("water").getx();
double absorptionEffiency = 0.0;
mixedStream.setThermoSystem((streams.get(0).getThermoSystem().clone()));
mixedStream.getThermoSystem().setNumberOfPhases(2);
mixedStream.getThermoSystem().reInitPhaseType();
mixedStream.getThermoSystem().init(0);
mixStream();
// System.out.println("feed total number of water " +
// mixedStream.getFluid().getPhase(0).getComponent("water").getNumberOfmoles());
double enthalpy = calcMixStreamEnthalpy();
//// System.out.println("temp guess " + guessTemperature());
mixedStream.getThermoSystem().setTemperature(guessTemperature());
ThermodynamicOperations testOps =
new ThermodynamicOperations(mixedStream.getThermoSystem());
testOps.TPflash();
testOps.PHflash(enthalpy, 0);

kwater = mixedStream.getThermoSystem().getPhase(0).getComponent("water").getx()
/ mixedStream.getThermoSystem().getPhase(1).getComponent("water").getx();

calcNumberOfTheoreticalStages();
// System.out.println("number of theoretical stages " +
// getNumberOfTheoreticalStages());
absorptionEffiency = calcEa();

y0 = calcY0();
y0TEG = calcY0TEG();
y1 = gasInStream.getThermoSystem().getPhase(0).getComponent("water").getx()
- absorptionEffiency * (gasInStream.getThermoSystem().getPhase(0)
.getComponent("water").getx() - y0);

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"));

// System.out.println("mole water to move " + molesWaterToMove);
// System.out.println("total moles water in gas " +
// mixedStream.getThermoSystem().getPhase(0).getComponent("water").getNumberOfMolesInPhase());
// System.out.println("total moles water " +
// mixedStream.getThermoSystem().getPhase(0).getComponent("water").getNumberOfmoles());
StreamInterface stream = mixedStream.clone();
stream.setName("test");
stream.getThermoSystem().addComponent("water", -molesWaterToMove, 0);
stream.getThermoSystem().addComponent("water", molesWaterToMove, 1);
stream.getThermoSystem().addComponent("TEG", molesTEGToMove, 0);
stream.getThermoSystem().addComponent("TEG", -molesTEGToMove, 1);
stream.getThermoSystem().initBeta();
stream.getThermoSystem().init_x_y();
stream.getThermoSystem().init(2);
mixedStream = stream;

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

SystemInterface tempSystem = mixedStream.getThermoSystem().clone();
SystemInterface gasTemp = tempSystem.phaseToSystem(tempSystem.getPhases()[0]);
gasTemp.init(2);
gasOutStream.setThermoSystem(gasTemp);
// System.out.println("gas total number of water " +
// gasOutStream.getFluid().getPhase(0).getComponent("water").getNumberOfmoles());

tempSystem = mixedStream.getThermoSystem().clone();
SystemInterface liqTemp = tempSystem.phaseToSystem(tempSystem.getPhases()[1]);
liqTemp.init(2);
solventOutStream.setThermoSystem(liqTemp);
// System.out.println("solvent total number of water " +
// solventOutStream.getFluid().getPhase(0).getComponent("water").getNumberOfmoles());

setNTU(calcNTU(y0, y1,
gasInStream.getThermoSystem().getPhase(0).getComponent("water").getx(), yMean));
// System.out.println("NTU " + getNTU());

// double Ks = 0.055;
getSolventOutStream().getThermoSystem().initPhysicalProperties();
getGasOutStream().getThermoSystem().initPhysicalProperties();

// double vtemp = Ks * Math.sqrt((getSolventOutStream().getThermoSystem().getPhase(0)
// .getPhysicalProperties().getDensity() -
// getGasOutStream().getThermoSystem().getPhase(0).getPhysicalProperties()
// .getDensity()) /
// getSolventOutStream().getThermoSystem().getPhase(0).getPhysicalProperties().getDensity());

// double d = Math.sqrt(4.0 * getGasOutStream().getMolarRate() *
// getGasOutStream().getThermoSystem().getPhase(0).getMolarMass() /
// getGasOutStream().getThermoSystem().getPhase(0).getPhysicalProperties()
// .getDensity()/ 3.14 / vtemp);
// System.out.println("diameter " + d);
} catch (Exception e) {
e.printStackTrace();
}
// System.out.println("rich TEG from absorber " +
// getSolventOutStream().getFlowRate("kg/hr"));
}


}
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,7 @@ public void runTEGProcessTest() {
new Heater("rich TEG preheater", glycol_flash_valve.getOutletStream());

HeatExchanger heatEx2 =
new HeatExchanger("rich TEG heat exchanger 1", richGLycolHeaterCondenser.getOutletStream());
new HeatExchanger("rich TEG heat exchanger 1", richGLycolHeaterCondenser.getOutStream());
heatEx2.setGuessOutTemperature(273.15 + 62.0);
heatEx2.setUAvalue(200.0);

Expand All @@ -390,11 +390,11 @@ public void runTEGProcessTest() {
Filter fineFilter = new Filter("TEG fine filter", flashLiquid);
fineFilter.setDeltaP(0.05, "bara");

Filter carbonFilter = new Filter("activated carbon filter", fineFilter.getOutletStream());
Filter carbonFilter = new Filter("activated carbon filter", fineFilter.getOutStream());
carbonFilter.setDeltaP(0.01, "bara");

HeatExchanger heatEx =
new HeatExchanger("rich TEG heat exchanger 2", carbonFilter.getOutletStream());
new HeatExchanger("rich TEG heat exchanger 2", carbonFilter.getOutStream());
heatEx.setGuessOutTemperature(273.15 + 130.0);
heatEx.setUAvalue(390.0);

Expand All @@ -417,7 +417,7 @@ public void runTEGProcessTest() {

DistillationColumn column = new DistillationColumn(1, true, true);
column.setName("TEG regeneration column");
column.addFeedStream(glycol_flash_valve2.getOutletStream(), 0);
column.addFeedStream(glycol_flash_valve2.getOutStream(), 0);
column.getReboiler().setOutTemperature(273.15 + 201.0);
column.getCondenser().setOutTemperature(273.15 + 92.0);
column.getReboiler().addStream(gasToReboiler);
Expand All @@ -427,7 +427,7 @@ public void runTEGProcessTest() {
Heater coolerRegenGas = new Heater("regen gas cooler", column.getGasOutStream());
coolerRegenGas.setOutTemperature(273.15 + 7.5);

Separator sepregenGas = new Separator("regen gas separator", coolerRegenGas.getOutletStream());
Separator sepregenGas = new Separator("regen gas separator", coolerRegenGas.getOutStream());

Stream gasToFlare = new Stream("gas to flare", sepregenGas.getGasOutStream());

Expand All @@ -450,25 +450,25 @@ public void runTEGProcessTest() {
Heater bufferTank = new Heater("TEG buffer tank", stripper.getLiquidOutStream());
bufferTank.setOutTemperature(273.15 + 191.0);

Pump hotLeanTEGPump = new Pump("hot lean TEG pump", bufferTank.getOutletStream());// stripper.getSolventOutStream());
Pump hotLeanTEGPump = new Pump("hot lean TEG pump", bufferTank.getOutStream());// stripper.getSolventOutStream());
hotLeanTEGPump.setOutletPressure(5.0);
hotLeanTEGPump.setIsentropicEfficiency(0.6);

heatEx.setFeedStream(1, hotLeanTEGPump.getOutletStream());
heatEx.setFeedStream(1, hotLeanTEGPump.getOutStream());

heatEx2.setFeedStream(1, heatEx.getOutStream(1));

Heater coolerhOTteg3 = new Heater("lean TEG cooler", heatEx2.getOutStream(1));
coolerhOTteg3.setOutTemperature(273.15 + 35.41);

Pump hotLeanTEGPump2 = new Pump("lean TEG HP pump", coolerhOTteg3.getOutletStream());
Pump hotLeanTEGPump2 = new Pump("lean TEG HP pump", coolerhOTteg3.getOutStream());
hotLeanTEGPump2.setOutletPressure(87.2);
hotLeanTEGPump2.setIsentropicEfficiency(0.75);

SetPoint pumpHPPresSet =
new SetPoint("HP pump set", hotLeanTEGPump2, "pressure", feedToAbsorber);

Stream leanTEGtoabs = new Stream("lean TEG to absorber", hotLeanTEGPump2.getOutletStream());
Stream leanTEGtoabs = new Stream("lean TEG to absorber", hotLeanTEGPump2.getOutStream());

neqsim.thermo.system.SystemInterface pureTEG = feedGas.clone();
pureTEG.setMolarComposition(
Expand All @@ -491,7 +491,7 @@ public void runTEGProcessTest() {
makeupMixer.addStream(makeupTEG);

Recycle resycleLeanTEG = new Recycle("lean TEG resycle");
resycleLeanTEG.addStream(makeupMixer.getOutletStream());
resycleLeanTEG.addStream(makeupMixer.getOutStream());
resycleLeanTEG.setOutletStream(TEGFeed);
resycleLeanTEG.setPriority(200);
resycleLeanTEG.setDownstreamProperty("flow rate");
Expand Down Expand Up @@ -542,6 +542,8 @@ public void runTEGProcessTest() {
operations.add(makeupTEG);
operations.add(makeupMixer);
operations.add(resycleLeanTEG);
// operations.run();
operations.run();
dehydratedGas.getFluid().display();
dehydratedGas.getFluid().display();
}
}

0 comments on commit b327341

Please sign in to comment.