{
"cells": [
{
"cell_type": "markdown",
"id": "43bbd8fc-ea24-41ef-9f68-775d2253bbac",
"metadata": {
"tags": []
},
"source": [
"# Disassembled thermal circuits from wall description\n",
"\n",
"[](https://mybinder.org/v2/gh/cghiaus/dm4bem_book/HEAD?labpath=%2Ftutorials%2Fpd01wall2TC.ipynb)\n",
"\n",
"This notebook presents how the _description of the walls_ is transformed into a set of _disassembled thermal networks_ implemented in the function `wall2TC()` of [dm4bem](dm4bem.py) module.\n",
"\n",
"The _description of the walls_ is given in a folder that contains two types of files (see [an example](https://github.com/cghiaus/dm4bem_toy_model)):\n",
"- wall types: thermo-physical properties of the materials;\n",
"- walls data: regarding the area, temperature & flow-rate sources, coefficients for convection and radiation of the wall surfaces.\n",
"\n",
"The _thermal network_ is a data structure (`dictionary`) containing the matrices $A, G, C$ and the vectors $b, f, y$."
]
},
{
"cell_type": "code",
"execution_count": 1,
"id": "33aa52c1-db7c-4563-8373-6d8872f6c858",
"metadata": {},
"outputs": [],
"source": [
"import pandas as pd\n",
"\n",
"import dm4bem"
]
},
{
"cell_type": "markdown",
"id": "c9dc5bd4-d844-4142-b943-f8ace023bb22",
"metadata": {},
"source": [
"The input data needed for the thermal model of the building is in a folder ([link](https://github.com/cghiaus/dm4bem_book/tree/main/tutorials/pd/bldg_wall2TC))."
]
},
{
"cell_type": "code",
"execution_count": 2,
"id": "bcec7e3f-503f-491e-8424-4877479e2843",
"metadata": {},
"outputs": [],
"source": [
"folder = \"./pd/bldg_wall2TC\""
]
},
{
"cell_type": "markdown",
"id": "2d96d401-165f-4219-8efa-2c6806502f68",
"metadata": {},
"source": [
"## Wall types"
]
},
{
"cell_type": "markdown",
"id": "b5e35357-0993-448b-9454-799368ecdcb5",
"metadata": {},
"source": [
"Let's consider two types of walls with physical properties given in the file `wall_types.csv` ([link](https://github.com/cghiaus/dm4bem_book/tree/main/tutorials/pd/bldg_wall2TC))."
]
},
{
"cell_type": "code",
"execution_count": 3,
"id": "0bafe10d-ef38-4419-819f-a95bb4b18d3c",
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"
\n",
"\n",
"
\n",
" \n",
" \n",
" | \n",
" type | \n",
" Material | \n",
" Conductivity | \n",
" Specific heat | \n",
" Density | \n",
" Width | \n",
" Mesh | \n",
"
\n",
" \n",
" \n",
" \n",
" 0 | \n",
" 0 | \n",
" Concrete | \n",
" 1.400 | \n",
" 880.0 | \n",
" 2300.0 | \n",
" 0.200 | \n",
" 1 | \n",
"
\n",
" \n",
" 1 | \n",
" 0 | \n",
" Plaster | \n",
" 1.000 | \n",
" 1000.0 | \n",
" 1200.0 | \n",
" 0.030 | \n",
" 0 | \n",
"
\n",
" \n",
" 2 | \n",
" 0 | \n",
" Insulation | \n",
" 0.027 | \n",
" 1210.0 | \n",
" 55.0 | \n",
" 0.080 | \n",
" 2 | \n",
"
\n",
" \n",
" 3 | \n",
" 1 | \n",
" Glass | \n",
" 1.400 | \n",
" 750.0 | \n",
" 2500.0 | \n",
" 0.004 | \n",
" 1 | \n",
"
\n",
" \n",
"
\n",
"
"
],
"text/plain": [
" type Material Conductivity Specific heat Density Width Mesh\n",
"0 0 Concrete 1.400 880.0 2300.0 0.200 1\n",
"1 0 Plaster 1.000 1000.0 1200.0 0.030 0\n",
"2 0 Insulation 0.027 1210.0 55.0 0.080 2\n",
"3 1 Glass 1.400 750.0 2500.0 0.004 1"
]
},
"execution_count": 3,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"wall_types = pd.read_csv(folder + '/wall_types.csv')\n",
"wall_types"
]
},
{
"cell_type": "markdown",
"id": "7289cf9c-f072-4d71-9c90-77bbbe74606c",
"metadata": {},
"source": [
"The file `wall_types.csv` contains:\n",
"- the physical properties of the materials given in SI units: __conductivity__ in W·m⁻¹·K⁻¹, __specific heat__ in J·kg⁻¹·K⁻¹, __density__ in kg·m⁻³;\n",
"- the __width__ of the layers in m;\n",
"- the number of __meshes__ in which each layer is numerically discretized; each mesh has:\n",
" - one resistance and no capacity, if __Mesh = 0__;\n",
" - two resistances and a capacity. if __Mesh > 0__.\n",
"\n",
"There are two types of walls in the file `wall_types.csv` (Figure 1):\n",
"\n",
"- The wall of __type 0__ has two layers: _Concrete_ and _Insulation_. _Concrete_ layer has one mesh (two resistances and a capacity) and _Insulation_ layer has two meshes (i.e., four resistances and two capacities).\n",
"- The wall of __type 1__ has one layer: _Glass_, discretized in one mesh.\n",
"\n",
"\n",
"> Figure 1. The two types of wall described in the file `wall_types.csv`"
]
},