Skip to content

Commit

Permalink
apply black
Browse files Browse the repository at this point in the history
  • Loading branch information
JavalVyas2000 committed Apr 30, 2024
1 parent 5ddd40c commit 6356d0e
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@
"source": [
"from importlib import resources\n",
"from pareto.utilities.get_data import get_data\n",
"from pareto.models_extra.CM_module.set_param_list import (\n",
" set_list,\n",
" parameter_list)\n",
"from pareto.models_extra.CM_module.set_param_list import set_list, parameter_list\n",
"from pareto.models_extra.CM_module.cm_utils.data_parser import data_parser\n",
"from pareto.models_extra.Integrate_desal.integrated_models.integrated_optimization_md import integrated_model_build\n",
"from pareto.models_extra.Integrate_desal.integrated_models.integrated_optimization_md import (\n",
" integrated_model_build,\n",
")\n",
"import pyomo.environ as pyo"
]
},
Expand All @@ -44,12 +44,12 @@
"outputs": [],
"source": [
"with resources.path(\n",
" \"pareto.case_studies\",\n",
" \"integrated_desalination_demo.xlsx\",\n",
" ) as fpath:\n",
" [df_sets, df_parameters] = get_data(fpath, set_list, parameter_list)\n",
" \"pareto.case_studies\",\n",
" \"integrated_desalination_demo.xlsx\",\n",
") as fpath:\n",
" [df_sets, df_parameters] = get_data(fpath, set_list, parameter_list)\n",
"\n",
" network_data = data_parser(df_sets, df_parameters)"
" network_data = data_parser(df_sets, df_parameters)"
]
},
{
Expand Down Expand Up @@ -109,7 +109,7 @@
"ipopt = pyo.SolverFactory(\"ipopt\")\n",
"ipopt.options[\"mu_init\"] = 1e-6\n",
"ipopt.options[\"bound_push\"] = 1e-6\n",
"ipopt.solve(m, tee = True)"
"ipopt.solve(m, tee=True)"
]
},
{
Expand All @@ -134,7 +134,7 @@
"print(\"######### Costing Variables (USD) #############\")\n",
"print(\"=================================================================\")\n",
"print(\"Piping cost\")\n",
"print(pyo.value(m.m_network.arc_cost)) \n",
"print(pyo.value(m.m_network.arc_cost))\n",
"print(\"=================================================================\")\n",
"print(\"Disposal cost\")\n",
"print(pyo.value(m.m_network.disp_cost))\n",
Expand All @@ -152,9 +152,23 @@
"print(pyo.value(m.m_network.treat_rev))\n",
"print(\"=================================================================\")\n",
"print(\"Treatment cost - OPEX\")\n",
"print(pyo.value(sum(sum(m.OPEX[s, t]/365*m.m_network.p_dt for t in m.m_network.s_T) for s in m.m_network.desalination_nodes)))\n",
"print(\n",
" pyo.value(\n",
" sum(\n",
" sum(m.OPEX[s, t] / 365 * m.m_network.p_dt for t in m.m_network.s_T)\n",
" for s in m.m_network.desalination_nodes\n",
" )\n",
" )\n",
")\n",
"print(\"Treatment cost - CAPEX\")\n",
"print(pyo.value(sum(m.CAPEX[s] for s in m.m_network.desalination_nodes)/365*m.m_network.p_dt*len(m.m_network.s_T)))\n",
"print(\n",
" pyo.value(\n",
" sum(m.CAPEX[s] for s in m.m_network.desalination_nodes)\n",
" / 365\n",
" * m.m_network.p_dt\n",
" * len(m.m_network.s_T)\n",
" )\n",
")\n",
"print(\"=================================================================\")"
]
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@
" parameter_list,\n",
")\n",
"from pareto.models_extra.CM_module.cm_utils.data_parser import data_parser\n",
"from pareto.models_extra.Integrate_desal.integrated_models.integrated_optimization_mvr import integrated_model_build\n",
"from pareto.models_extra.Integrate_desal.integrated_models.integrated_optimization_mvr import (\n",
" integrated_model_build,\n",
")\n",
"import pyomo.environ as pyo"
]
},
Expand All @@ -45,12 +47,12 @@
"outputs": [],
"source": [
"with resources.path(\n",
" \"pareto.case_studies\",\n",
" \"integrated_desalination_demo.xlsx\",\n",
" ) as fpath:\n",
" [df_sets, df_parameters] = get_data(fpath, set_list, parameter_list)\n",
" \"pareto.case_studies\",\n",
" \"integrated_desalination_demo.xlsx\",\n",
") as fpath:\n",
" [df_sets, df_parameters] = get_data(fpath, set_list, parameter_list)\n",
"\n",
" network_data = data_parser(df_sets, df_parameters)"
" network_data = data_parser(df_sets, df_parameters)"
]
},
{
Expand Down Expand Up @@ -88,7 +90,7 @@
"metadata": {},
"outputs": [],
"source": [
"m = integrated_model_build(network_data, treatment_dict={'R01_IN':1})"
"m = integrated_model_build(network_data, treatment_dict={\"R01_IN\": 1})"
]
},
{
Expand All @@ -112,7 +114,7 @@
"ipopt = pyo.SolverFactory(\"ipopt\")\n",
"ipopt.options[\"mu_init\"] = 1e-6\n",
"ipopt.options[\"bound_push\"] = 1e-6\n",
"ipopt.solve(m, tee = True)"
"ipopt.solve(m, tee=True)"
]
},
{
Expand All @@ -137,7 +139,7 @@
"print(\"######### Costing Variables (USD) #############\")\n",
"print(\"=================================================================\")\n",
"print(\"Piping cost\")\n",
"print(pyo.value(m.m_network.arc_cost)) \n",
"print(pyo.value(m.m_network.arc_cost))\n",
"print(\"=================================================================\")\n",
"print(\"Disposal cost\")\n",
"print(pyo.value(m.m_network.disp_cost))\n",
Expand All @@ -155,9 +157,25 @@
"print(pyo.value(m.m_network.treat_rev))\n",
"print(\"=================================================================\")\n",
"print(\"Treatment cost - OPEX\")\n",
"print(1000*pyo.value(sum(sum(m.OPEX[s, t]/365*m.m_network.p_dt for t in m.m_network.s_T) for s in m.m_network.desalination_nodes)))\n",
"print(\n",
" 1000\n",
" * pyo.value(\n",
" sum(\n",
" sum(m.OPEX[s, t] / 365 * m.m_network.p_dt for t in m.m_network.s_T)\n",
" for s in m.m_network.desalination_nodes\n",
" )\n",
" )\n",
")\n",
"print(\"Treatment cost - CAPEX\")\n",
"print(1000*pyo.value(sum(m.CAPEX[s] for s in m.m_network.desalination_nodes)/365*m.m_network.p_dt*len(m.m_network.s_T)))\n",
"print(\n",
" 1000\n",
" * pyo.value(\n",
" sum(m.CAPEX[s] for s in m.m_network.desalination_nodes)\n",
" / 365\n",
" * m.m_network.p_dt\n",
" * len(m.m_network.s_T)\n",
" )\n",
")\n",
"print(\"=================================================================\")"
]
},
Expand All @@ -177,7 +195,9 @@
"metadata": {},
"outputs": [],
"source": [
"from pareto.models_extra.Integrate_desal.integrated_models.backcalculate_mvr_design import back_calculate_design"
"from pareto.models_extra.Integrate_desal.integrated_models.backcalculate_mvr_design import (\n",
" back_calculate_design,\n",
")"
]
},
{
Expand All @@ -189,7 +209,7 @@
},
"outputs": [],
"source": [
"back_calculate_design(m, treatment_dict = desalination_dict)"
"back_calculate_design(m, treatment_dict=desalination_dict)"
]
}
],
Expand Down

0 comments on commit 6356d0e

Please sign in to comment.