This pull adds a sort parameter for sorting flows (in decreasing order) in the Stream.show method. A doctest to test this is also added:
Examples
--------
Show a stream's composition by weight for only the top 2 chemicals
with the highest mass fractions:
>>> import biosteam as bst
>>> bst.settings.set_thermo(['Water', 'Ethanol', 'Methanol', 'Propanol'])
>>> stream = bst.Stream('stream', Water=0.5, Ethanol=1.5, Methanol=0.2, Propanol=0.3, units='kg/hr')
>>> stream.show('cwt2s') # Alternatively: stream.show(composition=True, flow='kg/hr', N=2, sort=True)
Stream: stream
phase: 'l', T: 298.15 K, P: 101325 Pa
composition (%): Ethanol 60
Water 20
... 20
------- 2.5 kg/hr
This pull also adds a minor enhancement to Stream.vlle for consistent results (results are now the same regardless if stream starts as a gas or a liquid).
Once this pull is merged, I'll make another pull request in BioSTEAM for using the new sort parameter in Unit.show and System.show.
@sarangbhagwat, @yalinli2
This pull adds a
sort
parameter for sorting flows (in decreasing order) in theStream.show
method. A doctest to test this is also added:This pull also adds a minor enhancement to Stream.vlle for consistent results (results are now the same regardless if stream starts as a gas or a liquid).
Once this pull is merged, I'll make another pull request in BioSTEAM for using the new
sort
parameter inUnit.show
andSystem.show
.Thanks!