
{
"cell_type": "markdown",
"id": "8e7bc192-15cb-44a5-acb6-6e626b0ff951",
"metadata": {
"tags": []
},
"source": [
"## Walls data\n",
"The models of the walls are based on the materials given in the file `wall_types.csv`. For each specific wall, data related to surfaces is given (area, orientation, convection coefficients, radiative properties, temperature and flow-rate sources).\n",
"\n",
"There are three kinds of walls (Table 1, [link](https://github.com/cghiaus/dm4bem_book/tree/main/tutorials/pd/bldg_wall2TC)):\n",
"- generic (e.g., file `walls_generic.csv`), \n",
"- outdoor (e.g., file `walls_out.csv`),\n",
"- indoor (e.g., file `walls_in.csv`).\n",
"\n",
">Table 1. Columns of `walls_generic.csv`, `walls_out.csv`, and `walls_in.csv` files ([link](https://github.com/cghiaus/dm4bem_book/tree/main/tutorials/pd/bldg_wall2TC)). The columns that are present in the file are maked by ✓ for **_generic**, **_out** and **_in** walls. The columns needed to define the thermal circuit are marked by ✓ in **TC**.\n",
"\n",
"|Column|Unit|Definition | Example|_generic |_out|_in|TC|\n",
"|------|----|---------------------------------------|--------|----------|----|---|---|\n",
"| ID | | Identifiant of each wall | w2 | ✓ | ✓ | ✓ | ✓ |\n",
"| type | | Type of wall given in `wall_types.csv`| 1 | ✓ | ✓ | ✓ | ✓ |\n",
"| Area | m² | Surface area of the wall | 25 | ✓ | ✓ | ✓ | ✓ |\n",
"| β | ° | Tilt angle: 90° vertical; >90° upward facing| 90 | ✓ | ✓ | | |\n",
"| γ | ° | Azimuth: 0° South, 180° North, >0° westward | 90| ✓ | ✓ | | |\n",
"|albedo| | Fraction of sunlight that is diffusely reflected by ground surface|0.25| ✓ | ✓ | | | \n",
"| T0 | °C | Temperature source of outer surface | To | ✓ | ✓ | | ✓ |\n",
"| T1 | °C | Temperature source of inner surface | Ti | ✓ | | | ✓ |\n",
"| Q0 | W | Flow rate source on outer surface | Qo | ✓ | ✓ | ✓ | ✓ |\n",
"| Q1 | W | Flow rate source on inner surface | Qi | ✓ | ✓ | ✓ | ✓ |\n",
"| h0 | W·m⁻²·K⁻¹| Convection coefficient of outer surface | 25 | ✓ | ✓ | ✓ | ✓ |\n",
"| h1 | W·m⁻²·K⁻¹| Convection coefficient of inner surface | 8 | ✓ | ✓ | ✓ | ✓ |\n",
"| α0 | | Short-wave absorption coefficient of outer surface|0.25|✓ | ✓ | ✓ | |\n",
"| α1 | | Short-wave absorption coefficient of inner surface|0.30|✓ | ✓ | ✓ | |\n",
"| ε0 | | Long-wave hemispherical emissivity of outer surface|0.85|✓| ✓ | ✓ | |\n",
"| ε1 | | Long-wave hemispherical emissivity of inner surface|0.70|✓| ✓ | ✓ | |\n",
"| y | | Output temperature nodes (by using slicing) |[0, -1] | ✓ | ✓ | ✓ | ✓ |\n",
"\n",
"__Notes__:\n",
"1. The _generic_ walls may define _out_ or _in_ walls by not specifying temperature sources (see `wall_generic.csv`, `wall_out.csv`, and `wall_in.csv` files for examples).\n",
"\n",
"2. The _out_ walls do not need the temperature sources on the inner surfaces, T1.\n",
"\n",
"3. The _in_ walls do not need tilt (β) and azimuth (γ) angles, the albedo of the ground, and the temperature sources on the outer (T0) and the inner (T1) surfaces.\n",
"\n",
"4. The column __TC__ shows the information needed to obtain the thermal circuit. The data related to radiative exchange is used in the calculation of flow-rate sources in short-wave and for conductances in long-wave radiative exchange."
]
},
{
"cell_type": "markdown",
"id": "e569aafc-73e0-4248-95f8-f0377faf8a67",
"metadata": {},
"source": [
"### Generic wall\n",
"\n",
"Generic walls contain all the information listed in Table 1. For example, `wall_generic.csv` file describes the walls shown in Figure 2 ([link](https://github.com/cghiaus/dm4bem_book/tree/main/tutorials/pd/bldg_wall2TC))."
]
},