diff --git a/src/main/java/neqsim/process/processmodel/ProcessModel.java b/src/main/java/neqsim/process/processmodel/ProcessModel.java index 46d0e510a..82358e5c2 100644 --- a/src/main/java/neqsim/process/processmodel/ProcessModel.java +++ b/src/main/java/neqsim/process/processmodel/ProcessModel.java @@ -11,8 +11,46 @@ * @version $Id: $Id */ public class ProcessModel implements Runnable { - ArrayList processes = new ArrayList(0); + ArrayList processes = new ArrayList(); + private boolean runStep = false; + + /** + *

+ * isRunStep. + *

+ * + * + * @return a {@link java.lang.Boolean} runStep + * + */ + public boolean isRunStep() { + return runStep; + } + + /** + *

+ * runStep. + *

+ * + * @param runStep run in steps + * + */ + public void setRunStep(boolean runStep) { + this.runStep = runStep; + } + + + /** + *

+ * add. + *

+ * + * @param name name of process + * @param process process to add + * + * @return a {@link java.lang.Boolean} success + */ public boolean add(String name, ProcessSystem process) { processes.add(process); return true; @@ -20,14 +58,30 @@ public boolean add(String name, ProcessSystem process) { /** *

- * runAsThread. + * run. *

* - * @return a {@link java.lang.Thread} object */ public void run() { for (int i = 0; i < processes.size(); i++) { - processes.get(i).run(); + if (runStep) { + processes.get(i).run_step(); + } else { + processes.get(i).run(); + } + } + } + + /** + *

+ * runStep. + *

+ * + */ + public void runStep() { + for (int i = 0; i < processes.size(); i++) { + processes.get(i).run_step(); + } } diff --git a/src/test/java/neqsim/process/processmodel/CombinedModelsTest.java b/src/test/java/neqsim/process/processmodel/CombinedModelsTest.java index 82bb57de9..d6304561b 100644 --- a/src/test/java/neqsim/process/processmodel/CombinedModelsTest.java +++ b/src/test/java/neqsim/process/processmodel/CombinedModelsTest.java @@ -3,6 +3,7 @@ import java.io.File; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; +import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; import neqsim.process.equipment.compressor.Compressor; import neqsim.process.equipment.separator.ThreePhaseSeparator; @@ -63,10 +64,10 @@ public void testProcess() { ((Compressor) compressorProcess.getUnit("Compressor1")).setOutletPressure(100.0, "bara"); - ProcessModel fullProcess = new ProcessModel(); fullProcess.add("feed process", inletProcess); fullProcess.add("compressor process", compressorProcess); + fullProcess.setRunStep(true); try { fullProcess.run(); @@ -74,8 +75,11 @@ public void testProcess() { logger.debug(ex.getMessage(), ex); } - ((Compressor) compressorProcess.getUnit("Compressor1")).getOutletStream().getFluid() - .prettyPrint(); + Assertions.assertEquals(164.44139872, ((Compressor) compressorProcess.getUnit("Compressor1")) + .getOutletStream().getTemperature("C"), 0.1); + + // ((Compressor) compressorProcess.getUnit("Compressor1")).getOutletStream().getFluid() + // .prettyPrint(); }