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

refact: filters are twoports #430

Merged
merged 1 commit into from
Jun 2, 2022
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
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
package neqsim.processSimulation.processEquipment.filter;

import neqsim.processSimulation.processEquipment.ProcessEquipmentBaseClass;
import neqsim.processSimulation.processEquipment.ProcessEquipmentInterface;
import neqsim.processSimulation.processEquipment.stream.Stream;
import neqsim.processSimulation.processEquipment.TwoPortEquipment;
import neqsim.processSimulation.processEquipment.stream.StreamInterface;
import neqsim.thermo.system.SystemInterface;
import neqsim.thermodynamicOperations.ThermodynamicOperations;
Expand All @@ -15,129 +14,114 @@
* @author asmund
* @version $Id: $Id
*/
public class Filter extends ProcessEquipmentBaseClass {
private static final long serialVersionUID = 1000;
public class Filter extends TwoPortEquipment {
private static final long serialVersionUID = 1000;

private double deltaP = 0.01;
protected StreamInterface outStream;
protected StreamInterface inStream;
private double Cv = 0.0;
private double deltaP = 0.01;
private double Cv = 0.0;

/**
* <p>
* Constructor for Filter.
* </p>
*
* @param inStream a {@link neqsim.processSimulation.processEquipment.stream.StreamInterface}
* object
*/
@Deprecated
public Filter(StreamInterface inStream) {
this("Filter", inStream);
}
/**
* <p>
* Constructor for Filter.
* </p>
*
* @param inStream a {@link neqsim.processSimulation.processEquipment.stream.StreamInterface}
* object
*/
@Deprecated
public Filter(StreamInterface inStream) {
this("Filter", inStream);
}

/**
* <p>
* Constructor for Filter.
* </p>
*
* @param name
* @param inStream a {@link neqsim.processSimulation.processEquipment.stream.StreamInterface}
* object
*/
public Filter(String name, StreamInterface inStream) {
super(name);
this.inStream = inStream;
outStream = (Stream) inStream.clone();
}
/**
* <p>
* Constructor for Filter.
* </p>
*
* @param name
* @param inStream a {@link neqsim.processSimulation.processEquipment.stream.StreamInterface}
* object
*/
public Filter(String name, StreamInterface inStream) {
super(name, inStream);
}

/** {@inheritDoc} */
@Override
public void run() {
SystemInterface system = inStream.getThermoSystem().clone();
if (Math.abs(getDeltaP()) > 1e-10) {
system.setPressure(inStream.getPressure() - getDeltaP());
ThermodynamicOperations testOps = new ThermodynamicOperations(system);
testOps.TPflash();
}
system.initProperties();
outStream.setThermoSystem(system);
Cv = Math.sqrt(deltaP) / inStream.getFlowRate("kg/hr");
/** {@inheritDoc} */
@Override
public void run() {
SystemInterface system = inStream.getThermoSystem().clone();
if (Math.abs(getDeltaP()) > 1e-10) {
system.setPressure(inStream.getPressure() - getDeltaP());
ThermodynamicOperations testOps = new ThermodynamicOperations(system);
testOps.TPflash();
}
system.initProperties();
outStream.setThermoSystem(system);
Cv = Math.sqrt(deltaP) / inStream.getFlowRate("kg/hr");
}

/**
* <p>
* Getter for the field <code>deltaP</code>.
* </p>
*
* @return a double
*/
public double getDeltaP() {
return deltaP;
}

/**
* <p>
* Setter for the field <code>deltaP</code>.
* </p>
*
* @param deltaP a double
*/
public void setDeltaP(double deltaP) {
this.deltaP = deltaP;
this.outStream.setPressure(this.inStream.getPressure() - deltaP);
}
/**
* <p>
* Getter for the field <code>deltaP</code>.
* </p>
*
* @return a double
*/
public double getDeltaP() {
return deltaP;
}

/**
* <p>
* Setter for the field <code>deltaP</code>.
* </p>
*
* @param deltaP a double
* @param unit a {@link java.lang.String} object
*/
public void setDeltaP(double deltaP, String unit) {
this.deltaP = deltaP;
this.outStream.setPressure(this.inStream.getPressure(unit) - deltaP, unit);
}
/**
* <p>
* Setter for the field <code>deltaP</code>.
* </p>
*
* @param deltaP a double
*/
public void setDeltaP(double deltaP) {
this.deltaP = deltaP;
this.outStream.setPressure(this.inStream.getPressure() - deltaP);
}

/**
* <p>
* Getter for the field <code>outStream</code>.
* </p>
*
* @return a {@link neqsim.processSimulation.processEquipment.stream.StreamInterface} object
*/
public StreamInterface getOutStream() {
return outStream;
}
/**
* <p>
* Setter for the field <code>deltaP</code>.
* </p>
*
* @param deltaP a double
* @param unit a {@link java.lang.String} object
*/
public void setDeltaP(double deltaP, String unit) {
this.deltaP = deltaP;
this.outStream.setPressure(this.inStream.getPressure(unit) - deltaP, unit);
}

/** {@inheritDoc} */
@Override
public void runConditionAnalysis(ProcessEquipmentInterface refTEGabsorberloc) {
double deltaP = inStream.getPressure("bara") - outStream.getPressure("bara");
Cv = Math.sqrt(deltaP) / inStream.getFlowRate("kg/hr");
}
/** {@inheritDoc} */
@Override
public void runConditionAnalysis(ProcessEquipmentInterface refTEGabsorberloc) {
double deltaP = inStream.getPressure("bara") - outStream.getPressure("bara");
Cv = Math.sqrt(deltaP) / inStream.getFlowRate("kg/hr");
}

/**
* <p>
* getCvFactor.
* </p>
*
* @return a double
*/
public double getCvFactor() {
return Cv;
}
/**
* <p>
* getCvFactor.
* </p>
*
* @return a double
*/
public double getCvFactor() {
return Cv;
}

/**
* <p>
* setCvFactor.
* </p>
*
* @param pressureCoef a double
*/
public void setCvFactor(double pressureCoef) {
this.Cv = pressureCoef;
}
/**
* <p>
* setCvFactor.
* </p>
*
* @param pressureCoef a double
*/
public void setCvFactor(double pressureCoef) {
this.Cv = pressureCoef;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -127,11 +127,11 @@ public static neqsim.processSimulation.processSystem.ProcessSystem getProcess()
Filter fineFilter = new Filter("TEG fine filter", flashLiquid);
fineFilter.setDeltaP(0.05, "bara");

Filter carbonFilter = new Filter("activated carbon filter", fineFilter.getOutStream());
Filter carbonFilter = new Filter("activated carbon filter", fineFilter.getOutletStream());
carbonFilter.setDeltaP(0.01, "bara");

HeatExchanger heatEx =
new HeatExchanger("rich TEG heat exchanger 2", carbonFilter.getOutStream());
new HeatExchanger("rich TEG heat exchanger 2", carbonFilter.getOutletStream());
heatEx.setGuessOutTemperature(273.15 + 130.0);
heatEx.setUAvalue(390.0);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ public neqsim.processSimulation.processSystem.ProcessSystem getProcess() {
Filter filter = new Filter("filters", flashLiquid);

HeatExchanger heatEx =
new HeatExchanger("rich TEG heat exchanger 2", filter.getOutStream());
new HeatExchanger("rich TEG heat exchanger 2", filter.getOutletStream());
heatEx.setGuessOutTemperature(273.15 + 130.0);
heatEx.setUAvalue(UAvalueRichTEGHeatExchanger_2);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -255,11 +255,11 @@ public neqsim.processSimulation.processSystem.ProcessSystem getProcess() {
Filter fineFilter = new Filter("TEG fine filter", flashLiquid);
fineFilter.setDeltaP(0.05, "bara");

Filter carbonFilter = new Filter("activated carbon filter", fineFilter.getOutStream());
Filter carbonFilter = new Filter("activated carbon filter", fineFilter.getOutletStream());
carbonFilter.setDeltaP(0.01, "bara");

HeatExchanger heatEx =
new HeatExchanger("rich TEG heat exchanger 2", carbonFilter.getOutStream());
new HeatExchanger("rich TEG heat exchanger 2", carbonFilter.getOutletStream());
heatEx.setGuessOutTemperature(273.15 + 130.0);
heatEx.setUAvalue(UAvalueRichTEGHeatExchanger_2);

Expand Down