
{
"cell_type": "code",
"execution_count": 4,
"id": "e88044f6-9feb-4cc9-b77e-5ffba7ae5fad",
"metadata": {
"tags": []
},
"outputs": [
{
"data": {
"text/html": [
"\n",
"\n",
"
\n",
" \n",
" \n",
" | \n",
" ID | \n",
" type | \n",
" Area | \n",
" β | \n",
" γ | \n",
" albedo | \n",
" T0 | \n",
" T1 | \n",
" Q0 | \n",
" Q1 | \n",
" h0 | \n",
" h1 | \n",
" α0 | \n",
" α1 | \n",
" ε0 | \n",
" ε1 | \n",
" y | \n",
"
\n",
" \n",
" \n",
" \n",
" 0 | \n",
" w0 | \n",
" 1 | \n",
" 1.0 | \n",
" 90.0 | \n",
" 0.0 | \n",
" 0.25 | \n",
" To | \n",
" NaN | \n",
" Qo | \n",
" Qi | \n",
" 20.0 | \n",
" 10.0 | \n",
" 0.25 | \n",
" 0.3 | \n",
" 0.85 | \n",
" 0.7 | \n",
" [0, -1] | \n",
"
\n",
" \n",
" 1 | \n",
" w1 | \n",
" 1 | \n",
" 1.0 | \n",
" 90.0 | \n",
" 0.0 | \n",
" 0.25 | \n",
" To | \n",
" Ti | \n",
" Qo | \n",
" Qi | \n",
" 20.0 | \n",
" 10.0 | \n",
" 0.25 | \n",
" 0.3 | \n",
" 0.85 | \n",
" 0.7 | \n",
" 1 | \n",
"
\n",
" \n",
" 2 | \n",
" w2 | \n",
" 0 | \n",
" 10.0 | \n",
" 0.0 | \n",
" 90.0 | \n",
" 0.25 | \n",
" To | \n",
" NaN | \n",
" Qo | \n",
" Qi | \n",
" 21.0 | \n",
" 11.0 | \n",
" 0.25 | \n",
" 0.3 | \n",
" 0.85 | \n",
" 0.7 | \n",
" [1, 2, -1] | \n",
"
\n",
" \n",
" 3 | \n",
" w3 | \n",
" 0 | \n",
" 20.0 | \n",
" NaN | \n",
" NaN | \n",
" 0.25 | \n",
" NaN | \n",
" NaN | \n",
" Qo | \n",
" Qi | \n",
" 22.0 | \n",
" 12.0 | \n",
" 0.25 | \n",
" 0.3 | \n",
" 0.85 | \n",
" 0.7 | \n",
" [2, 1, 3] | \n",
"
\n",
" \n",
"
\n",
"
"
],
"text/plain": [
" ID type Area β γ albedo T0 T1 Q0 Q1 h0 h1 α0 \\\n",
"0 w0 1 1.0 90.0 0.0 0.25 To NaN Qo Qi 20.0 10.0 0.25 \n",
"1 w1 1 1.0 90.0 0.0 0.25 To Ti Qo Qi 20.0 10.0 0.25 \n",
"2 w2 0 10.0 0.0 90.0 0.25 To NaN Qo Qi 21.0 11.0 0.25 \n",
"3 w3 0 20.0 NaN NaN 0.25 NaN NaN Qo Qi 22.0 12.0 0.25 \n",
"\n",
" α1 ε0 ε1 y \n",
"0 0.3 0.85 0.7 [0, -1] \n",
"1 0.3 0.85 0.7 1 \n",
"2 0.3 0.85 0.7 [1, 2, -1] \n",
"3 0.3 0.85 0.7 [2, 1, 3] "
]
},
"execution_count": 4,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"walls = pd.read_csv(folder + \"/walls_generic.csv\")\n",
"walls"
]
},
{
"cell_type": "markdown",
"id": "81a93277-ebe0-4e59-a472-d572fd513b69",
"metadata": {},
"source": [
"The file `walls_generic.csv` describes four walls (Figure 2):\n",
"- according to the types of walls:\n",
" - w0 and w1 are of __type__ 1, i.e., concrete and insulation;\n",
" - w2 and w3 are of __type__ 0, i.e., glass.\n",
"- according to the temperature sources:\n",
" - w0 and w1 are outdoor walls that have as boundary condition the outdoor temperature __T0__; the temperature on the inner surface is a room temperature, which is an output of the model.\n",
" - w1 is a wall that has temperature sources on both sides.\n",
" - w3 is an inner wall that separates two rooms. It does not need information for solar direct radiation (tilt and azimuth angles and the albedo of the ground surface in front of the wall).\n",
"\n",
"Outdoor walls, such as gw0 (generic wall w0) and gw2 (generic wall w2) in Figure 2, can be obtained from the generic walls by not considering a temperature source __T1__ on inner surface, which is indicated by NaN in rows w0 and w2 for column __T1__.\n",
"\n",
"Likewise, indoor walls, such as gw3 (generic wall 3) in Figure 2, can be obtained from the generic walls by indicating that there are no temperature sources in __T0__ and __T1__, i.e. `T0 = NaN` and `T1 = NaN`.\n",
"\n",
"The outputs __y__ are indicated in a list using [slicing](https://python-reference.readthedocs.io/en/latest/docs/brackets/slicing.html). For example, the outputs of wall w0 are temperature nodes 0 and -1 (i.e., the last node which is node 3) in Figure 2.\n",
"\n",
"The numbering convention of the elements of the circuits is:\n",
"- the nodes (i.e., temperatures) are numbered from left to right and from up to down;\n",
"- the oriented branches (i.e., flows) are numbered from the node with a lower index to the node with a higher index;\n",
"- the __reference__ temperature node is not numbered.\n",
"\n",
"\n",
"> Figure 2. Four examples of generic walls described in the file `wall_generic.csv`. Walls gw0 and gw1 are of __type 1__ (glass), described in `wall_type.csv`. Walls gw2 and gw3 are of __type 0__ (concrete and insulation), described in `wall_type.csv`."
]
},