Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
EvenSol committed Nov 10, 2024
1 parent da43017 commit 6b92a1f
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 6 deletions.
26 changes: 23 additions & 3 deletions src/main/java/neqsim/process/equipment/splitter/Splitter.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package neqsim.process.equipment.splitter;

import java.util.Arrays;
import java.util.UUID;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
Expand Down Expand Up @@ -33,6 +34,8 @@ public class Splitter extends ProcessEquipmentBaseClass implements SplitterInter
double[] splitFactor = new double[1];
double[] flowRates;
String flowUnit = "mole/sec";
protected double[] oldSplitFactor = null;
protected double[] oldFlowRates = null;

/**
* Constructor for Splitter.
Expand Down Expand Up @@ -60,8 +63,7 @@ public Splitter(String name, StreamInterface inStream) {
* </p>
*
* @param name a {@link java.lang.String} object
* @param inletStream a {@link neqsim.process.equipment.stream.StreamInterface}
* object
* @param inletStream a {@link neqsim.process.equipment.stream.StreamInterface} object
* @param i a int
*/
public Splitter(String name, StreamInterface inletStream, int i) {
Expand Down Expand Up @@ -178,6 +180,19 @@ public StreamInterface getSplitStream(int i) {
return splitStream[i];
}

/** {@inheritDoc} */
@Override
public boolean needRecalculation() {
if (!inletStream.needRecalculation() && Arrays.equals(splitFactor, oldSplitFactor)
&& Arrays.equals(oldFlowRates, flowRates)) {
isSolved = true;
return false;
} else {
isSolved = false;
return true;
}
}

/** {@inheritDoc} */
@Override
public void run(UUID id) {
Expand Down Expand Up @@ -215,7 +230,12 @@ public void run(UUID id) {
new ThermodynamicOperations(splitStream[i].getThermoSystem());
thermoOps.TPflash();
}

if (splitFactor != null) {
oldSplitFactor = Arrays.copyOf(splitFactor, splitFactor.length);
}
if (flowRates != null) {
oldFlowRates = Arrays.copyOf(flowRates, flowRates.length);
}
setCalculationIdentifier(id);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,11 +134,10 @@ public void testProcess() {

operations.run();

assertEquals(2042.17826, recycleScrubberStream.getFlowRate("kg/hr"), 0.1);
assertEquals(2038.8824, recycleScrubberStream.getFlowRate("kg/hr"), 0.1);

neqsim.process.equipment.compressor.CompressorChartGenerator compchartgenerator =
new neqsim.process.equipment.compressor.CompressorChartGenerator(
seccondStageCompressor);
new neqsim.process.equipment.compressor.CompressorChartGenerator(seccondStageCompressor);
compchartgenerator.generateCompressorChart("mid range");

seccondStageCompressor.setCompressorChart(compchartgenerator.generateCompressorChart("normal"));
Expand Down

0 comments on commit 6b92a1f

Please sign in to comment.