Skip to content

Commit

Permalink
chore: style and silenced println
Browse files Browse the repository at this point in the history
  • Loading branch information
asmfstatoil committed Sep 25, 2024
1 parent d408538 commit 6d411c2
Show file tree
Hide file tree
Showing 34 changed files with 70 additions and 127 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,6 @@ public void runCalc() {
.getPhase(0).getComponent(j).getNumberOfMolesInPhase())
? test * getThermoSystem().getPhase(0).getComponent(j).getx()
: 0.0;

} catch (Exception e) {
logger.debug(e.getMessage());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,14 @@ public Packing(String name) {
super(name);
try (neqsim.util.database.NeqSimProcessDesignDataBase database =
new neqsim.util.database.NeqSimProcessDesignDataBase()) {
System.out.println("init packing");
// System.out.println("init packing");
java.sql.ResultSet dataSet =
database.getResultSet(("SELECT * FROM packing WHERE name='" + name + "'"));
dataSet.next();
size = 1e-3 * Double.parseDouble(dataSet.getString("size")); // C
surfaceAreaPrVolume = Double.parseDouble(dataSet.getString("surfaceAreaPrVolume"));
voidFractionPacking = Double.parseDouble(dataSet.getString("voidFraction"));
System.out.println("packing ok");
// System.out.println("packing ok");
} catch (Exception ex) {
logger.error(ex.getMessage(), ex);
}
Expand All @@ -61,7 +61,8 @@ public Packing(String name) {
*/
public Packing(String name, String material, int size) {
super(name);
try (neqsim.util.database.NeqSimProcessDesignDataBase database = new neqsim.util.database.NeqSimProcessDesignDataBase()) {
try (neqsim.util.database.NeqSimProcessDesignDataBase database =
new neqsim.util.database.NeqSimProcessDesignDataBase()) {
System.out.println("init packing");
java.sql.ResultSet dataSet = database.getResultSet(("SELECT * FROM packing WHERE name='"
+ name + "' AND size=" + size + " AND material='" + material + "'"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,6 @@ public void runDeltaT(UUID id) {
}

setCalculationIdentifier(id);

}

/** {@inheritDoc} */
Expand Down Expand Up @@ -703,7 +702,6 @@ public String toJson() {
.toJson(new HXResponse(this));
}


public void setUseDeltaT(boolean useDeltaT) {
this.useDeltaT = useDeltaT;
}
Expand All @@ -718,5 +716,4 @@ public void setDeltaT(double deltaT) {
useDeltaT = true;
this.deltaT = deltaT;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -1056,7 +1056,6 @@ public List<Double> getMixtureDensityProfile() {
return new ArrayList<>(mixtureDensityProfile);
}


/**
* <p>
* Getter for the field <code>liquidDensityProfile</code>.
Expand All @@ -1068,7 +1067,6 @@ public List<Double> getLiquidDensityProfile() {
return new ArrayList<>(liquidDensityProfile);
}


/**
* <p>
* Getter for the field <code>liquidHoldupProfile</code>.
Expand Down Expand Up @@ -1204,7 +1202,6 @@ public Double getSegmentMixtureDensity(int index) {
}
}


/**
* <p>
* getSegmentLiquidDensity.
Expand All @@ -1221,7 +1218,6 @@ public Double getSegmentLiquidDensity(int index) {
}
}


/**
* <p>
* getSegmentLiquidHoldup.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,6 @@ public void run(UUID id) {
waterStream = new Stream("Water Stream", waterFluid);
waterStream.setTemperature(temperature, "C");
waterStream.setPressure(pressure, "bara");

}
gasFluid.initPhysicalProperties();
oilFluid.initPhysicalProperties();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -516,7 +516,6 @@ public void run(UUID id) {
percentValveOpening = calcPercentValveOpening(inStream.getThermoSystem().getPressure(),
outStream.getThermoSystem().getPressure(), inStream.getFluid().getDensity("kg/m3"), Cv,
inStream.getFlowRate("kg/hr"));

} else {
percentValveOpening = calcPercentValveOpeningLiquid(inStream.getFlowRate("kg/hr"),
inStream.getThermoSystem().getPressure(), outStream.getThermoSystem().getPressure(),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package neqsim.processSimulation.processSystem.processModules;

import java.util.UUID;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import neqsim.processSimulation.processEquipment.compressor.Compressor;
import neqsim.processSimulation.processEquipment.distillation.Condenser;
import neqsim.processSimulation.processEquipment.distillation.DistillationColumn;
Expand Down Expand Up @@ -28,16 +30,29 @@
*/
public class DPCUModule extends ProcessModuleBaseClass {
private static final long serialVersionUID = 1000;
static Logger logger = LogManager.getLogger(ProcessModuleBaseClass.class);

StreamInterface ethaneOvhComp;
StreamInterface gasDistColumnExit;
StreamInterface liquidDistColumnExit;
StreamInterface feedStream;
StreamInterface gasExitStream;
StreamInterface oilExitStream;
StreamInterface glycolFeedStream;
StreamInterface glycolExitStream;

StreamInterface ethaneOvhComp, gasDistColumnExit, liquidDistColumnExit, feedStream, gasExitStream,
oilExitStream, glycolFeedStream, glycolExitStream;
Separator glycolScrubber;
Separator inletSeparator;
double inletSepTemperature = 50.00, pressureAfterRedValve = 55.0; // bar'
double gasScrubberTemperature = 30.00, firstStageOutPressure = 110.0,
glycolScrubberTemperature = 20.0, secondStageOutPressure = 200.0; // bar
double glycolInjectionRate = 10.0, exportGasTemperature = 273.15 + 30.0,
liquidPumpPressure = 150.0; // m^3/hr
double inletSepTemperature = 50.00;
double pressureAfterRedValve = 55.0;
double gasScrubberTemperature = 30.00;
double firstStageOutPressure = 110.0;
double glycolScrubberTemperature = 20.0;
double secondStageOutPressure = 200.0;
double glycolInjectionRate = 10.0;
double exportGasTemperature = 273.15 + 30.0;
double liquidPumpPressure = 150.0;

Separator LTseparator;
HeatExchanger heatExchanger1;
ThrottlingValve valve1;
Expand All @@ -62,9 +77,10 @@ public DPCUModule(String name) {
public void addInputStream(String streamName, StreamInterface stream) {
if (streamName.equals("feed stream")) {
this.feedStream = stream;
}
if (streamName.equals("glycol feed stream")) {
} else if (streamName.equals("glycol feed stream")) {
this.glycolFeedStream = stream;
} else {
logger.info("Stream name " + streamName + "not used.");
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -321,9 +321,7 @@ public void setCalculationModel(String model) {
this.model = model;
}

public void characterizePlusFractionWhitsonGamma() {

}
public void characterizePlusFractionWhitsonGamma() {}

public double gamma(double X) {
double[] dataB = {-0.577191652, 0.988205891, -0.897056937, 0.918206857, -0.756704078,
Expand Down Expand Up @@ -367,7 +365,6 @@ public double[] P0P1(double MWB) {
P1 = Q * (S - 1.0 / alfa);
break;
}

}
return new double[] {P0, P1};
}
Expand All @@ -382,8 +379,6 @@ public void densityUOP() {
}
}



@Override
public void characterizePlusFraction(TBPModelInterface TBPModel) {
system.init(0);
Expand Down Expand Up @@ -425,8 +420,6 @@ public void characterizePlusFraction(TBPModelInterface TBPModel) {
sumZ = sumZ + zValues[i];
}
densityUOP();


}

// Normalize z values to ensure sumZ equals zPlus
Expand Down Expand Up @@ -472,8 +465,6 @@ public double[] getM() {
public double[] getDens() {
return densities;
}


}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -464,7 +464,6 @@ public double calcCriticalVolume(double molarMass, double density) {
* Math.pow(((1 + 2 * fP) / (1 - 2 * fP)), 2);
return VC * 1e3; // m3/mol
}

}

/**
Expand Down
3 changes: 0 additions & 3 deletions src/main/java/neqsim/thermo/phase/Phase.java
Original file line number Diff line number Diff line change
Expand Up @@ -566,7 +566,6 @@ public double calcAT(int comp, PhaseInterface phase, double temperature, double
public double calcAij(int compNumb, int j, PhaseInterface phase, double temperature,
double pressure, int numbcomp) {
throw new UnsupportedOperationException("Unimplemented method 'calcAij'");

}

/** {@inheritDoc} */
Expand Down Expand Up @@ -1054,7 +1053,6 @@ public double getCv(String unit) {
break;
default:
throw new RuntimeException("unit not supported " + unit);

}
return refCv * conversionFactor;
}
Expand Down Expand Up @@ -2094,7 +2092,6 @@ public double getVolume(String unit) {
break;
default:
throw new RuntimeException("unit not supported " + unit);

}
return conversionFactor * getVolume() / 1.0e5;
}
Expand Down
5 changes: 2 additions & 3 deletions src/main/java/neqsim/thermo/system/SystemThermo.java
Original file line number Diff line number Diff line change
Expand Up @@ -1998,7 +1998,7 @@ public double getEnthalpy(String unit) {
conversionFactor = 0.00094781712;
break;
case "kJ/kmol":
conversionFactor = 1.0 / getTotalNumberOfMoles()/1000.0;
conversionFactor = 1.0 / getTotalNumberOfMoles() / 1000.0;
break;
case "J/mol":
conversionFactor = 1.0 / getTotalNumberOfMoles();
Expand Down Expand Up @@ -2041,7 +2041,7 @@ public double getEntropy(String unit) {
conversionFactor = 1.0 / getTotalNumberOfMoles();
break;
case "kJ/molK":
conversionFactor = 1.0 / getTotalNumberOfMoles()/1000.0;
conversionFactor = 1.0 / getTotalNumberOfMoles() / 1000.0;
break;
case "J/kgK":
conversionFactor = 1.0 / getTotalNumberOfMoles() / getMolarMass();
Expand Down Expand Up @@ -2880,7 +2880,6 @@ public double getSoundSpeed(String unit) {
break;
default:
throw new RuntimeException("unit not supported " + unit);

}
return refVel * conversionFactor;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,6 @@ public double solveQ() {
// + " new pressure " + nyPres + " error " + Math.abs((nyPres - oldPres) / (nyPres))
// + " numberofphases " + system.getNumberOfPhases() + " dQDVdP " + dQDVdP + " dQDVdPnumeric"
// + numericdQdVdP);

} while ((error > 1e-9 && iterations < 200) || iterations < 3);
return nyPres;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,6 @@ public double solveQ() {
// + " new pressure " + nyPres + " error " + Math.abs((nyPres - oldPres) / (nyPres))
// + " numberofphases " + system.getNumberOfPhases() + " dQDVdP " + dQDVdP + " dQDVdPnumeric"
// + numericdQdVdP);

} while ((error > 1e-9 && iterations < 200) || iterations < 3);
return nyPres;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -592,14 +592,11 @@ public double tempKWilson(double beta, double P) {

/** {@inheritDoc} */
@Override
public void displayResult() {

}
public void displayResult() {}

/** {@inheritDoc} */
@Override
public org.jfree.chart.JFreeChart getJFreeChart(String name) {
return null;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,7 @@ void testRunCalc() {
assertEquals(0.956122065, CMEsim.getRelativeVolume()[0], 0.001);
assertEquals(0.994254912, CMEsim.getRelativeVolume()[6], 0.001);
assertEquals(1.3572659252241415, CMEsim.getRelativeVolume()[12], 0.001);
assertEquals(2.153242696868525
, CMEsim.getYfactor()[12], 0.001);

assertEquals(2.153242696868525, CMEsim.getYfactor()[12], 0.001);
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -216,13 +216,13 @@ public void testCompressorWithGERG2008_2() {
compressor1.setUsePolytropicCalc(true);
compressor1.setUseGERG2008(true);
compressor1.run();
double head = compressor1.getPolytropicHead("kJ/kg");
logger.info("gerg power " + compressor1.getPower() + " W");
// double head = compressor1.getPolytropicHead("kJ/kg");
// logger.info("gerg power " + compressor1.getPower() + " W");
// assertEquals(compressor1.getPolytropicHead("kJ/kg"), 89.464626, 0.01);
compressor1.setUseGERG2008(false);
compressor1.run();
double head2 = compressor1.getPolytropicHead("kJ/kg");
logger.info("gerg power " + compressor1.getPower() + " W");
// double head2 = compressor1.getPolytropicHead("kJ/kg");
// logger.info("gerg power " + compressor1.getPower() + " W");
assertEquals(compressor1.getPolytropicHead("kJ/kg"), 94.32923841459161, 0.01);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,5 @@ void testRun2() {
heatExchanger1.run();

assertEquals(15780.77130, heatExchanger1.getUAvalue(), 1e-3);

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,5 @@ void testNeedRecalculation() {
assertTrue(((Heater) processOps.getUnit("heater 1")).needRecalculation());
processOps.run();
assertFalse(((Heater) processOps.getUnit("heater 1")).needRecalculation());

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,6 @@ void testRunTransientRes2() {
compressor2.setPolytropicEfficiency(0.6);
compressor2.setCompressionRatio(2.0);


neqsim.processSimulation.processEquipment.heatExchanger.Heater cooler1 =
new neqsim.processSimulation.processEquipment.heatExchanger.Heater("cooler 1",
compressor2.getOutletStream());
Expand All @@ -120,7 +119,6 @@ void testRunTransientRes2() {
adjuster.setMaxAdjustedValue(max_gas_production);
adjuster.setMinAdjustedValue(1.0);


neqsim.processSimulation.processSystem.ProcessSystem process =
new neqsim.processSimulation.processSystem.ProcessSystem();
process.add(reservoirOps);
Expand All @@ -136,7 +134,6 @@ void testRunTransientRes2() {

System.out
.println("gas production " + reservoirOps.getGasProdution("Sm3/day") / 1e6 + " MSm3/day");

}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,5 @@ void testRun() {
operations.run();

Assertions.assertEquals(8.95393178, multiPhaseMeter2.getMeasuredValue("GOR", ""), 1e-3);

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ void testCalcCvGas() {

assertEquals(48.2652, valve1.getCv("US"), 1e-2);
assertEquals(2649.7612, valve1.getCv("SI"), 1e-2);

}

@Test
Expand All @@ -51,6 +50,5 @@ void testCalcCvLiquid() {
assertEquals(100.0, valve1.getPercentValveOpening(), 1e-2);
assertEquals(100, stream1.getFlowRate("kg/hr"), 1e-2);
assertEquals(3.015805897362369E-4, valve1.getCv("US"), 1e-2);

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,5 @@ public void testProcess() {

assertTrue(seccondStageCompressor.isSurge(seccondStageCompressor.getPolytropicFluidHead(),
seccondStageCompressor.getInletStream().getFlowRate("m3/hr")));

}
}
Loading

0 comments on commit 6d411c2

Please sign in to comment.