
{
"cell_type": "markdown",
"id": "0d689173-16ed-4343-985d-4486e93b79b5",
"metadata": {},
"source": [
"The files describing the types (`wall_types.csv`) and the data (`walls_generic.csv`) of the walls contain the information needed to obtain the disassembled thermal circuits ([link](https://github.com/cghiaus/dm4bem_book/tree/main/tutorials/pd/bldg_wall2TC)). The names of the walls can have a prefix. "
]
},
{
"cell_type": "code",
"execution_count": 5,
"id": "4d971f08-f3e1-4a61-890c-622e8fc883cc",
"metadata": {},
"outputs": [],
"source": [
"# Thermal circuits from wall types and wall data\n",
"TCd_generic = dm4bem.wall2TC(wall_types, walls, prefix=\"g\")"
]
},
{
"cell_type": "markdown",
"id": "97f4b444-4f9d-4ead-9ae3-971fbd44b8e9",
"metadata": {},
"source": [
"Each matrix ($A, G, C$) or vector ($b, f, y$) of the thermal circuit can be accessed as a Pandas dataframe."
]
},
{
"cell_type": "code",
"execution_count": 6,
"id": "0829f6db-71cd-4231-a55c-9451faf7d481",
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"\n",
"\n",
"
\n",
" \n",
" \n",
" | \n",
" gw0_θ0 | \n",
" gw0_θ1 | \n",
" gw0_θ2 | \n",
" gw0_θ3 | \n",
"
\n",
" \n",
" \n",
" \n",
" gw0_q0 | \n",
" 1.0 | \n",
" 0.0 | \n",
" 0.0 | \n",
" 0.0 | \n",
"
\n",
" \n",
" gw0_q1 | \n",
" -1.0 | \n",
" 1.0 | \n",
" 0.0 | \n",
" 0.0 | \n",
"
\n",
" \n",
" gw0_q2 | \n",
" 0.0 | \n",
" -1.0 | \n",
" 1.0 | \n",
" 0.0 | \n",
"
\n",
" \n",
" gw0_q3 | \n",
" 0.0 | \n",
" 0.0 | \n",
" -1.0 | \n",
" 1.0 | \n",
"
\n",
" \n",
"
\n",
"
"
],
"text/plain": [
" gw0_θ0 gw0_θ1 gw0_θ2 gw0_θ3\n",
"gw0_q0 1.0 0.0 0.0 0.0\n",
"gw0_q1 -1.0 1.0 0.0 0.0\n",
"gw0_q2 0.0 -1.0 1.0 0.0\n",
"gw0_q3 0.0 0.0 -1.0 1.0"
]
},
"execution_count": 6,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"TCd_generic['gw0']['A']"
]
},
{
"cell_type": "markdown",
"id": "0f58635a-75ef-476f-8b91-4824c1bc9c7d",
"metadata": {},
"source": [
"All matrices ($A, G, C$) and vectors ($b, f, y$) of each thermal circuit can be printed."
]
},
{
"cell_type": "code",
"execution_count": 7,
"id": "ea44a661-00f3-41da-9c5a-5e5f0324a75a",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"A:\n",
" gw0_θ0 gw0_θ1 gw0_θ2 gw0_θ3\n",
"gw0_q0 1.0 0.0 0.0 0.0\n",
"gw0_q1 -1.0 1.0 0.0 0.0\n",
"gw0_q2 0.0 -1.0 1.0 0.0\n",
"gw0_q3 0.0 0.0 -1.0 1.0 \n",
"\n",
"G:\n",
"gw0_q0 20.0\n",
"gw0_q1 700.0\n",
"gw0_q2 700.0\n",
"gw0_q3 10.0\n",
"dtype: float64 \n",
"\n",
"C:\n",
"gw0_θ0 0.0\n",
"gw0_θ1 7500.0\n",
"gw0_θ2 0.0\n",
"gw0_θ3 0.0\n",
"dtype: float64 \n",
"\n",
"b:\n",
"gw0_q0 To\n",
"gw0_q1 0.0\n",
"gw0_q2 0.0\n",
"gw0_q3 0.0\n",
"dtype: object \n",
"\n",
"f:\n",
"gw0_θ0 Qo\n",
"gw0_θ1 0.0\n",
"gw0_θ2 Qi\n",
"gw0_θ3 0.0\n",
"dtype: object \n",
"\n",
"y:\n",
"gw0_θ0 1.0\n",
"gw0_θ1 0.0\n",
"gw0_θ2 0.0\n",
"gw0_θ3 1.0\n",
"dtype: float64 \n",
"\n"
]
}
],
"source": [
"dm4bem.print_TC(TCd_generic['gw0'])"
]
},