Skip to content

Commit

Permalink
Bug-fix-stream (#724)
Browse files Browse the repository at this point in the history
* initial work

* added more implementations

* added methods for stream and saturator

* added test for recalculation to process module

* added calc check heater/cooler

* style

* Update Heater.java

* revert

* Update Stream.java

* added check for null

* update

* fixed database parameters

* fixed db table

* added test and fixed bugs

* added test for recalc for mxer

* add test

* fixed bug

* set private

* update

* update

* use solved property remove isUpdated

* testelectrolyteEos

* added updates to test

* remove logging

* fixed error

* fix error

* fix

* fix

* fix splitter bug added test

* update test

* calc test

* added fix for stream

---------

Co-authored-by: Åsmund Våge Fannemel <34712686+asmfstatoil@users.noreply.github.com>
  • Loading branch information
EvenSol and asmfstatoil authored Jun 5, 2023
1 parent 1edd007 commit a2920a9
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 511 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ public Stream(String name) {
* @param stream input stream
*/
public Stream(String name, StreamInterface stream) {
super(name);
this(name);
this.setStream(stream);
thermoSystem = stream.getThermoSystem();
numberOfStreams++;
Expand Down Expand Up @@ -323,6 +323,9 @@ public void runTPflash() {
/** {@inheritDoc} */
@Override
public boolean needRecalculation() {
if (stream != null) {
thermoSystem = stream.getFluid();
}
if (getFluid().getTemperature() == lastTemperature && getFluid().getPressure() == lastPressure
&& Math.abs(getFluid().getFlowRate("kg/hr") - lastFlowRate)
/ getFluid().getFlowRate("kg/hr") < 1e-6) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package neqsim.processSimulation.processEquipment.util;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.UUID;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
Expand Down Expand Up @@ -58,6 +59,19 @@ public ProcessEquipmentInterface getOutputVariable() {
return outputVariable;
}

/** {@inheritDoc} */
@Override
public boolean needRecalculation() {
Iterator<ProcessEquipmentInterface> iter = inputVariable.iterator();
while (iter.hasNext()) {
ProcessEquipmentInterface str = iter.next();
if (!str.solved()) {
return true;
}
}
return false;
}

/** {@inheritDoc} */
@Override
public void run(UUID id) {
Expand All @@ -73,13 +87,13 @@ public void run(UUID id) {
}
}

//System.out.println("make up TEG " + sum);
//((Stream) outputVariable).setFlowRate(sum, "kg/hr");
// System.out.println("make up TEG " + sum);
// ((Stream) outputVariable).setFlowRate(sum, "kg/hr");
try {
if (sum < 1e-10) {
sum = 1e-10;
}
((Stream) outputVariable).setFlowRate(sum, "kg/hr");
((Stream) outputVariable).setFlowRate(sum, "kg/hr");
outputVariable.run();
outputVariable.setCalculationIdentifier(id);
} catch (Exception ex) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -331,8 +331,8 @@ public void run(UUID id) {
mixedStream.setCalculationIdentifier(id);
setError(massBalanceCheck());
setErrorFlow(massBalanceCheck2());
logger.info(name + " comp recycle error: " + getError());
logger.info(name + " flow recycle error: " + getErrorFlow());
logger.debug("comp recycle error: " + getError());
logger.debug("flow recycle error: " + getErrorFlow());
lastIterationStream = (Stream) mixedStream.clone();
outletStream.setThermoSystem(mixedStream.getThermoSystem());
outletStream.setCalculationIdentifier(id);
Expand Down
Loading

0 comments on commit a2920a9

Please sign in to comment.