{ "cells": [ { "cell_type": "markdown", "id": "57654529-c23a-46d7-a54b-dbb1d0f7351e", "metadata": {}, "source": [ "# Assembled thermal circuits (from matrix and lists)\n", "\n", "This notebook shows how a set of _disassembled thermal circuits_ is assembled into a single thermal circuit. The assembling can be by using assembling matrix or assembling lits. The assembling from matrix is implemented in the functions `assemble_TCd_matrix`. To assemble from lists, first the assembling lists are transformed in assembly matrix." ] }, { "cell_type": "code", "execution_count": 1, "id": "13d93595-c53e-4840-a864-965e6588ad05", "metadata": { "tags": [] }, "outputs": [], "source": [ "import pandas as pd\n", "import pd_dm4bem" ] }, { "cell_type": "markdown", "id": "01c03148-cf6e-4b7a-9de0-62568691909d", "metadata": {}, "source": [ "## Stating the problem\n", "Consider the disassembled thermal circuits shown in Figure 1 that we want to assemble as shown in Figure 2.\n", "\n", "![disassambled_TC](./bldg/ass_TCd.svg)\n", "> Figure 1. Four disassembled thermal circuits: wall_out, TC0, TC1, TC2, TC3.\n", "\n", "![disassambled_TC](./bldg/ass_TC.svg)\n", "> Figure 2. The assembling of the four circuits from Figure 1." ] }, { "cell_type": "markdown", "id": "e49c8b32-a6d3-43b6-81d5-fa21625ca4c0", "metadata": {}, "source": [ "## Description of the folder containing the circuits\n", "The disassembled circuits and the indications on how to assemble them are given in the folder `.\\bldg` composed by the files (see _Walls data_ in [01wall2TC.ipynb](01wall2TC.ipynb)):\n", "- assembly:\n", " - `assembly_lists.csv`: lists with the nodes that merge;\n", " - `assembly_matrix.csv`: matrix with the nodes that merge;\n", "- thermal circuits: `TC0.csv, ... , TC3.csv`;\n", "- walls:\n", " - `wall_types.csv`: physical properties and width of each mayerial; \n", " - `walls_out.csv`: geometric and surface characteristics of each wall. " ] }, { "cell_type": "markdown", "id": "4f35b81e-aa34-40cc-85dd-033ba700736f", "metadata": {}, "source": [ "## Assembling\n", "\n", "In order to obtain the assembled circuit, first we need to construct the disassembled thermal circuits `TCd`. The numbering of the thermal circuits `TC` can be automatic or the symbols given in `TC_.csv` files can be used." ] }, { "cell_type": "code", "execution_count": 2, "id": "f5f04393-cd31-4492-b621-31e71b8345dc", "metadata": {}, "outputs": [], "source": [ "folder_path = 'bldg'\n", "\n", "# Disassembled thermal circuits\n", "TCd = pd_dm4bem.bldg2TCd(folder_path,\n", " TC_auto_number=True)" ] }, { "cell_type": "markdown", "id": "a2e2f0e7-9f8e-43c2-9ff1-11127ef449d9", "metadata": {}, "source": [ "### Use of assembling matrix\n", "Then, we can obtain the assembled thermal circuits by using the assembly matrix." ] }, { "cell_type": "code", "execution_count": 3, "id": "2a6d7d72-55a8-4513-ac88-598803e40745", "metadata": {}, "outputs": [], "source": [ "# Assembled thermal circuit from assembly_matrix.csv\n", "ass_mat = pd.read_csv(folder_path + '/assembly_matrix.csv')\n", "TCm = pd_dm4bem.assemble_TCd_matrix(TCd, ass_mat)\n", "# pd_dm4bem.print_TC(TCm)" ] }, { "cell_type": "markdown", "id": "f438bc00-c8b6-4582-a356-3534d0633f7d", "metadata": {}, "source": [ "### Use of assembling lists\n", "Alternatively, we can obtain the assembled circuit by using the assembly lists." ] }, { "cell_type": "code", "execution_count": 4, "id": "92c0aad5-7d22-4670-ad2e-c10592f187e7", "metadata": {}, "outputs": [], "source": [ "# Assembled thermal circuit from assembly_lists.csv\n", "ass_lists = pd.read_csv(folder_path + '/assembly_lists.csv')\n", "ass_mat = pd_dm4bem.assemble_lists2matrix(ass_lists)\n", "TCl = pd_dm4bem.assemble_TCd_matrix(TCd, ass_mat)" ] }, { "cell_type": "markdown", "id": "a3abfe4a-6860-4b45-ab4a-481ed5c5236e", "metadata": {}, "source": [ "The otained thermal circuit has all the branches of the set of disassembled circuits but fewer nodes (Figure 2). " ] }, { "cell_type": "code", "execution_count": 5, "id": "76184b44-6208-4b20-8b17-1add777ccc0e", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "A:\n", " c1_θ0 c1_θ1 c2_θ0 ow0_θ0 ow0_θ1 ow0_θ2 ow0_θ3 ow0_θ4\n", "c0_q0 0.0 1.0 0.0 0.0 0.0 0.0 0.0 -1.0\n", "c1_q0 1.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0\n", "c1_q1 -1.0 1.0 0.0 0.0 0.0 0.0 0.0 0.0\n", "c1_q2 0.0 -1.0 1.0 0.0 0.0 0.0 0.0 0.0\n", "c2_q0 0.0 0.0 1.0 0.0 0.0 0.0 0.0 0.0\n", "c3_q0 0.0 0.0 1.0 0.0 0.0 0.0 0.0 0.0\n", "ow0_q0 0.0 0.0 0.0 1.0 0.0 0.0 0.0 0.0\n", "ow0_q1 0.0 0.0 0.0 -1.0 1.0 0.0 0.0 0.0\n", "ow0_q2 0.0 0.0 0.0 0.0 -1.0 1.0 0.0 0.0\n", "ow0_q3 0.0 0.0 0.0 0.0 0.0 -1.0 1.0 0.0\n", "ow0_q4 0.0 0.0 0.0 0.0 0.0 0.0 -1.0 1.0\n", "ow0_q5 0.0 0.0 1.0 0.0 0.0 0.0 0.0 -1.0 \n", "\n", "G:\n", "c0_q0 44.7868\n", "c1_q0 165.7890\n", "c1_q1 630.0000\n", "c1_q2 72.0000\n", "c2_q0 9.0000\n", "c3_q0 1000000.0000\n", "ow0_q0 1125.0000\n", "ow0_q1 630.0000\n", "ow0_q2 630.0000\n", "ow0_q3 30.3750\n", "ow0_q4 30.3750\n", "ow0_q5 360.0000\n", "dtype: float64 \n", "\n", "C:\n", "c1_θ0 1089000.0\n", "c1_θ1 0.0\n", "c2_θ0 32400.0\n", "ow0_θ0 0.0\n", "ow0_θ1 18216000.0\n", "ow0_θ2 0.0\n", "ow0_θ3 239580.0\n", "ow0_θ4 0.0\n", "dtype: float64 \n", "\n", "b:\n", "c0_q0 0\n", "c1_q0 To\n", "c1_q1 0\n", "c1_q2 0\n", "c2_q0 To\n", "c3_q0 Ti_sp\n", "ow0_q0 To\n", "ow0_q1 0\n", "ow0_q2 0\n", "ow0_q3 0\n", "ow0_q4 0\n", "ow0_q5 0\n", "dtype: object \n", "\n", "f:\n", "c1_θ0 Φ\n", "c1_θ1 0\n", "c2_θ0 Qa\n", "ow0_θ0 Qo\n", "ow0_θ1 0\n", "ow0_θ2 0\n", "ow0_θ3 0\n", "ow0_θ4 Qi\n", "dtype: object \n", "\n", "y:\n", "c1_θ0 0.0\n", "c1_θ1 0.0\n", "c2_θ0 3.0\n", "ow0_θ0 1.0\n", "ow0_θ1 0.0\n", "ow0_θ2 0.0\n", "ow0_θ3 0.0\n", "ow0_θ4 0.0\n", "dtype: float64 \n", "\n" ] } ], "source": [ "pd_dm4bem.print_TC(TCl)" ] }, { "cell_type": "markdown", "id": "a735839c-a3fb-44d7-a9d8-ac19bebf0a27", "metadata": {}, "source": [ "Note that the nodes which are faded in Figure 2 (c0_θ0, c0_θ1, c1_θ2, c3_θ0 and ow0_θ5) do not exist anymore in the assembeled thermal circuit since they were merged with the primary nodes." ] }, { "cell_type": "code", "execution_count": null, "id": "c76f634b-b9e2-4237-aa82-1f149f9bd5e9", "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.9.7" }, "toc-autonumbering": true }, "nbformat": 4, "nbformat_minor": 5 }