
{
"cell_type": "markdown",
"id": "5fd1d7b7-53bb-43e5-83f3-d5316d9668b7",
"metadata": {},
"source": [
"All thermal circuits read from the file `walls_generic.csv` can be printed."
]
},
{
"cell_type": "code",
"execution_count": 8,
"id": "9681cb1c-e727-4ece-a331-44c37ceccff8",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"TCd_generic\n",
"Wall: gw0\n",
"A:\n",
" gw0_θ0 gw0_θ1 gw0_θ2 gw0_θ3\n",
"gw0_q0 1.0 0.0 0.0 0.0\n",
"gw0_q1 -1.0 1.0 0.0 0.0\n",
"gw0_q2 0.0 -1.0 1.0 0.0\n",
"gw0_q3 0.0 0.0 -1.0 1.0 \n",
"\n",
"G:\n",
"gw0_q0 20.0\n",
"gw0_q1 700.0\n",
"gw0_q2 700.0\n",
"gw0_q3 10.0\n",
"dtype: float64 \n",
"\n",
"C:\n",
"gw0_θ0 0.0\n",
"gw0_θ1 7500.0\n",
"gw0_θ2 0.0\n",
"gw0_θ3 0.0\n",
"dtype: float64 \n",
"\n",
"b:\n",
"gw0_q0 To\n",
"gw0_q1 0.0\n",
"gw0_q2 0.0\n",
"gw0_q3 0.0\n",
"dtype: object \n",
"\n",
"f:\n",
"gw0_θ0 Qo\n",
"gw0_θ1 0.0\n",
"gw0_θ2 Qi\n",
"gw0_θ3 0.0\n",
"dtype: object \n",
"\n",
"y:\n",
"gw0_θ0 1.0\n",
"gw0_θ1 0.0\n",
"gw0_θ2 0.0\n",
"gw0_θ3 1.0\n",
"dtype: float64 \n",
"\n",
"Wall: gw1\n",
"A:\n",
" gw1_θ0 gw1_θ1 gw1_θ2\n",
"gw1_q0 1.0 0.0 0.0\n",
"gw1_q1 -1.0 1.0 0.0\n",
"gw1_q2 0.0 -1.0 1.0\n",
"gw1_q3 0.0 0.0 -1.0 \n",
"\n",
"G:\n",
"gw1_q0 20.0\n",
"gw1_q1 700.0\n",
"gw1_q2 700.0\n",
"gw1_q3 10.0\n",
"dtype: float64 \n",
"\n",
"C:\n",
"gw1_θ0 0.0\n",
"gw1_θ1 7500.0\n",
"gw1_θ2 0.0\n",
"dtype: float64 \n",
"\n",
"b:\n",
"gw1_q0 To\n",
"gw1_q1 0.0\n",
"gw1_q2 0.0\n",
"gw1_q3 Ti\n",
"dtype: object \n",
"\n",
"f:\n",
"gw1_θ0 Qo\n",
"gw1_θ1 0.0\n",
"gw1_θ2 Qi\n",
"dtype: object \n",
"\n",
"y:\n",
"gw1_θ0 0.0\n",
"gw1_θ1 1.0\n",
"gw1_θ2 0.0\n",
"dtype: float64 \n",
"\n",
"Wall: gw2\n",
"A:\n",
" gw2_θ0 gw2_θ1 gw2_θ2 gw2_θ3 gw2_θ4 gw2_θ5 gw2_θ6 gw2_θ7 gw2_θ8\n",
"gw2_q0 1.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0\n",
"gw2_q1 -1.0 1.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0\n",
"gw2_q2 0.0 -1.0 1.0 0.0 0.0 0.0 0.0 0.0 0.0\n",
"gw2_q3 0.0 0.0 -1.0 1.0 0.0 0.0 0.0 0.0 0.0\n",
"gw2_q4 0.0 0.0 0.0 -1.0 1.0 0.0 0.0 0.0 0.0\n",
"gw2_q5 0.0 0.0 0.0 0.0 -1.0 1.0 0.0 0.0 0.0\n",
"gw2_q6 0.0 0.0 0.0 0.0 0.0 -1.0 1.0 0.0 0.0\n",
"gw2_q7 0.0 0.0 0.0 0.0 0.0 0.0 -1.0 1.0 0.0\n",
"gw2_q8 0.0 0.0 0.0 0.0 0.0 0.0 0.0 -1.0 1.0 \n",
"\n",
"G:\n",
"gw2_q0 210.000000\n",
"gw2_q1 140.000000\n",
"gw2_q2 140.000000\n",
"gw2_q3 333.333333\n",
"gw2_q4 13.500000\n",
"gw2_q5 13.500000\n",
"gw2_q6 13.500000\n",
"gw2_q7 13.500000\n",
"gw2_q8 110.000000\n",
"dtype: float64 \n",
"\n",
"C:\n",
"gw2_θ0 0.0\n",
"gw2_θ1 4048000.0\n",
"gw2_θ2 0.0\n",
"gw2_θ3 0.0\n",
"gw2_θ4 26620.0\n",
"gw2_θ5 0.0\n",
"gw2_θ6 26620.0\n",
"gw2_θ7 0.0\n",
"gw2_θ8 0.0\n",
"dtype: float64 \n",
"\n",
"b:\n",
"gw2_q0 To\n",
"gw2_q1 0.0\n",
"gw2_q2 0.0\n",
"gw2_q3 0.0\n",
"gw2_q4 0.0\n",
"gw2_q5 0.0\n",
"gw2_q6 0.0\n",
"gw2_q7 0.0\n",
"gw2_q8 0.0\n",
"dtype: object \n",
"\n",
"f:\n",
"gw2_θ0 Qo\n",
"gw2_θ1 0.0\n",
"gw2_θ2 0.0\n",
"gw2_θ3 0.0\n",
"gw2_θ4 0.0\n",
"gw2_θ5 0.0\n",
"gw2_θ6 0.0\n",
"gw2_θ7 Qi\n",
"gw2_θ8 0.0\n",
"dtype: object \n",
"\n",
"y:\n",
"gw2_θ0 0.0\n",
"gw2_θ1 1.0\n",
"gw2_θ2 1.0\n",
"gw2_θ3 0.0\n",
"gw2_θ4 0.0\n",
"gw2_θ5 0.0\n",
"gw2_θ6 0.0\n",
"gw2_θ7 0.0\n",
"gw2_θ8 1.0\n",
"dtype: float64 \n",
"\n",
"Wall: gw3\n",
"A:\n",
" gw3_θ0 gw3_θ1 gw3_θ2 gw3_θ3 gw3_θ4 gw3_θ5 gw3_θ6 gw3_θ7 \\\n",
"gw3_q0 -1.0 1.0 0.0 0.0 0.0 0.0 0.0 0.0 \n",
"gw3_q1 0.0 -1.0 1.0 0.0 0.0 0.0 0.0 0.0 \n",
"gw3_q2 0.0 0.0 -1.0 1.0 0.0 0.0 0.0 0.0 \n",
"gw3_q3 0.0 0.0 0.0 -1.0 1.0 0.0 0.0 0.0 \n",
"gw3_q4 0.0 0.0 0.0 0.0 -1.0 1.0 0.0 0.0 \n",
"gw3_q5 0.0 0.0 0.0 0.0 0.0 -1.0 1.0 0.0 \n",
"gw3_q6 0.0 0.0 0.0 0.0 0.0 0.0 -1.0 1.0 \n",
"gw3_q7 0.0 0.0 0.0 0.0 0.0 0.0 0.0 -1.0 \n",
"gw3_q8 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 \n",
"\n",
" gw3_θ8 gw3_θ9 \n",
"gw3_q0 0.0 0.0 \n",
"gw3_q1 0.0 0.0 \n",
"gw3_q2 0.0 0.0 \n",
"gw3_q3 0.0 0.0 \n",
"gw3_q4 0.0 0.0 \n",
"gw3_q5 0.0 0.0 \n",
"gw3_q6 0.0 0.0 \n",
"gw3_q7 1.0 0.0 \n",
"gw3_q8 -1.0 1.0 \n",
"\n",
"G:\n",
"gw3_q0 440.000000\n",
"gw3_q1 280.000000\n",
"gw3_q2 280.000000\n",
"gw3_q3 666.666667\n",
"gw3_q4 27.000000\n",
"gw3_q5 27.000000\n",
"gw3_q6 27.000000\n",
"gw3_q7 27.000000\n",
"gw3_q8 240.000000\n",
"dtype: float64 \n",
"\n",
"C:\n",
"gw3_θ0 0.0\n",
"gw3_θ1 0.0\n",
"gw3_θ2 8096000.0\n",
"gw3_θ3 0.0\n",
"gw3_θ4 0.0\n",
"gw3_θ5 53240.0\n",
"gw3_θ6 0.0\n",
"gw3_θ7 53240.0\n",
"gw3_θ8 0.0\n",
"gw3_θ9 0.0\n",
"dtype: float64 \n",
"\n",
"b:\n",
"gw3_q0 0.0\n",
"gw3_q1 0.0\n",
"gw3_q2 0.0\n",
"gw3_q3 0.0\n",
"gw3_q4 0.0\n",
"gw3_q5 0.0\n",
"gw3_q6 0.0\n",
"gw3_q7 0.0\n",
"gw3_q8 0.0\n",
"dtype: object \n",
"\n",
"f:\n",
"gw3_θ0 0.0\n",
"gw3_θ1 Qo\n",
"gw3_θ2 0.0\n",
"gw3_θ3 0.0\n",
"gw3_θ4 0.0\n",
"gw3_θ5 0.0\n",
"gw3_θ6 0.0\n",
"gw3_θ7 0.0\n",
"gw3_θ8 Qi\n",
"gw3_θ9 0.0\n",
"dtype: object \n",
"\n",
"y:\n",
"gw3_θ0 0.0\n",
"gw3_θ1 1.0\n",
"gw3_θ2 1.0\n",
"gw3_θ3 1.0\n",
"gw3_θ4 0.0\n",
"gw3_θ5 0.0\n",
"gw3_θ6 0.0\n",
"gw3_θ7 0.0\n",
"gw3_θ8 0.0\n",
"gw3_θ9 0.0\n",
"dtype: float64 \n",
"\n"
]
}
],
"source": [
"print('TCd_generic')\n",
"for key in TCd_generic.keys():\n",
" print('Wall:', key)\n",
" dm4bem.print_TC(TCd_generic[key])"
]
},