equinor / neqsim

NeqSim is a library for calculation of fluid behavior, phase equilibrium and process simulation

Home Page:https://equinor.github.io/neqsimhome/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

set flow rate from a splitter

EvenSol opened this issue · comments

Is your feature request related to a problem? Please describe.
A splitter is today used by setting split fractions. However if we are using a splitter as part of a recycle loop (eg. compressor antisurge), we need to set flow rates from the splitter (else flow will go to infinite).

Describe the solution you'd like
Example code:

from neqsim.thermo import fluid, phaseenvelope

from neqsim.process import separator, heater, clearProcess, stream,  compressor, runProcess, viewProcess, getProcess, splitter, mixer, recycle2, valve




temperature_inlet = 35.0

pressure_inlet = 55.0

pressure_outlet = 100.0

gasFlowRate = 5.0 



splitfactors = [0.9, 0.1]



fluid1 = fluid('srk')

fluid1.addComponent("methane", 1.0)



clearProcess()

stream1 = stream(fluid1)

stream1.setPressure(pressure_inlet, 'bara')

stream1.setTemperature(temperature_inlet, 'C')

stream1.setFlowRate(gasFlowRate, "MSm3/day")



streamresycl  = stream1.copy()



mixerStream = mixer()

mixerStream.addStream(stream1)

mixerStream.addStream(streamresycl)



compressor_1 = compressor(mixerStream.getOutStream(), pressure_outlet)

compressor_1.setIsentropicEfficiency(0.77)



stream2 = compressor_1.getOutStream()



streamSplit = splitter(stream2,splitfactors)

**#new functions
streamSplit.setSplitStreamFlowRates(True)
streamSplit.setFlowRates([0.5, 5.0], 'MSm3/day')**  # mass balance will be checked
# streamSplit.setFlowRates([0.5, -1], 'MSm3/day') in this case the seccond split will be used as the free variable,mass balance will be checked


resycStream1 = streamSplit.getSplitStream(1)

valve1 = valve(resycStream1)

valve1.setOutletPressure(pressure_inlet)



resycleOp = recycle2()

resycleOp.addStream(valve1.getOutStream())

resycleOp.setOutletStream(streamresycl)



exportStream = streamSplit.getSplitStream(0)



runProcess()



print('export flow ' , exportStream.getFlowRate('MSm3/day'))

print('recycle flow ' , resycStream1.getFlowRate('MSm3/day'))

print('flow to compressor ' , mixerStream.getOutStream().getFlowRate('MSm3/day'))

print('power ', compressor_1.getPower('kW'), ' kW')

print('valve Cv ', valve1.getCv())

print('valve Cv ', valve1.getPercentValveOpening())