Skip to content

Commit

Permalink
Test-large-combined-model2 (#1219)
Browse files Browse the repository at this point in the history
* try to solve error

* dont run mixer calcs for one single input stream

* test update

* update

* update

* update
  • Loading branch information
EvenSol authored Dec 30, 2024
1 parent afdbcef commit 67e9fcc
Show file tree
Hide file tree
Showing 4 changed files with 292 additions and 133 deletions.
40 changes: 22 additions & 18 deletions src/main/java/neqsim/process/equipment/mixer/Mixer.java
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ public void run(UUID id) {
mixedStream.setThermoSystem(thermoSystem2);
// thermoSystem2.display();
ThermodynamicOperations testOps = new ThermodynamicOperations(thermoSystem2);
if (streams.size() > 0) {
if (streams.size() >= 2) {
mixedStream.getThermoSystem().setNumberOfPhases(2);
mixedStream.getThermoSystem().init(0);

Expand All @@ -221,33 +221,37 @@ public void run(UUID id) {
mixedStream.getThermoSystem().setTemperature(guessTemperature());
}
// System.out.println("filan temp " + mixedStream.getTemperature());
}
if (isSetOutTemperature) {
if (!Double.isNaN(getOutTemperature())) {
mixedStream.getThermoSystem().setTemperature(getOutTemperature());
}
testOps.TPflash();
mixedStream.getThermoSystem().init(2);
} else {
try {
testOps.PHflash(enthalpy, 0);
} catch (Exception ex) {
logger.error(ex.getMessage(), ex);

if (isSetOutTemperature) {
if (!Double.isNaN(getOutTemperature())) {
mixedStream.getThermoSystem().setTemperature(getOutTemperature());
}
testOps.TPflash();
mixedStream.getThermoSystem().init(2);
} else {
try {
testOps.PHflash(enthalpy, 0);
} catch (Exception ex) {
logger.error(ex.getMessage(), ex);
if (!Double.isNaN(getOutTemperature())) {
mixedStream.getThermoSystem().setTemperature(getOutTemperature());
}
testOps.TPflash();
}
}
} else {
testOps.TPflash();
mixedStream.getThermoSystem().init(2);
}
mixedStream.setCalculationIdentifier(id);


// System.out.println("enthalpy: " +
// mixedStream.getThermoSystem().getEnthalpy());
// System.out.println("enthalpy: " + enthalpy);
// mixedStream.getThermoSystem().getEnthalpy())
// System.out.println("enthalpy: " + en
// System.out.println("temperature: " +
// mixedStream.getThermoSystem().getTemperature());

// System.out.println("beta " + mixedStream.getThermoSystem().getBeta());

// System.out.println("beta " + mixedStream.getThermoSystem(
// outStream.setThermoSystem(mixedStream.getThermoSystem());
setCalculationIdentifier(id);
}
Expand Down
5 changes: 5 additions & 0 deletions src/main/java/neqsim/process/equipment/util/Recycle.java
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,8 @@ public void run(UUID id) {
if (numberOfInputStreams == 1 && thermoSystem2.getFlowRate("kg/hr") < 1e-100) {
setErrorCompositon(0.0);
setErrorFlow(0.0);
setErrorTemperature(0.0);
setErrorPressure(0.0);
return;
}
mixedStream.setThermoSystem(thermoSystem2);
Expand Down Expand Up @@ -598,6 +600,9 @@ public void setPriority(int priority) {
/** {@inheritDoc} */
@Override
public boolean solved() {
if (getOutletStream().getFlowRate("kg/hr") < 1e-20 && iterations > 1)
return true;

if (Math.abs(this.errorComposition) < compositionTolerance
&& Math.abs(this.errorFlow) < flowTolerance
&& Math.abs(this.errorTemperature) < temperatureTolerance
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ public boolean hasHigherPriorityLevel() {
*/
public boolean solvedAll() {
for (Recycle recyc : recycleArray) {
logger.info("recycle solved " + recyc.solved());
logger.info(recyc.getName() + " solved " + recyc.solved());
if (!recyc.solved()) {
return false;
}
Expand Down
Loading

0 comments on commit 67e9fcc

Please sign in to comment.