Skip to content

Commit

Permalink
added flow setter (#838)
Browse files Browse the repository at this point in the history
* added flow setter

* improve setter

* fix bug

* fix errors
  • Loading branch information
EvenSol authored Nov 8, 2023
1 parent 5e0caba commit d0a25bd
Show file tree
Hide file tree
Showing 5 changed files with 457 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,60 @@ public double getMeasuredValue(String measurement, String unit) {
return tempFluid.getPhase("gas").getCorrectedVolume()
/ tempFluid.getPhase("oil").getCorrectedVolume();
}
if (measurement.equals("Gas Flow Rate")) {
SystemInterface tempFluid = stream.getThermoSystem().clone();
tempFluid.setTemperature(temperature, unitT);
tempFluid.setPressure(pressure, unitP);
ThermodynamicOperations thermoOps = new ThermodynamicOperations(tempFluid);
try {
thermoOps.TPflash();
} catch (Exception ex) {
logger.error(ex.getMessage(), ex);
return Double.NaN;
}
// tempFluid.display();
if (!tempFluid.hasPhaseType("gas")) {
return Double.NaN;
}
tempFluid.initPhysicalProperties("density");
return tempFluid.getPhase("gas").getFlowRate(unit);
}
if (measurement.equals("Oil Flow Rate")) {
SystemInterface tempFluid = stream.getThermoSystem().clone();
tempFluid.setTemperature(temperature, unitT);
tempFluid.setPressure(pressure, unitP);
ThermodynamicOperations thermoOps = new ThermodynamicOperations(tempFluid);
try {
thermoOps.TPflash();
} catch (Exception ex) {
logger.error(ex.getMessage(), ex);
return Double.NaN;
}
// tempFluid.display();
if (!tempFluid.hasPhaseType("oil")) {
return Double.NaN;
}
tempFluid.initPhysicalProperties("density");
return tempFluid.getPhase("oil").getFlowRate(unit);
}
if (measurement.equals("Water Flow Rate")) {
SystemInterface tempFluid = stream.getThermoSystem().clone();
tempFluid.setTemperature(temperature, unitT);
tempFluid.setPressure(pressure, unitP);
ThermodynamicOperations thermoOps = new ThermodynamicOperations(tempFluid);
try {
thermoOps.TPflash();
} catch (Exception ex) {
logger.error(ex.getMessage(), ex);
return Double.NaN;
}
// tempFluid.display();
if (!tempFluid.hasPhaseType("aqueous")) {
return Double.NaN;
}
tempFluid.initPhysicalProperties("density");
return tempFluid.getPhase("aqueous").getFlowRate(unit);
}
if (measurement.equals("gasDensity") || measurement.equals("oilDensity")
|| measurement.equals("waterDensity")) {
SystemInterface tempFluid = stream.getThermoSystem().clone();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -199,9 +199,10 @@ public void run(UUID id) {
*
*
* <p>
* calcIdealAirGasRatio
* </p>
* Calculates ideal air fuel ratio [kg air/kg fuel]
* </p>
*
* @return ideal air fuel ratio [kg air/kg fuel]
*/
public double calcIdealAirFuelRatio() {
thermoSystem = inStream.getThermoSystem().clone();
Expand Down
Loading

0 comments on commit d0a25bd

Please sign in to comment.