Skip to content

Commit

Permalink
Merge pull request #204 from equinor/version2.5.5
Browse files Browse the repository at this point in the history
updated java library to version 2.5.5 add test
  • Loading branch information
EvenSol authored Aug 8, 2023
2 parents 2ba377a + d2ec722 commit 0c5a918
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 1 deletion.
Binary file modified neqsim/lib/neqsim-2.5.5.jar
Binary file not shown.
43 changes: 42 additions & 1 deletion tests/process/test_ProcessTools.py
Original file line number Diff line number Diff line change
Expand Up @@ -294,4 +294,45 @@ def test_gasoilprocess():

#assert 3859.9 == approx(recirc1stream.getFlowRate('kg/hr'), abs=1.0)
#assert 22876.1 == approx(pipeloss1st.getOutletStream().getFlowRate("kg/hr"), abs=1.0)
#assert separator3.getGasOutStream().getFlowRate("kg/hr") == pipeloss1st.getOutletStream().getFlowRate("kg/hr")
#assert separator3.getGasOutStream().getFlowRate("kg/hr") == pipeloss1st.getOutletStream().getFlowRate("kg/hr")

def test_AFR():
fluid = jNeqSim.thermo.system.SystemSrkEos((273.15 + 25.0), 10.00)
fluid.addComponent("nitrogen", 1.0)
fluid.addComponent("CO2", 1.0)
fluid.addComponent("methane", 92.0)
fluid.addComponent("ethane", 5.0)
fluid.addComponent("propane", 1.0)
fluid.addComponent("i-butane", 0.5)
fluid.addComponent("n-butane", 0.5)
fluid.addComponent("i-pentane", 0.1)
fluid.addComponent("n-pentane", 0.1)
fluid.addComponent("n-hexane", 0.01)
fluid.setMixingRule(2)
TPflash(fluid)

elements_h = 0.0
elements_c = 0.0
sum_hc = 0.0
molmass_hc = 0.0
wtfrac_hc = 0.0

for i in range(fluid.getNumberOfComponents()):
if fluid.getComponent(i).isHydrocarbon():
sum_hc = sum_hc + fluid.getComponent(i).getz()
molmass_hc = molmass_hc + fluid.getComponent(i).getz() * fluid.getComponent(i).getMolarMass()
elements_c = elements_c + fluid.getComponent(i).getz() * fluid.getComponent(i).getElements().getNumberOfElements("C")
elements_h = elements_h + fluid.getComponent(i).getz() * fluid.getComponent(i).getElements().getNumberOfElements("H")

if sum_hc == 0:
return 0.0
else:
wtfrac_hc = molmass_hc / fluid.getMolarMass()
molmass_hc /= sum_hc
elements_c /= sum_hc
elements_h /= sum_hc

aconst = elements_c + elements_h / 4
afr = aconst * (32.0 + 3.76 * 28.0) / 1000.0 / molmass_hc * wtfrac_hc

assert 16.2312248674 == approx(afr, abs=0.01)

0 comments on commit 0c5a918

Please sign in to comment.