File size: 8,311 Bytes
cc74eb7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
{
  "nbformat": 4,
  "nbformat_minor": 0,
  "metadata": {
    "colab": {
      "provenance": []
    },
    "kernelspec": {
      "name": "python3",
      "display_name": "Python 3"
    },
    "language_info": {
      "name": "python"
    }
  },
  "cells": [
    {
      "cell_type": "code",
      "source": [
        "# ⚠️ This is the Manager Agent (Foundation LLM: DeepSeek-Chat).\n",
        "# ⚠️ Please make sure to replace the API key with your own one.\n",
        "\n",
        "from openai import OpenAI\n",
        "client = OpenAI(api_key=\"your_own_api\", base_url=\"https://api.deepseek.com\")\n",
        "\n",
        "# Example of user input query (text or voice)\n",
        "user_query = f\"\"\"\n",
        "Simulate a 1 story hollow square, courtyard building.\n",
        "The height of story 1 is 11.42 meters.\n",
        "The horizontal segments are 144.24 meters long and 19.33 meters wide.\n",
        "The vertical segments are 29.80 meters long and 390.88 meters wide.\n",
        "The attic height is 26.60 meters. The building orientation is 352 degrees to the north.\n",
        "Each story has 4 thermal zones in each orientation.\n",
        "The window-to-wall ratio is 0.80 for the north, 0.58 for the south, 0.17 for the west, and 0.78 for the east.\n",
        "\n",
        "The wall is made of concrete, with a thickness of 0.03 meters and the wall insulation is R18.\n",
        "The roof is made of concrete, with a thickness of 0.05 meters and the roof insulation is R18.\n",
        "The floor is made of concrete, covered with carpet.\n",
        "The window U-factor is 1.8 W/m2K and the SHGC is 0.3.\n",
        "This building has 1 space types. Space type 1 is for zone 1, 2, 3, 4. For space type 1, the people density is 10 m2/person, the lighting density is 4 W/m2, and the electric equipment density is 8 W/m2.\n",
        "The people activity level is 130 W/person. The infiltration rate is 0.11 ACH.\n",
        "The occupancy rate is 0.9 from 8:00 to 16:00 and 0.2 in other periods of time.\n",
        "For zone 1, 2, 3, 4, the cooling setpoint is 24.0 Celsius during 6:00 to 18:00, and 26.0 Celsius in unoccupied periods. The heating setpoint is 20.0 Celsius during 6:00 to 18:00, and 18.0 Celsius in unoccupied periods.\n",
        "\n",
        "The HVAC system in this building is packaged air conditioning unit, rooftop unit, DX system with electric heater for heating.\n",
        "The unit 1 serves zone 1, zone 2.\n",
        "It includes an economizer, which operates based on differential dry bulb.\n",
        "The rated capacity is 41378 W for cooling and Autosize W for heating.\n",
        "The rated cooling COP is 3.8 and the heating efficiency is 0.75.\n",
        "The supply air temperature for cooling is 14.3 Celsius, and for heating is 40.7 Celsius.\n",
        "The outdoor ventilation rate is 3.69 ACH.\n",
        "The fan efficiency is 0.78, the pressure rise is 1770 Pa, and the maximum flow rate is Autosize m3/s.\n",
        "The unit 2 serves zone 3, zone 4.\n",
        "The rated capacity is Autosize W for cooling and 36963 W for heating.\n",
        "The rated cooling COP is 3.96 and the heating efficiency is 0.87.\n",
        "The supply air temperature for cooling is 18.6 Celsius, and for heating is 49.0 Celsius.\n",
        "The outdoor ventilation rate is 1.18 ACH.\n",
        "The fan efficiency is 0.64, the pressure rise is 1536 Pa, and the maximum flow rate is 130.08 m3/s.\n",
        "\"\"\"\n",
        "\n",
        "# Manager's prompt\n",
        "manager_prompt = f\"\"\"\n",
        "Please extract sentences related to the following categories from the provided content:\n",
        "1. Building geometry, including shape, story, height, orientation, window-to-wall ratio, etc.\n",
        "2. Building information, including materials, construction, insulations, information of space types, cooling and heating setpoints.\n",
        "3. HVAC systems, including fan and coil units, control methods, supply temperature, ventilation, economizer, outdoor air system, etc.\n",
        "4. Water loops, including chilled water, hot water, condenser water, and related equipment.\n",
        "\n",
        "For each category, identify and extract only the relevant sentences.\n",
        "\n",
        "The output format:\n",
        "**Category 1:** (the building geometry sentences).\n",
        "**Category 2:** (the building information sentences).\n",
        "**Category 3:** (the HVAC system sentences).\n",
        "**Category 4:** (the water loop sentences).\n",
        "\n",
        "Provided content:\n",
        "\"\"\"\n",
        "\n",
        "response = client.chat.completions.create(\n",
        "    model=\"deepseek-chat\",\n",
        "    messages=[\n",
        "        {\"role\": \"system\", \"content\": manager_prompt},\n",
        "        {\"role\": \"user\", \"content\": user_query},\n",
        "    ],\n",
        "    stream=False,\n",
        ")\n",
        "\n",
        "print(response.choices[0].message.content)\n",
        "\n",
        "# An extraction function, extract_categories, is designed to extract different categories based on the regular expression **Category {n}:** defined in the manager_prompt.\n",
        "# category_1, category_2, category_3, category_4 = extract_categories(response.choices[0].message.content)"
      ],
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "id": "-dr8xcL-yNW2",
        "outputId": "dba5ed50-d276-44b3-fff5-8db1e3c5f0a1"
      },
      "execution_count": null,
      "outputs": [
        {
          "output_type": "stream",
          "name": "stdout",
          "text": [
            "**Category 1:** Simulate a 1 story hollow square, courtyard building. The height of story 1 is 11.42 meters. The horizontal segments are 144.24 meters long and 19.33 meters wide. The vertical segments are 29.80 meters long and 390.88 meters wide. The attic height is 26.60 meters. The building orientation is 352 degrees to the north. Each story has 4 thermal zones in each orientation. The window-to-wall ratio is 0.80 for the north, 0.58 for the south, 0.17 for the west, and 0.78 for the east.\n",
            "\n",
            "**Category 2:** The wall is made of concrete, with a thickness of 0.03 meters and the wall insulation is R18. The roof is made of concrete, with a thickness of 0.05 meters and the roof insulation is R18. The floor is made of concrete, covered with carpet. The window U-factor is 1.8 W/m2K and the SHGC is 0.3. This building has 1 space types. Space type 1 is for zone 1, 2, 3, 4. For space type 1, the people density is 10 m2/person, the lighting density is 4 W/m2, and the electric equipment density is 8 W/m2. The people activity level is 130 W/person. The infiltration rate is 0.11 ACH. The occupancy rate is 0.9 from 8:00 to 16:00 and 0.2 in other periods of time. For zone 1, 2, 3, 4, the cooling setpoint is 24.0 Celsius during 6:00 to 18:00, and 26.0 Celsius in unoccupied periods. The heating setpoint is 20.0 Celsius during 6:00 to 18:00, and 18.0 Celsius in unoccupied periods.\n",
            "\n",
            "**Category 3:** The HVAC system in this building is packaged air conditioning unit, rooftop unit, DX system with electric heater for heating. The unit 1 serves zone 1, zone 2. It includes an economizer, which operates based on differential dry bulb. The rated capacity is 41378 W for cooling and Autosize W for heating. The rated cooling COP is 3.8 and the heating efficiency is 0.75. The supply air temperature for cooling is 14.3 Celsius, and for heating is 40.7 Celsius. The outdoor ventilation rate is 3.69 ACH. The fan efficiency is 0.78, the pressure rise is 1770 Pa, and the maximum flow rate is Autosize m3/s. The unit 2 serves zone 3, zone 4. The rated capacity is Autosize W for cooling and 36963 W for heating. The rated cooling COP is 3.96 and the heating efficiency is 0.87. The supply air temperature for cooling is 18.6 Celsius, and for heating is 49.0 Celsius. The outdoor ventilation rate is 1.18 ACH. The fan efficiency is 0.64, the pressure rise is 1536 Pa, and the maximum flow rate is 130.08 m3/s.\n",
            "\n",
            "**Category 4:**\n"
          ]
        }
      ]
    }
  ]
}