-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Create WellAllocator.java * Create WellAllocatorResponse.java * updates * update
- Loading branch information
Showing
5 changed files
with
274 additions
and
1 deletion.
There are no files selected for viewing
128 changes: 128 additions & 0 deletions
128
src/main/java/neqsim/processSimulation/measurementDevice/WellAllocator.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,128 @@ | ||
package neqsim.processSimulation.measurementDevice; | ||
|
||
import neqsim.processSimulation.processEquipment.separator.Separator; | ||
import neqsim.processSimulation.processEquipment.stream.Stream; | ||
import neqsim.processSimulation.processEquipment.stream.StreamInterface; | ||
import neqsim.processSimulation.util.monitor.WellAllocatorResponse; | ||
import neqsim.thermo.system.SystemInterface; | ||
import neqsim.thermo.system.SystemSrkEos; | ||
|
||
public class WellAllocator extends MeasurementDeviceBaseClass { | ||
|
||
protected StreamInterface wellStream = null; | ||
protected StreamInterface exportGasStream = null; | ||
protected StreamInterface exportOilStream = null; | ||
|
||
public WellAllocator() { | ||
name = "Well Allocator"; | ||
} | ||
|
||
|
||
public WellAllocator(StreamInterface stream) { | ||
name = "Well Allocator"; | ||
this.wellStream = stream; | ||
} | ||
|
||
public WellAllocator(String streamname, StreamInterface stream) { | ||
this(stream); | ||
name = streamname; | ||
} | ||
|
||
|
||
public void setExportGasStream(StreamInterface stream) { | ||
this.exportGasStream = stream; | ||
} | ||
|
||
public void setExportOilStream(StreamInterface stream) { | ||
this.exportOilStream = stream; | ||
} | ||
|
||
/** {@inheritDoc} */ | ||
@Override | ||
public double getMeasuredValue() { | ||
return wellStream.getThermoSystem().getFlowRate("kg/hr"); | ||
} | ||
|
||
/** {@inheritDoc} */ | ||
@Override | ||
public double getMeasuredValue(String measurement) { | ||
int numberOfComps = wellStream.getThermoSystem().getNumberOfComponents(); | ||
double[] splitFactors = new double[numberOfComps]; | ||
double gasExportFlow = 0.0; | ||
double oilExportFlow = 0.0; | ||
for (int i = 0; i < numberOfComps; i++) { | ||
splitFactors[i] = exportGasStream.getFluid().getComponent(i).getFlowRate("kg/hr") | ||
/ (exportGasStream.getFluid().getComponent(i).getFlowRate("kg/hr") | ||
+ exportOilStream.getFluid().getComponent(i).getFlowRate("kg/hr")); | ||
gasExportFlow += wellStream.getFluid().getComponent(i).getTotalFlowRate("kg/hr") * splitFactors[i]; | ||
oilExportFlow += | ||
wellStream.getFluid().getComponent(i).getTotalFlowRate("kg/hr") * (1.0 - splitFactors[i]); | ||
} | ||
|
||
if (measurement.equals("gas export rate")) { | ||
return gasExportFlow; | ||
} | ||
if (measurement.equals("oil export rate")) { | ||
return oilExportFlow; | ||
} | ||
if (measurement.equals("total export rate")) { | ||
return wellStream.getFluid().getFlowRate("kg/hr"); | ||
} | ||
return 0.0; | ||
} | ||
|
||
public static void main(String[] args) { | ||
SystemInterface testFluid = new SystemSrkEos(338.15, 50.0); | ||
testFluid.addComponent("nitrogen", 1.205); | ||
testFluid.addComponent("CO2", 1.340); | ||
testFluid.addComponent("methane", 87.974); | ||
testFluid.addComponent("ethane", 5.258); | ||
testFluid.addComponent("propane", 3.283); | ||
testFluid.addComponent("i-butane", 0.082); | ||
testFluid.addComponent("n-butane", 0.487); | ||
testFluid.addComponent("i-pentane", 0.056); | ||
testFluid.addComponent("n-pentane", 1.053); | ||
testFluid.addComponent("nC10", 14.053); | ||
testFluid.setMixingRule(2); | ||
|
||
testFluid.setTemperature(24.0, "C"); | ||
testFluid.setPressure(48.0, "bara"); | ||
testFluid.setTotalFlowRate(2500.0, "kg/hr"); | ||
|
||
Stream stream_1 = new Stream("Stream1", testFluid); | ||
|
||
SystemInterface testFluid2 = testFluid.clone(); | ||
// testFluid2.setMolarComposition(new double[] {0.1, 0.1, 0.9, 0.1, 0.1, 0.0, 0.0, 0.0, 0.0, 0.0}); | ||
Stream stream_2 = new Stream("Stream2", testFluid2); | ||
|
||
Separator sep1 = new Separator("sep1", stream_1); | ||
sep1.addStream(stream_2); | ||
|
||
Stream stream_gasExp = new Stream("gasexp", sep1.getGasOutStream()); | ||
|
||
Stream stream_oilExp = new Stream("gasexp", sep1.getLiquidOutStream()); | ||
|
||
WellAllocator wellAlloc = new WellAllocator("alloc", stream_1); | ||
wellAlloc.setExportGasStream(stream_gasExp); | ||
wellAlloc.setExportOilStream(stream_oilExp); | ||
|
||
neqsim.processSimulation.processSystem.ProcessSystem operations = | ||
new neqsim.processSimulation.processSystem.ProcessSystem(); | ||
operations.add(stream_1); | ||
operations.add(stream_2); | ||
operations.add(sep1); | ||
operations.add(stream_gasExp); | ||
operations.add(stream_oilExp); | ||
operations.add(wellAlloc); | ||
operations.run(); | ||
|
||
WellAllocatorResponse responsAl = new WellAllocatorResponse(wellAlloc); | ||
|
||
System.out.println("name " + responsAl.name); | ||
System.out.println("gas flow " + responsAl.gasExportRate); | ||
System.out.println("oil flow " + responsAl.oilExportRate); | ||
System.out.println("total flow " + responsAl.totalExportRate); | ||
|
||
} | ||
|
||
} |
37 changes: 37 additions & 0 deletions
37
src/main/java/neqsim/processSimulation/util/monitor/WellAllocatorResponse.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package neqsim.processSimulation.util.monitor; | ||
|
||
import neqsim.processSimulation.measurementDevice.WellAllocator; | ||
|
||
/** | ||
* <p> | ||
* WellAllocatorResponse class. | ||
* </p> | ||
* | ||
* @author asmund | ||
* @version $Id: $Id | ||
*/ | ||
public class WellAllocatorResponse { | ||
public String name; | ||
public Double gasExportRate, oilExportRate, totalExportRate; | ||
|
||
/** | ||
* <p> | ||
* Constructor for WellAllocatorResponse. | ||
* </p> | ||
*/ | ||
public WellAllocatorResponse() {} | ||
|
||
/** | ||
* <p> | ||
* Constructor for WellAllocatorResponse. | ||
* </p> | ||
* | ||
* @param inputAllocator a {@link neqsim.processSimulation.measurementDevice.WellAllocator} object | ||
*/ | ||
public WellAllocatorResponse(WellAllocator inputAllocator) { | ||
name = inputAllocator.getName(); | ||
gasExportRate = inputAllocator.getMeasuredValue("gas export rate"); | ||
oilExportRate = inputAllocator.getMeasuredValue("oil export rate"); | ||
totalExportRate = inputAllocator.getMeasuredValue("total export rate"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
94 changes: 94 additions & 0 deletions
94
src/test/java/neqsim/processSimulation/measurementDevice/WellAllocatorTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
/** | ||
* | ||
*/ | ||
package neqsim.processSimulation.measurementDevice; | ||
|
||
import static org.junit.jupiter.api.Assertions.*; | ||
import org.junit.jupiter.api.BeforeAll; | ||
import org.junit.jupiter.api.Test; | ||
import neqsim.processSimulation.processEquipment.separator.Separator; | ||
import neqsim.processSimulation.processEquipment.stream.Stream; | ||
import neqsim.processSimulation.util.monitor.WellAllocatorResponse; | ||
import neqsim.thermo.system.SystemInterface; | ||
import neqsim.thermo.system.SystemSrkEos; | ||
|
||
/** | ||
* @author ESOL | ||
* | ||
*/ | ||
class WellAllocatorTest extends neqsim.NeqSimTest{ | ||
|
||
/** | ||
* @throws java.lang.Exception | ||
*/ | ||
@BeforeAll | ||
static void setUpBeforeClass() throws Exception {} | ||
|
||
/** | ||
* Test method for {@link neqsim.processSimulation.measurementDevice.WellAllocator#getMeasuredValue(java.lang.String)}. | ||
*/ | ||
@Test | ||
void testGetMeasuredValueString() { | ||
SystemInterface testFluid = new SystemSrkEos(338.15, 50.0); | ||
testFluid.addComponent("nitrogen", 1.205); | ||
testFluid.addComponent("CO2", 1.340); | ||
testFluid.addComponent("methane", 87.974); | ||
testFluid.addComponent("ethane", 5.258); | ||
testFluid.addComponent("propane", 3.283); | ||
testFluid.addComponent("i-butane", 0.082); | ||
testFluid.addComponent("n-butane", 0.487); | ||
testFluid.addComponent("i-pentane", 0.056); | ||
testFluid.addComponent("n-pentane", 1.053); | ||
testFluid.addComponent("nC10", 14.053); | ||
testFluid.setMixingRule(2); | ||
|
||
testFluid.addToComponentNames("_well1"); | ||
|
||
testFluid.setTemperature(24.0, "C"); | ||
testFluid.setPressure(48.0, "bara"); | ||
testFluid.setTotalFlowRate(2500.0, "kg/hr"); | ||
|
||
|
||
SystemInterface testFluid2 = testFluid.clone(); | ||
|
||
|
||
testFluid.setTemperature(24.0, "C"); | ||
testFluid.setPressure(48.0, "bara"); | ||
testFluid.setTotalFlowRate(2500.0, "kg/hr"); | ||
|
||
Stream stream_1 = new Stream("Stream1", testFluid); | ||
|
||
Stream stream_2 = new Stream("Stream2", testFluid2); | ||
|
||
Separator sep1 = new Separator("sep1", stream_1); | ||
sep1.addStream(stream_2); | ||
|
||
Stream stream_gasExp = new Stream("gasexp", sep1.getGasOutStream()); | ||
|
||
Stream stream_oilExp = new Stream("gasexp", sep1.getLiquidOutStream()); | ||
|
||
WellAllocator wellAlloc = new WellAllocator("alloc", stream_1); | ||
wellAlloc.setExportGasStream(stream_gasExp); | ||
wellAlloc.setExportOilStream(stream_oilExp); | ||
|
||
neqsim.processSimulation.processSystem.ProcessSystem operations = | ||
new neqsim.processSimulation.processSystem.ProcessSystem(); | ||
operations.add(stream_1); | ||
operations.add(stream_2); | ||
operations.add(sep1); | ||
operations.add(stream_gasExp); | ||
operations.add(stream_oilExp); | ||
operations.add(wellAlloc); | ||
operations.run(); | ||
|
||
WellAllocatorResponse responsAl = new WellAllocatorResponse(wellAlloc); | ||
|
||
System.out.println("name " + responsAl.name); | ||
System.out.println("gas flow " + responsAl.gasExportRate); | ||
System.out.println("oil flow " + responsAl.oilExportRate); | ||
System.out.println("total flow " + responsAl.totalExportRate); | ||
// stream_1.displayResult(); | ||
// stream_1.displayResult(); | ||
} | ||
|
||
} |