Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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": 12,
"execution_count": null,
"metadata": {
"tags": [
"solution"
Expand All @@ -85,7 +84,7 @@
},
{
"cell_type": "code",
"execution_count": 13,
"execution_count": null,
"metadata": {
"tags": []
},
Expand All @@ -106,7 +105,7 @@
},
{
"cell_type": "code",
"execution_count": 14,
"execution_count": null,
"metadata": {
"tags": []
},
Expand Down Expand Up @@ -137,7 +136,18 @@
},
{
"cell_type": "code",
"execution_count": 16,
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"def get_scalar(data, key):\n",
" v = data[key]\n",
" return float(v.iloc[0] if hasattr(v, \"iloc\") else v)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"tags": [
"solution"
Expand Down Expand Up @@ -188,7 +198,7 @@
" 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",
" m.fs.state_block.temperature.fix(get_scalar(data, \"temperature\"))\n",
"\n",
" # Set bounds on variables to be estimated\n",
" m.fs.properties.tau[\"benzene\", \"toluene\"].setlb(-5)\n",
Expand All @@ -203,7 +213,7 @@
},
{
"cell_type": "code",
"execution_count": 17,
"execution_count": null,
"metadata": {
"tags": [
"testing"
Expand Down Expand Up @@ -273,7 +283,7 @@
},
{
"cell_type": "code",
"execution_count": 19,
"execution_count": null,
"metadata": {
"tags": [
"solution"
Expand Down Expand Up @@ -304,7 +314,7 @@
},
{
"cell_type": "code",
"execution_count": 20,
"execution_count": null,
"metadata": {
"tags": []
},
Expand Down Expand Up @@ -345,10 +355,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",
" get_scalar(data, \"vap_benzene\")\n",
" - m.fs.state_block.mole_frac_phase_comp[\"Vap\", \"benzene\"]\n",
" ) ** 2 + (\n",
" float(data[\"liq_benzene\"])\n",
" get_scalar(data, \"liq_benzene\")\n",
" - m.fs.state_block.mole_frac_phase_comp[\"Liq\", \"benzene\"]\n",
" ) ** 2\n",
" return expr * 1e4"
Expand Down Expand Up @@ -465,7 +475,7 @@
"metadata": {
"celltoolbar": "Tags",
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"display_name": "idaes-examples-dev",
"language": "python",
"name": "python3"
},
Expand All @@ -479,9 +489,9 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.9"
"version": "3.12.13"
}
},
"nbformat": 4,
"nbformat_minor": 3
}
}
Loading
Loading