BioSTEAMDevelopmentGroup / BioSTEAMDevelopmentGroup/Bioindustrial-Park

Consultation about @unit.add_specification

Open
#105 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Jupyter Notebook
Stars
53
Forks
27
PR merge metrics
No merged PRs in 30d

Description

Hello, may I ask you some questions about ```@unit.add_specification```? Thanks for your help.

a) If I adjust pressure drop of the unit, are both of the following codes correct?
The only difference between the two codes is that the first code first runs ```unit._run()```, then run ```P0 = min([i.P for i in unit.ins]), Pf = P0 - unit.dP, for i in unit.outs: i.P = Pf```, and the second code first runs ```P0 = min([i.P for i in unit.ins]), Pf = P0 - unit.dP, for i in unit.outs: i.P = Pf```, and then runs ```unit._run()```, is it right?
Both two codes do not need to add code like ```unit.run_until()```, is it right?
It seems first run ```P0 = min([i.P for i in unit.ins]), Pf = p0-unit. dP, for i in unit.outs: i.P = Pf```, then runs ```unit._run()```, that is, the second type of code is more appropriate to adjust the unit pressure drop? Because it seems to reduce the unit outlet pressure first, and then run the unit to get the corresponding flow mass and heat conditions.
The two codes are as follows:
```
unit.dP = 0.04
@unit.add_specification(run=False)
def set_dP():
unit._run()
P0 = min([i.P for i in unit.ins])
Pf = P0 - unit.dP
for i in unit.outs: i.P = Pf
```
```
unit.dP = 0.04
@unit.add_specification(run=True)
def set_dP():
P0 = min([i.P for i in unit.ins])
Pf = P0 - unit.dP
for i in unit.outs: i.P = Pf
```

b) If I want to increase the pressure of the outlet stream of the previous unit (such as ```H101```) through a pump (such as ```P101```, i.e. the pressure of ```H101``` outlet plus 10132.5), and then act as the inlet stream of the later unit (such as ```F101```), could I consult you which of the following two codes is correct?
There can be other codes between ```P101=units.Pump('P101', H101-0, P=101325)``` and ```@P101.add_specification(run=True)```, is it right?
Both two codes do not need to add code like ```unit.run_until()```, is it right?
The codes are as follows:
```
H101 = units.HXutility('H101', inlet, T=370)
P101=units.Pump('P101', H101-0, P=101325)
F101 = units.Flash('F101', P101-0, outs=('F101_vapor', 'F101_liquid'), P=10132.5, Q=0)
@P101.add_specification(run=True)
def adjust_pump_pressure_P101():
a = H101-0
P101.P = a.P + 10132.5
```
```
H101 = units.HXutility('H101', inlet, T=370)
P101=units.Pump('P101', H101-0, P=101325)
F101 = units.Flash('F101', P101-0, outs=('F101_vapor', 'F101_liquid'), P=10132.5, Q=0)
@P101.add_specification(run=False)
def adjust_pump_pressure_P101():
P101.run()
a = H101-0
P101.P = a.P + 10132.5
```

c) In ```def()``` in ```@unit.add_specification, def()```, there is no need to add the code ```unit.run_until()```, is it right? If no need to add the code ```unit.run_until()```, how can we ensure that the unit that is @ and the units that after the unit that is @ are rerun after the specification is executed?

d) When using ```@unit.add_specification```, how to select the unit that is @?

Contributor guide

No contributing guide indexed for this repository

Research direction

Start at the @unit.add_specification entry point and read how run=True and run=False interact with unit._run(), run(), and run_until(). Trace the shown HXutility, Pump, and Flash setup to determine which unit is selected and how downstream units rerun; done means documenting answers to questions (a)–(d) with a minimal reproducible example.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend
Issue type
Documentation
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.