Skip to content

Commit

Permalink
added GCV/WI to stream response (#998)
Browse files Browse the repository at this point in the history
  • Loading branch information
EvenSol authored May 3, 2024
1 parent 62aa470 commit f9f717f
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 10 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package neqsim.processSimulation.util.monitor;

import java.util.HashMap;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import neqsim.processSimulation.processEquipment.stream.StreamInterface;

/**
Expand All @@ -12,6 +14,7 @@
* @version $Id: $Id
*/
public class StreamResponse {
static Logger logger = LogManager.getLogger(StreamResponse.class);
public String name;
public Fluid fluid;
public Double temperature;
Expand All @@ -23,18 +26,20 @@ public class StreamResponse {
public Double massflowGas;
public Double massflowOil;
public Double massflowAqueous;
public HashMap<String, HashMap<String, Value>> properties = new HashMap<String, HashMap<String, Value>>();
public HashMap<String, HashMap<String, Value>> conditions = new HashMap<String, HashMap<String, Value>>();
public HashMap<String, HashMap<String, Value>> composition = new HashMap<String, HashMap<String, Value>>();
public HashMap<String, HashMap<String, Value>> properties =
new HashMap<String, HashMap<String, Value>>();
public HashMap<String, HashMap<String, Value>> conditions =
new HashMap<String, HashMap<String, Value>>();
public HashMap<String, HashMap<String, Value>> composition =
new HashMap<String, HashMap<String, Value>>();

/**
* <p>
* Constructor for StreamResponse.
* </p>
*
* @param inputStream a
* {@link neqsim.processSimulation.processEquipment.stream.StreamInterface}
* object
* @param inputStream a {@link neqsim.processSimulation.processEquipment.stream.StreamInterface}
* object
*/
public StreamResponse(StreamInterface inputStream) {

Expand Down Expand Up @@ -133,7 +138,6 @@ public StreamResponse(StreamInterface inputStream) {
Double.toString(
inputStream.getFluid().getMolarMass(neqsim.util.unit.Units.getSymbol("Molar Mass"))),
neqsim.util.unit.Units.getSymbol("Molar Mass")));
properties.put(inputStream.getName(), newdata);

newdata.put("flow rate", new Value(
Double.toString(
Expand All @@ -148,6 +152,8 @@ public StreamResponse(StreamInterface inputStream) {
Double.toString(inputStream.getFluid().getPhase(name)
.getDensity(neqsim.util.unit.Units.getSymbol("density"))),
neqsim.util.unit.Units.getSymbol("density")));
newdata.put("relative density", new Value(Double.toString(inputStream.getFluid()
.getPhase(name).getDensity(neqsim.util.unit.Units.getSymbol("density")) / 1000.0), "-"));
newdata.put("molar mass",
new Value(
Double.toString(inputStream.getFluid().getPhase(name)
Expand All @@ -159,6 +165,32 @@ public StreamResponse(StreamInterface inputStream) {
Double.toString(inputStream.getFluid().getPhase(name)
.getFlowRate(neqsim.util.unit.Units.getSymbol("volume flow"))),
neqsim.util.unit.Units.getSymbol("volume flow")));

if (name.equals("oil")) {
try {
newdata.put("TVP",
new Value(
Double.toString(
inputStream.getTVP(37.8, "C", neqsim.util.unit.Units.getSymbol("pressure"))),
neqsim.util.unit.Units.getSymbol("pressure")));
} catch (Exception e) {
logger.error(e.getMessage());
}
try {
newdata.put("RVP",
new Value(
Double.toString(
inputStream.getRVP(37.8, "C", neqsim.util.unit.Units.getSymbol("pressure"))),
neqsim.util.unit.Units.getSymbol("pressure")));
} catch (Exception e) {
logger.error(e.getMessage());
}
} else if (name.equals("gas")) {
newdata.put("GCV", new Value(
Double.toString(inputStream.getGCV("volume", 15.0, 15.0) / 1e6), "MJ/Sm3 @15C,15C"));
newdata.put("WI", new Value(Double.toString(inputStream.getGCV("volume", 15.0, 15.0) / 1e6),
"MJ/Sm3 @15C,15C"));
}
properties.put(name, newdata);
}

Expand Down Expand Up @@ -194,6 +226,5 @@ public StreamResponse(StreamInterface inputStream) {
* print.
* </p>
*/
public void print() {
}
public void print() {}
}
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ void testWrite() {

Report report = new Report(processOps);
String obj = report.json();
// System.out.println(obj);
//System.out.println(obj);
neqsim.util.unit.Units.activateFieldUnits();
String obj2 = report.json();
// System.out.println(obj2);
Expand Down

0 comments on commit f9f717f

Please sign in to comment.