Skip to content

Commit

Permalink
finalize test
Browse files Browse the repository at this point in the history
  • Loading branch information
EvenSol committed Dec 26, 2023
1 parent 05dd697 commit 157b0d4
Show file tree
Hide file tree
Showing 3 changed files with 99 additions and 91 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ public class Compressor extends TwoPortEquipment implements CompressorInterface
public SystemInterface thermoSystem;
private double outTemperature = 298.15;
private boolean useOutTemperature = false;
private double compressionRatio = 2.0;
private boolean useCompressionRatio = false;
private CompressorPropertyProfile propertyProfile = new CompressorPropertyProfile();
public double dH = 0.0;
public double inletEnthalpy = 0;
Expand Down Expand Up @@ -360,6 +362,9 @@ public void run(UUID id) {
double orginalMolarFLow = thermoSystem.getTotalNumberOfMoles();
double fractionAntiSurge = 0.0;
double kappa = 0.0;
if (useCompressionRatio) {
setOutletPressure(presinn * compressionRatio);
}
if (useOutTemperature) {
if (useRigorousPolytropicMethod) {
solveEfficiency(outTemperature);
Expand Down Expand Up @@ -668,7 +673,7 @@ public void run(UUID id) {
polytropicFluidHead =
getPower() / getThermoSystem().getFlowRate("kg/sec") / 1000.0 * getPolytropicEfficiency();
polytropicHeadMeter = polytropicFluidHead * 1000.0 / 9.81;

compressionRatio = getOutletPressure() / presinn;
setCalculationIdentifier(id);
}

Expand Down Expand Up @@ -1401,4 +1406,13 @@ public double getMaximumSpeed() {
public double getMinimumSpeed() {
return minspeed;
}

public void setCompressionRatio(double compRatio) {
this.compressionRatio = compRatio;
useCompressionRatio = true;
}

public double getCompressionRatio() {
return compressionRatio;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -343,9 +343,25 @@ public void setActivateWhenLess(boolean activateWhenLess) {

public void setMaxAdjustedValue(double maxVal) {
maxAdjustedValue = maxVal;
if (maxAdjustedValue < minAdjustedValue) {
minAdjustedValue = maxAdjustedValue;
}
}

public void setMinAdjustedValue(double minVal) {
minAdjustedValue = minVal;
if (minAdjustedValue > maxAdjustedValue) {
maxAdjustedValue = minAdjustedValue;
}

}

public double getMaxAdjustedValue() {
return maxAdjustedValue;
}

public double getMinAdjustedValue() {
return minAdjustedValue;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,12 @@ void testRun() {
process.add(wellflow);

process.run();

System.out.println("production index " + wellflow.getWellProductionIndex() + " MSm3/day/bar^2");
System.out.println("reservoir pressure " + producedGasStream.getPressure("bara"));
System.out
.println("pres bottomhole " + wellflow.getOutletStream().getPressure("bara") + " bara");

/*
* System.out.println("production index " + wellflow.getWellProductionIndex() +
* " MSm3/day/bar^2"); System.out.println("reservoir pressure " +
* producedGasStream.getPressure("bara")); System.out .println("pres bottomhole " +
* wellflow.getOutletStream().getPressure("bara") + " bara");
*/
}

@Test
Expand All @@ -53,12 +53,11 @@ void testRunTransient() {
fluid1.addComponent("nitrogen", 0.599);
fluid1.addComponent("CO2", 0.51);
fluid1.addComponent("methane", 62.8);
fluid1.addComponent("n-heptane", 12.8);
fluid1.setMixingRule(2);
fluid1.setMultiPhaseCheck(true);

SimpleReservoir reservoirOps = new SimpleReservoir("Well 1 reservoir");
reservoirOps.setReservoirFluid(fluid1, 1e9, 10.0, 10.0e7);
reservoirOps.setReservoirFluid(fluid1, 1e9, 1.0, 10.0e7);
reservoirOps.setLowPressureLimit(10.0, "bara");

StreamInterface producedGasStream = reservoirOps.addGasProducer("gasproducer_1");
Expand Down Expand Up @@ -99,115 +98,94 @@ void testRunTransient() {
process.add(pipeline);
process.add(adjuster);
process.run();

System.out.println("production flow rate " + producedGasStream.getFlowRate("MSm3/day"));
System.out.println("production index " + wellflow.getWellProductionIndex() + " MSm3/day/bar^2");
System.out.println("reservoir pressure " + producedGasStream.getPressure("bara"));
System.out
.println("pres bottomhole " + wellflow.getOutletStream().getPressure("bara") + " bara");
System.out.println("xmas pressure " + pipe.getOutletStream().getPressure("bara") + " bara");
System.out
.println("top side pressure " + pipeline.getOutletStream().getPressure("bara") + " bara");

/*
* System.out.println("production flow rate " + producedGasStream.getFlowRate("MSm3/day"));
* System.out.println("production index " + wellflow.getWellProductionIndex() +
* " MSm3/day/bar^2"); System.out.println("reservoir pressure " +
* producedGasStream.getPressure("bara")); System.out .println("pres bottomhole " +
* wellflow.getOutletStream().getPressure("bara") + " bara");
* System.out.println("xmas pressure " + pipe.getOutletStream().getPressure("bara") + " bara");
* System.out .println("top side pressure " + pipeline.getOutletStream().getPressure("bara") +
* " bara");
*/
// process.setTimeStep(60 * 60 * 24 * 365);

for (int i = 0; i < 10; i++) {
reservoirOps.runTransient(60 * 60 * 24 * 365);
process.run();
System.out.println("production flow rate " + producedGasStream.getFlowRate("MSm3/day"));
System.out.println("reservoir pressure " + wellflow.getInletStream().getPressure("bara"));
System.out
.println("pres bottomhole " + wellflow.getOutletStream().getPressure("bara") + " bara");

System.out.println("xmas pressure " + pipe.getOutletStream().getPressure("bara") + " bara");
System.out
.println("top side pressure " + pipeline.getOutletStream().getPressure("bara") + " bara");
System.out
.println("Total produced gas " + reservoirOps.getGasProductionTotal("GMSm3") + " GMSm3");
System.out.println("gas velocity " + pipeline.getSuperficialVelocity());

/*
* System.out.println("production flow rate " + producedGasStream.getFlowRate("MSm3/day"));
* System.out.println("reservoir pressure " + wellflow.getInletStream().getPressure("bara"));
* System.out .println("pres bottomhole " + wellflow.getOutletStream().getPressure("bara") +
* " bara");
*
* System.out.println("xmas pressure " + pipe.getOutletStream().getPressure("bara") +
* " bara"); System.out .println("top side pressure " +
* pipeline.getOutletStream().getPressure("bara") + " bara"); System.out
* .println("Total produced gas " + reservoirOps.getGasProductionTotal("GMSm3") + " GMSm3");
* System.out.println("gas velocity " + pipeline.getSuperficialVelocity());
*/
}

Compressor compressor = new Compressor("subcomp");
compressor.setInletStream(pipe.getOutletStream());
compressor.setCompressionRatio(3.0);
pipeline.setInletStream(compressor.getOutletStream());

process.add(3, compressor);
// process.run();

for (int i = 0; i < 8; i++) {
reservoirOps.runTransient(60 * 60 * 24 * 365);
compressor.setOutletPressure(pipe.getOutletPressure() * 2.0);
process.run();
System.out.println("Compressor in pressure " + compressor.getInletStream().getPressure()
+ " out pressure " + compressor.getOutletStream().getPressure());
System.out.println("production flow rate " + producedGasStream.getFlowRate("MSm3/day"));
System.out.println("reservoir pressure " + wellflow.getInletStream().getPressure("bara"));
System.out
.println("pres bottomhole " + wellflow.getOutletStream().getPressure("bara") + " bara");

System.out.println("xmas pressure " + pipe.getOutletStream().getPressure("bara") + " bara");
System.out
.println("top side pressure " + pipeline.getOutletStream().getPressure("bara") + " bara");
System.out
.println("Total produced gas " + reservoirOps.getGasProductionTotal("GMSm3") + " GMSm3");
System.out.println("gas velocity " + pipeline.getSuperficialVelocity());
/*
* System.out.println("Compressor in pressure " + compressor.getInletStream().getPressure() +
* " out pressure " + compressor.getOutletStream().getPressure() + " flow " +
* compressor.getInletStream().getFlowRate("m3/hr"));
* System.out.println("production flow rate " + producedGasStream.getFlowRate("MSm3/day"));
* System.out.println("reservoir pressure " + wellflow.getInletStream().getPressure("bara"));
* System.out .println("pres bottomhole " + wellflow.getOutletStream().getPressure("bara") +
* " bara");
*
* System.out.println("xmas pressure " + pipe.getOutletStream().getPressure("bara") +
* " bara"); System.out .println("top side pressure " +
* pipeline.getOutletStream().getPressure("bara") + " bara"); System.out
* .println("Total produced gas " + reservoirOps.getGasProductionTotal("GMSm3") + " GMSm3");
* System.out.println("gas velocity " + pipeline.getSuperficialVelocity());
*/

}

adjuster.setMaxAdjustedValue(4.0);
adjuster.setTargetVariable(pipeline.getOutletStream(), "pressure", 22.0, "bara");

for (int i = 0; i < 5; i++) {
reservoirOps.runTransient(60 * 60 * 24 * 365);
compressor.setOutletPressure(pipe.getOutletPressure() * 3.5);
process.run();
System.out.println("Compressor in pressure " + compressor.getInletStream().getPressure()
+ " out pressure " + compressor.getOutletStream().getPressure());
System.out.println("production flow rate " + producedGasStream.getFlowRate("MSm3/day"));
System.out.println("reservoir pressure " + wellflow.getInletStream().getPressure("bara"));
System.out
.println("pres bottomhole " + wellflow.getOutletStream().getPressure("bara") + " bara");

System.out.println("xmas pressure " + pipe.getOutletStream().getPressure("bara") + " bara");
System.out
.println("top side pressure " + pipeline.getOutletStream().getPressure("bara") + " bara");
System.out
.println("Total produced gas " + reservoirOps.getGasProductionTotal("GMSm3") + " GMSm3");
System.out.println("gas velocity " + pipeline.getSuperficialVelocity());

}

adjuster.setMaxAdjustedValue(2.0);

for (int i = 0; i < 15; i++) {
if (producedGasStream.getPressure() > 15) {
boolean reset = false;
for (int i = 0; i < 35; i++) {
if (wellflow.getOutletStream().getPressure("bara") > 15 || reset) {
reset = false;
reservoirOps.runTransient(60 * 60 * 24 * 365);
compressor.setOutletPressure(pipe.getOutletPressure() * 3.5);
process.run();

System.out.println("Compressor in pressure " + compressor.getInletStream().getPressure()
+ " out pressure " + compressor.getOutletStream().getPressure());
System.out.println("production flow rate " + producedGasStream.getFlowRate("MSm3/day"));
System.out.println("reservoir pressure " + wellflow.getInletStream().getPressure("bara"));
System.out
.println("pres bottomhole " + wellflow.getOutletStream().getPressure("bara") + " bara");

System.out.println("xmas pressure " + pipe.getOutletStream().getPressure("bara") + " bara");
System.out.println(
"top side pressure " + pipeline.getOutletStream().getPressure("bara") + " bara");
System.out.println(
"Total produced gas " + reservoirOps.getGasProductionTotal("GMSm3") + " GMSm3");
System.out.println("gas velocity " + pipeline.getSuperficialVelocity());
/*
* System.out.println("Compressor in pressure " + compressor.getInletStream().getPressure()
* + " out pressure " + compressor.getOutletStream().getPressure() + " flow " +
* compressor.getInletStream().getFlowRate("m3/hr"));
* System.out.println("production flow rate " + producedGasStream.getFlowRate("MSm3/day"));
* System.out.println("reservoir pressure " +
* wellflow.getInletStream().getPressure("bara")); System.out .println("pres bottomhole " +
* wellflow.getOutletStream().getPressure("bara") + " bara");
*
* System.out.println("xmas pressure " + pipe.getOutletStream().getPressure("bara") +
* " bara"); System.out.println( "top side pressure " +
* pipeline.getOutletStream().getPressure("bara") + " bara"); System.out.println(
* "Total produced gas " + reservoirOps.getGasProductionTotal("GMSm3") + " GMSm3");
* System.out.println("gas velocity " + pipeline.getSuperficialVelocity());
*/
} else {
reset = true;
adjuster.setMaxAdjustedValue(adjuster.getMaxAdjustedValue() / 2.0);
adjuster.setMinAdjustedValue(adjuster.getMinAdjustedValue() / 2.0);
}

}



// we install a subsea compressor


}


Expand Down

0 comments on commit 157b0d4

Please sign in to comment.