Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,23 +1,11 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": null,
"id": "b28b6845",
"metadata": {
"ExecuteTime": {
"end_time": "2024-10-22T14:03:12.518536Z",
"start_time": "2024-10-22T14:02:46.050855Z"
}
},
"outputs": [],
"cell_type": "markdown",
"id": "739e70ef-d053-40bb-af35-45359af6fa50",
"metadata": {},
"source": [
"import pandas as pd\n",
"import numpy as np\n",
"import os\n",
"import plotly.express as px\n",
"from pathlib import Path\n",
"pd.options.mode.chained_assignment = None # default='warn'"
"This tutorial can be found and ran in the GITHUB libray corrAI: https://github.com/BuildingEnergySimulationTools/corrai"
]
},
{
Expand All @@ -37,43 +25,37 @@
"The aim of this tutorial is to provide a complete workflow for material physical properties identification of a reference wall using **Modelitool** (modelica simulator) and **CorrAI** models by following these steps:\n",
"\n",
"1. **Measurement import and verification**:\n",
" - We will import measurement dataframe into the notebook and check measumreent before selecting an analysis period.\n",
" - We will import measurement dataframe into the notebook and check measurement before selecting an analysis period.\n",
" \n",
"2. **Model Creation/Import**:\n",
"2. **Model creation/import**:\n",
" - We will either create a new mathematical model or impor model (FMU, openModelica).\n",
"\n",
"3. **Loading Measurements**:\n",
" - We will load the necessary measurements or data that will be used for our sensitivity analysis and model id.f our model.\n",
"\n",
"4. **Performing Sensitivity Analysis**:\n",
"3. **Performing sensitivity analysis**:\n",
" - Sensitivity analysis will be conducted to determine how different input variables affect the output of the model. This step helps in identifying the most influential parameters in the model.\n",
"\n",
"5. **Model Identification**:\n",
"4. **Model identification**:\n",
" - Using the results from the sensitivity analysis, we will identify the parameters that need to be adjusted to improve the model's accuracy. This involves fitting the model to the data and refining its parameters.\n",
"\n",
"65. **Results Visualization and Interpretation**:\n",
" - Finally, we will visualize the results of our analysis and interpret the findings. This includes plotting the sensitivity indices and comparing the model's predictions with the liability of the model.\n",
"\n",
"---"
]
},
{
"cell_type": "markdown",
"id": "f5d604e7-343a-4370-8b53-0c4834bd251c",
"metadata": {},
"metadata": {
"jp-MarkdownHeadingCollapsed": true
},
"source": [
"# 1 Introduction\n"
"# Introduction"
]
},
{
"attachments": {},
"cell_type": "markdown",
"id": "d7c01447",
"metadata": {
"jp-MarkdownHeadingCollapsed": true
},
"metadata": {},
"source": [
"## 1.1 Use case presentation\n",
"## Use case presentation\n",
"\n",
"A \"real-scale\" test bench is used. The **O3BET** (or in this example BEF test bench in Anglet, France) offers experimental conditions to evaluate building façade solutions. Heat exchanges in a cell are restricted on five of its faces, while the sixth face is dedicated to the tested solution. Internal temperature and humidity conditions can be controlled or monitored. External conditions, including temperatures and solar radiation, are measured.\n",
"\n",
Expand All @@ -98,11 +80,9 @@
"attachments": {},
"cell_type": "markdown",
"id": "182f9b79-5f47-4998-baaa-59d0598525e7",
"metadata": {
"jp-MarkdownHeadingCollapsed": true
},
"metadata": {},
"source": [
"## 1.2 Identification framework\n",
"## Identification framework\n",
"The following framework is proposed to identify the **REFERENCE** wall thermal conductivity, and provides:\n",
"- Physical model description using Python\n",
"- Sensitivity analysis to identify materials properties which have an influence on the discrepancy between model outputs and measured phenomenon\n",
Expand All @@ -119,8 +99,30 @@
}
},
"source": [
"## 2.2 Load measurement file\n",
"First, let's load the reference cell measurement data on python that will be used as boundary conditions. Note that the data loaded here should be cleaned beforhand (see Tutorial **\"MeasuredDat example\"** if needed)"
"# 1. Measurement import and verification\n",
"\n",
"First, let's load some generic libraries (pandas, Path).\n",
"Then we can load the reference cell measurement data on python that will be used as boundary conditions. Note that the data loaded here should be cleaned beforhand (see Tutorial **\"MeasuredDat example\"** if needed)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "b28b6845",
"metadata": {
"ExecuteTime": {
"end_time": "2024-10-22T14:03:12.518536Z",
"start_time": "2024-10-22T14:02:46.050855Z"
}
},
"outputs": [],
"source": [
"import pandas as pd\n",
"import numpy as np\n",
"import os\n",
"import plotly.express as px\n",
"from pathlib import Path\n",
"pd.options.mode.chained_assignment = None # default='warn'"
]
},
{
Expand Down Expand Up @@ -280,15 +282,15 @@
"id": "4b6c113a-ccdb-4fb5-a81d-fa75473028c7",
"metadata": {},
"source": [
"For this example we propose a resistance/capacity approach.\n",
" Based on electrical circuit analogy, each layer of the wall is modeled by two resistance and a capacity:\n",
"For this example we propose a resistance/capacity approach. Based on electrical circuit analogy, each layer of the wall is modeled by two resistances and a capacity:\n",
"\n",
"\n",
"| Figure : RC model|\n",
"| :---: |\n",
"| <img src=\"images/RC_model.png\" style=\"height:400px;\"> | \n",
"\n",
"\n",
"Note that it is recommended to start with a **very simple** model (e.g., one resistance, one capacity with only Text and Tint as boundary conditions) and gradually make it more complex as you identify parameters. For the sake of this tutorial, the proposed model is already a bit detailed.\n",
"\n",
"\n",
"The following is a brief description of the thermal model:\n",
Expand Down Expand Up @@ -600,6 +602,16 @@
")"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "d9217031-ab41-4cdb-a53e-a3f7b438c9dd",
"metadata": {},
"outputs": [],
"source": [
"init_res_PYTH.head()"
]
},
{
"cell_type": "markdown",
"id": "fd810131-bf4d-428f-9a4b-d44d109a923e",
Expand Down Expand Up @@ -665,9 +677,13 @@
{
"cell_type": "markdown",
"id": "56c2c6a4-7060-435b-b472-8887eb7de5c3",
"metadata": {},
"metadata": {
"jp-MarkdownHeadingCollapsed": true
},
"source": [
"# 3. Sensitivity analysis"
"# 3. Sensitivity analysis\n",
"It is very important to know how our defined parameters have an influence on the model prediction. Therefore, we use a sensitivity analysis to \"rank\" the parameter by order of influence\n",
"on the model error. "
]
},
{
Expand Down Expand Up @@ -699,7 +715,8 @@
"- *y_i* is the observed value for the \\( i \\)-th observation,\n",
"- *hat{y}_i* is the predicted value for the \\( i \\)-th observation.\n",
"\n",
"The CV_RMSE measures the variation of the RMSE relative to the mean of the observed values. It provides a standardized measure of the error, which can be useful for comparing the performance of different models across different datasets.\n"
"The CV_RMSE measures the variation of the RMSE relative to the mean of the observed values. It provides a standardized measure of the error, which can be useful for comparing the performance of different models across different datasets.\n",
"Here, we can chose the error function as the CV_RMSE between measured temperature(s) and model prediction."
]
},
{
Expand Down Expand Up @@ -1221,7 +1238,9 @@
{
"cell_type": "markdown",
"id": "7d0c13f3-4a23-4731-adec-a2f57d55b35b",
"metadata": {},
"metadata": {
"jp-MarkdownHeadingCollapsed": true
},
"source": [
"# 4. Identification\n",
"Now, we proceed to finding optimal values for these parameters by minimizing the coefficient of variation of root mean square error (cv_rmse) between one or several measured nodes, and one or several relevant outputs of our model.\n",
Expand All @@ -1239,7 +1258,9 @@
{
"cell_type": "markdown",
"id": "c924aad5-9fa3-4df4-ac19-251152251c92",
"metadata": {},
"metadata": {
"jp-MarkdownHeadingCollapsed": true
},
"source": [
"## 4.1. Objective function\n",
"In parameter optimization, we aim to adjust certain model parameters to minimize the difference between simulated and observed data. The objective function is a scalar function that quantifies this difference. In this case, the CV_RMSE (Coefficient of Variation of Root Mean Square Error) is used as a measure of how well the model output matches the reference measurements.\n",
Expand Down Expand Up @@ -1780,7 +1801,7 @@
"id": "10743041-3b9b-496c-a12d-d6acc18a26a2",
"metadata": {},
"source": [
"For a bi-objective problem,and helping us chosing the best set of parameters value, wethen use the decomposition method called Augmented Scalarization Function (ASF), a well-known metric in the multi-objective optimization literature.\n",
"For a bi-objective problem,and helping us chosing the best set of parameters value, we can use the decomposition method called Augmented Scalarization Function (ASF), a well-known metric in the multi-objective optimization literature.\n",
"Let us assume the are equally important by setting the weights to 0.5 and 0.5 and setting these"
]
},
Expand Down Expand Up @@ -2241,7 +2262,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "20ac0fd8-03a8-4955-aa7b-3196bbd173c4",
"id": "e385c24d-22ff-46b1-9c5d-1c23de583326",
"metadata": {},
"outputs": [],
"source": []
Expand Down
Loading