Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/IDAES/examples into diagnos…
Browse files Browse the repository at this point in the history
…tics-mb
  • Loading branch information
Robbybp committed Jun 10, 2024
2 parents 771bb0d + 303845b commit 38e1793
Show file tree
Hide file tree
Showing 14 changed files with 9,643 additions and 57 deletions.
2 changes: 1 addition & 1 deletion .readthedocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ build:
jobs:
pre_build:
# Set conf vars and update the Sphinx configuration (conf.py)
- idaesx conf --execute cache --timeout 600 --sphinx --show
- idaesx conf --execute off --sphinx --show
python:
install:
- requirements: requirements-dev.txt
Expand Down
1 change: 1 addition & 0 deletions idaes_examples/notebooks/_toc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ parts:
sections:
- file: docs/unit_models/custom_unit_models/custom_compressor_doc
- file: docs/unit_models/custom_unit_models/custom_heater_doc
- file: docs/unit_models/custom_unit_models/creating_unit_model_doc
- caption: Property packages
chapters:
- file: docs/properties/index
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"cells": [
{
"cell_type": "code",
"execution_count": 10,
"execution_count": null,
"metadata": {
"tags": [
"header",
Expand Down Expand Up @@ -45,8 +45,7 @@
"\n",
"## Key links to documentation:\n",
"* NRTL Model - https://idaes-pse.readthedocs.io/en/stable/reference_guides/model_libraries/generic/property_models/activity_coefficient.html\n",
"* parmest - https://pyomo.readthedocs.io/en/stable/contributed_packages/parmest/index.html\n",
""
"* parmest - https://pyomo.readthedocs.io/en/stable/contributed_packages/parmest/index.html\n"
]
},
{
Expand All @@ -61,7 +60,7 @@
},
{
"cell_type": "code",
"execution_count": 11,
"execution_count": null,
"metadata": {
"tags": [
"exercise"
Expand All @@ -76,7 +75,7 @@
},
{
"cell_type": "code",
"execution_count": 12,
"execution_count": null,
"metadata": {
"tags": [
"solution"
Expand All @@ -100,7 +99,7 @@
},
{
"cell_type": "code",
"execution_count": 13,
"execution_count": null,
"metadata": {
"tags": []
},
Expand All @@ -121,7 +120,7 @@
},
{
"cell_type": "code",
"execution_count": 14,
"execution_count": null,
"metadata": {
"tags": []
},
Expand Down Expand Up @@ -152,7 +151,7 @@
},
{
"cell_type": "code",
"execution_count": 15,
"execution_count": null,
"metadata": {
"tags": [
"exercise"
Expand Down Expand Up @@ -198,7 +197,12 @@
" m.fs.state_block.initialize(outlvl=idaeslog.INFO)\n",
"\n",
" # Fix at actual temperature\n",
" m.fs.state_block.temperature.fix(float(data[\"temperature\"]))\n",
" if isinstance(data, dict) or isinstance(data, pd.Series):\n",
" m.fs.state_block.temperature.fix(float(data[\"temperature\"]))\n",
" elif isinstance(data, pd.DataFrame):\n",
" m.fs.state_block.temperature.fix(float(data.iloc[0][\"temperature\"]))\n",
" else:\n",
" raise ValueError(\"Unrecognized data type.\") \n",
"\n",
" # Set bounds on variables to be estimated\n",
" m.fs.properties.tau[\"benzene\", \"toluene\"].setlb(-5)\n",
Expand All @@ -213,7 +217,7 @@
},
{
"cell_type": "code",
"execution_count": 16,
"execution_count": null,
"metadata": {
"tags": [
"solution"
Expand Down Expand Up @@ -264,7 +268,13 @@
" m.fs.state_block.initialize(outlvl=idaeslog.INFO_LOW)\n",
"\n",
" # Fix at actual temperature\n",
" m.fs.state_block.temperature.fix(float(data[\"temperature\"]))\n",
" # Fix at actual temperature\n",
" if isinstance(data, dict) or isinstance(data, pd.Series):\n",
" m.fs.state_block.temperature.fix(float(data[\"temperature\"]))\n",
" elif isinstance(data, pd.DataFrame):\n",
" m.fs.state_block.temperature.fix(float(data.iloc[0][\"temperature\"]))\n",
" else:\n",
" raise ValueError(\"Unrecognized data type.\") \n",
"\n",
" # Set bounds on variables to be estimated\n",
" m.fs.properties.tau[\"benzene\", \"toluene\"].setlb(-5)\n",
Expand All @@ -279,7 +289,7 @@
},
{
"cell_type": "code",
"execution_count": 17,
"execution_count": null,
"metadata": {
"tags": [
"testing"
Expand Down Expand Up @@ -349,7 +359,7 @@
},
{
"cell_type": "code",
"execution_count": 18,
"execution_count": null,
"metadata": {
"tags": [
"exercise"
Expand All @@ -362,7 +372,7 @@
},
{
"cell_type": "code",
"execution_count": 19,
"execution_count": null,
"metadata": {
"tags": [
"solution"
Expand Down Expand Up @@ -393,7 +403,7 @@
},
{
"cell_type": "code",
"execution_count": 20,
"execution_count": null,
"metadata": {
"tags": []
},
Expand Down Expand Up @@ -453,10 +463,10 @@
" # and vapor phase. For example, the squared error for the vapor phase is:\n",
" # (float(data[\"vap_benzene\"]) - m.fs.state_block.mole_frac_phase_comp[\"Vap\", \"benzene\"])**2\n",
" expr = (\n",
" float(data[\"vap_benzene\"])\n",
" float(data.iloc[0][\"vap_benzene\"])\n",
" - m.fs.state_block.mole_frac_phase_comp[\"Vap\", \"benzene\"]\n",
" ) ** 2 + (\n",
" float(data[\"liq_benzene\"])\n",
" float(data.iloc[0][\"liq_benzene\"])\n",
" - m.fs.state_block.mole_frac_phase_comp[\"Liq\", \"benzene\"]\n",
" ) ** 2\n",
" return expr * 1e4"
Expand Down Expand Up @@ -587,7 +597,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.9"
"version": "3.8.19"
}
},
"nbformat": 4,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,12 @@
" m.fs.flash.initialize(outlvl=idaeslog.INFO_LOW)\n",
"\n",
" # Fix at actual temperature\n",
" m.fs.flash.inlet.temperature.fix(float(data[\"temperature\"]))\n",
" if isinstance(data, dict) or isinstance(data, pd.Series):\n",
" m.fs.state_block.temperature.fix(float(data[\"temperature\"]))\n",
" elif isinstance(data, pd.DataFrame):\n",
" m.fs.state_block.temperature.fix(float(data.iloc[0][\"temperature\"]))\n",
" else:\n",
" raise ValueError(\"Unrecognized data type.\") \n",
"\n",
" # Set bounds on variables to be estimated\n",
" m.fs.properties.tau[\"benzene\", \"toluene\"].setlb(-5)\n",
Expand Down Expand Up @@ -267,7 +272,12 @@
" m.fs.flash.initialize(outlvl=idaeslog.INFO_LOW)\n",
"\n",
" # Fix at actual temperature\n",
" m.fs.flash.inlet.temperature.fix(float(data[\"temperature\"]))\n",
" if isinstance(data, dict) or isinstance(data, pd.Series):\n",
" m.fs.flash.inlet.temperature.fix(float(data[\"temperature\"]))\n",
" elif isinstance(data, pd.DataFrame):\n",
" m.fs.flash.inlet.temperature.fix(float(data.iloc[0][\"temperature\"]))\n",
" else:\n",
" raise ValueError(\"Unrecognized data type.\") \n",
"\n",
" # Set bounds on variables to be estimated\n",
" m.fs.properties.tau[\"benzene\", \"toluene\"].setlb(-5)\n",
Expand Down Expand Up @@ -434,7 +444,7 @@
"def SSE(m, data):\n",
" # Todo: Add expression for computing the sum of squared errors in mole fraction of benzene in the liquid\n",
" # and vapor phase. For example, the squared error for the vapor phase is:\n",
" # (float(data[\"vap_benzene\"]) - m.fs.flash.vap_outlet.mole_frac_comp[0, \"benzene\"])**2\n",
" # (float(data.iloc[0][\"vap_benzene\"]) - m.fs.flash.vap_outlet.mole_frac_comp[0, \"benzene\"])**2\n",
"\n",
" return expr * 1e4"
]
Expand All @@ -455,9 +465,9 @@
" # and vapor phase. For example, the squared error for the vapor phase is:\n",
" # (float(data[\"vap_benzene\"]) - m.fs.flash.vap_outlet.mole_frac_comp[0, \"benzene\"])**2\n",
" expr = (\n",
" float(data[\"vap_benzene\"]) - m.fs.flash.vap_outlet.mole_frac_comp[0, \"benzene\"]\n",
" float(data.iloc[0][\"vap_benzene\"]) - m.fs.flash.vap_outlet.mole_frac_comp[0, \"benzene\"]\n",
" ) ** 2 + (\n",
" float(data[\"liq_benzene\"]) - m.fs.flash.liq_outlet.mole_frac_comp[0, \"benzene\"]\n",
" float(data.iloc[0][\"liq_benzene\"]) - m.fs.flash.liq_outlet.mole_frac_comp[0, \"benzene\"]\n",
" ) ** 2\n",
" return expr * 1e4"
]
Expand Down Expand Up @@ -587,9 +597,9 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.12"
"version": "3.8.19"
}
},
"nbformat": 4,
"nbformat_minor": 2
"nbformat_minor": 4
}
Loading

0 comments on commit 38e1793

Please sign in to comment.