
{
"cell_type": "markdown",
"id": "bdc06d5b-fd33-44d7-b7c3-0479e96a5210",
"metadata": {},
"source": [
"### Outdoor walls\n",
"\n",
"Outdoor walls do not have temperature sources on indoor surfaces (Figure 3, [link](https://github.com/cghiaus/dm4bem_book/tree/main/tutorials/pd/bldg_wall2TC)). They can be obtained from generic walls by omitting the temperature source T1 (on the indoor surface), or they can be described by specific files, such as `walls_in.csv`.\n",
"\n",
"Figure 3a shows walls w0 and w1 of __type__ 1 (described in `wall_types.csv`) with only one layer which has one mesh.\n",
"\n",
"Figure 3b shows walls w2 and w3 of __type__ 0 (described in `wall_types.csv`) with two layers (concrete and insulation). \n",
"\n",
"\n",
"> Figure 3. Outdoor walls: a) of __type__ 1 b) of __type__ 0. The __type__ is indicated in the file `wall_types.csv`."
]
},
{
"cell_type": "code",
"execution_count": 9,
"id": "ffba59a1-1c03-4f32-9c6e-49f015281fec",
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"\n",
"\n",
"
\n",
" \n",
" \n",
" | \n",
" ID | \n",
" type | \n",
" Area | \n",
" β | \n",
" γ | \n",
" albedo | \n",
" T0 | \n",
" Q0 | \n",
" Q1 | \n",
" h0 | \n",
" h1 | \n",
" α0 | \n",
" α1 | \n",
" ε0 | \n",
" ε1 | \n",
" y | \n",
"
\n",
" \n",
" \n",
" \n",
" 0 | \n",
" w0 | \n",
" 1 | \n",
" 1 | \n",
" 90 | \n",
" 0 | \n",
" 0.25 | \n",
" To | \n",
" Qo | \n",
" Qi | \n",
" 20 | \n",
" 10 | \n",
" 0.25 | \n",
" 0.3 | \n",
" 0.85 | \n",
" 0.7 | \n",
" [0, -1] | \n",
"
\n",
" \n",
" 1 | \n",
" w1 | \n",
" 1 | \n",
" 1 | \n",
" 90 | \n",
" 0 | \n",
" 0.25 | \n",
" To | \n",
" Qo | \n",
" Qi | \n",
" 20 | \n",
" 10 | \n",
" 0.25 | \n",
" 0.3 | \n",
" 0.85 | \n",
" 0.7 | \n",
" 1 | \n",
"
\n",
" \n",
" 2 | \n",
" w2 | \n",
" 0 | \n",
" 10 | \n",
" 0 | \n",
" 90 | \n",
" 0.25 | \n",
" To | \n",
" Qo | \n",
" Qi | \n",
" 21 | \n",
" 11 | \n",
" 0.25 | \n",
" 0.3 | \n",
" 0.85 | \n",
" 0.7 | \n",
" [1, 2, -1] | \n",
"
\n",
" \n",
" 3 | \n",
" w3 | \n",
" 0 | \n",
" 20 | \n",
" 0 | \n",
" 90 | \n",
" 0.25 | \n",
" Tsoil | \n",
" Qo | \n",
" Qi | \n",
" 22 | \n",
" 12 | \n",
" 0.25 | \n",
" 0.3 | \n",
" 0.85 | \n",
" 0.7 | \n",
" [2, 1, 3] | \n",
"
\n",
" \n",
"
\n",
"
"
],
"text/plain": [
" ID type Area β γ albedo T0 Q0 Q1 h0 h1 α0 α1 ε0 \\\n",
"0 w0 1 1 90 0 0.25 To Qo Qi 20 10 0.25 0.3 0.85 \n",
"1 w1 1 1 90 0 0.25 To Qo Qi 20 10 0.25 0.3 0.85 \n",
"2 w2 0 10 0 90 0.25 To Qo Qi 21 11 0.25 0.3 0.85 \n",
"3 w3 0 20 0 90 0.25 Tsoil Qo Qi 22 12 0.25 0.3 0.85 \n",
"\n",
" ε1 y \n",
"0 0.7 [0, -1] \n",
"1 0.7 1 \n",
"2 0.7 [1, 2, -1] \n",
"3 0.7 [2, 1, 3] "
]
},
"execution_count": 9,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"walls = pd.read_csv(folder + '/walls_out.csv')\n",
"walls"
]
},