From 7da26e5cddeeb15d38dca5871ba967943e55b12e Mon Sep 17 00:00:00 2001 From: Sviatoslav Eroshkin <109044598+Sviatose@users.noreply.github.com> Date: Thu, 31 Oct 2024 14:39:33 +0000 Subject: [PATCH 1/3] feat: param process run step --- .../processsystem/ProcessSystem.java | 21 ++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/src/main/java/neqsim/processsimulation/processsystem/ProcessSystem.java b/src/main/java/neqsim/processsimulation/processsystem/ProcessSystem.java index e047c52be..c8829d0a7 100644 --- a/src/main/java/neqsim/processsimulation/processsystem/ProcessSystem.java +++ b/src/main/java/neqsim/processsimulation/processsystem/ProcessSystem.java @@ -43,6 +43,7 @@ public class ProcessSystem extends SimulationBaseClass { new ArrayList(0); RecycleController recycleController = new RecycleController(); private double timeStep = 1.0; + private runStep = false; /** *

@@ -459,7 +460,7 @@ public void run(UUID id) { * signalDB[timeStepNumber][3 * i + 3] = ((MeasurementDeviceInterface) * measurementDevices.get(i)) .getUnit(); } */ - } while ((!isConverged || (iter < 2 && hasRecycle)) && iter < 100); + } while (((!isConverged || (iter < 2 && hasRecycle)) && iter < 100) && runStep); for (int i = 0; i < unitOperations.size(); i++) { unitOperations.get(i).setCalculationIdentifier(id); @@ -736,6 +737,24 @@ public void setName(String name) { this.name = name; } + /** + * Setter for the field runStep. + * + * @param runStep A boolean value if run only one iteration + */ + public void setRunStep(boolean runStep) { + this.runStep = runStep; + } + + /** + * Getter for the field runStep. + * + * @return A boolean value if run only one iteration + */ + public boolean isRunStep() { + return runStep; + } + /** *

* getEntropyProduction. From 9531058b59116fb1a31cea2dc3c219486028b4dc Mon Sep 17 00:00:00 2001 From: Even Solbraa <41290109+EvenSol@users.noreply.github.com> Date: Tue, 19 Nov 2024 19:37:31 +0000 Subject: [PATCH 2/3] update --- src/main/java/neqsim/process/processmodel/ProcessSystem.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/neqsim/process/processmodel/ProcessSystem.java b/src/main/java/neqsim/process/processmodel/ProcessSystem.java index 359ee5a96..c3434d111 100644 --- a/src/main/java/neqsim/process/processmodel/ProcessSystem.java +++ b/src/main/java/neqsim/process/processmodel/ProcessSystem.java @@ -43,7 +43,7 @@ public class ProcessSystem extends SimulationBaseClass { new ArrayList(0); RecycleController recycleController = new RecycleController(); private double timeStep = 1.0; - private runStep = false; + private boolean runStep = false; /** *

From bc4ee0ecff9032edb45f6c3e32fb4d3ac182b7b1 Mon Sep 17 00:00:00 2001 From: Even Solbraa <41290109+EvenSol@users.noreply.github.com> Date: Tue, 19 Nov 2024 19:45:54 +0000 Subject: [PATCH 3/3] update --- .../process/processmodel/ProcessSystem.java | 45 ++++++++----------- 1 file changed, 18 insertions(+), 27 deletions(-) diff --git a/src/main/java/neqsim/process/processmodel/ProcessSystem.java b/src/main/java/neqsim/process/processmodel/ProcessSystem.java index c3434d111..62775dbcd 100644 --- a/src/main/java/neqsim/process/processmodel/ProcessSystem.java +++ b/src/main/java/neqsim/process/processmodel/ProcessSystem.java @@ -68,8 +68,7 @@ public ProcessSystem(String name) { * Add to end. *

* - * @param operation a {@link neqsim.process.equipment.ProcessEquipmentInterface} - * object + * @param operation a {@link neqsim.process.equipment.ProcessEquipmentInterface} object */ public void add(ProcessEquipmentInterface operation) { // Add to end @@ -82,8 +81,7 @@ public void add(ProcessEquipmentInterface operation) { *

* * @param position 0-based position - * @param operation a {@link neqsim.process.equipment.ProcessEquipmentInterface} - * object + * @param operation a {@link neqsim.process.equipment.ProcessEquipmentInterface} object */ public void add(int position, ProcessEquipmentInterface operation) { ArrayList units = this.getUnitOperations(); @@ -114,8 +112,8 @@ public void add(int position, ProcessEquipmentInterface operation) { * Add measurementdevice. *

* - * @param measurementDevice a - * {@link neqsim.process.measurementdevice.MeasurementDeviceInterface} object + * @param measurementDevice a {@link neqsim.process.measurementdevice.MeasurementDeviceInterface} + * object */ public void add(MeasurementDeviceInterface measurementDevice) { measurementDevices.add(measurementDevice); @@ -126,8 +124,8 @@ public void add(MeasurementDeviceInterface measurementDevice) { * Add multiple process equipment to end. *

* - * @param operations an array of - * {@link neqsim.process.equipment.ProcessEquipmentInterface} objects + * @param operations an array of {@link neqsim.process.equipment.ProcessEquipmentInterface} + * objects */ public void add(ProcessEquipmentInterface[] operations) { getUnitOperations().addAll(Arrays.asList(operations)); @@ -223,8 +221,7 @@ public int getUnitNumber(String name) { *

* * @param unitName a {@link java.lang.String} object - * @param operation a {@link neqsim.process.equipment.ProcessEquipmentBaseClass} - * object + * @param operation a {@link neqsim.process.equipment.ProcessEquipmentBaseClass} object */ public void replaceObject(String unitName, ProcessEquipmentBaseClass operation) { unitOperations.set(getUnitNumber(name), operation); @@ -441,8 +438,7 @@ public void run(UUID id) { for (int i = 0; i < unitOperations.size(); i++) { if (unitOperations.get(i).getClass().getSimpleName().equals("Adjuster")) { - if (!((neqsim.process.equipment.util.Adjuster) unitOperations.get(i)) - .solved()) { + if (!((neqsim.process.equipment.util.Adjuster) unitOperations.get(i)).solved()) { isConverged = false; break; } @@ -460,7 +456,7 @@ public void run(UUID id) { * signalDB[timeStepNumber][3 * i + 3] = ((MeasurementDeviceInterface) * measurementDevices.get(i)) .getUnit(); } */ - } while (((!isConverged || (iter < 2 && hasRecycle)) && iter < 100) && runStep); + } while (((!isConverged || (iter < 2 && hasRecycle)) && iter < 100) && !runStep); for (int i = 0; i < unitOperations.size(); i++) { unitOperations.get(i).setCalculationIdentifier(id); @@ -747,10 +743,10 @@ public void setRunStep(boolean runStep) { } /** - * Getter for the field runStep. - * - * @return A boolean value if run only one iteration - */ + * Getter for the field runStep. + * + * @return A boolean value if run only one iteration + */ public boolean isRunStep() { return runStep; } @@ -803,11 +799,10 @@ public double getPower(String unit) { double power = 0.0; for (int i = 0; i < unitOperations.size(); i++) { if (unitOperations.get(i).getClass().getSimpleName().equals("Compressor")) { - power += ((neqsim.process.equipment.compressor.Compressor) unitOperations - .get(i)).getPower(); + power += + ((neqsim.process.equipment.compressor.Compressor) unitOperations.get(i)).getPower(); } else if (unitOperations.get(i).getClass().getSimpleName().equals("Pump")) { - power += ((neqsim.process.equipment.pump.Pump) unitOperations.get(i)) - .getPower(); + power += ((neqsim.process.equipment.pump.Pump) unitOperations.get(i)).getPower(); } } if (unit.equals("MW")) { @@ -831,9 +826,7 @@ public double getCoolerDuty(String unit) { double heat = 0.0; for (int i = 0; i < unitOperations.size(); i++) { if (unitOperations.get(i).getClass().getSimpleName().equals("Cooler")) { - heat += - ((neqsim.process.equipment.heatexchanger.Cooler) unitOperations.get(i)) - .getDuty(); + heat += ((neqsim.process.equipment.heatexchanger.Cooler) unitOperations.get(i)).getDuty(); } } if (unit.equals("MW")) { @@ -857,9 +850,7 @@ public double getHeaterDuty(String unit) { double heat = 0.0; for (int i = 0; i < unitOperations.size(); i++) { if (unitOperations.get(i).getClass().getSimpleName().equals("Heater")) { - heat += - ((neqsim.process.equipment.heatexchanger.Heater) unitOperations.get(i)) - .getDuty(); + heat += ((neqsim.process.equipment.heatexchanger.Heater) unitOperations.get(i)).getDuty(); } } if (unit.equals("MW")) {