diff --git a/.github/workflows/core.yml b/.github/workflows/core.yml index 848820b6..1c7213b5 100644 --- a/.github/workflows/core.yml +++ b/.github/workflows/core.yml @@ -78,7 +78,7 @@ jobs: run: | pwd ls idaes_examples - pytest -v idaes_examples --ignore=idaes_examples/notebooks/docs/surrogates/SCO2_example/ALAMO/ + pytest -v idaes_examples --ignore=idaes_examples/notebooks/docs/surrogates/sco2/alamo/ - name: Upload pytest-xdist worker logs if: success() || failure() uses: actions/upload-artifact@v3 diff --git a/idaes_examples/notebooks/_toc.yml b/idaes_examples/notebooks/_toc.yml index 1a2b68d4..33d21253 100644 --- a/idaes_examples/notebooks/_toc.yml +++ b/idaes_examples/notebooks/_toc.yml @@ -81,21 +81,21 @@ parts: - file: docs/surrogates/omlt/index sections: - file: docs/surrogates/omlt/keras_flowsheet_optimization_doc - - file: docs/surrogates/SCO2_example/ALAMO/index + - file: docs/surrogates/sco2/alamo/index sections: - - file: docs/surrogates/SCO2_example/ALAMO/SCO2_alamo_surrogate_doc - - file: docs/surrogates/SCO2_example/ALAMO/SCO2_properties_alamo_surrogate_embedding_doc - - file: docs/surrogates/SCO2_example/ALAMO/SCO2_flowsheet_alamo_surrogate_doc - - file: docs/surrogates/SCO2_example/OMLT/index + - file: docs/surrogates/sco2/alamo/alamo_training_doc + - file: docs/surrogates/sco2/alamo/surrogate_embedding_doc + - file: docs/surrogates/sco2/alamo/flowsheet_optimization_doc + - file: docs/surrogates/sco2/omlt/index sections: - - file: docs/surrogates/SCO2_example/OMLT/SCO2_keras_surrogate_doc - - file: docs/surrogates/SCO2_example/OMLT/SCO2_properties_keras_surrogate_embedding_doc - - file: docs/surrogates/SCO2_example/OMLT/SCO2_flowsheet_keras_surrogate_doc - - file: docs/surrogates/SCO2_example/PySMO/index + - file: docs/surrogates/sco2/omlt/omlt_training_doc + - file: docs/surrogates/sco2/omlt/surrogate_embedding_doc + - file: docs/surrogates/sco2/omlt/flowsheet_optimization_doc + - file: docs/surrogates/sco2/pysmo/index sections: - - file: docs/surrogates/SCO2_example/PySMO/SCO2_pysmo_surrogate_doc - - file: docs/surrogates/SCO2_example/PySMO/SCO2_properties_pysmo_surrogate_embedding_doc - - file: docs/surrogates/SCO2_example/PySMO/SCO2_flowsheet_pysmo_surrogate_doc + - file: docs/surrogates/sco2/pysmo/pysmo_training_doc + - file: docs/surrogates/sco2/pysmo/surrogate_embedding_doc + - file: docs/surrogates/sco2/pysmo/flowsheet_optimization_doc - caption: Power generation chapters: - file: docs/power_gen/supercritical/index diff --git a/idaes_examples/notebooks/docs/surrogates/SCO2_example/OMLT/keras_surrogate/fingerprint.pb b/idaes_examples/notebooks/docs/surrogates/SCO2_example/OMLT/keras_surrogate/fingerprint.pb deleted file mode 100644 index c94ddb92..00000000 --- a/idaes_examples/notebooks/docs/surrogates/SCO2_example/OMLT/keras_surrogate/fingerprint.pb +++ /dev/null @@ -1 +0,0 @@ -™Ù²¡™—ñû®¾¶âŽéدŠ-êô¢ËªºÕû[ ¿˜âãÒû‘Óç(÷úÝ칉¨¢W2 \ No newline at end of file diff --git a/idaes_examples/notebooks/docs/surrogates/SCO2_example/OMLT/keras_surrogate/idaes_info.json b/idaes_examples/notebooks/docs/surrogates/SCO2_example/OMLT/keras_surrogate/idaes_info.json deleted file mode 100644 index f582d087..00000000 --- a/idaes_examples/notebooks/docs/surrogates/SCO2_example/OMLT/keras_surrogate/idaes_info.json +++ /dev/null @@ -1 +0,0 @@ -{"input_scaler": {"expected_columns": ["pressure", "temperature"], "offset": {"pressure": 7.460891, "temperature": 306.215965}, "factor": {"pressure": 27.532923, "temperature": 693.756024}}, "output_scaler": {"expected_columns": ["enth_mol", "entr_mol"], "offset": {"enth_mol": -403924.714779, "entr_mol": -67.269005}, "factor": {"enth_mol": 43668.96112499997, "entr_mol": 88.088999}}, "input_labels": ["pressure", "temperature"], "output_labels": ["enth_mol", "entr_mol"], "input_bounds": {"pressure": [7, 40], "temperature": [306, 1000]}} \ No newline at end of file diff --git a/idaes_examples/notebooks/docs/surrogates/SCO2_example/OMLT/keras_surrogate/keras_metadata.pb b/idaes_examples/notebooks/docs/surrogates/SCO2_example/OMLT/keras_surrogate/keras_metadata.pb deleted file mode 100644 index 0429ce74..00000000 --- a/idaes_examples/notebooks/docs/surrogates/SCO2_example/OMLT/keras_surrogate/keras_metadata.pb +++ /dev/null @@ -1,10 +0,0 @@ - -¥5root"_tf_keras_sequential*€5{"name": "sequential", "trainable": true, "expects_training_arg": true, "dtype": "float32", "batch_input_shape": null, "must_restore_from_config": false, "class_name": "Sequential", "config": {"name": "sequential", "layers": [{"class_name": "InputLayer", "config": {"batch_input_shape": {"class_name": "__tuple__", "items": [null, 2]}, "dtype": "float32", "sparse": false, "ragged": false, "name": "dense_input"}}, {"class_name": "Dense", "config": {"name": "dense", "trainable": true, "batch_input_shape": {"class_name": "__tuple__", "items": [null, 2]}, "dtype": "float32", "units": 20, "activation": "tanh", "use_bias": true, "kernel_initializer": {"class_name": "GlorotUniform", "config": {"seed": null}}, "bias_initializer": {"class_name": "Zeros", "config": {}}, "kernel_regularizer": null, "bias_regularizer": null, "activity_regularizer": null, "kernel_constraint": null, "bias_constraint": null}}, {"class_name": "Dense", "config": {"name": "dense_1", "trainable": true, "dtype": "float32", "units": 20, "activation": "tanh", "use_bias": true, "kernel_initializer": {"class_name": "GlorotUniform", "config": {"seed": null}}, "bias_initializer": {"class_name": "Zeros", "config": {}}, "kernel_regularizer": null, "bias_regularizer": null, "activity_regularizer": null, "kernel_constraint": null, "bias_constraint": null}}, {"class_name": "Dense", "config": {"name": "dense_2", "trainable": true, "dtype": "float32", "units": 20, "activation": "tanh", "use_bias": true, "kernel_initializer": {"class_name": "GlorotUniform", "config": {"seed": null}}, "bias_initializer": {"class_name": "Zeros", "config": {}}, "kernel_regularizer": null, "bias_regularizer": null, "activity_regularizer": null, "kernel_constraint": null, "bias_constraint": null}}, {"class_name": "Dense", "config": {"name": "dense_3", "trainable": true, "dtype": "float32", "units": 20, "activation": "tanh", "use_bias": true, "kernel_initializer": {"class_name": "GlorotUniform", "config": {"seed": null}}, "bias_initializer": {"class_name": "Zeros", "config": {}}, "kernel_regularizer": null, "bias_regularizer": null, "activity_regularizer": null, "kernel_constraint": null, "bias_constraint": null}}, {"class_name": "Dense", "config": {"name": "dense_4", "trainable": true, "dtype": "float32", "units": 2, "activation": "linear", "use_bias": true, "kernel_initializer": {"class_name": "GlorotUniform", "config": {"seed": null}}, "bias_initializer": {"class_name": "Zeros", "config": {}}, "kernel_regularizer": null, "bias_regularizer": null, "activity_regularizer": null, "kernel_constraint": null, "bias_constraint": null}}]}, "shared_object_id": 16, "input_spec": [{"class_name": "InputSpec", "config": {"dtype": null, "shape": {"class_name": "__tuple__", "items": [null, 2]}, "ndim": 2, "max_ndim": null, "min_ndim": null, "axes": {}}}], "build_input_shape": {"class_name": "TensorShape", "items": [null, 2]}, "is_graph_network": true, "full_save_spec": {"class_name": "__tuple__", "items": [[{"class_name": "TypeSpec", "type_spec": "tf.TensorSpec", "serialized": [{"class_name": "TensorShape", "items": [null, 2]}, "float32", "dense_input"]}], {}]}, "save_spec": {"class_name": "TypeSpec", "type_spec": "tf.TensorSpec", "serialized": [{"class_name": "TensorShape", "items": [null, 2]}, "float32", "dense_input"]}, "keras_version": "2.9.0", "backend": "tensorflow", "model_config": {"class_name": "Sequential", "config": {"name": "sequential", "layers": [{"class_name": "InputLayer", "config": {"batch_input_shape": {"class_name": "__tuple__", "items": [null, 2]}, "dtype": "float32", "sparse": false, "ragged": false, "name": "dense_input"}, "shared_object_id": 0}, {"class_name": "Dense", "config": {"name": "dense", "trainable": true, "batch_input_shape": {"class_name": "__tuple__", "items": [null, 2]}, "dtype": "float32", "units": 20, "activation": "tanh", "use_bias": true, "kernel_initializer": {"class_name": "GlorotUniform", "config": {"seed": null}, "shared_object_id": 1}, "bias_initializer": {"class_name": "Zeros", "config": {}, "shared_object_id": 2}, "kernel_regularizer": null, "bias_regularizer": null, "activity_regularizer": null, "kernel_constraint": null, "bias_constraint": null}, "shared_object_id": 3}, {"class_name": "Dense", "config": {"name": "dense_1", "trainable": true, "dtype": "float32", "units": 20, "activation": "tanh", "use_bias": true, "kernel_initializer": {"class_name": "GlorotUniform", "config": {"seed": null}, "shared_object_id": 4}, "bias_initializer": {"class_name": "Zeros", "config": {}, "shared_object_id": 5}, "kernel_regularizer": null, "bias_regularizer": null, "activity_regularizer": null, "kernel_constraint": null, "bias_constraint": null}, "shared_object_id": 6}, {"class_name": "Dense", "config": {"name": "dense_2", "trainable": true, "dtype": "float32", "units": 20, "activation": "tanh", "use_bias": true, "kernel_initializer": {"class_name": "GlorotUniform", "config": {"seed": null}, "shared_object_id": 7}, "bias_initializer": {"class_name": "Zeros", "config": {}, "shared_object_id": 8}, "kernel_regularizer": null, "bias_regularizer": null, "activity_regularizer": null, "kernel_constraint": null, "bias_constraint": null}, "shared_object_id": 9}, {"class_name": "Dense", "config": {"name": "dense_3", "trainable": true, "dtype": "float32", "units": 20, "activation": "tanh", "use_bias": true, "kernel_initializer": {"class_name": "GlorotUniform", "config": {"seed": null}, "shared_object_id": 10}, "bias_initializer": {"class_name": "Zeros", "config": {}, "shared_object_id": 11}, "kernel_regularizer": null, "bias_regularizer": null, "activity_regularizer": null, "kernel_constraint": null, "bias_constraint": null}, "shared_object_id": 12}, {"class_name": "Dense", "config": {"name": "dense_4", "trainable": true, "dtype": "float32", "units": 2, "activation": "linear", "use_bias": true, "kernel_initializer": {"class_name": "GlorotUniform", "config": {"seed": null}, "shared_object_id": 13}, "bias_initializer": {"class_name": "Zeros", "config": {}, "shared_object_id": 14}, "kernel_regularizer": null, "bias_regularizer": null, "activity_regularizer": null, "kernel_constraint": null, "bias_constraint": null}, "shared_object_id": 15}]}}, "training_config": {"loss": "mse", "metrics": [[{"class_name": "MeanMetricWrapper", "config": {"name": "mae", "dtype": "float32", "fn": "mean_absolute_error"}, "shared_object_id": 18}, {"class_name": "MeanMetricWrapper", "config": {"name": "mse", "dtype": "float32", "fn": "mean_squared_error"}, "shared_object_id": 19}]], "weighted_metrics": null, "loss_weights": null, "optimizer_config": {"class_name": "Adam", "config": {"name": "Adam", "learning_rate": 0.0010000000474974513, "decay": 0.0, "beta_1": 0.8999999761581421, "beta_2": 0.9990000128746033, "epsilon": 1e-07, "amsgrad": false}}}}2 -°root.layer_with_weights-0"_tf_keras_layer*ù{"name": "dense", "trainable": true, "expects_training_arg": false, "dtype": "float32", "batch_input_shape": {"class_name": "__tuple__", "items": [null, 2]}, "stateful": false, "must_restore_from_config": false, "class_name": "Dense", "config": {"name": "dense", "trainable": true, "batch_input_shape": {"class_name": "__tuple__", "items": [null, 2]}, "dtype": "float32", "units": 20, "activation": "tanh", "use_bias": true, "kernel_initializer": {"class_name": "GlorotUniform", "config": {"seed": null}, "shared_object_id": 1}, "bias_initializer": {"class_name": "Zeros", "config": {}, "shared_object_id": 2}, "kernel_regularizer": null, "bias_regularizer": null, "activity_regularizer": null, "kernel_constraint": null, "bias_constraint": null}, "shared_object_id": 3, "input_spec": {"class_name": "InputSpec", "config": {"dtype": null, "shape": null, "ndim": null, "max_ndim": null, "min_ndim": 2, "axes": {"-1": 2}}, "shared_object_id": 20}, "build_input_shape": {"class_name": "TensorShape", "items": [null, 2]}}2 -Åroot.layer_with_weights-1"_tf_keras_layer*Ž{"name": "dense_1", "trainable": true, "expects_training_arg": false, "dtype": "float32", "batch_input_shape": null, "stateful": false, "must_restore_from_config": false, "class_name": "Dense", "config": {"name": "dense_1", "trainable": true, "dtype": "float32", "units": 20, "activation": "tanh", "use_bias": true, "kernel_initializer": {"class_name": "GlorotUniform", "config": {"seed": null}, "shared_object_id": 4}, "bias_initializer": {"class_name": "Zeros", "config": {}, "shared_object_id": 5}, "kernel_regularizer": null, "bias_regularizer": null, "activity_regularizer": null, "kernel_constraint": null, "bias_constraint": null}, "shared_object_id": 6, "input_spec": {"class_name": "InputSpec", "config": {"dtype": null, "shape": null, "ndim": null, "max_ndim": null, "min_ndim": 2, "axes": {"-1": 20}}, "shared_object_id": 21}, "build_input_shape": {"class_name": "TensorShape", "items": [null, 20]}}2 -Åroot.layer_with_weights-2"_tf_keras_layer*Ž{"name": "dense_2", "trainable": true, "expects_training_arg": false, "dtype": "float32", "batch_input_shape": null, "stateful": false, "must_restore_from_config": false, "class_name": "Dense", "config": {"name": "dense_2", "trainable": true, "dtype": "float32", "units": 20, "activation": "tanh", "use_bias": true, "kernel_initializer": {"class_name": "GlorotUniform", "config": {"seed": null}, "shared_object_id": 7}, "bias_initializer": {"class_name": "Zeros", "config": {}, "shared_object_id": 8}, "kernel_regularizer": null, "bias_regularizer": null, "activity_regularizer": null, "kernel_constraint": null, "bias_constraint": null}, "shared_object_id": 9, "input_spec": {"class_name": "InputSpec", "config": {"dtype": null, "shape": null, "ndim": null, "max_ndim": null, "min_ndim": 2, "axes": {"-1": 20}}, "shared_object_id": 22}, "build_input_shape": {"class_name": "TensorShape", "items": [null, 20]}}2 -Èroot.layer_with_weights-3"_tf_keras_layer*‘{"name": "dense_3", "trainable": true, "expects_training_arg": false, "dtype": "float32", "batch_input_shape": null, "stateful": false, "must_restore_from_config": false, "class_name": "Dense", "config": {"name": "dense_3", "trainable": true, "dtype": "float32", "units": 20, "activation": "tanh", "use_bias": true, "kernel_initializer": {"class_name": "GlorotUniform", "config": {"seed": null}, "shared_object_id": 10}, "bias_initializer": {"class_name": "Zeros", "config": {}, "shared_object_id": 11}, "kernel_regularizer": null, "bias_regularizer": null, "activity_regularizer": null, "kernel_constraint": null, "bias_constraint": null}, "shared_object_id": 12, "input_spec": {"class_name": "InputSpec", "config": {"dtype": null, "shape": null, "ndim": null, "max_ndim": null, "min_ndim": 2, "axes": {"-1": 20}}, "shared_object_id": 23}, "build_input_shape": {"class_name": "TensorShape", "items": [null, 20]}}2 -Éroot.layer_with_weights-4"_tf_keras_layer*’{"name": "dense_4", "trainable": true, "expects_training_arg": false, "dtype": "float32", "batch_input_shape": null, "stateful": false, "must_restore_from_config": false, "class_name": "Dense", "config": {"name": "dense_4", "trainable": true, "dtype": "float32", "units": 2, "activation": "linear", "use_bias": true, "kernel_initializer": {"class_name": "GlorotUniform", "config": {"seed": null}, "shared_object_id": 13}, "bias_initializer": {"class_name": "Zeros", "config": {}, "shared_object_id": 14}, "kernel_regularizer": null, "bias_regularizer": null, "activity_regularizer": null, "kernel_constraint": null, "bias_constraint": null}, "shared_object_id": 15, "input_spec": {"class_name": "InputSpec", "config": {"dtype": null, "shape": null, "ndim": null, "max_ndim": null, "min_ndim": 2, "axes": {"-1": 20}}, "shared_object_id": 24}, "build_input_shape": {"class_name": "TensorShape", "items": [null, 20]}}2 -¹mroot.keras_api.metrics.0"_tf_keras_metric*‚{"class_name": "Mean", "name": "loss", "dtype": "float32", "config": {"name": "loss", "dtype": "float32"}, "shared_object_id": 25}2 -ánroot.keras_api.metrics.1"_tf_keras_metric*ª{"class_name": "MeanMetricWrapper", "name": "mae", "dtype": "float32", "config": {"name": "mae", "dtype": "float32", "fn": "mean_absolute_error"}, "shared_object_id": 18}2 -àoroot.keras_api.metrics.2"_tf_keras_metric*©{"class_name": "MeanMetricWrapper", "name": "mse", "dtype": "float32", "config": {"name": "mse", "dtype": "float32", "fn": "mean_squared_error"}, "shared_object_id": 19}2 \ No newline at end of file diff --git a/idaes_examples/notebooks/docs/surrogates/SCO2_example/OMLT/keras_surrogate/saved_model.pb b/idaes_examples/notebooks/docs/surrogates/SCO2_example/OMLT/keras_surrogate/saved_model.pb deleted file mode 100644 index 1fdda895..00000000 Binary files a/idaes_examples/notebooks/docs/surrogates/SCO2_example/OMLT/keras_surrogate/saved_model.pb and /dev/null differ diff --git a/idaes_examples/notebooks/docs/surrogates/SCO2_example/OMLT/keras_surrogate/variables/variables.data-00000-of-00001 b/idaes_examples/notebooks/docs/surrogates/SCO2_example/OMLT/keras_surrogate/variables/variables.data-00000-of-00001 deleted file mode 100644 index 15d19da8..00000000 Binary files a/idaes_examples/notebooks/docs/surrogates/SCO2_example/OMLT/keras_surrogate/variables/variables.data-00000-of-00001 and /dev/null differ diff --git a/idaes_examples/notebooks/docs/surrogates/SCO2_example/OMLT/keras_surrogate/variables/variables.index b/idaes_examples/notebooks/docs/surrogates/SCO2_example/OMLT/keras_surrogate/variables/variables.index deleted file mode 100644 index 0cd2376b..00000000 Binary files a/idaes_examples/notebooks/docs/surrogates/SCO2_example/OMLT/keras_surrogate/variables/variables.index and /dev/null differ diff --git a/idaes_examples/notebooks/docs/surrogates/SCO2_example/PySMO/pysmo_poly_surrogate.json b/idaes_examples/notebooks/docs/surrogates/SCO2_example/PySMO/pysmo_poly_surrogate.json deleted file mode 100644 index 5258094b..00000000 --- a/idaes_examples/notebooks/docs/surrogates/SCO2_example/PySMO/pysmo_poly_surrogate.json +++ /dev/null @@ -1 +0,0 @@ -{"model_encoding": {"enth_mol": {"attr": {"regression_data_columns": ["pressure", "temperature"], "multinomials": 1, "additional_term_expressions": ["IndexedParam[pressure]*IndexedParam[temperature]*IndexedParam[temperature]", "IndexedParam[pressure]*IndexedParam[pressure]*IndexedParam[temperature]*IndexedParam[temperature]", "IndexedParam[pressure]*IndexedParam[pressure]*IndexedParam[temperature]", "IndexedParam[pressure]/IndexedParam[temperature]", "IndexedParam[temperature]/IndexedParam[pressure]"], "optimal_weights_array": [[-539145.2641931743], [-1572.9941129612596], [1028.1303702529963], [-41.89265612633253], [-2.854098382160082], [3.1084792045014056], [0.0040249321969904606], [-0.07298691795031877], [-2.7827021177926484e-06], [0.0006559340352560386], [7.62454692622566e-10], [4.50540106476475], [-0.0025967218940188964], [3.27147430041989e-05], [-0.05205092851352775], [149943.17003170087], [-3.5662256522946807]], "final_polynomial_order": 5, "errors": {"MAE": 116.22937611304296, "MSE": 39254.96789837278, "R2": 0.9997117200542968}, "extra_terms_feature_vector": ["IndexedParam[pressure]", "IndexedParam[temperature]"]}, "map": {"regression_data_columns": "list", "multinomials": "str", "additional_term_expressions": "other", "optimal_weights_array": "numpy", "final_polynomial_order": "str", "errors": "str", "extra_terms_feature_vector": "other"}}, "entr_mol": {"attr": {"regression_data_columns": ["pressure", "temperature"], "multinomials": 1, "additional_term_expressions": ["IndexedParam[pressure]*IndexedParam[temperature]*IndexedParam[temperature]", "IndexedParam[pressure]*IndexedParam[pressure]*IndexedParam[temperature]*IndexedParam[temperature]", "IndexedParam[pressure]*IndexedParam[pressure]*IndexedParam[temperature]", "IndexedParam[pressure]/IndexedParam[temperature]", "IndexedParam[temperature]/IndexedParam[pressure]"], "optimal_weights_array": [[-529.9581296941684], [-5.674476891947422], [3.6251620831469844], [-0.012206052330165947], [-0.010121999171951317], [0.0044164987227566545], [1.4212146246171698e-05], [-0.00012049491972756627], [-9.875650167428602e-09], [1.1673348430972035e-06], [2.72031843813476e-12], [0.010605178085763924], [-6.047902870413699e-06], [6.872924493404928e-08], [-0.00011146830780061758], [437.25207041949056], [0.0015391876304710196]], "final_polynomial_order": 5, "errors": {"MAE": 0.34548912239751245, "MSE": 0.3560561890323906, "R2": 0.9991570382929269}, "extra_terms_feature_vector": ["IndexedParam[pressure]", "IndexedParam[temperature]"]}, "map": {"regression_data_columns": "list", "multinomials": "str", "additional_term_expressions": "other", "optimal_weights_array": "numpy", "final_polynomial_order": "str", "errors": "str", "extra_terms_feature_vector": "other"}}}, "input_labels": ["pressure", "temperature"], "output_labels": ["enth_mol", "entr_mol"], "input_bounds": {"pressure": [7, 40], "temperature": [306, 1000]}, "surrogate_type": "poly"} \ No newline at end of file diff --git a/idaes_examples/notebooks/docs/surrogates/SCO2_example/500_Points_DataSet.csv b/idaes_examples/notebooks/docs/surrogates/sco2/500_Points_DataSet.csv similarity index 100% rename from idaes_examples/notebooks/docs/surrogates/SCO2_example/500_Points_DataSet.csv rename to idaes_examples/notebooks/docs/surrogates/sco2/500_Points_DataSet.csv diff --git a/idaes_examples/notebooks/docs/surrogates/SCO2_example/CO2_flowsheet.png b/idaes_examples/notebooks/docs/surrogates/sco2/CO2_flowsheet.png similarity index 100% rename from idaes_examples/notebooks/docs/surrogates/SCO2_example/CO2_flowsheet.png rename to idaes_examples/notebooks/docs/surrogates/sco2/CO2_flowsheet.png diff --git a/idaes_examples/notebooks/docs/surrogates/SCO2_example/ALAMO/__init__.py b/idaes_examples/notebooks/docs/surrogates/sco2/__init__.py similarity index 100% rename from idaes_examples/notebooks/docs/surrogates/SCO2_example/ALAMO/__init__.py rename to idaes_examples/notebooks/docs/surrogates/sco2/__init__.py diff --git a/idaes_examples/notebooks/docs/surrogates/SCO2_example/OMLT/__init__.py b/idaes_examples/notebooks/docs/surrogates/sco2/alamo/__init__.py similarity index 100% rename from idaes_examples/notebooks/docs/surrogates/SCO2_example/OMLT/__init__.py rename to idaes_examples/notebooks/docs/surrogates/sco2/alamo/__init__.py diff --git a/idaes_examples/notebooks/docs/surrogates/SCO2_example/ALAMO/alamo_run.trc b/idaes_examples/notebooks/docs/surrogates/sco2/alamo/alamo_run.trc similarity index 100% rename from idaes_examples/notebooks/docs/surrogates/SCO2_example/ALAMO/alamo_run.trc rename to idaes_examples/notebooks/docs/surrogates/sco2/alamo/alamo_run.trc diff --git a/idaes_examples/notebooks/docs/surrogates/SCO2_example/ALAMO/alamo_surrogate.json b/idaes_examples/notebooks/docs/surrogates/sco2/alamo/alamo_surrogate.json similarity index 100% rename from idaes_examples/notebooks/docs/surrogates/SCO2_example/ALAMO/alamo_surrogate.json rename to idaes_examples/notebooks/docs/surrogates/sco2/alamo/alamo_surrogate.json diff --git a/idaes_examples/notebooks/docs/surrogates/SCO2_example/ALAMO/SCO2_alamo_surrogate.ipynb b/idaes_examples/notebooks/docs/surrogates/sco2/alamo/alamo_training.ipynb similarity index 99% rename from idaes_examples/notebooks/docs/surrogates/SCO2_example/ALAMO/SCO2_alamo_surrogate.ipynb rename to idaes_examples/notebooks/docs/surrogates/sco2/alamo/alamo_training.ipynb index 89fc9c7b..74963d2b 100644 --- a/idaes_examples/notebooks/docs/surrogates/SCO2_example/ALAMO/SCO2_alamo_surrogate.ipynb +++ b/idaes_examples/notebooks/docs/surrogates/sco2/alamo/alamo_training.ipynb @@ -567,7 +567,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "Now, the surrogate is trained and validated, we shall embed it in the property package, which is demonstrated in the [SCO2_properties_alamo_surrogate_embedding](https://github.com/IDAES/examples/blob/supercritcial_CO2_example/idaes_examples/notebooks/docs/surrogates/SCO2_example/ALAMO/SCO2_properties_alamo_surrogate_embedding.ipynb) file." + "Now, the surrogate is trained and validated, we shall embed it in the property package, which is demonstrated in the [surrogate_embedding](https://github.com/IDAES/examples/blob/supercritcial_CO2_example/idaes_examples/notebooks/docs/surrogates/sco2/alamo/surrogate_embedding.ipynb) file." ] } ], diff --git a/idaes_examples/notebooks/docs/surrogates/SCO2_example/ALAMO/SCO2_alamo_surrogate_doc.ipynb b/idaes_examples/notebooks/docs/surrogates/sco2/alamo/alamo_training_doc.ipynb similarity index 99% rename from idaes_examples/notebooks/docs/surrogates/SCO2_example/ALAMO/SCO2_alamo_surrogate_doc.ipynb rename to idaes_examples/notebooks/docs/surrogates/sco2/alamo/alamo_training_doc.ipynb index 76fefb3c..6347febe 100644 --- a/idaes_examples/notebooks/docs/surrogates/SCO2_example/ALAMO/SCO2_alamo_surrogate_doc.ipynb +++ b/idaes_examples/notebooks/docs/surrogates/sco2/alamo/alamo_training_doc.ipynb @@ -567,7 +567,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "Now, the surrogate is trained and validated, we shall embed it in the property package, which is demonstrated in the [SCO2_properties_alamo_surrogate_embedding](https://github.com/IDAES/examples/blob/supercritcial_CO2_example/idaes_examples/notebooks/docs/surrogates/SCO2_example/ALAMO/SCO2_properties_alamo_surrogate_embedding_doc.md) file." + "Now, the surrogate is trained and validated, we shall embed it in the property package, which is demonstrated in the [surrogate_embedding](https://github.com/IDAES/examples/blob/supercritcial_CO2_example/idaes_examples/notebooks/docs/surrogates/sco2/alamo/surrogate_embedding_doc.md) file." ] } ], diff --git a/idaes_examples/notebooks/docs/surrogates/SCO2_example/ALAMO/SCO2_alamo_surrogate_test.ipynb b/idaes_examples/notebooks/docs/surrogates/sco2/alamo/alamo_training_test.ipynb similarity index 99% rename from idaes_examples/notebooks/docs/surrogates/SCO2_example/ALAMO/SCO2_alamo_surrogate_test.ipynb rename to idaes_examples/notebooks/docs/surrogates/sco2/alamo/alamo_training_test.ipynb index e54ba5a4..bf1b4b99 100644 --- a/idaes_examples/notebooks/docs/surrogates/SCO2_example/ALAMO/SCO2_alamo_surrogate_test.ipynb +++ b/idaes_examples/notebooks/docs/surrogates/sco2/alamo/alamo_training_test.ipynb @@ -567,7 +567,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "Now, the surrogate is trained and validated, we shall embed it in the property package, which is demonstrated in the [SCO2_properties_alamo_surrogate_embedding](https://github.com/IDAES/examples/blob/supercritcial_CO2_example/idaes_examples/notebooks/docs/surrogates/SCO2_example/ALAMO/SCO2_properties_alamo_surrogate_embedding_test.ipynb) file." + "Now, the surrogate is trained and validated, we shall embed it in the property package, which is demonstrated in the [surrogate_embedding](https://github.com/IDAES/examples/blob/supercritcial_CO2_example/idaes_examples/notebooks/docs/surrogates/sco2/alamo/surrogate_embedding_test.ipynb) file." ] } ], diff --git a/idaes_examples/notebooks/docs/surrogates/SCO2_example/ALAMO/SCO2_alamo_surrogate_usr.ipynb b/idaes_examples/notebooks/docs/surrogates/sco2/alamo/alamo_training_usr.ipynb similarity index 99% rename from idaes_examples/notebooks/docs/surrogates/SCO2_example/ALAMO/SCO2_alamo_surrogate_usr.ipynb rename to idaes_examples/notebooks/docs/surrogates/sco2/alamo/alamo_training_usr.ipynb index 14b624a2..b9bafbf0 100644 --- a/idaes_examples/notebooks/docs/surrogates/SCO2_example/ALAMO/SCO2_alamo_surrogate_usr.ipynb +++ b/idaes_examples/notebooks/docs/surrogates/sco2/alamo/alamo_training_usr.ipynb @@ -567,7 +567,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "Now, the surrogate is trained and validated, we shall embed it in the property package, which is demonstrated in the [SCO2_properties_alamo_surrogate_embedding](https://github.com/IDAES/examples/blob/supercritcial_CO2_example/idaes_examples/notebooks/docs/surrogates/SCO2_example/ALAMO/SCO2_properties_alamo_surrogate_embedding_usr.ipynb) file." + "Now, the surrogate is trained and validated, we shall embed it in the property package, which is demonstrated in the [surrogate_embedding](https://github.com/IDAES/examples/blob/supercritcial_CO2_example/idaes_examples/notebooks/docs/surrogates/sco2/alamo/surrogate_embedding_usr.ipynb) file." ] } ], diff --git a/idaes_examples/notebooks/docs/surrogates/SCO2_example/ALAMO/SCO2_flowsheet_alamo_surrogate.ipynb b/idaes_examples/notebooks/docs/surrogates/sco2/alamo/flowsheet_optimization.ipynb similarity index 99% rename from idaes_examples/notebooks/docs/surrogates/SCO2_example/ALAMO/SCO2_flowsheet_alamo_surrogate.ipynb rename to idaes_examples/notebooks/docs/surrogates/sco2/alamo/flowsheet_optimization.ipynb index 01a0e48b..55b9d0c2 100644 --- a/idaes_examples/notebooks/docs/surrogates/SCO2_example/ALAMO/SCO2_flowsheet_alamo_surrogate.ipynb +++ b/idaes_examples/notebooks/docs/surrogates/sco2/alamo/flowsheet_optimization.ipynb @@ -24,7 +24,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "# Supercritical CO2 Property Surrogate with ALAMO Surrogate Object - SCO2_flowsheet_optimization_alamo_surrogate (Part 3)\n", + "# Supercritical CO2 Property Surrogate with ALAMO Surrogate Object - flowsheet_optimization (Part 3)\n", "\n", "Maintainer: Javal Vyas\n", "\n", @@ -97,7 +97,7 @@ "from idaes.models.unit_models.pressure_changer import ThermodynamicAssumption\n", "from idaes.core.util.model_statistics import degrees_of_freedom\n", "from idaes.core.util.initialization import propagate_state\n", - "from SCO2_properties_alamo_surrogate import SCO2ParameterBlock\n", + "from properties import SCO2ParameterBlock\n", "\n", "import idaes.logger as idaeslog\n", "\n", @@ -110,7 +110,7 @@ "source": [ "# 2. Constructing the flowsheet\n", "\n", - "To construct the flowsheet we need to define a ConcreteModel using pyomo and then add a FlowsheetBlock to the ConcreteModel. Here since we are focusing on the steady state process, we shall have the dynamic flag as False in the FlowsheetBlock. Next, we define the properties in the FlowsheetBlock that we imported from the SCO2_properties_keras_surrogate.py file. Then start adding the unit models to the FlowsheetBlock with the suitable arguements, after which we connect them using Arcs as in the flowsheet above. \n", + "To construct the flowsheet we need to define a ConcreteModel using pyomo and then add a FlowsheetBlock to the ConcreteModel. Here since we are focusing on the steady state process, we shall have the dynamic flag as False in the FlowsheetBlock. Next, we define the properties in the FlowsheetBlock that we imported from the properties.py file. Then start adding the unit models to the FlowsheetBlock with the suitable arguements, after which we connect them using Arcs as in the flowsheet above. \n", "\n", "Once we have the connected flowsheet, we initialize individual unit models. Before initializing, we fix desired variables for the desired behavior of the unit model and then use `propagate_state` to pass on the state variables to next unit model in the flowsheet. After completely initializing the flowsheet, we convert the network to a mathematical form by using `network.expand_arcs` from the TransformationFactory and apply it on the flowsheet block. Then we call the solver and solve the flowsheet to calculate the total work in the process. " ] diff --git a/idaes_examples/notebooks/docs/surrogates/SCO2_example/ALAMO/SCO2_flowsheet_alamo.py b/idaes_examples/notebooks/docs/surrogates/sco2/alamo/flowsheet_optimization.py similarity index 99% rename from idaes_examples/notebooks/docs/surrogates/SCO2_example/ALAMO/SCO2_flowsheet_alamo.py rename to idaes_examples/notebooks/docs/surrogates/sco2/alamo/flowsheet_optimization.py index 907fa645..7190e06b 100644 --- a/idaes_examples/notebooks/docs/surrogates/SCO2_example/ALAMO/SCO2_flowsheet_alamo.py +++ b/idaes_examples/notebooks/docs/surrogates/sco2/alamo/flowsheet_optimization.py @@ -43,7 +43,7 @@ from idaes.models.unit_models.pressure_changer import ThermodynamicAssumption from idaes.core.util.model_statistics import degrees_of_freedom from idaes.core.util.initialization import propagate_state -from SCO2_properties_alamo_surrogate import SCO2ParameterBlock +from properties import SCO2ParameterBlock import idaes.logger as idaeslog def main(): diff --git a/idaes_examples/notebooks/docs/surrogates/SCO2_example/ALAMO/SCO2_flowsheet_alamo_surrogate_doc.ipynb b/idaes_examples/notebooks/docs/surrogates/sco2/alamo/flowsheet_optimization_doc.ipynb similarity index 99% rename from idaes_examples/notebooks/docs/surrogates/SCO2_example/ALAMO/SCO2_flowsheet_alamo_surrogate_doc.ipynb rename to idaes_examples/notebooks/docs/surrogates/sco2/alamo/flowsheet_optimization_doc.ipynb index b53e1d31..7603d3e1 100644 --- a/idaes_examples/notebooks/docs/surrogates/SCO2_example/ALAMO/SCO2_flowsheet_alamo_surrogate_doc.ipynb +++ b/idaes_examples/notebooks/docs/surrogates/sco2/alamo/flowsheet_optimization_doc.ipynb @@ -24,7 +24,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "# Supercritical CO2 Property Surrogate with ALAMO Surrogate Object - SCO2_flowsheet_optimization_alamo_surrogate (Part 3)\n", + "# Supercritical CO2 Property Surrogate with ALAMO Surrogate Object - flowsheet_optimization (Part 3)\n", "\n", "Maintainer: Javal Vyas\n", "\n", @@ -97,7 +97,7 @@ "from idaes.models.unit_models.pressure_changer import ThermodynamicAssumption\n", "from idaes.core.util.model_statistics import degrees_of_freedom\n", "from idaes.core.util.initialization import propagate_state\n", - "from SCO2_properties_alamo_surrogate import SCO2ParameterBlock\n", + "from properties import SCO2ParameterBlock\n", "\n", "import idaes.logger as idaeslog\n", "\n", @@ -110,7 +110,7 @@ "source": [ "# 2. Constructing the flowsheet\n", "\n", - "To construct the flowsheet we need to define a ConcreteModel using pyomo and then add a FlowsheetBlock to the ConcreteModel. Here since we are focusing on the steady state process, we shall have the dynamic flag as False in the FlowsheetBlock. Next, we define the properties in the FlowsheetBlock that we imported from the SCO2_properties_keras_surrogate.py file. Then start adding the unit models to the FlowsheetBlock with the suitable arguements, after which we connect them using Arcs as in the flowsheet above. \n", + "To construct the flowsheet we need to define a ConcreteModel using pyomo and then add a FlowsheetBlock to the ConcreteModel. Here since we are focusing on the steady state process, we shall have the dynamic flag as False in the FlowsheetBlock. Next, we define the properties in the FlowsheetBlock that we imported from the properties.py file. Then start adding the unit models to the FlowsheetBlock with the suitable arguements, after which we connect them using Arcs as in the flowsheet above. \n", "\n", "Once we have the connected flowsheet, we initialize individual unit models. Before initializing, we fix desired variables for the desired behavior of the unit model and then use `propagate_state` to pass on the state variables to next unit model in the flowsheet. After completely initializing the flowsheet, we convert the network to a mathematical form by using `network.expand_arcs` from the TransformationFactory and apply it on the flowsheet block. Then we call the solver and solve the flowsheet to calculate the total work in the process. " ] diff --git a/idaes_examples/notebooks/docs/surrogates/SCO2_example/ALAMO/SCO2_flowsheet_alamo_surrogate_test.ipynb b/idaes_examples/notebooks/docs/surrogates/sco2/alamo/flowsheet_optimization_test.ipynb similarity index 99% rename from idaes_examples/notebooks/docs/surrogates/SCO2_example/ALAMO/SCO2_flowsheet_alamo_surrogate_test.ipynb rename to idaes_examples/notebooks/docs/surrogates/sco2/alamo/flowsheet_optimization_test.ipynb index b53e1d31..7603d3e1 100644 --- a/idaes_examples/notebooks/docs/surrogates/SCO2_example/ALAMO/SCO2_flowsheet_alamo_surrogate_test.ipynb +++ b/idaes_examples/notebooks/docs/surrogates/sco2/alamo/flowsheet_optimization_test.ipynb @@ -24,7 +24,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "# Supercritical CO2 Property Surrogate with ALAMO Surrogate Object - SCO2_flowsheet_optimization_alamo_surrogate (Part 3)\n", + "# Supercritical CO2 Property Surrogate with ALAMO Surrogate Object - flowsheet_optimization (Part 3)\n", "\n", "Maintainer: Javal Vyas\n", "\n", @@ -97,7 +97,7 @@ "from idaes.models.unit_models.pressure_changer import ThermodynamicAssumption\n", "from idaes.core.util.model_statistics import degrees_of_freedom\n", "from idaes.core.util.initialization import propagate_state\n", - "from SCO2_properties_alamo_surrogate import SCO2ParameterBlock\n", + "from properties import SCO2ParameterBlock\n", "\n", "import idaes.logger as idaeslog\n", "\n", @@ -110,7 +110,7 @@ "source": [ "# 2. Constructing the flowsheet\n", "\n", - "To construct the flowsheet we need to define a ConcreteModel using pyomo and then add a FlowsheetBlock to the ConcreteModel. Here since we are focusing on the steady state process, we shall have the dynamic flag as False in the FlowsheetBlock. Next, we define the properties in the FlowsheetBlock that we imported from the SCO2_properties_keras_surrogate.py file. Then start adding the unit models to the FlowsheetBlock with the suitable arguements, after which we connect them using Arcs as in the flowsheet above. \n", + "To construct the flowsheet we need to define a ConcreteModel using pyomo and then add a FlowsheetBlock to the ConcreteModel. Here since we are focusing on the steady state process, we shall have the dynamic flag as False in the FlowsheetBlock. Next, we define the properties in the FlowsheetBlock that we imported from the properties.py file. Then start adding the unit models to the FlowsheetBlock with the suitable arguements, after which we connect them using Arcs as in the flowsheet above. \n", "\n", "Once we have the connected flowsheet, we initialize individual unit models. Before initializing, we fix desired variables for the desired behavior of the unit model and then use `propagate_state` to pass on the state variables to next unit model in the flowsheet. After completely initializing the flowsheet, we convert the network to a mathematical form by using `network.expand_arcs` from the TransformationFactory and apply it on the flowsheet block. Then we call the solver and solve the flowsheet to calculate the total work in the process. " ] diff --git a/idaes_examples/notebooks/docs/surrogates/SCO2_example/ALAMO/SCO2_flowsheet_alamo_surrogate_usr.ipynb b/idaes_examples/notebooks/docs/surrogates/sco2/alamo/flowsheet_optimization_usr.ipynb similarity index 99% rename from idaes_examples/notebooks/docs/surrogates/SCO2_example/ALAMO/SCO2_flowsheet_alamo_surrogate_usr.ipynb rename to idaes_examples/notebooks/docs/surrogates/sco2/alamo/flowsheet_optimization_usr.ipynb index b53e1d31..7603d3e1 100644 --- a/idaes_examples/notebooks/docs/surrogates/SCO2_example/ALAMO/SCO2_flowsheet_alamo_surrogate_usr.ipynb +++ b/idaes_examples/notebooks/docs/surrogates/sco2/alamo/flowsheet_optimization_usr.ipynb @@ -24,7 +24,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "# Supercritical CO2 Property Surrogate with ALAMO Surrogate Object - SCO2_flowsheet_optimization_alamo_surrogate (Part 3)\n", + "# Supercritical CO2 Property Surrogate with ALAMO Surrogate Object - flowsheet_optimization (Part 3)\n", "\n", "Maintainer: Javal Vyas\n", "\n", @@ -97,7 +97,7 @@ "from idaes.models.unit_models.pressure_changer import ThermodynamicAssumption\n", "from idaes.core.util.model_statistics import degrees_of_freedom\n", "from idaes.core.util.initialization import propagate_state\n", - "from SCO2_properties_alamo_surrogate import SCO2ParameterBlock\n", + "from properties import SCO2ParameterBlock\n", "\n", "import idaes.logger as idaeslog\n", "\n", @@ -110,7 +110,7 @@ "source": [ "# 2. Constructing the flowsheet\n", "\n", - "To construct the flowsheet we need to define a ConcreteModel using pyomo and then add a FlowsheetBlock to the ConcreteModel. Here since we are focusing on the steady state process, we shall have the dynamic flag as False in the FlowsheetBlock. Next, we define the properties in the FlowsheetBlock that we imported from the SCO2_properties_keras_surrogate.py file. Then start adding the unit models to the FlowsheetBlock with the suitable arguements, after which we connect them using Arcs as in the flowsheet above. \n", + "To construct the flowsheet we need to define a ConcreteModel using pyomo and then add a FlowsheetBlock to the ConcreteModel. Here since we are focusing on the steady state process, we shall have the dynamic flag as False in the FlowsheetBlock. Next, we define the properties in the FlowsheetBlock that we imported from the properties.py file. Then start adding the unit models to the FlowsheetBlock with the suitable arguements, after which we connect them using Arcs as in the flowsheet above. \n", "\n", "Once we have the connected flowsheet, we initialize individual unit models. Before initializing, we fix desired variables for the desired behavior of the unit model and then use `propagate_state` to pass on the state variables to next unit model in the flowsheet. After completely initializing the flowsheet, we convert the network to a mathematical form by using `network.expand_arcs` from the TransformationFactory and apply it on the flowsheet block. Then we call the solver and solve the flowsheet to calculate the total work in the process. " ] diff --git a/idaes_examples/notebooks/docs/surrogates/SCO2_example/ALAMO/index.md b/idaes_examples/notebooks/docs/surrogates/sco2/alamo/index.md similarity index 100% rename from idaes_examples/notebooks/docs/surrogates/SCO2_example/ALAMO/index.md rename to idaes_examples/notebooks/docs/surrogates/sco2/alamo/index.md diff --git a/idaes_examples/notebooks/docs/surrogates/SCO2_example/ALAMO/SCO2_properties_alamo_surrogate.py b/idaes_examples/notebooks/docs/surrogates/sco2/alamo/properties.py similarity index 99% rename from idaes_examples/notebooks/docs/surrogates/SCO2_example/ALAMO/SCO2_properties_alamo_surrogate.py rename to idaes_examples/notebooks/docs/surrogates/sco2/alamo/properties.py index 19d12d08..3b2f8bbb 100644 --- a/idaes_examples/notebooks/docs/surrogates/SCO2_example/ALAMO/SCO2_properties_alamo_surrogate.py +++ b/idaes_examples/notebooks/docs/surrogates/sco2/alamo/properties.py @@ -18,9 +18,6 @@ """ -# Changes the divide behavior to not do integer division -from __future__ import division - # Import Python libraries import logging diff --git a/idaes_examples/notebooks/docs/surrogates/SCO2_example/ALAMO/SCO2_properties_alamo_surrogate_embedding.ipynb b/idaes_examples/notebooks/docs/surrogates/sco2/alamo/surrogate_embedding.ipynb similarity index 96% rename from idaes_examples/notebooks/docs/surrogates/SCO2_example/ALAMO/SCO2_properties_alamo_surrogate_embedding.ipynb rename to idaes_examples/notebooks/docs/surrogates/sco2/alamo/surrogate_embedding.ipynb index db7155b1..430fdbe4 100644 --- a/idaes_examples/notebooks/docs/surrogates/SCO2_example/ALAMO/SCO2_properties_alamo_surrogate_embedding.ipynb +++ b/idaes_examples/notebooks/docs/surrogates/sco2/alamo/surrogate_embedding.ipynb @@ -36,7 +36,7 @@ "\n", "Here we shall see how to integrate the trained surrogate in the custom property package. One can read more about making a properties package from read the docs. To integrate the surrogate we first define the physical paramter block which will return the properties based on the state variables. State variables would be called from the State Block as Pyomo variables. We will define the surrogate input and output as pyomo variables as well. Once we have defined the variables in the state block then we define our surrogate block.\n", "\n", - "*NOTE:* For ease of explaination the property package is written in \".ipynb\" format, ideally it should be in a python script. Each class of this package is separated in different cell for the same reason, in practive all the classes in this notebook should be part of the same python script. This folder includes \"SCO2_properties_alamo_surrogate.py\" file which is how embedding file should look like. \n", + "*NOTE:* For ease of explaination the property package is written in \".ipynb\" format, ideally it should be in a python script. Each class of this package is separated in different cell for the same reason, in practive all the classes in this notebook should be part of the same python script. This folder includes \"properties.py\" file which is how embedding file should look like. \n", "\n", "### 1.1 Steps in Creating a Property Package\n", "Creating a new property package can be broken down into the following steps, which will be demonstrated in the next part of this tutorial.\n", @@ -66,9 +66,6 @@ "metadata": {}, "outputs": [], "source": [ - "# Changes the divide behavior to not do integer division\n", - "from __future__ import division\n", - "\n", "# Import Python libraries\n", "import logging\n", "\n", @@ -192,7 +189,7 @@ "We start by defining the 5 state variables: flow_mol, pressure, temperature, enth_mol and entr_mol as the Pyomo Var, each of this variable has a unit for unit consistency. This is done in _make_state_vars function. We get the enth_mol and entr_mol variables from trained surrogate which we define in this function as well. To get the output variables from the surrogate:\n", "\n", "1. Define the input and output variables to the trained surrogate\n", - "2. Load the surrogate from the folder it is saved in, here it is saved in the folder called alamo_surrogate (look at the SCO2_alamo_surrogate.ipynb file) using the Alamopy Surrogate API of IDAES package\n", + "2. Load the surrogate from the folder it is saved in, here it is saved in the folder called alamo_surrogate (look at the alamo_training.ipynb file) using the Alamopy Surrogate API of IDAES package\n", "3. Define a `SurrogateBlock` and call the build_model method on the block with the input variables, output variables, model formulation and the loaded surrogate as the arguements. \n", "4. Define the constraints necessary for ensuring physical feasibility of the system like the mass balance and energy balance. Check for the state variables to be within the bounds. \n" ] @@ -452,7 +449,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "Now we have our property package ready for being used in the flowsheet for optimization. We shall see that in the next part of this tutorial, [SCO2_flowsheet_alamo_surrogate](https://github.com/IDAES/examples/blob/supercritcial_CO2_example/idaes_examples/notebooks/docs/surrogates/SCO2_example/ALAMO/SCO2_flowsheet_alamo_surrogate.ipynb). To learn in detail about making a custom property package, one should go through [Property Package Example](https://github.com/IDAES/examples/blob/main/idaes_examples/notebooks/docs/properties/custom/custom_physical_property_packages.ipynb). " + "Now we have our property package ready for being used in the flowsheet for optimization. We shall see that in the next part of this tutorial, [flowsheet_optimization](https://github.com/IDAES/examples/blob/supercritcial_CO2_example/idaes_examples/notebooks/docs/surrogates/sco2/alamo/flowsheet_optimization.ipynb). To learn in detail about making a custom property package, one should go through [Property Package Example](https://github.com/IDAES/examples/blob/main/idaes_examples/notebooks/docs/properties/custom/custom_physical_property_packages.ipynb). " ] } ], diff --git a/idaes_examples/notebooks/docs/surrogates/SCO2_example/ALAMO/SCO2_properties_alamo_surrogate_embedding_usr.ipynb b/idaes_examples/notebooks/docs/surrogates/sco2/alamo/surrogate_embedding_doc.ipynb similarity index 97% rename from idaes_examples/notebooks/docs/surrogates/SCO2_example/ALAMO/SCO2_properties_alamo_surrogate_embedding_usr.ipynb rename to idaes_examples/notebooks/docs/surrogates/sco2/alamo/surrogate_embedding_doc.ipynb index 6203f48f..31b5027b 100644 --- a/idaes_examples/notebooks/docs/surrogates/SCO2_example/ALAMO/SCO2_properties_alamo_surrogate_embedding_usr.ipynb +++ b/idaes_examples/notebooks/docs/surrogates/sco2/alamo/surrogate_embedding_doc.ipynb @@ -36,7 +36,7 @@ "\n", "Here we shall see how to integrate the trained surrogate in the custom property package. One can read more about making a properties package from read the docs. To integrate the surrogate we first define the physical paramter block which will return the properties based on the state variables. State variables would be called from the State Block as Pyomo variables. We will define the surrogate input and output as pyomo variables as well. Once we have defined the variables in the state block then we define our surrogate block.\n", "\n", - "*NOTE:* For ease of explaination the property package is written in \".ipynb\" format, ideally it should be in a python script. Each class of this package is separated in different cell for the same reason, in practive all the classes in this notebook should be part of the same python script. This folder includes \"SCO2_properties_alamo_surrogate.py\" file which is how embedding file should look like. \n", + "*NOTE:* For ease of explaination the property package is written in \".ipynb\" format, ideally it should be in a python script. Each class of this package is separated in different cell for the same reason, in practive all the classes in this notebook should be part of the same python script. This folder includes \"properties.py\" file which is how embedding file should look like. \n", "\n", "### 1.1 Steps in Creating a Property Package\n", "Creating a new property package can be broken down into the following steps, which will be demonstrated in the next part of this tutorial.\n", @@ -66,9 +66,6 @@ "metadata": {}, "outputs": [], "source": [ - "# Changes the divide behavior to not do integer division\n", - "from __future__ import division\n", - "\n", "# Import Python libraries\n", "import logging\n", "\n", @@ -192,7 +189,7 @@ "We start by defining the 5 state variables: flow_mol, pressure, temperature, enth_mol and entr_mol as the Pyomo Var, each of this variable has a unit for unit consistency. This is done in _make_state_vars function. We get the enth_mol and entr_mol variables from trained surrogate which we define in this function as well. To get the output variables from the surrogate:\n", "\n", "1. Define the input and output variables to the trained surrogate\n", - "2. Load the surrogate from the folder it is saved in, here it is saved in the folder called alamo_surrogate (look at the SCO2_alamo_surrogate_usr.ipynb file) using the Alamopy Surrogate API of IDAES package\n", + "2. Load the surrogate from the folder it is saved in, here it is saved in the folder called alamo_surrogate (look at the alamo_training_doc.md file) using the Alamopy Surrogate API of IDAES package\n", "3. Define a `SurrogateBlock` and call the build_model method on the block with the input variables, output variables, model formulation and the loaded surrogate as the arguements. \n", "4. Define the constraints necessary for ensuring physical feasibility of the system like the mass balance and energy balance. Check for the state variables to be within the bounds. \n" ] @@ -452,7 +449,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "Now we have our property package ready for being used in the flowsheet for optimization. We shall see that in the next part of this tutorial, [SCO2_flowsheet_alamo_surrogate](https://github.com/IDAES/examples/blob/supercritcial_CO2_example/idaes_examples/notebooks/docs/surrogates/SCO2_example/ALAMO/SCO2_flowsheet_alamo_surrogate_usr.ipynb). To learn in detail about making a custom property package, one should go through [Property Package Example](https://github.com/IDAES/examples/blob/main/idaes_examples/notebooks/docs/properties/custom/custom_physical_property_packages_usr.ipynb). " + "Now we have our property package ready for being used in the flowsheet for optimization. We shall see that in the next part of this tutorial, [flowsheet_optimization](https://github.com/IDAES/examples/blob/supercritcial_CO2_example/idaes_examples/notebooks/docs/surrogates/sco2/alamo/flowsheet_optimization_doc.md). To learn in detail about making a custom property package, one should go through [Property Package Example](https://github.com/IDAES/examples/blob/main/idaes_examples/notebooks/docs/properties/custom/custom_physical_property_packages_doc.md). " ] } ], diff --git a/idaes_examples/notebooks/docs/surrogates/SCO2_example/ALAMO/SCO2_properties_alamo_surrogate_embedding_test.ipynb b/idaes_examples/notebooks/docs/surrogates/sco2/alamo/surrogate_embedding_test.ipynb similarity index 97% rename from idaes_examples/notebooks/docs/surrogates/SCO2_example/ALAMO/SCO2_properties_alamo_surrogate_embedding_test.ipynb rename to idaes_examples/notebooks/docs/surrogates/sco2/alamo/surrogate_embedding_test.ipynb index ec7eb0a4..9640004e 100644 --- a/idaes_examples/notebooks/docs/surrogates/SCO2_example/ALAMO/SCO2_properties_alamo_surrogate_embedding_test.ipynb +++ b/idaes_examples/notebooks/docs/surrogates/sco2/alamo/surrogate_embedding_test.ipynb @@ -36,7 +36,7 @@ "\n", "Here we shall see how to integrate the trained surrogate in the custom property package. One can read more about making a properties package from read the docs. To integrate the surrogate we first define the physical paramter block which will return the properties based on the state variables. State variables would be called from the State Block as Pyomo variables. We will define the surrogate input and output as pyomo variables as well. Once we have defined the variables in the state block then we define our surrogate block.\n", "\n", - "*NOTE:* For ease of explaination the property package is written in \".ipynb\" format, ideally it should be in a python script. Each class of this package is separated in different cell for the same reason, in practive all the classes in this notebook should be part of the same python script. This folder includes \"SCO2_properties_alamo_surrogate.py\" file which is how embedding file should look like. \n", + "*NOTE:* For ease of explaination the property package is written in \".ipynb\" format, ideally it should be in a python script. Each class of this package is separated in different cell for the same reason, in practive all the classes in this notebook should be part of the same python script. This folder includes \"properties.py\" file which is how embedding file should look like. \n", "\n", "### 1.1 Steps in Creating a Property Package\n", "Creating a new property package can be broken down into the following steps, which will be demonstrated in the next part of this tutorial.\n", @@ -66,9 +66,6 @@ "metadata": {}, "outputs": [], "source": [ - "# Changes the divide behavior to not do integer division\n", - "from __future__ import division\n", - "\n", "# Import Python libraries\n", "import logging\n", "\n", @@ -192,7 +189,7 @@ "We start by defining the 5 state variables: flow_mol, pressure, temperature, enth_mol and entr_mol as the Pyomo Var, each of this variable has a unit for unit consistency. This is done in _make_state_vars function. We get the enth_mol and entr_mol variables from trained surrogate which we define in this function as well. To get the output variables from the surrogate:\n", "\n", "1. Define the input and output variables to the trained surrogate\n", - "2. Load the surrogate from the folder it is saved in, here it is saved in the folder called alamo_surrogate (look at the SCO2_alamo_surrogate_test.ipynb file) using the Alamopy Surrogate API of IDAES package\n", + "2. Load the surrogate from the folder it is saved in, here it is saved in the folder called alamo_surrogate (look at the alamo_training_test.ipynb file) using the Alamopy Surrogate API of IDAES package\n", "3. Define a `SurrogateBlock` and call the build_model method on the block with the input variables, output variables, model formulation and the loaded surrogate as the arguements. \n", "4. Define the constraints necessary for ensuring physical feasibility of the system like the mass balance and energy balance. Check for the state variables to be within the bounds. \n" ] @@ -452,7 +449,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "Now we have our property package ready for being used in the flowsheet for optimization. We shall see that in the next part of this tutorial, [SCO2_flowsheet_alamo_surrogate](https://github.com/IDAES/examples/blob/supercritcial_CO2_example/idaes_examples/notebooks/docs/surrogates/SCO2_example/ALAMO/SCO2_flowsheet_alamo_surrogate_test.ipynb). To learn in detail about making a custom property package, one should go through [Property Package Example](https://github.com/IDAES/examples/blob/main/idaes_examples/notebooks/docs/properties/custom/custom_physical_property_packages_test.ipynb). " + "Now we have our property package ready for being used in the flowsheet for optimization. We shall see that in the next part of this tutorial, [flowsheet_optimization](https://github.com/IDAES/examples/blob/supercritcial_CO2_example/idaes_examples/notebooks/docs/surrogates/sco2/alamo/flowsheet_optimization_test.ipynb). To learn in detail about making a custom property package, one should go through [Property Package Example](https://github.com/IDAES/examples/blob/main/idaes_examples/notebooks/docs/properties/custom/custom_physical_property_packages_test.ipynb). " ] } ], diff --git a/idaes_examples/notebooks/docs/surrogates/SCO2_example/ALAMO/SCO2_properties_alamo_surrogate_embedding_doc.ipynb b/idaes_examples/notebooks/docs/surrogates/sco2/alamo/surrogate_embedding_usr.ipynb similarity index 97% rename from idaes_examples/notebooks/docs/surrogates/SCO2_example/ALAMO/SCO2_properties_alamo_surrogate_embedding_doc.ipynb rename to idaes_examples/notebooks/docs/surrogates/sco2/alamo/surrogate_embedding_usr.ipynb index 001452b8..c70b43e1 100644 --- a/idaes_examples/notebooks/docs/surrogates/SCO2_example/ALAMO/SCO2_properties_alamo_surrogate_embedding_doc.ipynb +++ b/idaes_examples/notebooks/docs/surrogates/sco2/alamo/surrogate_embedding_usr.ipynb @@ -36,7 +36,7 @@ "\n", "Here we shall see how to integrate the trained surrogate in the custom property package. One can read more about making a properties package from read the docs. To integrate the surrogate we first define the physical paramter block which will return the properties based on the state variables. State variables would be called from the State Block as Pyomo variables. We will define the surrogate input and output as pyomo variables as well. Once we have defined the variables in the state block then we define our surrogate block.\n", "\n", - "*NOTE:* For ease of explaination the property package is written in \".ipynb\" format, ideally it should be in a python script. Each class of this package is separated in different cell for the same reason, in practive all the classes in this notebook should be part of the same python script. This folder includes \"SCO2_properties_alamo_surrogate.py\" file which is how embedding file should look like. \n", + "*NOTE:* For ease of explaination the property package is written in \".ipynb\" format, ideally it should be in a python script. Each class of this package is separated in different cell for the same reason, in practive all the classes in this notebook should be part of the same python script. This folder includes \"properties.py\" file which is how embedding file should look like. \n", "\n", "### 1.1 Steps in Creating a Property Package\n", "Creating a new property package can be broken down into the following steps, which will be demonstrated in the next part of this tutorial.\n", @@ -192,7 +192,7 @@ "We start by defining the 5 state variables: flow_mol, pressure, temperature, enth_mol and entr_mol as the Pyomo Var, each of this variable has a unit for unit consistency. This is done in _make_state_vars function. We get the enth_mol and entr_mol variables from trained surrogate which we define in this function as well. To get the output variables from the surrogate:\n", "\n", "1. Define the input and output variables to the trained surrogate\n", - "2. Load the surrogate from the folder it is saved in, here it is saved in the folder called alamo_surrogate (look at the SCO2_alamo_surrogate_doc.md file) using the Alamopy Surrogate API of IDAES package\n", + "2. Load the surrogate from the folder it is saved in, here it is saved in the folder called alamo_surrogate (look at the alamo_training_usr.ipynb file) using the Alamopy Surrogate API of IDAES package\n", "3. Define a `SurrogateBlock` and call the build_model method on the block with the input variables, output variables, model formulation and the loaded surrogate as the arguements. \n", "4. Define the constraints necessary for ensuring physical feasibility of the system like the mass balance and energy balance. Check for the state variables to be within the bounds. \n" ] @@ -452,7 +452,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "Now we have our property package ready for being used in the flowsheet for optimization. We shall see that in the next part of this tutorial, [SCO2_flowsheet_alamo_surrogate](https://github.com/IDAES/examples/blob/supercritcial_CO2_example/idaes_examples/notebooks/docs/surrogates/SCO2_example/ALAMO/SCO2_flowsheet_alamo_surrogate_doc.md). To learn in detail about making a custom property package, one should go through [Property Package Example](https://github.com/IDAES/examples/blob/main/idaes_examples/notebooks/docs/properties/custom/custom_physical_property_packages_doc.md). " + "Now we have our property package ready for being used in the flowsheet for optimization. We shall see that in the next part of this tutorial, [flowsheet_optimization](https://github.com/IDAES/examples/blob/supercritcial_CO2_example/idaes_examples/notebooks/docs/surrogates/sco2/alamo/flowsheet_optimization_usr.ipynb). To learn in detail about making a custom property package, one should go through [Property Package Example](https://github.com/IDAES/examples/blob/main/idaes_examples/notebooks/docs/properties/custom/custom_physical_property_packages_usr.ipynb). " ] } ], diff --git a/idaes_examples/notebooks/docs/surrogates/SCO2_example/OMLT/.mdl_co2.h5 b/idaes_examples/notebooks/docs/surrogates/sco2/omlt/.mdl_co2.h5 similarity index 100% rename from idaes_examples/notebooks/docs/surrogates/SCO2_example/OMLT/.mdl_co2.h5 rename to idaes_examples/notebooks/docs/surrogates/sco2/omlt/.mdl_co2.h5 diff --git a/idaes_examples/notebooks/docs/surrogates/SCO2_example/PySMO/__init__.py b/idaes_examples/notebooks/docs/surrogates/sco2/omlt/__init__.py similarity index 100% rename from idaes_examples/notebooks/docs/surrogates/SCO2_example/PySMO/__init__.py rename to idaes_examples/notebooks/docs/surrogates/sco2/omlt/__init__.py diff --git a/idaes_examples/notebooks/docs/surrogates/SCO2_example/OMLT/SCO2_flowsheet_keras_surrogate.ipynb b/idaes_examples/notebooks/docs/surrogates/sco2/omlt/flowsheet_optimization.ipynb similarity index 99% rename from idaes_examples/notebooks/docs/surrogates/SCO2_example/OMLT/SCO2_flowsheet_keras_surrogate.ipynb rename to idaes_examples/notebooks/docs/surrogates/sco2/omlt/flowsheet_optimization.ipynb index 0dca17be..827abb3d 100644 --- a/idaes_examples/notebooks/docs/surrogates/SCO2_example/OMLT/SCO2_flowsheet_keras_surrogate.ipynb +++ b/idaes_examples/notebooks/docs/surrogates/sco2/omlt/flowsheet_optimization.ipynb @@ -24,7 +24,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "# Supercritical CO2 Property Surrogate with OMLT Surrogate Object - SCO2_flowsheet_optimization_keras_surrogate (Part 3)\n", + "# Supercritical CO2 Property Surrogate with OMLT Surrogate Object - flowsheet_optimization (Part 3)\n", "\n", "Maintainer: Javal Vyas\n", "\n", @@ -107,7 +107,7 @@ "from idaes.models.unit_models.pressure_changer import ThermodynamicAssumption\n", "from idaes.core.util.model_statistics import degrees_of_freedom\n", "from idaes.core.util.initialization import propagate_state\n", - "from SCO2_properties_keras_surrogate import SCO2ParameterBlock\n", + "from properties import SCO2ParameterBlock\n", "\n", "import idaes.logger as idaeslog\n", "\n", @@ -120,7 +120,7 @@ "source": [ "# 2. Constructing the flowsheet\n", "\n", - "To construct the flowsheet we need to define a ConcreteModel using pyomo and then add a FlowsheetBlock to the ConcreteModel. Here since we are focusing on the steady state process, we shall have the dynamic flag as False in the FlowsheetBlock. Next, we define the properties in the FlowsheetBlock that we imported from the SCO2_properties_keras_surrogate.py file. Then start adding the unit models to the FlowsheetBlock with the suitable arguements, after which we connect them using Arcs as in the flowsheet above. \n", + "To construct the flowsheet we need to define a ConcreteModel using pyomo and then add a FlowsheetBlock to the ConcreteModel. Here since we are focusing on the steady state process, we shall have the dynamic flag as False in the FlowsheetBlock. Next, we define the properties in the FlowsheetBlock that we imported from the properties.py file. Then start adding the unit models to the FlowsheetBlock with the suitable arguements, after which we connect them using Arcs as in the flowsheet above. \n", "\n", "Once we have the connected flowsheet, we initialize individual unit models. Before initializing, we fix desired variables for the desired behavior of the unit model and then use `propagate_state` to pass on the state variables to next unit model in the flowsheet. After completely initializing the flowsheet, we convert the network to a mathematical form by using `network.expand_arcs` from the TransformationFactory and apply it on the flowsheet block. Then we call the solver and solve the flowsheet to calculate the total work in the process. " ] diff --git a/idaes_examples/notebooks/docs/surrogates/SCO2_example/OMLT/SCO2_flowsheet_keras.py b/idaes_examples/notebooks/docs/surrogates/sco2/omlt/flowsheet_optimization.py similarity index 99% rename from idaes_examples/notebooks/docs/surrogates/SCO2_example/OMLT/SCO2_flowsheet_keras.py rename to idaes_examples/notebooks/docs/surrogates/sco2/omlt/flowsheet_optimization.py index 97a43954..f8658c3e 100644 --- a/idaes_examples/notebooks/docs/surrogates/SCO2_example/OMLT/SCO2_flowsheet_keras.py +++ b/idaes_examples/notebooks/docs/surrogates/sco2/omlt/flowsheet_optimization.py @@ -43,7 +43,7 @@ from idaes.models.unit_models.pressure_changer import ThermodynamicAssumption from idaes.core.util.model_statistics import degrees_of_freedom from idaes.core.util.initialization import propagate_state -from SCO2_properties_keras_surrogate import SCO2ParameterBlock +from properties import SCO2ParameterBlock import idaes.logger as idaeslog def main(): diff --git a/idaes_examples/notebooks/docs/surrogates/SCO2_example/OMLT/SCO2_flowsheet_keras_surrogate_doc.ipynb b/idaes_examples/notebooks/docs/surrogates/sco2/omlt/flowsheet_optimization_doc.ipynb similarity index 99% rename from idaes_examples/notebooks/docs/surrogates/SCO2_example/OMLT/SCO2_flowsheet_keras_surrogate_doc.ipynb rename to idaes_examples/notebooks/docs/surrogates/sco2/omlt/flowsheet_optimization_doc.ipynb index bc4e9f41..c20d883f 100644 --- a/idaes_examples/notebooks/docs/surrogates/SCO2_example/OMLT/SCO2_flowsheet_keras_surrogate_doc.ipynb +++ b/idaes_examples/notebooks/docs/surrogates/sco2/omlt/flowsheet_optimization_doc.ipynb @@ -24,7 +24,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "# Supercritical CO2 Property Surrogate with OMLT Surrogate Object - SCO2_flowsheet_optimization_keras_surrogate (Part 3)\n", + "# Supercritical CO2 Property Surrogate with OMLT Surrogate Object - flowsheet_optimization (Part 3)\n", "\n", "Maintainer: Javal Vyas\n", "\n", @@ -97,7 +97,7 @@ "from idaes.models.unit_models.pressure_changer import ThermodynamicAssumption\n", "from idaes.core.util.model_statistics import degrees_of_freedom\n", "from idaes.core.util.initialization import propagate_state\n", - "from SCO2_properties_keras_surrogate import SCO2ParameterBlock\n", + "from properties import SCO2ParameterBlock\n", "\n", "import idaes.logger as idaeslog\n", "\n", @@ -110,7 +110,7 @@ "source": [ "# 2. Constructing the flowsheet\n", "\n", - "To construct the flowsheet we need to define a ConcreteModel using pyomo and then add a FlowsheetBlock to the ConcreteModel. Here since we are focusing on the steady state process, we shall have the dynamic flag as False in the FlowsheetBlock. Next, we define the properties in the FlowsheetBlock that we imported from the SCO2_properties_keras_surrogate.py file. Then start adding the unit models to the FlowsheetBlock with the suitable arguements, after which we connect them using Arcs as in the flowsheet above. \n", + "To construct the flowsheet we need to define a ConcreteModel using pyomo and then add a FlowsheetBlock to the ConcreteModel. Here since we are focusing on the steady state process, we shall have the dynamic flag as False in the FlowsheetBlock. Next, we define the properties in the FlowsheetBlock that we imported from the properties.py file. Then start adding the unit models to the FlowsheetBlock with the suitable arguements, after which we connect them using Arcs as in the flowsheet above. \n", "\n", "Once we have the connected flowsheet, we initialize individual unit models. Before initializing, we fix desired variables for the desired behavior of the unit model and then use `propagate_state` to pass on the state variables to next unit model in the flowsheet. After completely initializing the flowsheet, we convert the network to a mathematical form by using `network.expand_arcs` from the TransformationFactory and apply it on the flowsheet block. Then we call the solver and solve the flowsheet to calculate the total work in the process. " ] diff --git a/idaes_examples/notebooks/docs/surrogates/SCO2_example/OMLT/SCO2_flowsheet_keras_surrogate_test.ipynb b/idaes_examples/notebooks/docs/surrogates/sco2/omlt/flowsheet_optimization_test.ipynb similarity index 99% rename from idaes_examples/notebooks/docs/surrogates/SCO2_example/OMLT/SCO2_flowsheet_keras_surrogate_test.ipynb rename to idaes_examples/notebooks/docs/surrogates/sco2/omlt/flowsheet_optimization_test.ipynb index ceabe341..316819c4 100644 --- a/idaes_examples/notebooks/docs/surrogates/SCO2_example/OMLT/SCO2_flowsheet_keras_surrogate_test.ipynb +++ b/idaes_examples/notebooks/docs/surrogates/sco2/omlt/flowsheet_optimization_test.ipynb @@ -24,7 +24,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "# Supercritical CO2 Property Surrogate with OMLT Surrogate Object - SCO2_flowsheet_optimization_keras_surrogate (Part 3)\n", + "# Supercritical CO2 Property Surrogate with OMLT Surrogate Object - flowsheet_optimization (Part 3)\n", "\n", "Maintainer: Javal Vyas\n", "\n", @@ -97,7 +97,7 @@ "from idaes.models.unit_models.pressure_changer import ThermodynamicAssumption\n", "from idaes.core.util.model_statistics import degrees_of_freedom\n", "from idaes.core.util.initialization import propagate_state\n", - "from SCO2_properties_keras_surrogate import SCO2ParameterBlock\n", + "from properties import SCO2ParameterBlock\n", "\n", "import idaes.logger as idaeslog\n", "\n", @@ -110,7 +110,7 @@ "source": [ "# 2. Constructing the flowsheet\n", "\n", - "To construct the flowsheet we need to define a ConcreteModel using pyomo and then add a FlowsheetBlock to the ConcreteModel. Here since we are focusing on the steady state process, we shall have the dynamic flag as False in the FlowsheetBlock. Next, we define the properties in the FlowsheetBlock that we imported from the SCO2_properties_keras_surrogate.py file. Then start adding the unit models to the FlowsheetBlock with the suitable arguements, after which we connect them using Arcs as in the flowsheet above. \n", + "To construct the flowsheet we need to define a ConcreteModel using pyomo and then add a FlowsheetBlock to the ConcreteModel. Here since we are focusing on the steady state process, we shall have the dynamic flag as False in the FlowsheetBlock. Next, we define the properties in the FlowsheetBlock that we imported from the properties.py file. Then start adding the unit models to the FlowsheetBlock with the suitable arguements, after which we connect them using Arcs as in the flowsheet above. \n", "\n", "Once we have the connected flowsheet, we initialize individual unit models. Before initializing, we fix desired variables for the desired behavior of the unit model and then use `propagate_state` to pass on the state variables to next unit model in the flowsheet. After completely initializing the flowsheet, we convert the network to a mathematical form by using `network.expand_arcs` from the TransformationFactory and apply it on the flowsheet block. Then we call the solver and solve the flowsheet to calculate the total work in the process. " ] diff --git a/idaes_examples/notebooks/docs/surrogates/SCO2_example/OMLT/SCO2_flowsheet_keras_surrogate_usr.ipynb b/idaes_examples/notebooks/docs/surrogates/sco2/omlt/flowsheet_optimization_usr.ipynb similarity index 99% rename from idaes_examples/notebooks/docs/surrogates/SCO2_example/OMLT/SCO2_flowsheet_keras_surrogate_usr.ipynb rename to idaes_examples/notebooks/docs/surrogates/sco2/omlt/flowsheet_optimization_usr.ipynb index ceabe341..316819c4 100644 --- a/idaes_examples/notebooks/docs/surrogates/SCO2_example/OMLT/SCO2_flowsheet_keras_surrogate_usr.ipynb +++ b/idaes_examples/notebooks/docs/surrogates/sco2/omlt/flowsheet_optimization_usr.ipynb @@ -24,7 +24,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "# Supercritical CO2 Property Surrogate with OMLT Surrogate Object - SCO2_flowsheet_optimization_keras_surrogate (Part 3)\n", + "# Supercritical CO2 Property Surrogate with OMLT Surrogate Object - flowsheet_optimization (Part 3)\n", "\n", "Maintainer: Javal Vyas\n", "\n", @@ -97,7 +97,7 @@ "from idaes.models.unit_models.pressure_changer import ThermodynamicAssumption\n", "from idaes.core.util.model_statistics import degrees_of_freedom\n", "from idaes.core.util.initialization import propagate_state\n", - "from SCO2_properties_keras_surrogate import SCO2ParameterBlock\n", + "from properties import SCO2ParameterBlock\n", "\n", "import idaes.logger as idaeslog\n", "\n", @@ -110,7 +110,7 @@ "source": [ "# 2. Constructing the flowsheet\n", "\n", - "To construct the flowsheet we need to define a ConcreteModel using pyomo and then add a FlowsheetBlock to the ConcreteModel. Here since we are focusing on the steady state process, we shall have the dynamic flag as False in the FlowsheetBlock. Next, we define the properties in the FlowsheetBlock that we imported from the SCO2_properties_keras_surrogate.py file. Then start adding the unit models to the FlowsheetBlock with the suitable arguements, after which we connect them using Arcs as in the flowsheet above. \n", + "To construct the flowsheet we need to define a ConcreteModel using pyomo and then add a FlowsheetBlock to the ConcreteModel. Here since we are focusing on the steady state process, we shall have the dynamic flag as False in the FlowsheetBlock. Next, we define the properties in the FlowsheetBlock that we imported from the properties.py file. Then start adding the unit models to the FlowsheetBlock with the suitable arguements, after which we connect them using Arcs as in the flowsheet above. \n", "\n", "Once we have the connected flowsheet, we initialize individual unit models. Before initializing, we fix desired variables for the desired behavior of the unit model and then use `propagate_state` to pass on the state variables to next unit model in the flowsheet. After completely initializing the flowsheet, we convert the network to a mathematical form by using `network.expand_arcs` from the TransformationFactory and apply it on the flowsheet block. Then we call the solver and solve the flowsheet to calculate the total work in the process. " ] diff --git a/idaes_examples/notebooks/docs/surrogates/SCO2_example/OMLT/index.md b/idaes_examples/notebooks/docs/surrogates/sco2/omlt/index.md similarity index 100% rename from idaes_examples/notebooks/docs/surrogates/SCO2_example/OMLT/index.md rename to idaes_examples/notebooks/docs/surrogates/sco2/omlt/index.md diff --git a/idaes_examples/notebooks/docs/surrogates/SCO2_example/OMLT/SCO2_keras_surrogate.ipynb b/idaes_examples/notebooks/docs/surrogates/sco2/omlt/keras_training.ipynb similarity index 99% rename from idaes_examples/notebooks/docs/surrogates/SCO2_example/OMLT/SCO2_keras_surrogate.ipynb rename to idaes_examples/notebooks/docs/surrogates/sco2/omlt/keras_training.ipynb index 18f11772..ecb167ba 100644 --- a/idaes_examples/notebooks/docs/surrogates/SCO2_example/OMLT/SCO2_keras_surrogate.ipynb +++ b/idaes_examples/notebooks/docs/surrogates/sco2/omlt/keras_training.ipynb @@ -1085,7 +1085,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "Now, the surrogate is trained and validated, we shall embed it in the property package, which is demonstrated in the [SCO2_properties_keras_surrogate_embedding.ipynb](https://github.com/IDAES/examples/blob/supercritcial_CO2_example/idaes_examples/notebooks/docs/surrogates/SCO2_example/OMLT/SCO2_properties_keras_surrogate_embedding.ipynb.ipynb) file." + "Now, the surrogate is trained and validated, we shall embed it in the property package, which is demonstrated in the [surrogate_embedding.ipynb](https://github.com/IDAES/examples/blob/supercritcial_CO2_example/idaes_examples/notebooks/docs/surrogates/sco2/omlt/surrogate_embedding.ipynb.ipynb) file." ] } ], diff --git a/idaes_examples/notebooks/docs/surrogates/SCO2_example/OMLT/SCO2_keras_surrogate_doc.ipynb b/idaes_examples/notebooks/docs/surrogates/sco2/omlt/keras_training_doc.ipynb similarity index 99% rename from idaes_examples/notebooks/docs/surrogates/SCO2_example/OMLT/SCO2_keras_surrogate_doc.ipynb rename to idaes_examples/notebooks/docs/surrogates/sco2/omlt/keras_training_doc.ipynb index 20615f2e..565b6514 100644 --- a/idaes_examples/notebooks/docs/surrogates/SCO2_example/OMLT/SCO2_keras_surrogate_doc.ipynb +++ b/idaes_examples/notebooks/docs/surrogates/sco2/omlt/keras_training_doc.ipynb @@ -1075,7 +1075,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "Now, the surrogate is trained and validated, we shall embed it in the property package, which is demonstrated in the [SCO2_properties_keras_surrogate_embedding_doc.md](https://github.com/IDAES/examples/blob/supercritcial_CO2_example/idaes_examples/notebooks/docs/surrogates/SCO2_example/OMLT/SCO2_properties_keras_surrogate_embedding.ipynb_doc.md) file." + "Now, the surrogate is trained and validated, we shall embed it in the property package, which is demonstrated in the [surrogate_embedding_doc.md](https://github.com/IDAES/examples/blob/supercritcial_CO2_example/idaes_examples/notebooks/docs/surrogates/sco2/omlt/surrogate_embedding.ipynb_doc.md) file." ] } ], diff --git a/idaes_examples/notebooks/docs/surrogates/SCO2_example/OMLT/SCO2_keras_surrogate_test.ipynb b/idaes_examples/notebooks/docs/surrogates/sco2/omlt/keras_training_test.ipynb similarity index 99% rename from idaes_examples/notebooks/docs/surrogates/SCO2_example/OMLT/SCO2_keras_surrogate_test.ipynb rename to idaes_examples/notebooks/docs/surrogates/sco2/omlt/keras_training_test.ipynb index b1cf32a4..bff0eb63 100644 --- a/idaes_examples/notebooks/docs/surrogates/SCO2_example/OMLT/SCO2_keras_surrogate_test.ipynb +++ b/idaes_examples/notebooks/docs/surrogates/sco2/omlt/keras_training_test.ipynb @@ -1075,7 +1075,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "Now, the surrogate is trained and validated, we shall embed it in the property package, which is demonstrated in the [SCO2_properties_keras_surrogate_embedding_test.ipynb](https://github.com/IDAES/examples/blob/supercritcial_CO2_example/idaes_examples/notebooks/docs/surrogates/SCO2_example/OMLT/SCO2_properties_keras_surrogate_embedding.ipynb_test.ipynb) file." + "Now, the surrogate is trained and validated, we shall embed it in the property package, which is demonstrated in the [surrogate_embedding_test.ipynb](https://github.com/IDAES/examples/blob/supercritcial_CO2_example/idaes_examples/notebooks/docs/surrogates/sco2/omlt/surrogate_embedding.ipynb_test.ipynb) file." ] } ], diff --git a/idaes_examples/notebooks/docs/surrogates/SCO2_example/OMLT/SCO2_keras_surrogate_usr.ipynb b/idaes_examples/notebooks/docs/surrogates/sco2/omlt/keras_training_usr.ipynb similarity index 99% rename from idaes_examples/notebooks/docs/surrogates/SCO2_example/OMLT/SCO2_keras_surrogate_usr.ipynb rename to idaes_examples/notebooks/docs/surrogates/sco2/omlt/keras_training_usr.ipynb index a2caf1f2..2f3ab63c 100644 --- a/idaes_examples/notebooks/docs/surrogates/SCO2_example/OMLT/SCO2_keras_surrogate_usr.ipynb +++ b/idaes_examples/notebooks/docs/surrogates/sco2/omlt/keras_training_usr.ipynb @@ -1075,7 +1075,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "Now, the surrogate is trained and validated, we shall embed it in the property package, which is demonstrated in the [SCO2_properties_keras_surrogate_embedding_usr.ipynb](https://github.com/IDAES/examples/blob/supercritcial_CO2_example/idaes_examples/notebooks/docs/surrogates/SCO2_example/OMLT/SCO2_properties_keras_surrogate_embedding.ipynb_usr.ipynb) file." + "Now, the surrogate is trained and validated, we shall embed it in the property package, which is demonstrated in the [surrogate_embedding_usr.ipynb](https://github.com/IDAES/examples/blob/supercritcial_CO2_example/idaes_examples/notebooks/docs/surrogates/sco2/omlt/surrogate_embedding.ipynb_usr.ipynb) file." ] } ], diff --git a/idaes_examples/notebooks/docs/surrogates/SCO2_example/OMLT/SCO2_properties_keras_surrogate.py b/idaes_examples/notebooks/docs/surrogates/sco2/omlt/properties.py similarity index 99% rename from idaes_examples/notebooks/docs/surrogates/SCO2_example/OMLT/SCO2_properties_keras_surrogate.py rename to idaes_examples/notebooks/docs/surrogates/sco2/omlt/properties.py index c3a358b2..7ebce138 100644 --- a/idaes_examples/notebooks/docs/surrogates/SCO2_example/OMLT/SCO2_properties_keras_surrogate.py +++ b/idaes_examples/notebooks/docs/surrogates/sco2/omlt/properties.py @@ -23,9 +23,6 @@ Valid Temperature Range = 306.25 K to 1000 K """ -# Changes the divide behavior to not do integer division -from __future__ import division - # Import Python libraries import logging diff --git a/idaes_examples/notebooks/docs/surrogates/SCO2_example/OMLT/SCO2_properties_keras_surrogate_embedding.ipynb b/idaes_examples/notebooks/docs/surrogates/sco2/omlt/surrogate_embedding.ipynb similarity index 96% rename from idaes_examples/notebooks/docs/surrogates/SCO2_example/OMLT/SCO2_properties_keras_surrogate_embedding.ipynb rename to idaes_examples/notebooks/docs/surrogates/sco2/omlt/surrogate_embedding.ipynb index 5409a830..58726e40 100644 --- a/idaes_examples/notebooks/docs/surrogates/SCO2_example/OMLT/SCO2_properties_keras_surrogate_embedding.ipynb +++ b/idaes_examples/notebooks/docs/surrogates/sco2/omlt/surrogate_embedding.ipynb @@ -36,7 +36,7 @@ "\n", "Here we shall see how to integrate the trained surrogate in the custom property package. One can read more about making a properties package from read the docs. To integrate the surrogate we first define the physical paramter block which will return the properties based on the state variables. State variables would be called from the State Block as Pyomo variables. We will define the surrogate input and output as pyomo variables as well. Once we have defined the variables in the state block then we define our surrogate block.\n", "\n", - "*NOTE:* For ease of explaination the property package is written in \".ipynb\" format, ideally it should be in a python script. Each class of this package is separated in different cell for the same reason, in practive all the classes in this notebook should be part of the same python script. This folder includes \"SCO2_properties_keras_surrogate.py\" file which is how embedding file should look like. \n", + "*NOTE:* For ease of explaination the property package is written in \".ipynb\" format, ideally it should be in a python script. Each class of this package is separated in different cell for the same reason, in practive all the classes in this notebook should be part of the same python script. This folder includes \"properties.py\" file which is how embedding file should look like. \n", "\n", "### 1.1 Steps in Creating a Property Package\n", "Creating a new property package can be broken down into the following steps, which will be demonstrated in the next part of this tutorial.\n", @@ -66,9 +66,6 @@ "metadata": {}, "outputs": [], "source": [ - "# Changes the divide behavior to not do integer division\n", - "from __future__ import division\n", - "\n", "# Import Python libraries\n", "import logging\n", "\n", @@ -192,7 +189,7 @@ "We start by defining the 5 state variables: flow_mol, pressure, temperature, enth_mol and entr_mol as the Pyomo Var, each of this variable has a unit for unit consistency. This is done in _make_state_vars function. We get the enth_mol and entr_mol variables from trained surrogate which we define in this function as well. To get the output variables from the surrogate:\n", "\n", "1. Define the input and output variables to the trained surrogate\n", - "2. Load the surrogate from the folder it is saved in, here it is saved in the folder called keras_surrogate (look at the SCO2_keras_surrogate.ipynb file) using the keras Surrogate API of IDAES package\n", + "2. Load the surrogate from the folder it is saved in, here it is saved in the folder called keras_surrogate (look at the keras_training.ipynb file) using the keras Surrogate API of IDAES package\n", "3. Define a `SurrogateBlock` and call the build_model method on the block with the input variables, output variables, model formulation and the loaded surrogate as the arguements. \n", "4. Define the constraints necessary for ensuring physical feasibility of the system like the mass balance and energy balance. Check for the state variables to be within the bounds. \n" ] @@ -447,7 +444,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "Now we have our property package ready for being used in the flowsheet for optimization. We shall see that in the next part of this tutorial, [SCO2_flowsheet_keras_surrogate](https://github.com/IDAES/examples/blob/supercritcial_CO2_example/idaes_examples/notebooks/docs/surrogates/SCO2_example/OMLT/SCO2_flowsheet_keras_surrogate.ipynb). To learn in detail about making a custom property package, one should go through [Property Package Example](https://github.com/IDAES/examples/blob/main/idaes_examples/notebooks/docs/properties/custom/custom_physical_property_packages.ipynb). " + "Now we have our property package ready for being used in the flowsheet for optimization. We shall see that in the next part of this tutorial, [flowsheet_optimization](https://github.com/IDAES/examples/blob/supercritcial_CO2_example/idaes_examples/notebooks/docs/surrogates/sco2/omlt/flowsheet_optimization.ipynb). To learn in detail about making a custom property package, one should go through [Property Package Example](https://github.com/IDAES/examples/blob/main/idaes_examples/notebooks/docs/properties/custom/custom_physical_property_packages.ipynb). " ] } ], diff --git a/idaes_examples/notebooks/docs/surrogates/SCO2_example/OMLT/SCO2_properties_keras_surrogate_embedding_doc.ipynb b/idaes_examples/notebooks/docs/surrogates/sco2/omlt/surrogate_embedding_doc.ipynb similarity index 97% rename from idaes_examples/notebooks/docs/surrogates/SCO2_example/OMLT/SCO2_properties_keras_surrogate_embedding_doc.ipynb rename to idaes_examples/notebooks/docs/surrogates/sco2/omlt/surrogate_embedding_doc.ipynb index 63687e26..82ef41ba 100644 --- a/idaes_examples/notebooks/docs/surrogates/SCO2_example/OMLT/SCO2_properties_keras_surrogate_embedding_doc.ipynb +++ b/idaes_examples/notebooks/docs/surrogates/sco2/omlt/surrogate_embedding_doc.ipynb @@ -35,7 +35,7 @@ "\n", "Here we shall see how to integrate the trained surrogate in the custom property package. One can read more about making a properties package from read the docs. To integrate the surrogate we first define the physical paramter block which will return the properties based on the state variables. State variables would be called from the State Block as Pyomo variables. We will define the surrogate input and output as pyomo variables as well. Once we have defined the variables in the state block then we define our surrogate block.\n", "\n", - "*NOTE:* For ease of explaination the property package is written in \".ipynb\" format, ideally it should be in a python script. Each class of this package is separated in different cell for the same reason, in practive all the classes in this notebook should be part of the same python script. This folder includes \"SCO2_properties_keras_surrogate.py\" file which is how embedding file should look like. \n", + "*NOTE:* For ease of explaination the property package is written in \".ipynb\" format, ideally it should be in a python script. Each class of this package is separated in different cell for the same reason, in practive all the classes in this notebook should be part of the same python script. This folder includes \"properties.py\" file which is how embedding file should look like. \n", "\n", "### 1.1 Steps in Creating a Property Package\n", "Creating a new property package can be broken down into the following steps, which will be demonstrated in the next part of this tutorial.\n", @@ -65,9 +65,6 @@ "metadata": {}, "outputs": [], "source": [ - "# Changes the divide behavior to not do integer division\n", - "from __future__ import division\n", - "\n", "# Import Python libraries\n", "import logging\n", "\n", @@ -191,7 +188,7 @@ "We start by defining the 5 state variables: flow_mol, pressure, temperature, enth_mol and entr_mol as the Pyomo Var, each of this variable has a unit for unit consistency. This is done in _make_state_vars function. We get the enth_mol and entr_mol variables from trained surrogate which we define in this function as well. To get the output variables from the surrogate:\n", "\n", "1. Define the input and output variables to the trained surrogate\n", - "2. Load the surrogate from the folder it is saved in, here it is saved in the folder called keras_surrogate (look at the SCO2_keras_surrogate_doc.md file) using the keras Surrogate API of IDAES package\n", + "2. Load the surrogate from the folder it is saved in, here it is saved in the folder called keras_surrogate (look at the keras_training_doc.md file) using the keras Surrogate API of IDAES package\n", "3. Define a `SurrogateBlock` and call the build_model method on the block with the input variables, output variables, model formulation and the loaded surrogate as the arguements. \n", "4. Define the constraints necessary for ensuring physical feasibility of the system like the mass balance and energy balance. Check for the state variables to be within the bounds. \n" ] @@ -446,7 +443,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "Now we have our property package ready for being used in the flowsheet for optimization. We shall see that in the next part of this tutorial, [SCO2_flowsheet_keras_surrogate](https://github.com/IDAES/examples/blob/supercritcial_CO2_example/idaes_examples/notebooks/docs/surrogates/SCO2_example/OMLT/SCO2_flowsheet_keras_surrogate_doc.md). To learn in detail about making a custom property package, one should go through [Property Package Example](https://github.com/IDAES/examples/blob/main/idaes_examples/notebooks/docs/properties/custom/custom_physical_property_packages_doc.md). " + "Now we have our property package ready for being used in the flowsheet for optimization. We shall see that in the next part of this tutorial, [flowsheet_optimization](https://github.com/IDAES/examples/blob/supercritcial_CO2_example/idaes_examples/notebooks/docs/surrogates/sco2/omlt/flowsheet_optimization_doc.md). To learn in detail about making a custom property package, one should go through [Property Package Example](https://github.com/IDAES/examples/blob/main/idaes_examples/notebooks/docs/properties/custom/custom_physical_property_packages_doc.md). " ] } ], diff --git a/idaes_examples/notebooks/docs/surrogates/SCO2_example/OMLT/SCO2_properties_keras_surrogate_embedding_usr.ipynb b/idaes_examples/notebooks/docs/surrogates/sco2/omlt/surrogate_embedding_test.ipynb similarity index 97% rename from idaes_examples/notebooks/docs/surrogates/SCO2_example/OMLT/SCO2_properties_keras_surrogate_embedding_usr.ipynb rename to idaes_examples/notebooks/docs/surrogates/sco2/omlt/surrogate_embedding_test.ipynb index db5ff278..12e2a7ac 100644 --- a/idaes_examples/notebooks/docs/surrogates/SCO2_example/OMLT/SCO2_properties_keras_surrogate_embedding_usr.ipynb +++ b/idaes_examples/notebooks/docs/surrogates/sco2/omlt/surrogate_embedding_test.ipynb @@ -35,7 +35,7 @@ "\n", "Here we shall see how to integrate the trained surrogate in the custom property package. One can read more about making a properties package from read the docs. To integrate the surrogate we first define the physical paramter block which will return the properties based on the state variables. State variables would be called from the State Block as Pyomo variables. We will define the surrogate input and output as pyomo variables as well. Once we have defined the variables in the state block then we define our surrogate block.\n", "\n", - "*NOTE:* For ease of explaination the property package is written in \".ipynb\" format, ideally it should be in a python script. Each class of this package is separated in different cell for the same reason, in practive all the classes in this notebook should be part of the same python script. This folder includes \"SCO2_properties_keras_surrogate.py\" file which is how embedding file should look like. \n", + "*NOTE:* For ease of explaination the property package is written in \".ipynb\" format, ideally it should be in a python script. Each class of this package is separated in different cell for the same reason, in practive all the classes in this notebook should be part of the same python script. This folder includes \"properties.py\" file which is how embedding file should look like. \n", "\n", "### 1.1 Steps in Creating a Property Package\n", "Creating a new property package can be broken down into the following steps, which will be demonstrated in the next part of this tutorial.\n", @@ -65,9 +65,6 @@ "metadata": {}, "outputs": [], "source": [ - "# Changes the divide behavior to not do integer division\n", - "from __future__ import division\n", - "\n", "# Import Python libraries\n", "import logging\n", "\n", @@ -191,7 +188,7 @@ "We start by defining the 5 state variables: flow_mol, pressure, temperature, enth_mol and entr_mol as the Pyomo Var, each of this variable has a unit for unit consistency. This is done in _make_state_vars function. We get the enth_mol and entr_mol variables from trained surrogate which we define in this function as well. To get the output variables from the surrogate:\n", "\n", "1. Define the input and output variables to the trained surrogate\n", - "2. Load the surrogate from the folder it is saved in, here it is saved in the folder called keras_surrogate (look at the SCO2_keras_surrogate_usr.ipynb file) using the keras Surrogate API of IDAES package\n", + "2. Load the surrogate from the folder it is saved in, here it is saved in the folder called keras_surrogate (look at the keras_training_test.ipynb file) using the keras Surrogate API of IDAES package\n", "3. Define a `SurrogateBlock` and call the build_model method on the block with the input variables, output variables, model formulation and the loaded surrogate as the arguements. \n", "4. Define the constraints necessary for ensuring physical feasibility of the system like the mass balance and energy balance. Check for the state variables to be within the bounds. \n" ] @@ -446,7 +443,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "Now we have our property package ready for being used in the flowsheet for optimization. We shall see that in the next part of this tutorial, [SCO2_flowsheet_keras_surrogate](https://github.com/IDAES/examples/blob/supercritcial_CO2_example/idaes_examples/notebooks/docs/surrogates/SCO2_example/OMLT/SCO2_flowsheet_keras_surrogate_usr.ipynb). To learn in detail about making a custom property package, one should go through [Property Package Example](https://github.com/IDAES/examples/blob/main/idaes_examples/notebooks/docs/properties/custom/custom_physical_property_packages_usr.ipynb). " + "Now we have our property package ready for being used in the flowsheet for optimization. We shall see that in the next part of this tutorial, [flowsheet_optimization](https://github.com/IDAES/examples/blob/supercritcial_CO2_example/idaes_examples/notebooks/docs/surrogates/sco2/omlt/flowsheet_optimization_test.ipynb). To learn in detail about making a custom property package, one should go through [Property Package Example](https://github.com/IDAES/examples/blob/main/idaes_examples/notebooks/docs/properties/custom/custom_physical_property_packages_test.ipynb). " ] } ], diff --git a/idaes_examples/notebooks/docs/surrogates/SCO2_example/OMLT/SCO2_properties_keras_surrogate_embedding_test.ipynb b/idaes_examples/notebooks/docs/surrogates/sco2/omlt/surrogate_embedding_usr.ipynb similarity index 97% rename from idaes_examples/notebooks/docs/surrogates/SCO2_example/OMLT/SCO2_properties_keras_surrogate_embedding_test.ipynb rename to idaes_examples/notebooks/docs/surrogates/sco2/omlt/surrogate_embedding_usr.ipynb index 12a59982..67a78b77 100644 --- a/idaes_examples/notebooks/docs/surrogates/SCO2_example/OMLT/SCO2_properties_keras_surrogate_embedding_test.ipynb +++ b/idaes_examples/notebooks/docs/surrogates/sco2/omlt/surrogate_embedding_usr.ipynb @@ -35,7 +35,7 @@ "\n", "Here we shall see how to integrate the trained surrogate in the custom property package. One can read more about making a properties package from read the docs. To integrate the surrogate we first define the physical paramter block which will return the properties based on the state variables. State variables would be called from the State Block as Pyomo variables. We will define the surrogate input and output as pyomo variables as well. Once we have defined the variables in the state block then we define our surrogate block.\n", "\n", - "*NOTE:* For ease of explaination the property package is written in \".ipynb\" format, ideally it should be in a python script. Each class of this package is separated in different cell for the same reason, in practive all the classes in this notebook should be part of the same python script. This folder includes \"SCO2_properties_keras_surrogate.py\" file which is how embedding file should look like. \n", + "*NOTE:* For ease of explaination the property package is written in \".ipynb\" format, ideally it should be in a python script. Each class of this package is separated in different cell for the same reason, in practive all the classes in this notebook should be part of the same python script. This folder includes \"properties.py\" file which is how embedding file should look like. \n", "\n", "### 1.1 Steps in Creating a Property Package\n", "Creating a new property package can be broken down into the following steps, which will be demonstrated in the next part of this tutorial.\n", @@ -65,9 +65,6 @@ "metadata": {}, "outputs": [], "source": [ - "# Changes the divide behavior to not do integer division\n", - "from __future__ import division\n", - "\n", "# Import Python libraries\n", "import logging\n", "\n", @@ -191,7 +188,7 @@ "We start by defining the 5 state variables: flow_mol, pressure, temperature, enth_mol and entr_mol as the Pyomo Var, each of this variable has a unit for unit consistency. This is done in _make_state_vars function. We get the enth_mol and entr_mol variables from trained surrogate which we define in this function as well. To get the output variables from the surrogate:\n", "\n", "1. Define the input and output variables to the trained surrogate\n", - "2. Load the surrogate from the folder it is saved in, here it is saved in the folder called keras_surrogate (look at the SCO2_keras_surrogate_test.ipynb file) using the keras Surrogate API of IDAES package\n", + "2. Load the surrogate from the folder it is saved in, here it is saved in the folder called keras_surrogate (look at the keras_training_usr.ipynb file) using the keras Surrogate API of IDAES package\n", "3. Define a `SurrogateBlock` and call the build_model method on the block with the input variables, output variables, model formulation and the loaded surrogate as the arguements. \n", "4. Define the constraints necessary for ensuring physical feasibility of the system like the mass balance and energy balance. Check for the state variables to be within the bounds. \n" ] @@ -446,7 +443,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "Now we have our property package ready for being used in the flowsheet for optimization. We shall see that in the next part of this tutorial, [SCO2_flowsheet_keras_surrogate](https://github.com/IDAES/examples/blob/supercritcial_CO2_example/idaes_examples/notebooks/docs/surrogates/SCO2_example/OMLT/SCO2_flowsheet_keras_surrogate_test.ipynb). To learn in detail about making a custom property package, one should go through [Property Package Example](https://github.com/IDAES/examples/blob/main/idaes_examples/notebooks/docs/properties/custom/custom_physical_property_packages_test.ipynb). " + "Now we have our property package ready for being used in the flowsheet for optimization. We shall see that in the next part of this tutorial, [flowsheet_optimization](https://github.com/IDAES/examples/blob/supercritcial_CO2_example/idaes_examples/notebooks/docs/surrogates/sco2/omlt/flowsheet_optimization_usr.ipynb). To learn in detail about making a custom property package, one should go through [Property Package Example](https://github.com/IDAES/examples/blob/main/idaes_examples/notebooks/docs/properties/custom/custom_physical_property_packages_usr.ipynb). " ] } ], diff --git a/idaes_examples/notebooks/docs/surrogates/SCO2_example/__init__.py b/idaes_examples/notebooks/docs/surrogates/sco2/pysmo/__init__.py similarity index 100% rename from idaes_examples/notebooks/docs/surrogates/SCO2_example/__init__.py rename to idaes_examples/notebooks/docs/surrogates/sco2/pysmo/__init__.py diff --git a/idaes_examples/notebooks/docs/surrogates/SCO2_example/PySMO/SCO2_flowsheet_pysmo_surrogate.ipynb b/idaes_examples/notebooks/docs/surrogates/sco2/pysmo/flowsheet_optimization.ipynb similarity index 99% rename from idaes_examples/notebooks/docs/surrogates/SCO2_example/PySMO/SCO2_flowsheet_pysmo_surrogate.ipynb rename to idaes_examples/notebooks/docs/surrogates/sco2/pysmo/flowsheet_optimization.ipynb index 309674e0..a535274c 100644 --- a/idaes_examples/notebooks/docs/surrogates/SCO2_example/PySMO/SCO2_flowsheet_pysmo_surrogate.ipynb +++ b/idaes_examples/notebooks/docs/surrogates/sco2/pysmo/flowsheet_optimization.ipynb @@ -24,7 +24,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "# Supercritical CO2 Property Surrogate with PySMO Surrogate Object - SCO2_flowsheet_optimization_pysmo_surrogate (Part 3)\n", + "# Supercritical CO2 Property Surrogate with PySMO Surrogate Object - flowsheet_optimization (Part 3)\n", "\n", "\n", "Maintainer: Javal Vyas\n", @@ -99,7 +99,7 @@ "from idaes.models.unit_models.pressure_changer import ThermodynamicAssumption\n", "from idaes.core.util.model_statistics import degrees_of_freedom\n", "from idaes.core.util.initialization import propagate_state\n", - "from SCO2_properties_pysmo_surrogate import SCO2ParameterBlock\n", + "from properties import SCO2ParameterBlock\n", "\n", "import idaes.logger as idaeslog\n", "\n", @@ -112,7 +112,7 @@ "source": [ "# 2. Constructing the flowsheet\n", "\n", - "To construct the flowsheet we need to define a ConcreteModel using pyomo and then add a FlowsheetBlock to the ConcreteModel. Here since we are focusing on the steady state process, we shall have the dynamic flag as False in the FlowsheetBlock. Next, we define the properties in the FlowsheetBlock that we imported from the SCO2_properties_keras_surrogate.py file. Then start adding the unit models to the FlowsheetBlock with the suitable arguements, after which we connect them using Arcs as in the flowsheet above. \n", + "To construct the flowsheet we need to define a ConcreteModel using pyomo and then add a FlowsheetBlock to the ConcreteModel. Here since we are focusing on the steady state process, we shall have the dynamic flag as False in the FlowsheetBlock. Next, we define the properties in the FlowsheetBlock that we imported from the properties.py file. Then start adding the unit models to the FlowsheetBlock with the suitable arguements, after which we connect them using Arcs as in the flowsheet above. \n", "\n", "Once we have the connected flowsheet, we initialize individual unit models. Before initializing, we fix desired variables for the desired behavior of the unit model and then use `propagate_state` to pass on the state variables to next unit model in the flowsheet. After completely initializing the flowsheet, we convert the network to a mathematical form by using `network.expand_arcs` from the TransformationFactory and apply it on the flowsheet block. Then we call the solver and solve the flowsheet to calculate the total work in the process. " ] diff --git a/idaes_examples/notebooks/docs/surrogates/SCO2_example/PySMO/SCO2_flowsheet_pysmo.py b/idaes_examples/notebooks/docs/surrogates/sco2/pysmo/flowsheet_optimization.py similarity index 99% rename from idaes_examples/notebooks/docs/surrogates/SCO2_example/PySMO/SCO2_flowsheet_pysmo.py rename to idaes_examples/notebooks/docs/surrogates/sco2/pysmo/flowsheet_optimization.py index d0911dbc..80f14165 100644 --- a/idaes_examples/notebooks/docs/surrogates/SCO2_example/PySMO/SCO2_flowsheet_pysmo.py +++ b/idaes_examples/notebooks/docs/surrogates/sco2/pysmo/flowsheet_optimization.py @@ -43,7 +43,7 @@ from idaes.models.unit_models.pressure_changer import ThermodynamicAssumption from idaes.core.util.model_statistics import degrees_of_freedom from idaes.core.util.initialization import propagate_state -from SCO2_properties_pysmo_surrogate import SCO2ParameterBlock +from properties import SCO2ParameterBlock import idaes.logger as idaeslog def main(): diff --git a/idaes_examples/notebooks/docs/surrogates/SCO2_example/PySMO/SCO2_flowsheet_pysmo_surrogate_doc.ipynb b/idaes_examples/notebooks/docs/surrogates/sco2/pysmo/flowsheet_optimization_doc.ipynb similarity index 99% rename from idaes_examples/notebooks/docs/surrogates/SCO2_example/PySMO/SCO2_flowsheet_pysmo_surrogate_doc.ipynb rename to idaes_examples/notebooks/docs/surrogates/sco2/pysmo/flowsheet_optimization_doc.ipynb index fffedd14..5ab2578c 100644 --- a/idaes_examples/notebooks/docs/surrogates/SCO2_example/PySMO/SCO2_flowsheet_pysmo_surrogate_doc.ipynb +++ b/idaes_examples/notebooks/docs/surrogates/sco2/pysmo/flowsheet_optimization_doc.ipynb @@ -24,7 +24,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "# Supercritical CO2 Property Surrogate with PySMO Surrogate Object - SCO2_flowsheet_optimization_pysmo_surrogate (Part 3)\n", + "# Supercritical CO2 Property Surrogate with PySMO Surrogate Object - flowsheet_optimization (Part 3)\n", "\n", "Maintainer: Javal Vyas\n", "\n", @@ -97,7 +97,7 @@ "from idaes.models.unit_models.pressure_changer import ThermodynamicAssumption\n", "from idaes.core.util.model_statistics import degrees_of_freedom\n", "from idaes.core.util.initialization import propagate_state\n", - "from SCO2_properties_pysmo_surrogate import SCO2ParameterBlock\n", + "from properties import SCO2ParameterBlock\n", "\n", "import idaes.logger as idaeslog\n", "\n", @@ -110,7 +110,7 @@ "source": [ "# 2. Constructing the flowsheet\n", "\n", - "To construct the flowsheet we need to define a ConcreteModel using pyomo and then add a FlowsheetBlock to the ConcreteModel. Here since we are focusing on the steady state process, we shall have the dynamic flag as False in the FlowsheetBlock. Next, we define the properties in the FlowsheetBlock that we imported from the SCO2_properties_keras_surrogate.py file. Then start adding the unit models to the FlowsheetBlock with the suitable arguements, after which we connect them using Arcs as in the flowsheet above. \n", + "To construct the flowsheet we need to define a ConcreteModel using pyomo and then add a FlowsheetBlock to the ConcreteModel. Here since we are focusing on the steady state process, we shall have the dynamic flag as False in the FlowsheetBlock. Next, we define the properties in the FlowsheetBlock that we imported from the properties.py file. Then start adding the unit models to the FlowsheetBlock with the suitable arguements, after which we connect them using Arcs as in the flowsheet above. \n", "\n", "Once we have the connected flowsheet, we initialize individual unit models. Before initializing, we fix desired variables for the desired behavior of the unit model and then use `propagate_state` to pass on the state variables to next unit model in the flowsheet. After completely initializing the flowsheet, we convert the network to a mathematical form by using `network.expand_arcs` from the TransformationFactory and apply it on the flowsheet block. Then we call the solver and solve the flowsheet to calculate the total work in the process. " ] diff --git a/idaes_examples/notebooks/docs/surrogates/SCO2_example/PySMO/SCO2_flowsheet_pysmo_surrogate_test.ipynb b/idaes_examples/notebooks/docs/surrogates/sco2/pysmo/flowsheet_optimization_test.ipynb similarity index 99% rename from idaes_examples/notebooks/docs/surrogates/SCO2_example/PySMO/SCO2_flowsheet_pysmo_surrogate_test.ipynb rename to idaes_examples/notebooks/docs/surrogates/sco2/pysmo/flowsheet_optimization_test.ipynb index fffedd14..5ab2578c 100644 --- a/idaes_examples/notebooks/docs/surrogates/SCO2_example/PySMO/SCO2_flowsheet_pysmo_surrogate_test.ipynb +++ b/idaes_examples/notebooks/docs/surrogates/sco2/pysmo/flowsheet_optimization_test.ipynb @@ -24,7 +24,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "# Supercritical CO2 Property Surrogate with PySMO Surrogate Object - SCO2_flowsheet_optimization_pysmo_surrogate (Part 3)\n", + "# Supercritical CO2 Property Surrogate with PySMO Surrogate Object - flowsheet_optimization (Part 3)\n", "\n", "Maintainer: Javal Vyas\n", "\n", @@ -97,7 +97,7 @@ "from idaes.models.unit_models.pressure_changer import ThermodynamicAssumption\n", "from idaes.core.util.model_statistics import degrees_of_freedom\n", "from idaes.core.util.initialization import propagate_state\n", - "from SCO2_properties_pysmo_surrogate import SCO2ParameterBlock\n", + "from properties import SCO2ParameterBlock\n", "\n", "import idaes.logger as idaeslog\n", "\n", @@ -110,7 +110,7 @@ "source": [ "# 2. Constructing the flowsheet\n", "\n", - "To construct the flowsheet we need to define a ConcreteModel using pyomo and then add a FlowsheetBlock to the ConcreteModel. Here since we are focusing on the steady state process, we shall have the dynamic flag as False in the FlowsheetBlock. Next, we define the properties in the FlowsheetBlock that we imported from the SCO2_properties_keras_surrogate.py file. Then start adding the unit models to the FlowsheetBlock with the suitable arguements, after which we connect them using Arcs as in the flowsheet above. \n", + "To construct the flowsheet we need to define a ConcreteModel using pyomo and then add a FlowsheetBlock to the ConcreteModel. Here since we are focusing on the steady state process, we shall have the dynamic flag as False in the FlowsheetBlock. Next, we define the properties in the FlowsheetBlock that we imported from the properties.py file. Then start adding the unit models to the FlowsheetBlock with the suitable arguements, after which we connect them using Arcs as in the flowsheet above. \n", "\n", "Once we have the connected flowsheet, we initialize individual unit models. Before initializing, we fix desired variables for the desired behavior of the unit model and then use `propagate_state` to pass on the state variables to next unit model in the flowsheet. After completely initializing the flowsheet, we convert the network to a mathematical form by using `network.expand_arcs` from the TransformationFactory and apply it on the flowsheet block. Then we call the solver and solve the flowsheet to calculate the total work in the process. " ] diff --git a/idaes_examples/notebooks/docs/surrogates/SCO2_example/PySMO/SCO2_flowsheet_pysmo_surrogate_usr.ipynb b/idaes_examples/notebooks/docs/surrogates/sco2/pysmo/flowsheet_optimization_usr.ipynb similarity index 99% rename from idaes_examples/notebooks/docs/surrogates/SCO2_example/PySMO/SCO2_flowsheet_pysmo_surrogate_usr.ipynb rename to idaes_examples/notebooks/docs/surrogates/sco2/pysmo/flowsheet_optimization_usr.ipynb index fffedd14..5ab2578c 100644 --- a/idaes_examples/notebooks/docs/surrogates/SCO2_example/PySMO/SCO2_flowsheet_pysmo_surrogate_usr.ipynb +++ b/idaes_examples/notebooks/docs/surrogates/sco2/pysmo/flowsheet_optimization_usr.ipynb @@ -24,7 +24,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "# Supercritical CO2 Property Surrogate with PySMO Surrogate Object - SCO2_flowsheet_optimization_pysmo_surrogate (Part 3)\n", + "# Supercritical CO2 Property Surrogate with PySMO Surrogate Object - flowsheet_optimization (Part 3)\n", "\n", "Maintainer: Javal Vyas\n", "\n", @@ -97,7 +97,7 @@ "from idaes.models.unit_models.pressure_changer import ThermodynamicAssumption\n", "from idaes.core.util.model_statistics import degrees_of_freedom\n", "from idaes.core.util.initialization import propagate_state\n", - "from SCO2_properties_pysmo_surrogate import SCO2ParameterBlock\n", + "from properties import SCO2ParameterBlock\n", "\n", "import idaes.logger as idaeslog\n", "\n", @@ -110,7 +110,7 @@ "source": [ "# 2. Constructing the flowsheet\n", "\n", - "To construct the flowsheet we need to define a ConcreteModel using pyomo and then add a FlowsheetBlock to the ConcreteModel. Here since we are focusing on the steady state process, we shall have the dynamic flag as False in the FlowsheetBlock. Next, we define the properties in the FlowsheetBlock that we imported from the SCO2_properties_keras_surrogate.py file. Then start adding the unit models to the FlowsheetBlock with the suitable arguements, after which we connect them using Arcs as in the flowsheet above. \n", + "To construct the flowsheet we need to define a ConcreteModel using pyomo and then add a FlowsheetBlock to the ConcreteModel. Here since we are focusing on the steady state process, we shall have the dynamic flag as False in the FlowsheetBlock. Next, we define the properties in the FlowsheetBlock that we imported from the properties.py file. Then start adding the unit models to the FlowsheetBlock with the suitable arguements, after which we connect them using Arcs as in the flowsheet above. \n", "\n", "Once we have the connected flowsheet, we initialize individual unit models. Before initializing, we fix desired variables for the desired behavior of the unit model and then use `propagate_state` to pass on the state variables to next unit model in the flowsheet. After completely initializing the flowsheet, we convert the network to a mathematical form by using `network.expand_arcs` from the TransformationFactory and apply it on the flowsheet block. Then we call the solver and solve the flowsheet to calculate the total work in the process. " ] diff --git a/idaes_examples/notebooks/docs/surrogates/SCO2_example/PySMO/index.md b/idaes_examples/notebooks/docs/surrogates/sco2/pysmo/index.md similarity index 100% rename from idaes_examples/notebooks/docs/surrogates/SCO2_example/PySMO/index.md rename to idaes_examples/notebooks/docs/surrogates/sco2/pysmo/index.md diff --git a/idaes_examples/notebooks/docs/surrogates/SCO2_example/PySMO/SCO2_properties_pysmo_surrogate.py b/idaes_examples/notebooks/docs/surrogates/sco2/pysmo/properties.py similarity index 99% rename from idaes_examples/notebooks/docs/surrogates/SCO2_example/PySMO/SCO2_properties_pysmo_surrogate.py rename to idaes_examples/notebooks/docs/surrogates/sco2/pysmo/properties.py index bb9d9013..accad220 100644 --- a/idaes_examples/notebooks/docs/surrogates/SCO2_example/PySMO/SCO2_properties_pysmo_surrogate.py +++ b/idaes_examples/notebooks/docs/surrogates/sco2/pysmo/properties.py @@ -23,9 +23,6 @@ """ -# Changes the divide behavior to not do integer division -from __future__ import division - # Import Python libraries import logging diff --git a/idaes_examples/notebooks/docs/surrogates/SCO2_example/PySMO/SCO2_pysmo_surrogate.ipynb b/idaes_examples/notebooks/docs/surrogates/sco2/pysmo/pysmo_training.ipynb similarity index 99% rename from idaes_examples/notebooks/docs/surrogates/SCO2_example/PySMO/SCO2_pysmo_surrogate.ipynb rename to idaes_examples/notebooks/docs/surrogates/sco2/pysmo/pysmo_training.ipynb index 3cc125c6..02898325 100644 --- a/idaes_examples/notebooks/docs/surrogates/SCO2_example/PySMO/SCO2_pysmo_surrogate.ipynb +++ b/idaes_examples/notebooks/docs/surrogates/sco2/pysmo/pysmo_training.ipynb @@ -627,7 +627,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "Now, the surrogate is trained and validated, we shall embed it in the property package, which is demonstrated in the [SCO2_properties_pysmo_surrogate_embedding](https://github.com/IDAES/examples/blob/supercritcial_CO2_example/idaes_examples/notebooks/docs/surrogates/SCO2_example/PySMO/SCO2_properties_pysmo_surrogate_embedding.ipynb) file." + "Now, the surrogate is trained and validated, we shall embed it in the property package, which is demonstrated in the [surrogate_embedding](https://github.com/IDAES/examples/blob/supercritcial_CO2_example/idaes_examples/notebooks/docs/surrogates/sco2/pysmo/surrogate_embedding.ipynb) file." ] } ], diff --git a/idaes_examples/notebooks/docs/surrogates/SCO2_example/PySMO/SCO2_pysmo_surrogate_doc.ipynb b/idaes_examples/notebooks/docs/surrogates/sco2/pysmo/pysmo_training_doc.ipynb similarity index 99% rename from idaes_examples/notebooks/docs/surrogates/SCO2_example/PySMO/SCO2_pysmo_surrogate_doc.ipynb rename to idaes_examples/notebooks/docs/surrogates/sco2/pysmo/pysmo_training_doc.ipynb index 7627974f..6fbb5b53 100644 --- a/idaes_examples/notebooks/docs/surrogates/SCO2_example/PySMO/SCO2_pysmo_surrogate_doc.ipynb +++ b/idaes_examples/notebooks/docs/surrogates/sco2/pysmo/pysmo_training_doc.ipynb @@ -627,7 +627,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "Now, the surrogate is trained and validated, we shall embed it in the property package, which is demonstrated in the [SCO2_properties_pysmo_surrogate_embedding](https://github.com/IDAES/examples/blob/supercritcial_CO2_example/idaes_examples/notebooks/docs/surrogates/SCO2_example/PySMO/SCO2_properties_pysmo_surrogate_embedding_doc.md) file." + "Now, the surrogate is trained and validated, we shall embed it in the property package, which is demonstrated in the [surrogate_embedding](https://github.com/IDAES/examples/blob/supercritcial_CO2_example/idaes_examples/notebooks/docs/surrogates/sco2/pysmo/surrogate_embedding_doc.md) file." ] } ], diff --git a/idaes_examples/notebooks/docs/surrogates/SCO2_example/PySMO/SCO2_pysmo_surrogate_test.ipynb b/idaes_examples/notebooks/docs/surrogates/sco2/pysmo/pysmo_training_test.ipynb similarity index 99% rename from idaes_examples/notebooks/docs/surrogates/SCO2_example/PySMO/SCO2_pysmo_surrogate_test.ipynb rename to idaes_examples/notebooks/docs/surrogates/sco2/pysmo/pysmo_training_test.ipynb index f0a8b7a9..96cce342 100644 --- a/idaes_examples/notebooks/docs/surrogates/SCO2_example/PySMO/SCO2_pysmo_surrogate_test.ipynb +++ b/idaes_examples/notebooks/docs/surrogates/sco2/pysmo/pysmo_training_test.ipynb @@ -627,7 +627,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "Now, the surrogate is trained and validated, we shall embed it in the property package, which is demonstrated in the [SCO2_properties_pysmo_surrogate_embedding](https://github.com/IDAES/examples/blob/supercritcial_CO2_example/idaes_examples/notebooks/docs/surrogates/SCO2_example/PySMO/SCO2_properties_pysmo_surrogate_embedding_test.ipynb) file." + "Now, the surrogate is trained and validated, we shall embed it in the property package, which is demonstrated in the [surrogate_embedding](https://github.com/IDAES/examples/blob/supercritcial_CO2_example/idaes_examples/notebooks/docs/surrogates/sco2/pysmo/surrogate_embedding_test.ipynb) file." ] } ], diff --git a/idaes_examples/notebooks/docs/surrogates/SCO2_example/PySMO/SCO2_pysmo_surrogate_usr.ipynb b/idaes_examples/notebooks/docs/surrogates/sco2/pysmo/pysmo_training_usr.ipynb similarity index 99% rename from idaes_examples/notebooks/docs/surrogates/SCO2_example/PySMO/SCO2_pysmo_surrogate_usr.ipynb rename to idaes_examples/notebooks/docs/surrogates/sco2/pysmo/pysmo_training_usr.ipynb index 48499bba..b489f502 100644 --- a/idaes_examples/notebooks/docs/surrogates/SCO2_example/PySMO/SCO2_pysmo_surrogate_usr.ipynb +++ b/idaes_examples/notebooks/docs/surrogates/sco2/pysmo/pysmo_training_usr.ipynb @@ -627,7 +627,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "Now, the surrogate is trained and validated, we shall embed it in the property package, which is demonstrated in the [SCO2_properties_pysmo_surrogate_embedding](https://github.com/IDAES/examples/blob/supercritcial_CO2_example/idaes_examples/notebooks/docs/surrogates/SCO2_example/PySMO/SCO2_properties_pysmo_surrogate_embedding_usr.ipynb) file." + "Now, the surrogate is trained and validated, we shall embed it in the property package, which is demonstrated in the [surrogate_embedding](https://github.com/IDAES/examples/blob/supercritcial_CO2_example/idaes_examples/notebooks/docs/surrogates/sco2/pysmo/surrogate_embedding_usr.ipynb) file." ] } ], diff --git a/idaes_examples/notebooks/docs/surrogates/SCO2_example/PySMO/SCO2_properties_pysmo_surrogate_embedding.ipynb b/idaes_examples/notebooks/docs/surrogates/sco2/pysmo/surrogate_embedding.ipynb similarity index 96% rename from idaes_examples/notebooks/docs/surrogates/SCO2_example/PySMO/SCO2_properties_pysmo_surrogate_embedding.ipynb rename to idaes_examples/notebooks/docs/surrogates/sco2/pysmo/surrogate_embedding.ipynb index 67e4c6c4..56df32cb 100644 --- a/idaes_examples/notebooks/docs/surrogates/SCO2_example/PySMO/SCO2_properties_pysmo_surrogate_embedding.ipynb +++ b/idaes_examples/notebooks/docs/surrogates/sco2/pysmo/surrogate_embedding.ipynb @@ -34,7 +34,7 @@ "\n", "Here we shall see how to integrate the trained surrogate in the custom property package. One can read more about making a properties package from read the docs. To integrate the surrogate we first define the physical paramter block which will return the properties based on the state variables. State variables would be called from the State Block as Pyomo variables. We will define the surrogate input and output as pyomo variables as well. Once we have defined the variables in the state block then we define our surrogate block.\n", "\n", - "*NOTE:* For ease of explaination the property package is written in \".ipynb\" format, ideally it should be in a python script. Each class of this package is separated in different cell for the same reason, in practive all the classes in this notebook should be part of the same python script. This folder includes \"SCO2_properties_pysmo_surrogate.py\" file which is how embedding file should look like. \n", + "*NOTE:* For ease of explaination the property package is written in \".ipynb\" format, ideally it should be in a python script. Each class of this package is separated in different cell for the same reason, in practive all the classes in this notebook should be part of the same python script. This folder includes \"properties.py\" file which is how embedding file should look like. \n", "\n", "### 1.1 Steps in Creating a Property Package\n", "Creating a new property package can be broken down into the following steps, which will be demonstrated in the next part of this tutorial.\n", @@ -64,9 +64,6 @@ "metadata": {}, "outputs": [], "source": [ - "# Changes the divide behavior to not do integer division\n", - "from __future__ import division\n", - "\n", "# Import Python libraries\n", "import logging\n", "\n", @@ -191,7 +188,7 @@ "We start by defining the 5 state variables: flow_mol, pressure, temperature, enth_mol and entr_mol as the Pyomo Var, each of this variable has a unit for unit consistency. This is done in _make_state_vars function. We get the enth_mol and entr_mol variables from trained surrogate which we define in this function as well. To get the output variables from the surrogate:\n", "\n", "1. Define the input and output variables to the trained surrogate\n", - "2. Load the surrogate from the folder it is saved in, here it is saved in the folder called pysmo_surrogate (look at the SCO2_pysmo_surrogate.ipynb file) using the PySMO Surrogate API of IDAES package\n", + "2. Load the surrogate from the folder it is saved in, here it is saved in the folder called pysmo_surrogate (look at the pysmo_training.ipynb file) using the PySMO Surrogate API of IDAES package\n", "3. Define a `SurrogateBlock` and call the build_model method on the block with the input variables, output variables, model formulation and the loaded surrogate as the arguements. \n", "4. Define the constraints necessary for ensuring physical feasibility of the system like the mass balance and energy balance. Check for the state variables to be within the bounds. \n" ] @@ -449,7 +446,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "Now we have our property package ready for being used in the flowsheet for optimization. We shall see that in the next part of this tutorial, [SCO2_flowsheet_pysmo_surrogate](https://github.com/IDAES/examples/blob/supercritcial_CO2_example/idaes_examples/notebooks/docs/surrogates/SCO2_example/PySMO/SCO2_flowsheet_pysmo_surrogate.ipynb). To learn in detail about making a custom property package, one should go through [Property Package Example](https://github.com/IDAES/examples/blob/main/idaes_examples/notebooks/docs/properties/custom/custom_physical_property_packages.ipynb). " + "Now we have our property package ready for being used in the flowsheet for optimization. We shall see that in the next part of this tutorial, [flowsheet_optimization](https://github.com/IDAES/examples/blob/supercritcial_CO2_example/idaes_examples/notebooks/docs/surrogates/sco2/pysmo/flowsheet_optimization.ipynb). To learn in detail about making a custom property package, one should go through [Property Package Example](https://github.com/IDAES/examples/blob/main/idaes_examples/notebooks/docs/properties/custom/custom_physical_property_packages.ipynb). " ] } ], diff --git a/idaes_examples/notebooks/docs/surrogates/SCO2_example/PySMO/SCO2_properties_pysmo_surrogate_embedding_doc.ipynb b/idaes_examples/notebooks/docs/surrogates/sco2/pysmo/surrogate_embedding_doc.ipynb similarity index 97% rename from idaes_examples/notebooks/docs/surrogates/SCO2_example/PySMO/SCO2_properties_pysmo_surrogate_embedding_doc.ipynb rename to idaes_examples/notebooks/docs/surrogates/sco2/pysmo/surrogate_embedding_doc.ipynb index 2b0df77f..3c647096 100644 --- a/idaes_examples/notebooks/docs/surrogates/SCO2_example/PySMO/SCO2_properties_pysmo_surrogate_embedding_doc.ipynb +++ b/idaes_examples/notebooks/docs/surrogates/sco2/pysmo/surrogate_embedding_doc.ipynb @@ -34,7 +34,7 @@ "\n", "Here we shall see how to integrate the trained surrogate in the custom property package. One can read more about making a properties package from read the docs. To integrate the surrogate we first define the physical paramter block which will return the properties based on the state variables. State variables would be called from the State Block as Pyomo variables. We will define the surrogate input and output as pyomo variables as well. Once we have defined the variables in the state block then we define our surrogate block.\n", "\n", - "*NOTE:* For ease of explaination the property package is written in \".ipynb\" format, ideally it should be in a python script. Each class of this package is separated in different cell for the same reason, in practive all the classes in this notebook should be part of the same python script. This folder includes \"SCO2_properties_pysmo_surrogate.py\" file which is how embedding file should look like. \n", + "*NOTE:* For ease of explaination the property package is written in \".ipynb\" format, ideally it should be in a python script. Each class of this package is separated in different cell for the same reason, in practive all the classes in this notebook should be part of the same python script. This folder includes \"properties.py\" file which is how embedding file should look like. \n", "\n", "### 1.1 Steps in Creating a Property Package\n", "Creating a new property package can be broken down into the following steps, which will be demonstrated in the next part of this tutorial.\n", @@ -64,9 +64,6 @@ "metadata": {}, "outputs": [], "source": [ - "# Changes the divide behavior to not do integer division\n", - "from __future__ import division\n", - "\n", "# Import Python libraries\n", "import logging\n", "\n", @@ -191,7 +188,7 @@ "We start by defining the 5 state variables: flow_mol, pressure, temperature, enth_mol and entr_mol as the Pyomo Var, each of this variable has a unit for unit consistency. This is done in _make_state_vars function. We get the enth_mol and entr_mol variables from trained surrogate which we define in this function as well. To get the output variables from the surrogate:\n", "\n", "1. Define the input and output variables to the trained surrogate\n", - "2. Load the surrogate from the folder it is saved in, here it is saved in the folder called pysmo_surrogate (look at the SCO2_pysmo_surrogate_doc.md file) using the PySMO Surrogate API of IDAES package\n", + "2. Load the surrogate from the folder it is saved in, here it is saved in the folder called pysmo_surrogate (look at the pysmo_training_doc.md file) using the PySMO Surrogate API of IDAES package\n", "3. Define a `SurrogateBlock` and call the build_model method on the block with the input variables, output variables, model formulation and the loaded surrogate as the arguements. \n", "4. Define the constraints necessary for ensuring physical feasibility of the system like the mass balance and energy balance. Check for the state variables to be within the bounds. \n" ] @@ -449,7 +446,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "Now we have our property package ready for being used in the flowsheet for optimization. We shall see that in the next part of this tutorial, [SCO2_flowsheet_pysmo_surrogate](https://github.com/IDAES/examples/blob/supercritcial_CO2_example/idaes_examples/notebooks/docs/surrogates/SCO2_example/PySMO/SCO2_flowsheet_pysmo_surrogate_doc.md). To learn in detail about making a custom property package, one should go through [Property Package Example](https://github.com/IDAES/examples/blob/main/idaes_examples/notebooks/docs/properties/custom/custom_physical_property_packages_doc.md). " + "Now we have our property package ready for being used in the flowsheet for optimization. We shall see that in the next part of this tutorial, [flowsheet_optimization](https://github.com/IDAES/examples/blob/supercritcial_CO2_example/idaes_examples/notebooks/docs/surrogates/sco2/pysmo/flowsheet_optimization_doc.md). To learn in detail about making a custom property package, one should go through [Property Package Example](https://github.com/IDAES/examples/blob/main/idaes_examples/notebooks/docs/properties/custom/custom_physical_property_packages_doc.md). " ] } ], diff --git a/idaes_examples/notebooks/docs/surrogates/SCO2_example/PySMO/SCO2_properties_pysmo_surrogate_embedding_usr.ipynb b/idaes_examples/notebooks/docs/surrogates/sco2/pysmo/surrogate_embedding_test.ipynb similarity index 97% rename from idaes_examples/notebooks/docs/surrogates/SCO2_example/PySMO/SCO2_properties_pysmo_surrogate_embedding_usr.ipynb rename to idaes_examples/notebooks/docs/surrogates/sco2/pysmo/surrogate_embedding_test.ipynb index 725d6397..df1dfb7d 100644 --- a/idaes_examples/notebooks/docs/surrogates/SCO2_example/PySMO/SCO2_properties_pysmo_surrogate_embedding_usr.ipynb +++ b/idaes_examples/notebooks/docs/surrogates/sco2/pysmo/surrogate_embedding_test.ipynb @@ -34,7 +34,7 @@ "\n", "Here we shall see how to integrate the trained surrogate in the custom property package. One can read more about making a properties package from read the docs. To integrate the surrogate we first define the physical paramter block which will return the properties based on the state variables. State variables would be called from the State Block as Pyomo variables. We will define the surrogate input and output as pyomo variables as well. Once we have defined the variables in the state block then we define our surrogate block.\n", "\n", - "*NOTE:* For ease of explaination the property package is written in \".ipynb\" format, ideally it should be in a python script. Each class of this package is separated in different cell for the same reason, in practive all the classes in this notebook should be part of the same python script. This folder includes \"SCO2_properties_pysmo_surrogate.py\" file which is how embedding file should look like. \n", + "*NOTE:* For ease of explaination the property package is written in \".ipynb\" format, ideally it should be in a python script. Each class of this package is separated in different cell for the same reason, in practive all the classes in this notebook should be part of the same python script. This folder includes \"properties.py\" file which is how embedding file should look like. \n", "\n", "### 1.1 Steps in Creating a Property Package\n", "Creating a new property package can be broken down into the following steps, which will be demonstrated in the next part of this tutorial.\n", @@ -64,9 +64,6 @@ "metadata": {}, "outputs": [], "source": [ - "# Changes the divide behavior to not do integer division\n", - "from __future__ import division\n", - "\n", "# Import Python libraries\n", "import logging\n", "\n", @@ -191,7 +188,7 @@ "We start by defining the 5 state variables: flow_mol, pressure, temperature, enth_mol and entr_mol as the Pyomo Var, each of this variable has a unit for unit consistency. This is done in _make_state_vars function. We get the enth_mol and entr_mol variables from trained surrogate which we define in this function as well. To get the output variables from the surrogate:\n", "\n", "1. Define the input and output variables to the trained surrogate\n", - "2. Load the surrogate from the folder it is saved in, here it is saved in the folder called pysmo_surrogate (look at the SCO2_pysmo_surrogate_usr.ipynb file) using the PySMO Surrogate API of IDAES package\n", + "2. Load the surrogate from the folder it is saved in, here it is saved in the folder called pysmo_surrogate (look at the pysmo_training_test.ipynb file) using the PySMO Surrogate API of IDAES package\n", "3. Define a `SurrogateBlock` and call the build_model method on the block with the input variables, output variables, model formulation and the loaded surrogate as the arguements. \n", "4. Define the constraints necessary for ensuring physical feasibility of the system like the mass balance and energy balance. Check for the state variables to be within the bounds. \n" ] @@ -449,7 +446,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "Now we have our property package ready for being used in the flowsheet for optimization. We shall see that in the next part of this tutorial, [SCO2_flowsheet_pysmo_surrogate](https://github.com/IDAES/examples/blob/supercritcial_CO2_example/idaes_examples/notebooks/docs/surrogates/SCO2_example/PySMO/SCO2_flowsheet_pysmo_surrogate_usr.ipynb). To learn in detail about making a custom property package, one should go through [Property Package Example](https://github.com/IDAES/examples/blob/main/idaes_examples/notebooks/docs/properties/custom/custom_physical_property_packages_usr.ipynb). " + "Now we have our property package ready for being used in the flowsheet for optimization. We shall see that in the next part of this tutorial, [flowsheet_optimization](https://github.com/IDAES/examples/blob/supercritcial_CO2_example/idaes_examples/notebooks/docs/surrogates/sco2/pysmo/flowsheet_optimization_test.ipynb). To learn in detail about making a custom property package, one should go through [Property Package Example](https://github.com/IDAES/examples/blob/main/idaes_examples/notebooks/docs/properties/custom/custom_physical_property_packages_test.ipynb). " ] } ], diff --git a/idaes_examples/notebooks/docs/surrogates/SCO2_example/PySMO/SCO2_properties_pysmo_surrogate_embedding_test.ipynb b/idaes_examples/notebooks/docs/surrogates/sco2/pysmo/surrogate_embedding_usr.ipynb similarity index 96% rename from idaes_examples/notebooks/docs/surrogates/SCO2_example/PySMO/SCO2_properties_pysmo_surrogate_embedding_test.ipynb rename to idaes_examples/notebooks/docs/surrogates/sco2/pysmo/surrogate_embedding_usr.ipynb index ef19a6dc..9e9b06b6 100644 --- a/idaes_examples/notebooks/docs/surrogates/SCO2_example/PySMO/SCO2_properties_pysmo_surrogate_embedding_test.ipynb +++ b/idaes_examples/notebooks/docs/surrogates/sco2/pysmo/surrogate_embedding_usr.ipynb @@ -34,7 +34,7 @@ "\n", "Here we shall see how to integrate the trained surrogate in the custom property package. One can read more about making a properties package from read the docs. To integrate the surrogate we first define the physical paramter block which will return the properties based on the state variables. State variables would be called from the State Block as Pyomo variables. We will define the surrogate input and output as pyomo variables as well. Once we have defined the variables in the state block then we define our surrogate block.\n", "\n", - "*NOTE:* For ease of explaination the property package is written in \".ipynb\" format, ideally it should be in a python script. Each class of this package is separated in different cell for the same reason, in practive all the classes in this notebook should be part of the same python script. This folder includes \"SCO2_properties_pysmo_surrogate.py\" file which is how embedding file should look like. \n", + "*NOTE:* For ease of explaination the property package is written in \".ipynb\" format, ideally it should be in a python script. Each class of this package is separated in different cell for the same reason, in practive all the classes in this notebook should be part of the same python script. This folder includes \"properties.py\" file which is how embedding file should look like. \n", "\n", "### 1.1 Steps in Creating a Property Package\n", "Creating a new property package can be broken down into the following steps, which will be demonstrated in the next part of this tutorial.\n", @@ -64,9 +64,6 @@ "metadata": {}, "outputs": [], "source": [ - "# Changes the divide behavior to not do integer division\n", - "from __future__ import division\n", - "\n", "# Import Python libraries\n", "import logging\n", "\n", @@ -175,7 +172,7 @@ " 'length': units.m,\n", " 'mass': units.kg,\n", " 'amount': units.mol,\n", - " 'temperature': units.K})" + " 'temperatureo': units.K})" ] }, { @@ -191,7 +188,7 @@ "We start by defining the 5 state variables: flow_mol, pressure, temperature, enth_mol and entr_mol as the Pyomo Var, each of this variable has a unit for unit consistency. This is done in _make_state_vars function. We get the enth_mol and entr_mol variables from trained surrogate which we define in this function as well. To get the output variables from the surrogate:\n", "\n", "1. Define the input and output variables to the trained surrogate\n", - "2. Load the surrogate from the folder it is saved in, here it is saved in the folder called pysmo_surrogate (look at the SCO2_pysmo_surrogate_test.ipynb file) using the PySMO Surrogate API of IDAES package\n", + "2. Load the surrogate from the folder it is saved in, here it is saved in the folder called pysmo_surrogate (look at the pysmo_training_usr.ipynb file) using the PySMO Surrogate API of IDAES package\n", "3. Define a `SurrogateBlock` and call the build_model method on the block with the input variables, output variables, model formulation and the loaded surrogate as the arguements. \n", "4. Define the constraints necessary for ensuring physical feasibility of the system like the mass balance and energy balance. Check for the state variables to be within the bounds. \n" ] @@ -449,7 +446,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "Now we have our property package ready for being used in the flowsheet for optimization. We shall see that in the next part of this tutorial, [SCO2_flowsheet_pysmo_surrogate](https://github.com/IDAES/examples/blob/supercritcial_CO2_example/idaes_examples/notebooks/docs/surrogates/SCO2_example/PySMO/SCO2_flowsheet_pysmo_surrogate_test.ipynb). To learn in detail about making a custom property package, one should go through [Property Package Example](https://github.com/IDAES/examples/blob/main/idaes_examples/notebooks/docs/properties/custom/custom_physical_property_packages_test.ipynb). " + "Now we have our property package ready for being used in the flowsheet for optimization. We shall see that in the next part of this tutorial, [flowsheet_optimization](https://github.com/IDAES/examples/blob/supercritcial_CO2_example/idaes_examples/notebooks/docs/surrogates/sco2/pysmo/flowsheet_optimization_usr.ipynb). To learn in detail about making a custom property package, one should go through [Property Package Example](https://github.com/IDAES/examples/blob/main/idaes_examples/notebooks/docs/properties/custom/custom_physical_property_packages_usr.ipynb). " ] } ],