
{
"cell_type": "code",
"execution_count": 10,
"id": "221df4bf-0222-4db8-b516-21df5f180945",
"metadata": {},
"outputs": [],
"source": [
"# Thermal circuits from data & type files of walls\n",
"TCd_out = dm4bem.wall2TC(wall_types, walls, prefix=\"o\")\n",
"\n",
"# Uncomment below to print all thermal circuits\n",
"# print('TCd_out')\n",
"# for key in TCd_out.keys():\n",
"# print('Wall:', key)\n",
"# pd_dm4bem.print_TC(TCd_out[key])"
]
},
{
"cell_type": "markdown",
"id": "1f8e091c-6494-4868-966c-d86de103e7fb",
"metadata": {},
"source": [
"### Indoor walls\n",
"\n",
"Indoor walls do not have temperature sources on surfaces (Figure 4, [link](https://github.com/cghiaus/dm4bem_book/tree/main/tutorials/pd/bldg_wall2TC)). They can be obtained from generic walls by not indicating temperature sources T0 and T1, or they can be described by specific files, such as `walls_in.csv`.\n",
"\n",
"Figure 4a shows walls w0 and w1 of __type__ 1 (described in `wall_types.csv`) with only one layer which has one mesh.\n",
"\n",
"Figure 4b shows wall w2 and w3 of __type__ 0 (described in `wall_types.csv`) with two layers (concrete and insulation); the insulation layer is discretized in two meshes.\n",
"\n",
"\n",
"> Figure 4. Indoor walls: a) of __type__ 1 b) of __type__ 0. The __type__ is indicated in the file `wall_types.csv`."
]
},