{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Welcome to the preheat_open Quick Start Guide!" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Installation\n", "\n", "If you haven't done so already, please install the package by the terminal command\n", "\n", " pip install preheat_open\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Setting up an API key\n", "\n", "This step is required to access data via the Neogrid API. Obtain or access your API key by accessing your [user profile page in the PreHEAT App](https://app.neogrid.dk/v2/#!/app/user/profile)." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Importing and setting up a configuration object\n", "\n", "The `preheat_open` package consists of a model layer and an api interface. These are found in the modules `preheat_open` and `preheat_open.api` modules, respectively. It is recommended to import both modules as aliases: " ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "import preheat_open as po\n", "import preheat_open.configuration as conf" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "The first step hereafter would in most cases be setting up a configuration object:" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [], "source": [ "# config = conf.PersonalConfig()\n", "# config.name = \"Testy McTestface\"\n", "# config.email = \"test@test.com\"\n", "# config.update.all()\n", "\n", "# config2 = conf.NeogridApiConfig()\n", "# config2.token = \"\"\n", "# config2.update.all()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Creating configuration yaml file" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# Loading a Location" ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [], "source": [ "with po.ApiAdapter() as adapter:\n", " location = adapter.get_location(2756)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# Getting units, zones, components etc." ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "[Unit(type=COLD_WATER, name=cold_water_primary, id=15316),\n", " Unit(type=COOLING, name=cooling_primary, id=15315),\n", " Unit(type=CUSTOM, name=custom_unit_1, id=15319),\n", " Unit(type=CONTROL, name=control_unit_custom_1, id=15357),\n", " Unit(type=ELECTRICITY, name=electricity_primary, id=15317),\n", " Unit(type=HEAT_PUMP, name=heat_pump_1, id=15320),\n", " Unit(type=HEATING, name=heating_primary, id=15314),\n", " Unit(type=SECONDARY, name=, id=15401),\n", " Unit(type=CONTROL, name=dummy_heating_controller, id=15402),\n", " Unit(type=HOT_WATER, name=dhw_primary, id=15313),\n", " Unit(type=INDOOR_CLIMATE, name=indoor_climate_1, id=15318),\n", " Unit(type=MAIN, name=main_unit, id=15312),\n", " Unit(type=VENTILATION, name=ventilation_primary_1, id=15321),\n", " Unit(type=WEATHER_FORECAST, name=Weather Forecast, id=168)]" ] }, "execution_count": 4, "metadata": {}, "output_type": "execute_result" } ], "source": [ "units = list(location.get_units())\n", "units" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "it is also possible to call location.get_units with keyword arguments type, name, id and/or parent. for parent provide a dict with key type name and/or id." ] }, { "cell_type": "code", "execution_count": 5, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "Unit(type=SECONDARY, name=, id=15401)" ] }, "execution_count": 5, "metadata": {}, "output_type": "execute_result" } ], "source": [ "secondary_heating=list(location.get_units(type=po.UnitType.SECONDARY,parent=dict(type=po.UnitType.HEATING)))[0]\n", "secondary_heating" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "inspect the components on a unit, calling get_components gets all components of the specified unit and all subunits. the method can also be called om the location directly. the method take to same keyword arguments as get_units (type,name,id,parent)" ] }, { "cell_type": "code", "execution_count": 6, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "[Component(id=32718, type=RETURN_TEMPERATURE, name=ReturnFlowTemperature),\n", " Component(id=32717, type=SUPPLY_TEMPERATURE, name=InletFlowTemperature),\n", " Component(id=32719, type=SETPOINT, name=CONTROL_POSITION)]" ] }, "execution_count": 6, "metadata": {}, "output_type": "execute_result" } ], "source": [ "components = list(secondary_heating.get_components())\n", "components" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# Getting measurements" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [ { "data": { "application/vnd.microsoft.datawrangler.viewer.v0+json": { "columns": [ { "name": "index", "rawType": "object", "type": "string" }, { "name": "returnT_secondaries", "rawType": "float64", "type": "float" }, { "name": "supplyT_secondaries", "rawType": "float64", "type": "float" }, { "name": "setPoint_controls", "rawType": "float64", "type": "float" }, { "name": "energy_hotWater", "rawType": "float64", "type": "float" }, { "name": "energy_main", "rawType": "float64", "type": "float" }, { "name": "flow_main", "rawType": "float64", "type": "float" }, { "name": "power_main", "rawType": "float64", "type": "float" }, { "name": "returnT_main", "rawType": "float64", "type": "float" }, { "name": "supplyT_main", "rawType": "float64", "type": "float" }, { "name": "volume_main", "rawType": "float64", "type": "float" }, { "name": "Temperature_weatherForecast", "rawType": "float64", "type": "float" }, { "name": "Humidity_weatherForecast", "rawType": "float64", "type": "float" }, { "name": "WindDirection_weatherForecast", "rawType": "float64", "type": "float" }, { "name": "WindSpeed_weatherForecast", "rawType": "float64", "type": "float" }, { "name": "Pressure_weatherForecast", "rawType": "float64", "type": "float" }, { "name": "LowClouds_weatherForecast", "rawType": "float64", "type": "float" }, { "name": "MediumClouds_weatherForecast", "rawType": "float64", "type": "float" }, { "name": "HighClouds_weatherForecast", "rawType": "float64", "type": "float" }, { "name": "Fog_weatherForecast", "rawType": "float64", "type": "float" }, { "name": "WindGust_weatherForecast", "rawType": "float64", "type": "float" }, { "name": "DewPointTemperature_weatherForecast", "rawType": "float64", "type": "float" }, { "name": "Cloudiness_weatherForecast", "rawType": "float64", "type": "float" }, { "name": "Precipitation_weatherForecast", "rawType": "float64", "type": "float" }, { "name": "DirectSunPower_weatherForecast", "rawType": "float64", "type": "float" }, { "name": "DiffuseSunPower_weatherForecast", "rawType": "float64", "type": "float" }, { "name": "SunAltitude_weatherForecast", "rawType": "float64", "type": "float" }, { "name": "SunAzimuth_weatherForecast", "rawType": "float64", "type": "float" }, { "name": "DirectSunPowerVertical_weatherForecast", "rawType": "float64", "type": "float" } ], "ref": "d6e6a70e-459b-4cee-bc8d-419a2c2f5fb5", "rows": [ [ "count", "744.0", "744.0", "744.0", "744.0", "744.0", "744.0", "744.0", "744.0", "744.0", "744.0", "744.0", "744.0", "744.0", "744.0", "744.0", "744.0", "744.0", "744.0", "744.0", "744.0", "744.0", "744.0", "744.0", "744.0", "744.0", "280.0", "280.0", "744.0" ], [ "mean", "27.49202473681781", "44.958604195426354", "49.81622196233966", "150.034", "150.034", "0.049380452124203646", "0.002510949603420642", "27.49202473681781", "44.958604195426354", "75017.0", "0.6061827956989249", "87.62795698924731", "169.4483870967742", "3.9811827956989245", "1008.0317204301074", "71.2625", "28.76666666666667", "36.51935483870968", "4.746774193548387", "6.317876344086022", "-1.442741935483871", "81.46841397849462", "0.058198924731182794", "0.012734068525176133", "0.009709260603110816", "6.208637424637199", "180.3638517762185", "0.08000914108767515" ], [ "std", "0.422389260631018", "0.8396488283636956", "8.252763502699567", "5.158046141709087", "5.158046141709087", "0.008469857048419627", "0.00041274276013765753", "0.422389260631018", "0.8396488283636956", "2579.0230708545437", "2.5797564647492583", "7.556582300402117", "112.23595193706906", "2.433623974980795", "13.579513675112098", "35.92761722325197", "37.84683827401721", "42.611370999764524", "19.48408510432839", "3.8853024369296376", "3.014670456770153", "31.244306457993954", "0.20820965518025902", "0.029370676809688325", "0.01846299261484226", "5.602158664814182", "35.73100441740844", "0.15561958290469388" ], [ "min", "26.283086968691705", "42.597956796201615", "24.074561645531208", "141.118", "141.118", "0.0220706723726892", "0.0011010581994928", "26.283086968691705", "42.597956796201615", "70559.0", "-7.2", "63.5", "0.1", "0.1", "975.4", "0.0", "0.0", "0.0", "0.0", "0.7", "-9.5", "0.0", "0.0", "0.0", "0.0", "-5.997874449104728", "123.47675818880802", "0.0" ], [ "25%", "27.187001022044186", "44.38667755294227", "44.37472967092138", "145.576", "145.576", "0.04334173310565485", "0.00225127080353725", "27.187001022044186", "44.38667755294227", "72788.0", "-0.6", "82.9", "44.675000000000004", "2.0", "998.6999999999999", "49.525", "0.0", "0.0", "0.0", "3.2", "-3.6", "79.625", "0.0", "0.0", "0.0", "2.2699229891401767", "150.93840334235838", "0.0" ], [ "50%", "27.478028604736412", "44.95099062081151", "49.975029013479684", "150.034", "150.034", "0.0496879109870548", "0.00251657910859005", "27.478028604736412", "44.95099062081151", "75017.0", "0.8", "88.4", "190.6", "3.5", "1007.45", "90.35", "2.8", "6.35", "0.0", "5.55", "-1.0", "98.4", "0.0", "0.0", "0.0", "7.131740883759861", "180.06771958545494", "0.0" ], [ "75%", "27.780777358353518", "45.517521422503926", "55.58335410904594", "154.492", "154.492", "0.05530776542826207", "0.0027831151128289", "27.780777358353518", "45.517521422503926", "77246.0", "1.825", "93.4", "266.5", "5.4", "1018.9", "99.6", "61.575", "89.025", "0.2", "8.3", "0.5", "100.0", "0.0", "0.0080333954143675", "0.011685804222865", "10.699911555529152", "208.5165951929517", "0.0793799904893559" ], [ "max", "29.0163929044678", "47.89656741892616", "79.60744099961735", "158.95", "158.95", "0.0753554870497145", "0.0037611555603908", "29.0163929044678", "47.89656741892616", "79475.0", "7.2", "99.5", "360.0", "12.9", "1029.0", "100.0", "100.0", "100.0", "100.0", "20.8", "6.5", "100.0", "1.8", "0.1988435911012244", "0.0750776910895226", "15.792464577499205", "247.51585063273927", "0.7030512652044633" ] ], "shape": { "columns": 28, "rows": 8 } }, "text/html": [ "
| \n", " | returnT_secondaries | \n", "supplyT_secondaries | \n", "setPoint_controls | \n", "energy_hotWater | \n", "energy_main | \n", "flow_main | \n", "power_main | \n", "returnT_main | \n", "supplyT_main | \n", "volume_main | \n", "... | \n", "Fog_weatherForecast | \n", "WindGust_weatherForecast | \n", "DewPointTemperature_weatherForecast | \n", "Cloudiness_weatherForecast | \n", "Precipitation_weatherForecast | \n", "DirectSunPower_weatherForecast | \n", "DiffuseSunPower_weatherForecast | \n", "SunAltitude_weatherForecast | \n", "SunAzimuth_weatherForecast | \n", "DirectSunPowerVertical_weatherForecast | \n", "
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| count | \n", "744.000000 | \n", "744.000000 | \n", "744.000000 | \n", "744.000000 | \n", "744.000000 | \n", "744.000000 | \n", "744.000000 | \n", "744.000000 | \n", "744.000000 | \n", "744.000000 | \n", "... | \n", "744.000000 | \n", "744.000000 | \n", "744.000000 | \n", "744.000000 | \n", "744.000000 | \n", "744.000000 | \n", "744.000000 | \n", "280.000000 | \n", "280.000000 | \n", "744.000000 | \n", "
| mean | \n", "27.492025 | \n", "44.958604 | \n", "49.816222 | \n", "150.034000 | \n", "150.034000 | \n", "0.049380 | \n", "0.002511 | \n", "27.492025 | \n", "44.958604 | \n", "75017.000000 | \n", "... | \n", "4.746774 | \n", "6.317876 | \n", "-1.442742 | \n", "81.468414 | \n", "0.058199 | \n", "0.012734 | \n", "0.009709 | \n", "6.208637 | \n", "180.363852 | \n", "0.080009 | \n", "
| std | \n", "0.422389 | \n", "0.839649 | \n", "8.252764 | \n", "5.158046 | \n", "5.158046 | \n", "0.008470 | \n", "0.000413 | \n", "0.422389 | \n", "0.839649 | \n", "2579.023071 | \n", "... | \n", "19.484085 | \n", "3.885302 | \n", "3.014670 | \n", "31.244306 | \n", "0.208210 | \n", "0.029371 | \n", "0.018463 | \n", "5.602159 | \n", "35.731004 | \n", "0.155620 | \n", "
| min | \n", "26.283087 | \n", "42.597957 | \n", "24.074562 | \n", "141.118000 | \n", "141.118000 | \n", "0.022071 | \n", "0.001101 | \n", "26.283087 | \n", "42.597957 | \n", "70559.000000 | \n", "... | \n", "0.000000 | \n", "0.700000 | \n", "-9.500000 | \n", "0.000000 | \n", "0.000000 | \n", "0.000000 | \n", "0.000000 | \n", "-5.997874 | \n", "123.476758 | \n", "0.000000 | \n", "
| 25% | \n", "27.187001 | \n", "44.386678 | \n", "44.374730 | \n", "145.576000 | \n", "145.576000 | \n", "0.043342 | \n", "0.002251 | \n", "27.187001 | \n", "44.386678 | \n", "72788.000000 | \n", "... | \n", "0.000000 | \n", "3.200000 | \n", "-3.600000 | \n", "79.625000 | \n", "0.000000 | \n", "0.000000 | \n", "0.000000 | \n", "2.269923 | \n", "150.938403 | \n", "0.000000 | \n", "
| 50% | \n", "27.478029 | \n", "44.950991 | \n", "49.975029 | \n", "150.034000 | \n", "150.034000 | \n", "0.049688 | \n", "0.002517 | \n", "27.478029 | \n", "44.950991 | \n", "75017.000000 | \n", "... | \n", "0.000000 | \n", "5.550000 | \n", "-1.000000 | \n", "98.400000 | \n", "0.000000 | \n", "0.000000 | \n", "0.000000 | \n", "7.131741 | \n", "180.067720 | \n", "0.000000 | \n", "
| 75% | \n", "27.780777 | \n", "45.517521 | \n", "55.583354 | \n", "154.492000 | \n", "154.492000 | \n", "0.055308 | \n", "0.002783 | \n", "27.780777 | \n", "45.517521 | \n", "77246.000000 | \n", "... | \n", "0.200000 | \n", "8.300000 | \n", "0.500000 | \n", "100.000000 | \n", "0.000000 | \n", "0.008033 | \n", "0.011686 | \n", "10.699912 | \n", "208.516595 | \n", "0.079380 | \n", "
| max | \n", "29.016393 | \n", "47.896567 | \n", "79.607441 | \n", "158.950000 | \n", "158.950000 | \n", "0.075355 | \n", "0.003761 | \n", "29.016393 | \n", "47.896567 | \n", "79475.000000 | \n", "... | \n", "100.000000 | \n", "20.800000 | \n", "6.500000 | \n", "100.000000 | \n", "1.800000 | \n", "0.198844 | \n", "0.075078 | \n", "15.792465 | \n", "247.515851 | \n", "0.703051 | \n", "
8 rows × 28 columns
\n", "