Skip to content

Commit 243c4f2

Browse files
committed
improve new tutorial
1 parent 446a568 commit 243c4f2

File tree

3 files changed

+37
-31
lines changed

3 files changed

+37
-31
lines changed

biosteam/process_tools/process_model.py

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -96,10 +96,21 @@ def show(self):
9696

9797
class ProcessModel:
9898
"""
99-
ProcessModel is an abstract class which has missing (i.e., "abstract")
100-
attributes and methods. The user must define a `Scenario` dataclass which
101-
determines all inputs to the process model. Additionally, the user must
102-
define the `as_scenario`, `create_thermo`, `create_system`, and
99+
ProcessModel objects allow us to write code for many related configurations
100+
with ease. It streamlines the process of creating a model, including:
101+
102+
* Defining **scenarios** to compare.
103+
* Creating the **thermodynamic property package**.
104+
* Forming the **system** from unit operations.
105+
* Setting up the evaluation **model**.
106+
107+
Additionally, all objects created within the process model
108+
(e.g., chemicals, streams, units, systems) can be easily accessed as attributes.
109+
110+
The first step is to inherit from the ProcessModel abstract class.
111+
An abstract class has missing (or "abstract") attributes/methods which
112+
the user must define to complete the class. The user must define a
113+
`Scenario` dataclass, and `as_scenario`, `create_thermo`, `create_system`,
103114
`create_model` methods for the process model to initialize its key components.
104115
105116
It may help to look at how ProcessModel objects are created (approximately):

docs/tutorial/Process_models.ipynb renamed to docs/tutorial/Comparative_techno-economic_analysis.ipynb

Lines changed: 21 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,24 @@
44
"cell_type": "markdown",
55
"metadata": {},
66
"source": [
7+
"# Comparative techno-economic analysis\n",
8+
"\n",
9+
"Techno-economic analysis (TEA) of emerging and conceptual technologies rarely provides a good estimate of economic viability. In fact, economic indicators are largely overly optimistic due to biased assumptions and unforseen expenses. The real power of early-stage TEA is the ability to **compare** technologies under harmonized assumptions and establish key **performance targets** that technologies need to meet for market competitiveness. Perfoming comparative techno-economic analysis under harmonized assumptions, however, can be challenging due to the complexity of managing many biorefinery codes. In this chapter, we demonstrate how BioSTEAM can facilitate the evaluation and comparison of many configuration **scenarios** through ProcessModel objects.\n",
10+
"\n",
11+
"As a demonstrative case study, we will perform economic analysis of cellulosic ethanol production for two alternative biorefinery configurations: one processing cornstover with dilute acid pretreatment [1] and another processing switchgrass with AFEX pretreatment [2]. For simplicity, assumptions on fermentation performance in the switchgrass biorefinery are the same as in the cornstover biorefinery.\n",
12+
"\n",
713
"## Process models\n",
814
"\n",
9-
"ProcessModel objects allow us to write code for multiple related configurations with ease. It streamlines system creation and provides an easy handle to access objects within a model configuration (e.g., chemicals, streams, units, systems). ProcessModel is an abstract class which has missing (or \"abstract\") attributes and methods. The user must define a `Scenario` dataclass which determines all inputs to the process model. Additionally, the user must define the `as_scenario`, `create_thermo`, `create_system`, and `create_model` methods for the process model to initialize its key components. \n",
15+
"ProcessModel objects allow us to write code for many related configurations with ease. It streamlines the process of creating a model, including:\n",
16+
"\n",
17+
"* Defining **scenarios** to compare.\n",
18+
"* Creating the **thermodynamic property package**.\n",
19+
"* Forming the **system** from unit operations.\n",
20+
"* Setting up the evaluation **model**.\n",
21+
"\n",
22+
"Additionally, all objects created within the process model (e.g., chemicals, streams, units, systems) can be easily accessed as attributes.\n",
23+
"\n",
24+
"The first step is to inherit from the ProcessModel abstract class. An abstract class has missing (or \"abstract\") attributes/methods which the user must define to complete the class. The user must define a `Scenario` dataclass, and `as_scenario`, `create_thermo`, `create_system`, `create_model` methods for the process model to initialize its key components. \n",
1025
"\n",
1126
"It may help to look at how ProcessModel objects are created (approximately):\n",
1227
" \n",
@@ -48,9 +63,7 @@
4863
" self.cache[scenario] = self\n",
4964
" return self\n",
5065
"\n",
51-
"```\n",
52-
" \n",
53-
"In this chapter, we will create a ProcessModel object to facilitate the economic analysis of cellulosic ethanol production for two alternative biorefinery configurations: one processing cornstover with dilute acid pretreatment [1] and another processing switchgrass with AFEX pretreatment [2]. For simplicity, assumptions on fermentation performance in the switchgrass biorefinery are the same as in the cornstover biorefinery."
66+
"```"
5467
]
5568
},
5669
{
@@ -76,31 +89,18 @@
7689
" \n",
7790
" @classmethod\n",
7891
" def as_scenario(cls, scenario):\n",
79-
" \"\"\"\n",
80-
" This method allows the process model to interpret objects \n",
81-
" (e.g., strings, numbers) as a Scenario.\n",
82-
" \"\"\"\n",
8392
" # Interpret strings in the form of '{feedstock}/{pretreatment}' as a scenario.\n",
8493
" feedstock, pretreatment = scenario.split('/')\n",
8594
" return cls.Scenario(feedstock, pretreatment)\n",
8695
" \n",
8796
" def create_thermo(self):\n",
88-
" \"\"\"\n",
89-
" This method should return a chemicals or thermo object.\n",
90-
" BioSTEAM will automatically set it as the thermodynmic property package.\n",
91-
" \"\"\"\n",
9297
" return cellulosic.create_cellulosic_ethanol_chemicals()\n",
9398
" \n",
9499
" def create_system(self):\n",
95-
" \"\"\"\n",
96-
" This method should create unit operations and connect them.\n",
97-
" It can return a system object, optionally. Otherwise, BioSTEAM will \n",
98-
" take care of creating the system from these units and saves \n",
99-
" it as the `self.system` attribute.\n",
100-
" All streams and unit operations are also saved as attributes by their ID.\n",
101-
" \"\"\"\n",
100+
" # Here we create the units and connect them.\n",
101+
" # BioSTEAM can take care of creating the system.\n",
102102
" cellulosic.load_process_settings()\n",
103-
" scenario = self.scenario # The input paremters to the process model are saved here.\n",
103+
" scenario = self.scenario # The input parameters to the process model are saved here.\n",
104104
" if self.scenario.feedstock == 'cornstover':\n",
105105
" feedstock = bst.Stream(\n",
106106
" ID='feedstock',\n",
@@ -178,12 +178,7 @@
178178
" area=600,\n",
179179
" )\n",
180180
" \n",
181-
" def create_model(self):\n",
182-
" \"\"\"\n",
183-
" This method should return a model object. The model will be saved as a self.model attribute. \n",
184-
" All pareameters and metrics of the model object will also be saved as attributes by their \n",
185-
" function names.\n",
186-
" \"\"\"\n",
181+
" def create_model(self): # We create the Model object here.\n",
187182
" system = self.system # BioSTEAM automaticaly creates the system and saves it as self.system\n",
188183
" self.tea = tea = create_cellulosic_ethanol_tea(system)\n",
189184
" model = bst.Model(system)\n",

docs/tutorial/index.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ User guide
5555
:caption: Automation
5656

5757
Uncertainty_and_sensitivity
58-
Process_models
58+
Comparative_techno-economic_analysis
5959
Operational_flexibility
6060

6161
.. grid-item::

0 commit comments

Comments
 (0)