
{
"cell_type": "code",
"execution_count": 11,
"id": "9144df23-4c21-4d5c-bedd-600032294516",
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"\n",
"\n",
"
\n",
" \n",
" \n",
" | \n",
" ID | \n",
" type | \n",
" Area | \n",
" Q0 | \n",
" Q1 | \n",
" h0 | \n",
" h1 | \n",
" α0 | \n",
" α1 | \n",
" ε0 | \n",
" ε1 | \n",
" y | \n",
"
\n",
" \n",
" \n",
" \n",
" 0 | \n",
" w0 | \n",
" 1 | \n",
" 1 | \n",
" Qo | \n",
" Qi | \n",
" 20 | \n",
" 10 | \n",
" 0.25 | \n",
" 0.3 | \n",
" 0.85 | \n",
" 0.7 | \n",
" [0, -1] | \n",
"
\n",
" \n",
" 1 | \n",
" w1 | \n",
" 1 | \n",
" 1 | \n",
" Qo | \n",
" Qi | \n",
" 20 | \n",
" 10 | \n",
" 0.25 | \n",
" 0.3 | \n",
" 0.85 | \n",
" 0.7 | \n",
" 1 | \n",
"
\n",
" \n",
" 2 | \n",
" w2 | \n",
" 0 | \n",
" 10 | \n",
" Qo | \n",
" Qi | \n",
" 21 | \n",
" 11 | \n",
" 0.25 | \n",
" 0.3 | \n",
" 0.85 | \n",
" 0.7 | \n",
" [1, 2, -1] | \n",
"
\n",
" \n",
" 3 | \n",
" w3 | \n",
" 0 | \n",
" 20 | \n",
" Qo | \n",
" Qi | \n",
" 22 | \n",
" 12 | \n",
" 0.25 | \n",
" 0.3 | \n",
" 0.85 | \n",
" 0.7 | \n",
" [2, 1, 3] | \n",
"
\n",
" \n",
"
\n",
"
"
],
"text/plain": [
" ID type Area Q0 Q1 h0 h1 α0 α1 ε0 ε1 y\n",
"0 w0 1 1 Qo Qi 20 10 0.25 0.3 0.85 0.7 [0, -1]\n",
"1 w1 1 1 Qo Qi 20 10 0.25 0.3 0.85 0.7 1\n",
"2 w2 0 10 Qo Qi 21 11 0.25 0.3 0.85 0.7 [1, 2, -1]\n",
"3 w3 0 20 Qo Qi 22 12 0.25 0.3 0.85 0.7 [2, 1, 3]"
]
},
"execution_count": 11,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"walls = pd.read_csv(folder + '/walls_in.csv')\n",
"walls"
]
},
{
"cell_type": "code",
"execution_count": 12,
"id": "678f53dc-a07e-4b2c-bfe0-3ccf00aedde7",
"metadata": {},
"outputs": [],
"source": [
"# Thermal circuits from data & type files of walls\n",
"TCd_in = dm4bem.wall2TC(wall_types, walls, prefix=\"i\")\n",
"\n",
"# Uncomment below to print all thermal circuits\n",
"# print('TCd_in')\n",
"# for key in TCd_in.keys():\n",
"# print('Wall:', key)\n",
"# pd_dm4bem.print_TC(TCd_in[key])"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "7e2df34b-7d8b-40de-b0ad-2af1ee576dfd",
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.7"
},
"toc-autonumbering": true
},
"nbformat": 4,
"nbformat_minor": 5
}