Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix bugs #1166

Merged
merged 2 commits into from
Nov 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 5 additions & 12 deletions src/main/java/neqsim/process/equipment/separator/Separator.java
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,7 @@ public Separator(String name) {
* Constructor for Separator.
*
* @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
*/
public Separator(String name, StreamInterface inletStream) {
this(name);
Expand All @@ -114,8 +113,7 @@ public void initMechanicalDesign() {
* setInletStream.
* </p>
*
* @param inletStream a {@link neqsim.process.equipment.stream.StreamInterface}
* object
* @param inletStream a {@link neqsim.process.equipment.stream.StreamInterface} object
*/
public void setInletStream(StreamInterface inletStream) {
inletStreamMixer.addStream(inletStream);
Expand All @@ -133,8 +131,7 @@ public void setInletStream(StreamInterface inletStream) {
* addStream.
* </p>
*
* @param newStream a {@link neqsim.process.equipment.stream.StreamInterface}
* object
* @param newStream a {@link neqsim.process.equipment.stream.StreamInterface} object
*/
public void addStream(StreamInterface newStream) {
if (numberOfInputStreams == 0) {
Expand Down Expand Up @@ -651,9 +648,7 @@ public void setSeparatorLength(double separatorLength) {
* </p>
*
* @param i a int
* @return a
* {@link neqsim.process.equipment.separator.sectiontype.SeparatorSection}
* object
* @return a {@link neqsim.process.equipment.separator.sectiontype.SeparatorSection} object
*/
public SeparatorSection getSeparatorSection(int i) {
return separatorSection.get(i);
Expand All @@ -665,9 +660,7 @@ public SeparatorSection getSeparatorSection(int i) {
* </p>
*
* @param name a {@link java.lang.String} object
* @return a
* {@link neqsim.process.equipment.separator.sectiontype.SeparatorSection}
* object
* @return a {@link neqsim.process.equipment.separator.sectiontype.SeparatorSection} object
*/
public SeparatorSection getSeparatorSection(String name) {
for (SeparatorSection sec : separatorSection) {
Expand Down
4 changes: 3 additions & 1 deletion src/main/java/neqsim/process/equipment/stream/Stream.java
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,9 @@ public boolean needRecalculation() {
/** {@inheritDoc} */
@Override
public void run(UUID id) {
// logger.info("start flashing stream... " + streamNumber);
if (!getFluid().isInitialized()) {
getFluid().init(0);
}
thermoSystem = getFluid().clone();

ThermodynamicOperations thermoOps = new ThermodynamicOperations(thermoSystem);
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/neqsim/thermo/system/SystemInterface.java
Original file line number Diff line number Diff line change
Expand Up @@ -2659,4 +2659,6 @@ public default void setPhysicalPropertyModel(int type) {
* @param phasetypename a {@link java.lang.String} object
*/
public void setForceSinglePhase(String phasetypename);

public boolean isInitialized();
}
8 changes: 6 additions & 2 deletions src/main/java/neqsim/thermo/system/SystemThermo.java
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,11 @@ public abstract class SystemThermo implements SystemInterface {

// Initialization
boolean isInitialized = false;

public boolean isInitialized() {
return isInitialized;
}

/** Maximum allowed number of phases . */
public int maxNumberOfPhases = 2;
private int mixingRule = 1;
Expand Down Expand Up @@ -5049,8 +5054,7 @@ public double[] getzvector() {
/** {@inheritDoc} */
@Override
public String toJson() {
return new GsonBuilder().create()
.toJson(new neqsim.process.util.monitor.FluidResponse(this));
return new GsonBuilder().create().toJson(new neqsim.process.util.monitor.FluidResponse(this));
}

/** {@inheritDoc} */
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package neqsim.processsimulation.controllerdevice;
package neqsim.process.controllerdevice;

import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeAll;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package neqsim.processsimulation.processequipment.absorber;
package neqsim.process.equipment.absorber;

import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Disabled;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package neqsim.processsimulation.processequipment.adsorber;
package neqsim.process.equipment.adsorber;

import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Disabled;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package neqsim.processsimulation.processequipment.compressor;
package neqsim.process.equipment.compressor;

import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeEach;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package neqsim.processsimulation.processequipment.compressor;
package neqsim.process.equipment.compressor;

import static org.junit.jupiter.api.Assertions.assertTrue;
import org.junit.jupiter.api.Assertions;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package neqsim.processsimulation.processequipment.compressor;
package neqsim.process.equipment.compressor;

import static org.junit.jupiter.api.Assertions.assertEquals;
import org.junit.jupiter.api.BeforeEach;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package neqsim.processsimulation.processequipment.compressor;
package neqsim.process.equipment.compressor;

import static org.junit.jupiter.api.Assertions.assertEquals;
import java.io.File;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package neqsim.processsimulation.processequipment.distillation;
package neqsim.process.equipment.distillation;

import static org.junit.jupiter.api.Assertions.assertEquals;
import org.junit.jupiter.api.Test;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package neqsim.processsimulation.processequipment.heatexchanger;
package neqsim.process.equipment.heatexchanger;

import static org.junit.jupiter.api.Assertions.assertEquals;
import org.junit.jupiter.api.BeforeEach;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package neqsim.processsimulation.processequipment.heatexchanger;
package neqsim.process.equipment.heatexchanger;

import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertTrue;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package neqsim.processsimulation.processequipment.manifold;
package neqsim.process.equipment.manifold;

import static org.junit.jupiter.api.Assertions.assertEquals;
import org.junit.jupiter.api.Test;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package neqsim.processsimulation.processequipment.mixer;
package neqsim.process.equipment.mixer;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package neqsim.processsimulation.processequipment.pipeline;
package neqsim.process.equipment.pipeline;

import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package neqsim.processsimulation.processequipment.pipeline;
package neqsim.process.equipment.pipeline;

import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package neqsim.processsimulation.processequipment.pipeline;
package neqsim.process.equipment.pipeline;

import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package neqsim.processsimulation.processequipment.powergeneration;
package neqsim.process.equipment.powergeneration;

import static org.junit.jupiter.api.Assertions.assertEquals;
import org.apache.logging.log4j.LogManager;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package neqsim.processsimulation.processequipment.pump;
package neqsim.process.equipment.pump;

import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package neqsim.processsimulation.processequipment.pump;
package neqsim.process.equipment.pump;

import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package neqsim.processsimulation.processequipment.reservoir;
package neqsim.process.equipment.reservoir;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package neqsim.processsimulation.processequipment.reservoir;
package neqsim.process.equipment.reservoir;

import org.junit.jupiter.api.Test;
import neqsim.process.equipment.pipeline.PipeBeggsAndBrills;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package neqsim.processsimulation.processequipment.separator;
package neqsim.process.equipment.separator;

import static org.junit.jupiter.api.DynamicTest.stream;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
Expand All @@ -8,6 +9,7 @@
import neqsim.process.equipment.stream.StreamInterface;
import neqsim.process.measurementdevice.LevelTransmitter;
import neqsim.process.processmodel.ProcessSystem;
import neqsim.thermo.phase.PhaseType;
import neqsim.thermo.system.SystemSrkCPAstatoil;

/**
Expand Down Expand Up @@ -65,4 +67,41 @@ public void testOnePhase() {

processOps.run();
}

@Test
public void testSimpleSeparator() {
neqsim.thermo.system.SystemSrkEos fluid1 = new neqsim.thermo.system.SystemSrkEos(280.0, 10.0);
fluid1.addComponent("water", 2.7);
fluid1.addComponent("nitrogen", 0.7);
fluid1.addComponent("CO2", 2.1);
fluid1.addComponent("methane", 70.0);
fluid1.addComponent("ethane", 10.0);
fluid1.addComponent("propane", 5.0);
fluid1.addComponent("i-butane", 3.0);
fluid1.addComponent("n-butane", 2.0);
fluid1.addComponent("i-pentane", 1.0);
fluid1.addComponent("n-pentane", 1.0);
fluid1.addTBPfraction("C6", 1.49985, 86.3 / 1000.0, 0.7432);
fluid1.addTBPfraction("C7", 0.49985, 103.3 / 1000.0, 0.76432);
fluid1.addTBPfraction("C8", 0.39985, 125.0 / 1000.0, 0.78432);
fluid1.addTBPfraction("C9", 0.49985, 145.0 / 1000.0, 0.79432);
fluid1.addTBPfraction("C10", 0.149985, 165.0 / 1000.0, 0.81);
fluid1.setMixingRule(2);
fluid1.setMultiPhaseCheck(true);
fluid1.setTemperature(55.0, "C");
fluid1.setPressure(55.0, "bara");


Stream feedStream = new Stream("feed fluid", fluid1);
Separator separator1 = new Separator("sep1", feedStream);

processOps = new ProcessSystem();
processOps.add(feedStream);
processOps.add(separator1);
processOps.run();

Assertions.assertEquals(0.1598175271755,
separator1.getFluid().getPhase(PhaseType.OIL).getBeta(), 1e-5);

}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package neqsim.processsimulation.processequipment.separator;
package neqsim.process.equipment.separator;

import java.util.ArrayList;
import java.util.List;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package neqsim.processsimulation.processequipment.splitter;
package neqsim.process.equipment.splitter;

import static org.junit.jupiter.api.Assertions.assertEquals;
import org.apache.logging.log4j.LogManager;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package neqsim.processsimulation.processequipment.stream;
package neqsim.process.equipment.stream;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package neqsim.processsimulation.processequipment.stream;
package neqsim.process.equipment.stream;

import static org.junit.jupiter.api.Assertions.assertEquals;
import org.junit.jupiter.api.BeforeEach;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package neqsim.processsimulation.processequipment.util;
package neqsim.process.equipment.util;

import static org.junit.jupiter.api.Assertions.assertEquals;
import org.junit.jupiter.api.Test;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package neqsim.processsimulation.processequipment.util;
package neqsim.process.equipment.util;

import static org.junit.jupiter.api.Assertions.assertEquals;
import org.junit.jupiter.api.Test;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package neqsim.processsimulation.processequipment.util;
package neqsim.process.equipment.util;

import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package neqsim.processsimulation.processequipment.util;
package neqsim.process.equipment.util;

import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package neqsim.processsimulation.processequipment.util;
package neqsim.process.equipment.util;

import static org.junit.jupiter.api.Assertions.assertEquals;
import org.junit.jupiter.api.Test;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package neqsim.processsimulation.processequipment.util;
package neqsim.process.equipment.util;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package neqsim.processsimulation.processequipment.valve;
package neqsim.process.equipment.valve;

import static org.junit.jupiter.api.Assertions.assertEquals;
import org.junit.jupiter.api.Test;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package neqsim.processsimulation.measurementdevice;
package neqsim.process.measurementdevice;

import static org.junit.jupiter.api.Assertions.assertEquals;
import org.junit.jupiter.api.Test;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package neqsim.processsimulation.measurementdevice;
package neqsim.process.measurementdevice;

import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package neqsim.processsimulation.measurementdevice;
package neqsim.process.measurementdevice;

import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package neqsim.processsimulation.measurementdevice;
package neqsim.process.measurementdevice;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package neqsim.processsimulation.measurementdevice;
package neqsim.process.measurementdevice;

import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeAll;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package neqsim.processsimulation.measurementdevice;
package neqsim.process.measurementdevice;

import static org.junit.jupiter.api.Assertions.assertEquals;
import org.apache.logging.log4j.LogManager;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package neqsim.processsimulation.measurementdevice.simpleflowregime;
package neqsim.process.measurementdevice.simpleflowregime;

import static org.junit.jupiter.api.Assertions.assertEquals;
import org.junit.jupiter.api.Test;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package neqsim.processsimulation.mechanicaldesign;
package neqsim.process.mechanicaldesign;

import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package neqsim.processsimulation.processsystem;
package neqsim.process.processmodel;

import static org.junit.jupiter.api.Assertions.assertEquals;
import org.junit.jupiter.api.Test;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package neqsim.processsimulation.processsystem;
package neqsim.process.processmodel;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertTrue;
Expand Down
Loading