From 5ba9bd977d786cdb4445fd9aa67d9f208cf423ec Mon Sep 17 00:00:00 2001 From: Even Solbraa <41290109+EvenSol@users.noreply.github.com> Date: Sun, 24 Sep 2023 20:43:58 +0000 Subject: [PATCH 1/2] add table pump --- .../processEquipment/pump/Pump.java | 158 ++++++++++++++---- 1 file changed, 129 insertions(+), 29 deletions(-) diff --git a/src/main/java/neqsim/processSimulation/processEquipment/pump/Pump.java b/src/main/java/neqsim/processSimulation/processEquipment/pump/Pump.java index 8163cff914..faf3772473 100644 --- a/src/main/java/neqsim/processSimulation/processEquipment/pump/Pump.java +++ b/src/main/java/neqsim/processSimulation/processEquipment/pump/Pump.java @@ -50,13 +50,29 @@ public Pump() { super("Pump"); } + /** + *
+ * Return head + *
+ * @param unit unit can be or kJ/kg + */ + public double getHead(String unit){ + if(unit.equals("meter")){ + return (getOutletStream().getPressure("bara")-getInletStream().getPressure("bara"))/(1000.0 * ThermodynamicConstantsInterface.gravity / 1.0E5) + } + else if(unit.equals("kJ/kg")){ + return getPower("kW")/getInletStream().getFlowRate("kg/sec"); + } + } + /** ** Constructor for Pump. *
* - * @param inletStream a {@link neqsim.processSimulation.processEquipment.stream.StreamInterface} - * object + * @param inletStream a + * {@link neqsim.processSimulation.processEquipment.stream.StreamInterface} + * object */ @Deprecated public Pump(StreamInterface inletStream) { @@ -78,9 +94,10 @@ public Pump(String name) { * Constructor for Pump. * * - * @param name name of pump - * @param inletStream a {@link neqsim.processSimulation.processEquipment.stream.StreamInterface} - * object + * @param name name of pump + * @param inletStream a + * {@link neqsim.processSimulation.processEquipment.stream.StreamInterface} + * object */ public Pump(String name, StreamInterface inletStream) { super(name, inletStream); @@ -188,8 +205,7 @@ public void run(UUID id) { thermoSystem = inStream.getThermoSystem().clone(); double pumpHead = 0.0; pumpHead = getPumpChart().getHead(thermoSystem.getFlowRate("m3/hr"), getSpeed()); - isentropicEfficiency = - getPumpChart().getEfficiency(thermoSystem.getFlowRate("m3/hr"), getSpeed()); + isentropicEfficiency = getPumpChart().getEfficiency(thermoSystem.getFlowRate("m3/hr"), getSpeed()); double deltaP = pumpHead * 1000.0 * ThermodynamicConstantsInterface.gravity / 1.0E5; thermoSystem = inStream.getThermoSystem().clone(); thermoSystem.setPressure(inStream.getPressure() + deltaP); @@ -225,6 +241,89 @@ public void run(UUID id) { // outStream.run(id); } + /** {@inheritDoc} */ + @Override + public String[][] createTable(String name) { + + String[][] table = new String[50][5]; + String[] names = { "", "Phase 1", "Phase 2", "Phase 3", "Unit" }; + table[0][0] = ""; + table[0][1] = ""; + table[0][2] = ""; + table[0][3] = ""; + StringBuffer buf = new StringBuffer(); + FieldPosition test = new FieldPosition(0); + + for (int i = 0; i < thermoSystem.getNumberOfPhases(); i++) { + for (int j = 0; j < thermoSystem.getPhases()[0].getNumberOfComponents(); j++) { + table[j + 1][0] = thermoSystem.getPhases()[0].getComponents()[j].getName(); + buf = new StringBuffer(); + table[j + 1][i + 1] = nf.format(thermoSystem.getPhases()[i].getComponents()[j].getx(), buf, test).toString(); + table[j + 1][4] = "[-]"; + } + buf = new StringBuffer(); + table[thermoSystem.getPhases()[0].getNumberOfComponents() + 2][0] = "Density"; + table[thermoSystem.getPhases()[0].getNumberOfComponents() + 2][i + 1] = nf + .format(thermoSystem.getPhases()[i].getPhysicalProperties().getDensity(), buf, test) + .toString(); + table[thermoSystem.getPhases()[0].getNumberOfComponents() + 2][4] = "[kg/m^3]"; + + // Double.longValue(thermoSystem.getPhases()[i].getBeta()); + buf = new StringBuffer(); + table[thermoSystem.getPhases()[0].getNumberOfComponents() + 3][0] = "PhaseFraction"; + table[thermoSystem.getPhases()[0].getNumberOfComponents() + 3][i + 1] = nf + .format(thermoSystem.getPhases()[i].getBeta(), buf, test).toString(); + table[thermoSystem.getPhases()[0].getNumberOfComponents() + 3][4] = "[-]"; + + buf = new StringBuffer(); + table[thermoSystem.getPhases()[0].getNumberOfComponents() + 4][0] = "MolarMass"; + table[thermoSystem.getPhases()[0].getNumberOfComponents() + 4][i + 1] = nf + .format(thermoSystem.getPhases()[i].getMolarMass() * 1000, buf, test).toString(); + table[thermoSystem.getPhases()[0].getNumberOfComponents() + 4][4] = "[kg/kmol]"; + + buf = new StringBuffer(); + table[thermoSystem.getPhases()[0].getNumberOfComponents() + 5][0] = "Cp"; + table[thermoSystem.getPhases()[0].getNumberOfComponents() + 5][i + 1] = nf + .format((thermoSystem.getPhases()[i].getCp() + / thermoSystem.getPhases()[i].getNumberOfMolesInPhase() * 1.0 + / thermoSystem.getPhases()[i].getMolarMass() * 1000), buf, test) + .toString(); + table[thermoSystem.getPhases()[0].getNumberOfComponents() + 5][4] = "[kJ/kg*K]"; + + buf = new StringBuffer(); + table[thermoSystem.getPhases()[0].getNumberOfComponents() + 7][0] = "Viscosity"; + table[thermoSystem.getPhases()[0].getNumberOfComponents() + 7][i + 1] = nf + .format((thermoSystem.getPhases()[i].getPhysicalProperties().getViscosity()), buf, test) + .toString(); + table[thermoSystem.getPhases()[0].getNumberOfComponents() + 7][4] = "[kg/m*sec]"; + + buf = new StringBuffer(); + table[thermoSystem.getPhases()[0].getNumberOfComponents() + 8][0] = "Conductivity"; + table[thermoSystem.getPhases()[0].getNumberOfComponents() + 8][i + 1] = nf + .format(thermoSystem.getPhases()[i].getPhysicalProperties().getConductivity(), buf, test) + .toString(); + table[thermoSystem.getPhases()[0].getNumberOfComponents() + 8][4] = "[W/m*K]"; + + buf = new StringBuffer(); + table[thermoSystem.getPhases()[0].getNumberOfComponents() + 10][0] = "Pressure"; + table[thermoSystem.getPhases()[0].getNumberOfComponents() + 10][i + 1] = Double + .toString(thermoSystem.getPhases()[i].getPressure()); + table[thermoSystem.getPhases()[0].getNumberOfComponents() + 10][4] = "[bar]"; + + buf = new StringBuffer(); + table[thermoSystem.getPhases()[0].getNumberOfComponents() + 11][0] = "Temperature"; + table[thermoSystem.getPhases()[0].getNumberOfComponents() + 11][i + 1] = Double + .toString(thermoSystem.getPhases()[i].getTemperature()); + table[thermoSystem.getPhases()[0].getNumberOfComponents() + 11][4] = "[K]"; + Double.toString(thermoSystem.getPhases()[i].getTemperature()); + + buf = new StringBuffer(); + table[thermoSystem.getPhases()[0].getNumberOfComponents() + 13][0] = "Stream"; + table[thermoSystem.getPhases()[0].getNumberOfComponents() + 13][i + 1] = name; + table[thermoSystem.getPhases()[0].getNumberOfComponents() + 13][4] = "-"; + } + } + /** {@inheritDoc} */ @Override public void displayResult() { @@ -238,7 +337,7 @@ public void displayResult() { thermoSystem.initPhysicalProperties(); String[][] table = new String[50][5]; - String[] names = {"", "Phase 1", "Phase 2", "Phase 3", "Unit"}; + String[] names = { "", "Phase 1", "Phase 2", "Phase 3", "Unit" }; table[0][0] = ""; table[0][1] = ""; table[0][2] = ""; @@ -250,43 +349,43 @@ public void displayResult() { for (int j = 0; j < thermoSystem.getPhases()[0].getNumberOfComponents(); j++) { table[j + 1][0] = thermoSystem.getPhases()[0].getComponents()[j].getName(); buf = new StringBuffer(); - table[j + 1][i + 1] = - nf.format(thermoSystem.getPhases()[i].getComponents()[j].getx(), buf, test).toString(); + table[j + 1][i + 1] = nf.format(thermoSystem.getPhases()[i].getComponents()[j].getx(), buf, test).toString(); table[j + 1][4] = "[-]"; } buf = new StringBuffer(); table[thermoSystem.getPhases()[0].getNumberOfComponents() + 2][0] = "Density"; - table[thermoSystem.getPhases()[0].getNumberOfComponents() + 2][i + 1] = - nf.format(thermoSystem.getPhases()[i].getPhysicalProperties().getDensity(), buf, test) - .toString(); + table[thermoSystem.getPhases()[0].getNumberOfComponents() + 2][i + 1] = nf + .format(thermoSystem.getPhases()[i].getPhysicalProperties().getDensity(), buf, test) + .toString(); table[thermoSystem.getPhases()[0].getNumberOfComponents() + 2][4] = "[kg/m^3]"; // Double.longValue(thermoSystem.getPhases()[i].getBeta()); buf = new StringBuffer(); table[thermoSystem.getPhases()[0].getNumberOfComponents() + 3][0] = "PhaseFraction"; - table[thermoSystem.getPhases()[0].getNumberOfComponents() + 3][i + 1] = - nf.format(thermoSystem.getPhases()[i].getBeta(), buf, test).toString(); + table[thermoSystem.getPhases()[0].getNumberOfComponents() + 3][i + 1] = nf + .format(thermoSystem.getPhases()[i].getBeta(), buf, test).toString(); table[thermoSystem.getPhases()[0].getNumberOfComponents() + 3][4] = "[-]"; buf = new StringBuffer(); table[thermoSystem.getPhases()[0].getNumberOfComponents() + 4][0] = "MolarMass"; - table[thermoSystem.getPhases()[0].getNumberOfComponents() + 4][i + 1] = - nf.format(thermoSystem.getPhases()[i].getMolarMass() * 1000, buf, test).toString(); + table[thermoSystem.getPhases()[0].getNumberOfComponents() + 4][i + 1] = nf + .format(thermoSystem.getPhases()[i].getMolarMass() * 1000, buf, test).toString(); table[thermoSystem.getPhases()[0].getNumberOfComponents() + 4][4] = "[kg/kmol]"; buf = new StringBuffer(); table[thermoSystem.getPhases()[0].getNumberOfComponents() + 5][0] = "Cp"; - table[thermoSystem.getPhases()[0].getNumberOfComponents() + 5][i + 1] = - nf.format((thermoSystem.getPhases()[i].getCp() + table[thermoSystem.getPhases()[0].getNumberOfComponents() + 5][i + 1] = nf + .format((thermoSystem.getPhases()[i].getCp() / thermoSystem.getPhases()[i].getNumberOfMolesInPhase() * 1.0 - / thermoSystem.getPhases()[i].getMolarMass() * 1000), buf, test).toString(); + / thermoSystem.getPhases()[i].getMolarMass() * 1000), buf, test) + .toString(); table[thermoSystem.getPhases()[0].getNumberOfComponents() + 5][4] = "[kJ/kg*K]"; buf = new StringBuffer(); table[thermoSystem.getPhases()[0].getNumberOfComponents() + 7][0] = "Viscosity"; - table[thermoSystem.getPhases()[0].getNumberOfComponents() + 7][i + 1] = - nf.format((thermoSystem.getPhases()[i].getPhysicalProperties().getViscosity()), buf, test) - .toString(); + table[thermoSystem.getPhases()[0].getNumberOfComponents() + 7][i + 1] = nf + .format((thermoSystem.getPhases()[i].getPhysicalProperties().getViscosity()), buf, test) + .toString(); table[thermoSystem.getPhases()[0].getNumberOfComponents() + 7][4] = "[kg/m*sec]"; buf = new StringBuffer(); @@ -298,14 +397,14 @@ public void displayResult() { buf = new StringBuffer(); table[thermoSystem.getPhases()[0].getNumberOfComponents() + 10][0] = "Pressure"; - table[thermoSystem.getPhases()[0].getNumberOfComponents() + 10][i + 1] = - Double.toString(thermoSystem.getPhases()[i].getPressure()); + table[thermoSystem.getPhases()[0].getNumberOfComponents() + 10][i + 1] = Double + .toString(thermoSystem.getPhases()[i].getPressure()); table[thermoSystem.getPhases()[0].getNumberOfComponents() + 10][4] = "[bar]"; buf = new StringBuffer(); table[thermoSystem.getPhases()[0].getNumberOfComponents() + 11][0] = "Temperature"; - table[thermoSystem.getPhases()[0].getNumberOfComponents() + 11][i + 1] = - Double.toString(thermoSystem.getPhases()[i].getTemperature()); + table[thermoSystem.getPhases()[0].getNumberOfComponents() + 11][i + 1] = Double + .toString(thermoSystem.getPhases()[i].getTemperature()); table[thermoSystem.getPhases()[0].getNumberOfComponents() + 11][4] = "[K]"; Double.toString(thermoSystem.getPhases()[i].getTemperature()); @@ -418,7 +517,7 @@ public void setPressure(double pressure) { * * * @param pressure a double - * @param unit a {@link java.lang.String} object + * @param unit a {@link java.lang.String} object */ public void setPressure(double pressure, String unit) { setOutletPressure(pressure); @@ -452,7 +551,8 @@ public double getSpeed() { * Getter for the fieldpumpChart
.
*
*
- * @return a {@link neqsim.processSimulation.processEquipment.pump.PumpChart} object
+ * @return a {@link neqsim.processSimulation.processEquipment.pump.PumpChart}
+ * object
*/
public PumpChart getPumpChart() {
return pumpChart;
From a623937a6d8bfd70b5fe53f3ae9eaf6e112680bd Mon Sep 17 00:00:00 2001
From: Even Solbraa <41290109+EvenSol@users.noreply.github.com>
Date: Mon, 25 Sep 2023 20:51:38 +0000
Subject: [PATCH 2/2] updated method
---
.../ProcessEquipmentBaseClass.java | 11 ++
.../ProcessEquipmentInterface.java | 10 ++
.../processEquipment/pump/Pump.java | 169 ++++++------------
.../processSystem/ProcessModuleBaseClass.java | 11 ++
.../processEquipment/pump/PumpTest.java | 2 +
5 files changed, 93 insertions(+), 110 deletions(-)
diff --git a/src/main/java/neqsim/processSimulation/processEquipment/ProcessEquipmentBaseClass.java b/src/main/java/neqsim/processSimulation/processEquipment/ProcessEquipmentBaseClass.java
index 8ceaacab5f..88eb4d68ec 100644
--- a/src/main/java/neqsim/processSimulation/processEquipment/ProcessEquipmentBaseClass.java
+++ b/src/main/java/neqsim/processSimulation/processEquipment/ProcessEquipmentBaseClass.java
@@ -285,4 +285,15 @@ public boolean equals(Object obj) {
&& Arrays.deepEquals(report, other.report)
&& Objects.equals(specification, other.specification);
}
+
+ /** {@inheritDoc} */
+ public String[][] createTable(String name) {
+
+ String[][] table = new String[50][3];
+ String[] names = {"Property", "Value", "Unit"};
+ table[0][0] = "";
+ table[0][1] = "";
+ table[0][2] = "";
+ return table;
+ }
}
diff --git a/src/main/java/neqsim/processSimulation/processEquipment/ProcessEquipmentInterface.java b/src/main/java/neqsim/processSimulation/processEquipment/ProcessEquipmentInterface.java
index fc1507259a..6717fb31f9 100644
--- a/src/main/java/neqsim/processSimulation/processEquipment/ProcessEquipmentInterface.java
+++ b/src/main/java/neqsim/processSimulation/processEquipment/ProcessEquipmentInterface.java
@@ -216,4 +216,14 @@ public default SystemInterface getFluid() {
/** {@inheritDoc} */
@Override
public int hashCode();
+
+ /**
+ * Prints the fluid in a visually appealing way.
+ *
+ */
+ public default void prettyPrint() {
+ neqsim.thermo.util.readwrite.TablePrinter.printTable(createTable(getName()));
+ }
+
+ public String[][] createTable(String name);
}
diff --git a/src/main/java/neqsim/processSimulation/processEquipment/pump/Pump.java b/src/main/java/neqsim/processSimulation/processEquipment/pump/Pump.java
index faf3772473..f75dffa8ec 100644
--- a/src/main/java/neqsim/processSimulation/processEquipment/pump/Pump.java
+++ b/src/main/java/neqsim/processSimulation/processEquipment/pump/Pump.java
@@ -54,15 +54,17 @@ public Pump() {
* * Return head *
- * @param unit unit can be or kJ/kg + * + * @param unit unit can be or kJ/kg */ - public double getHead(String unit){ - if(unit.equals("meter")){ - return (getOutletStream().getPressure("bara")-getInletStream().getPressure("bara"))/(1000.0 * ThermodynamicConstantsInterface.gravity / 1.0E5) - } - else if(unit.equals("kJ/kg")){ - return getPower("kW")/getInletStream().getFlowRate("kg/sec"); - } + public double getHead(String unit) { + if (unit.equals("meter")) { + return (getOutletStream().getPressure("bara") - getInletStream().getPressure("bara")) + / (1000.0 * ThermodynamicConstantsInterface.gravity / 1.0E5); + } else if (unit.equals("kJ/kg")) { + return getPower("kW") / getInletStream().getFlowRate("kg/sec"); + } else + return getPower("kW") / getInletStream().getFlowRate("kg/sec"); } /** @@ -70,9 +72,8 @@ else if(unit.equals("kJ/kg")){ * Constructor for Pump. * * - * @param inletStream a - * {@link neqsim.processSimulation.processEquipment.stream.StreamInterface} - * object + * @param inletStream a {@link neqsim.processSimulation.processEquipment.stream.StreamInterface} + * object */ @Deprecated public Pump(StreamInterface inletStream) { @@ -94,10 +95,9 @@ public Pump(String name) { * Constructor for Pump. * * - * @param name name of pump - * @param inletStream a - * {@link neqsim.processSimulation.processEquipment.stream.StreamInterface} - * object + * @param name name of pump + * @param inletStream a {@link neqsim.processSimulation.processEquipment.stream.StreamInterface} + * object */ public Pump(String name, StreamInterface inletStream) { super(name, inletStream); @@ -205,7 +205,8 @@ public void run(UUID id) { thermoSystem = inStream.getThermoSystem().clone(); double pumpHead = 0.0; pumpHead = getPumpChart().getHead(thermoSystem.getFlowRate("m3/hr"), getSpeed()); - isentropicEfficiency = getPumpChart().getEfficiency(thermoSystem.getFlowRate("m3/hr"), getSpeed()); + isentropicEfficiency = + getPumpChart().getEfficiency(thermoSystem.getFlowRate("m3/hr"), getSpeed()); double deltaP = pumpHead * 1000.0 * ThermodynamicConstantsInterface.gravity / 1.0E5; thermoSystem = inStream.getThermoSystem().clone(); thermoSystem.setPressure(inStream.getPressure() + deltaP); @@ -244,84 +245,33 @@ public void run(UUID id) { /** {@inheritDoc} */ @Override public String[][] createTable(String name) { + DecimalFormat nf = new DecimalFormat(); + nf.setMaximumFractionDigits(5); + nf.applyPattern("#.#####E0"); - String[][] table = new String[50][5]; - String[] names = { "", "Phase 1", "Phase 2", "Phase 3", "Unit" }; + String[][] table = new String[4][3]; + String[] names = {"Property", "Value", "Unit"}; table[0][0] = ""; table[0][1] = ""; table[0][2] = ""; - table[0][3] = ""; StringBuffer buf = new StringBuffer(); FieldPosition test = new FieldPosition(0); - for (int i = 0; i < thermoSystem.getNumberOfPhases(); i++) { - for (int j = 0; j < thermoSystem.getPhases()[0].getNumberOfComponents(); j++) { - table[j + 1][0] = thermoSystem.getPhases()[0].getComponents()[j].getName(); - buf = new StringBuffer(); - table[j + 1][i + 1] = nf.format(thermoSystem.getPhases()[i].getComponents()[j].getx(), buf, test).toString(); - table[j + 1][4] = "[-]"; - } - buf = new StringBuffer(); - table[thermoSystem.getPhases()[0].getNumberOfComponents() + 2][0] = "Density"; - table[thermoSystem.getPhases()[0].getNumberOfComponents() + 2][i + 1] = nf - .format(thermoSystem.getPhases()[i].getPhysicalProperties().getDensity(), buf, test) - .toString(); - table[thermoSystem.getPhases()[0].getNumberOfComponents() + 2][4] = "[kg/m^3]"; - - // Double.longValue(thermoSystem.getPhases()[i].getBeta()); - buf = new StringBuffer(); - table[thermoSystem.getPhases()[0].getNumberOfComponents() + 3][0] = "PhaseFraction"; - table[thermoSystem.getPhases()[0].getNumberOfComponents() + 3][i + 1] = nf - .format(thermoSystem.getPhases()[i].getBeta(), buf, test).toString(); - table[thermoSystem.getPhases()[0].getNumberOfComponents() + 3][4] = "[-]"; - - buf = new StringBuffer(); - table[thermoSystem.getPhases()[0].getNumberOfComponents() + 4][0] = "MolarMass"; - table[thermoSystem.getPhases()[0].getNumberOfComponents() + 4][i + 1] = nf - .format(thermoSystem.getPhases()[i].getMolarMass() * 1000, buf, test).toString(); - table[thermoSystem.getPhases()[0].getNumberOfComponents() + 4][4] = "[kg/kmol]"; - - buf = new StringBuffer(); - table[thermoSystem.getPhases()[0].getNumberOfComponents() + 5][0] = "Cp"; - table[thermoSystem.getPhases()[0].getNumberOfComponents() + 5][i + 1] = nf - .format((thermoSystem.getPhases()[i].getCp() - / thermoSystem.getPhases()[i].getNumberOfMolesInPhase() * 1.0 - / thermoSystem.getPhases()[i].getMolarMass() * 1000), buf, test) - .toString(); - table[thermoSystem.getPhases()[0].getNumberOfComponents() + 5][4] = "[kJ/kg*K]"; - - buf = new StringBuffer(); - table[thermoSystem.getPhases()[0].getNumberOfComponents() + 7][0] = "Viscosity"; - table[thermoSystem.getPhases()[0].getNumberOfComponents() + 7][i + 1] = nf - .format((thermoSystem.getPhases()[i].getPhysicalProperties().getViscosity()), buf, test) - .toString(); - table[thermoSystem.getPhases()[0].getNumberOfComponents() + 7][4] = "[kg/m*sec]"; - - buf = new StringBuffer(); - table[thermoSystem.getPhases()[0].getNumberOfComponents() + 8][0] = "Conductivity"; - table[thermoSystem.getPhases()[0].getNumberOfComponents() + 8][i + 1] = nf - .format(thermoSystem.getPhases()[i].getPhysicalProperties().getConductivity(), buf, test) - .toString(); - table[thermoSystem.getPhases()[0].getNumberOfComponents() + 8][4] = "[W/m*K]"; - - buf = new StringBuffer(); - table[thermoSystem.getPhases()[0].getNumberOfComponents() + 10][0] = "Pressure"; - table[thermoSystem.getPhases()[0].getNumberOfComponents() + 10][i + 1] = Double - .toString(thermoSystem.getPhases()[i].getPressure()); - table[thermoSystem.getPhases()[0].getNumberOfComponents() + 10][4] = "[bar]"; - - buf = new StringBuffer(); - table[thermoSystem.getPhases()[0].getNumberOfComponents() + 11][0] = "Temperature"; - table[thermoSystem.getPhases()[0].getNumberOfComponents() + 11][i + 1] = Double - .toString(thermoSystem.getPhases()[i].getTemperature()); - table[thermoSystem.getPhases()[0].getNumberOfComponents() + 11][4] = "[K]"; - Double.toString(thermoSystem.getPhases()[i].getTemperature()); - - buf = new StringBuffer(); - table[thermoSystem.getPhases()[0].getNumberOfComponents() + 13][0] = "Stream"; - table[thermoSystem.getPhases()[0].getNumberOfComponents() + 13][i + 1] = name; - table[thermoSystem.getPhases()[0].getNumberOfComponents() + 13][4] = "-"; - } + table[1][0] = "Inlet pressure"; + buf = new StringBuffer(); + table[1][1] = nf.format(inStream.getPressure("bara"), buf, test).toString(); + table[1][2] = "bara"; + + table[2][0] = "Outlet pressure"; + buf = new StringBuffer(); + table[2][1] = nf.format(outStream.getPressure("bara"), buf, test).toString(); + table[2][2] = "bara"; + + table[3][0] = "Head"; + buf = new StringBuffer(); + table[3][1] = nf.format(getHead("meter"), buf, test).toString(); + table[3][2] = "meter"; + return table; } /** {@inheritDoc} */ @@ -337,7 +287,7 @@ public void displayResult() { thermoSystem.initPhysicalProperties(); String[][] table = new String[50][5]; - String[] names = { "", "Phase 1", "Phase 2", "Phase 3", "Unit" }; + String[] names = {"", "Phase 1", "Phase 2", "Phase 3", "Unit"}; table[0][0] = ""; table[0][1] = ""; table[0][2] = ""; @@ -349,43 +299,43 @@ public void displayResult() { for (int j = 0; j < thermoSystem.getPhases()[0].getNumberOfComponents(); j++) { table[j + 1][0] = thermoSystem.getPhases()[0].getComponents()[j].getName(); buf = new StringBuffer(); - table[j + 1][i + 1] = nf.format(thermoSystem.getPhases()[i].getComponents()[j].getx(), buf, test).toString(); + table[j + 1][i + 1] = + nf.format(thermoSystem.getPhases()[i].getComponents()[j].getx(), buf, test).toString(); table[j + 1][4] = "[-]"; } buf = new StringBuffer(); table[thermoSystem.getPhases()[0].getNumberOfComponents() + 2][0] = "Density"; - table[thermoSystem.getPhases()[0].getNumberOfComponents() + 2][i + 1] = nf - .format(thermoSystem.getPhases()[i].getPhysicalProperties().getDensity(), buf, test) - .toString(); + table[thermoSystem.getPhases()[0].getNumberOfComponents() + 2][i + 1] = + nf.format(thermoSystem.getPhases()[i].getPhysicalProperties().getDensity(), buf, test) + .toString(); table[thermoSystem.getPhases()[0].getNumberOfComponents() + 2][4] = "[kg/m^3]"; // Double.longValue(thermoSystem.getPhases()[i].getBeta()); buf = new StringBuffer(); table[thermoSystem.getPhases()[0].getNumberOfComponents() + 3][0] = "PhaseFraction"; - table[thermoSystem.getPhases()[0].getNumberOfComponents() + 3][i + 1] = nf - .format(thermoSystem.getPhases()[i].getBeta(), buf, test).toString(); + table[thermoSystem.getPhases()[0].getNumberOfComponents() + 3][i + 1] = + nf.format(thermoSystem.getPhases()[i].getBeta(), buf, test).toString(); table[thermoSystem.getPhases()[0].getNumberOfComponents() + 3][4] = "[-]"; buf = new StringBuffer(); table[thermoSystem.getPhases()[0].getNumberOfComponents() + 4][0] = "MolarMass"; - table[thermoSystem.getPhases()[0].getNumberOfComponents() + 4][i + 1] = nf - .format(thermoSystem.getPhases()[i].getMolarMass() * 1000, buf, test).toString(); + table[thermoSystem.getPhases()[0].getNumberOfComponents() + 4][i + 1] = + nf.format(thermoSystem.getPhases()[i].getMolarMass() * 1000, buf, test).toString(); table[thermoSystem.getPhases()[0].getNumberOfComponents() + 4][4] = "[kg/kmol]"; buf = new StringBuffer(); table[thermoSystem.getPhases()[0].getNumberOfComponents() + 5][0] = "Cp"; - table[thermoSystem.getPhases()[0].getNumberOfComponents() + 5][i + 1] = nf - .format((thermoSystem.getPhases()[i].getCp() + table[thermoSystem.getPhases()[0].getNumberOfComponents() + 5][i + 1] = + nf.format((thermoSystem.getPhases()[i].getCp() / thermoSystem.getPhases()[i].getNumberOfMolesInPhase() * 1.0 - / thermoSystem.getPhases()[i].getMolarMass() * 1000), buf, test) - .toString(); + / thermoSystem.getPhases()[i].getMolarMass() * 1000), buf, test).toString(); table[thermoSystem.getPhases()[0].getNumberOfComponents() + 5][4] = "[kJ/kg*K]"; buf = new StringBuffer(); table[thermoSystem.getPhases()[0].getNumberOfComponents() + 7][0] = "Viscosity"; - table[thermoSystem.getPhases()[0].getNumberOfComponents() + 7][i + 1] = nf - .format((thermoSystem.getPhases()[i].getPhysicalProperties().getViscosity()), buf, test) - .toString(); + table[thermoSystem.getPhases()[0].getNumberOfComponents() + 7][i + 1] = + nf.format((thermoSystem.getPhases()[i].getPhysicalProperties().getViscosity()), buf, test) + .toString(); table[thermoSystem.getPhases()[0].getNumberOfComponents() + 7][4] = "[kg/m*sec]"; buf = new StringBuffer(); @@ -397,14 +347,14 @@ public void displayResult() { buf = new StringBuffer(); table[thermoSystem.getPhases()[0].getNumberOfComponents() + 10][0] = "Pressure"; - table[thermoSystem.getPhases()[0].getNumberOfComponents() + 10][i + 1] = Double - .toString(thermoSystem.getPhases()[i].getPressure()); + table[thermoSystem.getPhases()[0].getNumberOfComponents() + 10][i + 1] = + Double.toString(thermoSystem.getPhases()[i].getPressure()); table[thermoSystem.getPhases()[0].getNumberOfComponents() + 10][4] = "[bar]"; buf = new StringBuffer(); table[thermoSystem.getPhases()[0].getNumberOfComponents() + 11][0] = "Temperature"; - table[thermoSystem.getPhases()[0].getNumberOfComponents() + 11][i + 1] = Double - .toString(thermoSystem.getPhases()[i].getTemperature()); + table[thermoSystem.getPhases()[0].getNumberOfComponents() + 11][i + 1] = + Double.toString(thermoSystem.getPhases()[i].getTemperature()); table[thermoSystem.getPhases()[0].getNumberOfComponents() + 11][4] = "[K]"; Double.toString(thermoSystem.getPhases()[i].getTemperature()); @@ -517,7 +467,7 @@ public void setPressure(double pressure) { * * * @param pressure a double - * @param unit a {@link java.lang.String} object + * @param unit a {@link java.lang.String} object */ public void setPressure(double pressure, String unit) { setOutletPressure(pressure); @@ -551,8 +501,7 @@ public double getSpeed() { * Getter for the fieldpumpChart
.
*
*
- * @return a {@link neqsim.processSimulation.processEquipment.pump.PumpChart}
- * object
+ * @return a {@link neqsim.processSimulation.processEquipment.pump.PumpChart} object
*/
public PumpChart getPumpChart() {
return pumpChart;
diff --git a/src/main/java/neqsim/processSimulation/processSystem/ProcessModuleBaseClass.java b/src/main/java/neqsim/processSimulation/processSystem/ProcessModuleBaseClass.java
index d88a67e5a4..4b62748ce6 100644
--- a/src/main/java/neqsim/processSimulation/processSystem/ProcessModuleBaseClass.java
+++ b/src/main/java/neqsim/processSimulation/processSystem/ProcessModuleBaseClass.java
@@ -241,4 +241,15 @@ public String[][] getResultTable() {
public double getPressure(String unit) {
return 1.0;
}
+
+ /** {@inheritDoc} */
+ public String[][] createTable(String name) {
+
+ String[][] table = new String[50][3];
+ String[] names = {"Property", "Value", "Unit"};
+ table[0][0] = "";
+ table[0][1] = "";
+ table[0][2] = "";
+ return table;
+ }
}
diff --git a/src/test/java/neqsim/processSimulation/processEquipment/pump/PumpTest.java b/src/test/java/neqsim/processSimulation/processEquipment/pump/PumpTest.java
index 24a8688a47..9fa2e1e5f3 100644
--- a/src/test/java/neqsim/processSimulation/processEquipment/pump/PumpTest.java
+++ b/src/test/java/neqsim/processSimulation/processEquipment/pump/PumpTest.java
@@ -98,6 +98,8 @@ void testSimplePumpCurve() {
pump1.setSpeed(500);
pump1.run();
+ pump1.prettyPrint();
+
Assertions.assertEquals(7.274237081101, pump1.getOutletPressure(), 1e-5);
}