diff --git a/README.md b/README.md index 39b1f72f..0ee902ca 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,9 @@ ![E.ON EBC RWTH Aachen University](./img/EBC_Logo.png) +![DVG TU Berlin](./img/DVG_Logo.png) # DistrictGenerator [![License](http://img.shields.io/:license-mit-blue.svg)](http://doge.mit-license.org) -[![Documentation](https://rwth-ebc.github.io/FiLiP/master/docs/doc.svg)](https://rwth-ebc.github.io/FiLiP/master/docs/index.html) The districtgenerator is a Python tool for generating building-specific thermal, electrical and occupancy profiles for districts. By integrating several open-source data bases and tools like [TEASER](https://github.com/RWTH-EBC/TEASER) and @@ -74,11 +74,6 @@ The minimal input data set was defined following the [TABULA archetype approach] * _retrofit_: retrofit state according to TABULA (0: existing state, 1: usual refurbishment, 2: advanced refurbishment) * _area_: reference floor area (given in square meters) -- id: building ID (just numerate the buildings) -- building: residential building type (single family house, terraced house, multi family house or apartment block) -- year: construction year (the calendar year in which the building was constructed) -- retrofit: retrofit state according to TABULA (0: existing state, 1: usual refurbishment, 2: advanced refurbishment) -- area: reference floor area (given in square meters) The example.csv file can be used as [template](../districtgenerator/data/scenarios/example.csv). diff --git a/classes.html b/classes.html deleted file mode 100644 index 95a9ba66..00000000 --- a/classes.html +++ /dev/null @@ -1,158 +0,0 @@ - - - -
- - classDiagram - class Datahandler { - SunRad : ndarray - advancedModel : NoneType - counter : dict - district : list - filePath - resultPath : NoneType - scenario : NoneType, TextFileReader - scenario_name : NoneType, str - sheetFile : NoneType - site : dict - srcPath - time : dict - weatherFile : NoneType - generateBuildings() - generateDemands(calcUserProfiles: bool, saveUserProfiles: bool, savePath: str) - generateDistrictComplete(scenario_name, calcUserProfiles, saveUserProfiles) - generateEnvironment() - initializeBuildings(scenario_name) - loadDistrict(scenario_name) - plot(mode, initialTime, timeHorizon, savePlots, timeStamp, show) - saveDistrict() - setAdvancedModel(pathAdvancedModel) - setResultPath(new_path) - } - class DemandPlots { - color : dict - factor - filePath - l - labels : dict - months : list - plots : list - plotsMonthly : list - srcPath - time - titles : dict - y : dict - defaultPlots(plotResolution, initialTime, timeHorizon, savePlots, timeStamp, show) - onePlot(plotType, plotResolution, initialTime, timeHorizon, label, title, color, savePlots, timeStamp, show) - preparePlots(data) - } - class Envelope { - A : dict - A_m - A_tot - C_m - Delta_theta_er : int - F_F : int - F_r : dict - F_sh_gl : int - H_tr_em : dict - H_tr_is - H_tr_ms - H_tr_w - H_ve - I_sol : dict - Lambda : dict - R_se : dict - R_si : dict - T_set_min - U : dict - V - alpha_Sc : dict - attributes : list - b_floor : float - b_tr : dict - c_p_air - construction_type - construction_year - cp : dict - d : dict - d_iso : dict - epsilon : dict - f_class : dict - file_path - g_gl : dict - h_is : float - h_ms : float - h_r : dict - id - kappa : dict - lambda_at : float - opaque : set - opaque_ext : list - phi_ia - phi_m : dict - phi_st : dict - retrofit - rho : dict - rho_air - usage_short - ventilationRate - calcHeatLoad(site, method) - calcNormativeProperties(SunRad, internal_gains) - loadAreas(prj) - loadComponentProperties(prj) - loadMaterialID(mat_id, data_class) - loadParams() - specificHeatCapacity(d, d_iso, density, cp) - } - class Profiles { - activity_profile : NoneType, list - app_load : list, ndarray - initial_day - light_load : list, ndarray - nb_days - number_occupants - occ_profile : list, ndarray - prob_profiles_dhw : dict - time_resolution - generate_activity_profile() - generate_dhw_profile() - generate_el_profile(irradiance, el_wrapper, annual_demand, do_normalization) - generate_gain_profile() - generate_occupancy_profiles() - loadProbabilitiesDhw() - } - class Sun { - filePath - getGeometry(initialTime, timeDiscretization, timesteps, timeZone, location, altitude) - getIncidenceAngle(beta, gamma, phi, omega, delta) - getSolarGains(initialTime, timeDiscretization, timeSteps, timeZone, location, altitude, beta, gamma, beam, diffuse, albedo) - getTotalRadiationTiltedSurface(theta, thetaZ, beamRadiation, diffuseRadiation, airmass, extraterrestrialIrradiance, beta, albedo) - } - class Users { - annual_el_demand : NoneType, ndarray - building - dhw : NoneType, ndarray - el_wrapper : list - elec : NoneType, ndarray - gains : NoneType, ndarray - heat : NoneType, ndarray - lighting_index : list - nb_flats : NoneType, int - nb_occ : list - occ : NoneType, ndarray - calcHeatingProfile(site, envelope, time_resolution) - calcProfiles(site, time_resolution, time_horizon, initital_day) - create_el_wrapper() - generate_annual_el_consumption() - generate_lighting_index() - generate_number_flats(area) - generate_number_occupants() - loadProfiles(unique_name, path) - saveHeatingProfile(unique_name, path) - saveProfiles(unique_name, path) - } - -
- - diff --git a/districtgenerator/data/scenarios/test_scenario_nwg.csv b/districtgenerator/data/scenarios/test_scenario_nwg.csv new file mode 100644 index 00000000..f8b3a0a6 --- /dev/null +++ b/districtgenerator/data/scenarios/test_scenario_nwg.csv @@ -0,0 +1,12 @@ +id;building;year;retrofit;area +0;IWU Office, Administrative or Government Buildings;1963;0;61 +1;IWU Research and University Teaching;1934;0;59 +2;IWU Health and Care;2014;0;25 +3;IWU School, Day Nursery and other Care;1926;0;21 +4;IWU Culture and Leisure;1993;0;21 +5;IWU Sports Facilities;1905;0;54 +6;IWU Trade Buildings;1947;0;64 +7;IWU Technical and Utility (supply and disposal);1924;0;70 +8;IWU Transport;1927;0;89 +9;IWU Generalized (1) Services building;1929;0;16 +10;IWU Generalized (2) Production buildings;1988;0;86 diff --git a/img/DVG_Logo.png b/img/DVG_Logo.png new file mode 100644 index 00000000..6602d329 Binary files /dev/null and b/img/DVG_Logo.png differ diff --git a/packages.html b/packages.html deleted file mode 100644 index 80e92668..00000000 --- a/packages.html +++ /dev/null @@ -1,35 +0,0 @@ - - - -
- - classDiagram - class districtgenerator { - } - class datahandler { - } - class envelope { - } - class plots { - } - class profils { - } - class solar { - } - class users { - } - districtgenerator --> datahandler - districtgenerator --> envelope - districtgenerator --> plots - districtgenerator --> profils - districtgenerator --> solar - districtgenerator --> users - datahandler --> envelope - datahandler --> plots - datahandler --> solar - datahandler --> users - users --> profils - -
- - diff --git a/test.ipynb b/test.ipynb deleted file mode 100644 index 2af52fdb..00000000 --- a/test.ipynb +++ /dev/null @@ -1,3549 +0,0 @@ -{ - "cells": [ - { - "cell_type": "code", - "execution_count": 1, - "metadata": {}, - "outputs": [], - "source": [ - "import os, math\n", - "import json \n", - "import random as rd\n", - "import numpy as np\n", - "import richardsonpy\n", - "import richardsonpy.classes.stochastic_el_load_wrapper as wrap\n", - "import richardsonpy.classes.appliance as app_model\n", - "import richardsonpy.classes.lighting as light_model\n", - "from districtgenerator.profils import Profiles\n", - "import functions.heating_profile_5R1C as heating\n", - "from districtgenerator import Datahandler" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": 2, - "metadata": {}, - "outputs": [], - "source": [ - "import random as rd\n", - "annual_el_demand = 1100\n", - " # Write a function, that returns the respective \n", - "src_path = os.path.dirname(richardsonpy.__file__)\n", - "path_app = os.path.join(src_path,'inputs','Appliances.csv')\n", - "path_light = os.path.join(src_path,'inputs','LightBulbs.csv')\n", - "# annual demand of the elictric appliances (annual demand minus lighting)\n", - "# source: https://www.umweltbundesamt.de/daten/private-haushalte-konsum/wohnen/energieverbrauch-privater-haushalte#stromverbrauch-mit-einem-anteil-von-rund-einem-funftel\n", - "# values from diagram for 2018 without heating, dhw and cooling: 8,1 / 81,1 = 10,0%\n", - "appliancesDemand = 0.9 * annual_el_demand\n", - "random_nb = rd.random()\n", - "lighting_index = int(random_nb * 100)\n", - "\n", - "# Create and save appliances object\n", - "appliances = \\\n", - " app_model.Appliances(path_app,\n", - " annual_consumption=appliancesDemand,\n", - " randomize_appliances=True,\n", - " max_iter=15,\n", - " prev_heat_dev=True)\n", - "\n", - "# Create and save light configuration object\n", - "lights = light_model.load_lighting_profile(filename=path_light,\n", - " index=lighting_index)\n", - "\n", - "# Create wrapper object\n", - "el_wrapper = wrap.ElectricityProfile(appliances,lights)" - ] - }, - { - "cell_type": "code", - "execution_count": 3, - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "{'data': [[0, 0.163, 6115.75933, 14.0, 190.0, 0.0, 56.0, 0.0, 7.0, 1.0, 0.8],\n", - " [1, 0.651, 6115.75933, 22.0, 190.0, 0.0, 44.0, 0.0, 7.0, 1.0, 0.8],\n", - " [1, 0.43, 6115.75933, 18.0, 110.0, 0.0, 36.0, 0.0, 7.0, 1.0, 0.8],\n", - " [0, 0.291, 6115.75933, 20.0, 155.0, 0.0, 40.0, 0.0, 7.0, 1.0, 0.8],\n", - " [1, 0.9, 1e-05, 0.0, 0.0, 1.0, 0.0, 1.0, 6.0, 1.0, 1.0],\n", - " [1, 0.9, 1212.76286, 60.0, 15.0, 2.0, 0.0, 1.0, 6.0, 1.0, 1.0],\n", - " [1, 0.9, 1e-05, 0.0, 0.0, 2.0, 0.0, 0.0, 7.0, 1.0, 1.0],\n", - " [1, 0.9, 1e-05, 0.0, 0.0, 1.0, 0.0, 1.0, 6.0, 1.0, 1.0],\n", - " [1, 0.9, 109.42554, 60.0, 100.0, 9.0, 0.0, 1.0, 6.0, 1.0, 1.0],\n", - " [1, 0.9, 35.45947, 30.0, 1000.0, 0.0, 0.0, 1.0, 4.0, 0.0185, 1.0],\n", - " [1, 0.937, 110.3676, 20.0, 2000.0, 0.0, 0.0, 1.0, 5.0, 0.0665, 1.0],\n", - " [0, 0.2, 197.12359, 31.0, 37.0, 3.0, 0.0, 1.0, 6.0, 1.0, 0.9],\n", - " [1, 0.708, 449.23798, 300.0, 141.0, 5.0, 0.0, 1.0, 6.0, 1.0, 0.9],\n", - " [1, 0.665, 654.87596, 4.0, 335.0, 4.0, 0.0, 1.0, 6.0, 1.0, 0.9],\n", - " [1, 0.977, 1464.26654, 73.0, 124.0, 3.0, 0.0, 1.0, 0.0, 0.3398, 0.9],\n", - " [0, 0.58, 1464.26654, 73.0, 124.0, 3.0, 0.0, 1.0, 0.0, 0.3398, 0.9],\n", - " [0, 0.18, 1521.49597, 73.0, 124.0, 2.0, 0.0, 1.0, 0.0, 0.3398, 0.9],\n", - " [0, 0.896, 1464.26654, 73.0, 34.0, 2.0, 0.0, 1.0, 0.0, 0.3398, 1.0],\n", - " [1, 0.934, 1464.26654, 73.0, 27.0, 15.0, 0.0, 1.0, 0.0, 0.3398, 1.0],\n", - " [1, 0.463, 417.90201, 16.0, 2400.0, 1.0, 0.0, 1.0, 1.0, 0.1443, 1.0],\n", - " [1, 0.616, 219.7928, 27.0, 2125.0, 3.0, 0.0, 1.0, 1.0, 0.1443, 1.0],\n", - " [0, 0.859, 94.61932, 30.0, 1250.0, 2.0, 0.0, 1.0, 1.0, 0.1443, 1.0],\n", - " [1, 0.975, 1519.82287, 3.0, 2000.0, 1.0, 0.0, 1.0, 6.0, 1.0, 1.0],\n", - " [1, 1.0, 292.32622, 3.0, 1000.0, 2.0, 0.0, 1.0, 1.0, 0.1443, 1.0],\n", - " [0, 0.335, 241.4764, 60.0, 1131.0, 0.0, 0.0, 1.0, 1.0, 0.1443, 0.8],\n", - " [0, 0.416, 122.07292, 60.0, 2500.0, 1.0, 0.0, 1.0, 2.0, 0.0177, 0.8],\n", - " [1, 0.781, 195.9066, 138.0, 406.0, 1.0, 0.0, 1.0, 2.0, 0.0177, 0.8],\n", - " [0, 0.153, 195.9066, 198.0, 792.0, 1.0, 0.0, 1.0, 2.0, 0.0177, 0.8],\n", - " [0, 0.17, 2684.99685, 20.0, 3000.0, 0.0, 0.0, 1.0, 6.0, 1.0, 1.0],\n", - " [0, 0.01, 7208.63284, 5.0, 3000.0, 0.0, 0.0, 1.0, 6.0, 1.0, 1.0],\n", - " [0, 0.67, 290.39551, 3.0, 9000.0, 0.0, 0.0, 1.0, 3.0, 0.1251, 1.0],\n", - " [0, 0.028, 227.20878, 360.0, 10200.0, 0.0, 0.0, 0.0, 8.0, 0.6225, 1.0],\n", - " [0, 0.026, 365.67578, 240.0, 2000.0, 0.0, 0.0, 1.0, 6.0, 1.0, 1.0]],\n", - " 'calib_cycles': [1586.420078106104,\n", - " 1586.420078106104,\n", - " 1586.420078106104,\n", - " 1586.420078106104,\n", - " 2.5939870954766694e-06,\n", - " 314.58912087133785,\n", - " 2.5939870954766694e-06,\n", - " 2.5939870954766694e-06,\n", - " 28.384843867556608,\n", - " 9.19814075924421,\n", - " 28.62921301587308,\n", - " 51.13360486740338,\n", - " 116.5317522918006,\n", - " 169.87397893778953,\n", - " 379.8288509098272,\n", - " 379.8288509098272,\n", - " 394.67409119997575,\n", - " 379.8288509098272,\n", - " 379.8288509098272,\n", - " 108.4032421113762,\n", - " 57.01396868786844,\n", - " 24.544129506277752,\n", - " 394.2400912190315,\n", - " 75.82904423494738,\n", - " 62.638666546216236,\n", - " 31.665557918715578,\n", - " 50.81791923187096,\n", - " 50.81791923187096,\n", - " 696.4847180295505,\n", - " 1869.9100562989333,\n", - " 75.3282205524366,\n", - " 58.93766432989975,\n", - " 94.85582544483654],\n", - " 'calib_scalar': [0.003826843089912523,\n", - " 0.0037691473479786264,\n", - " 0.0036060466920655927,\n", - " 0.0036857935539834656,\n", - " 1.0752260288383644e-11,\n", - " 0.0014146781169209353,\n", - " 4.935287472368093e-12,\n", - " 1.0752260288383644e-11,\n", - " 0.00011849368687317316,\n", - " 0.0020632759443043845,\n", - " 0.0017887584699843937,\n", - " 0.000213354264364235,\n", - " 0.0005648904862136316,\n", - " 0.0007061285303159479,\n", - " 0.005235041493391806,\n", - " 0.005235041493391806,\n", - " 0.005467396916244901,\n", - " 0.005235041493391806,\n", - " 0.005235041493391806,\n", - " 0.003136472643864102,\n", - " 0.0016482646205589915,\n", - " 0.0007071976423047182,\n", - " 0.001642203947105384,\n", - " 0.0021802732188093673,\n", - " 0.0018277931341477247,\n", - " 0.007474456171544179,\n", - " 0.01225708330402154,\n", - " 0.012418738299501174,\n", - " 0.0030638859582565268,\n", - " 0.008063403211194519,\n", - " 0.002498269929769884,\n", - " 0.0001877126782710789,\n", - " 0.0004341525716771488]}" - ] - }, - "execution_count": 3, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "vars(el_wrapper.appliances)" - ] - }, - { - "cell_type": "code", - "execution_count": 4, - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "{'data': [[0, 0.163, 6115.75933, 14.0, 190.0, 0.0, 56.0, 0.0, 7.0, 1.0, 0.8],\n", - " [1, 0.651, 6115.75933, 22.0, 190.0, 0.0, 44.0, 0.0, 7.0, 1.0, 0.8],\n", - " [1, 0.43, 6115.75933, 18.0, 110.0, 0.0, 36.0, 0.0, 7.0, 1.0, 0.8],\n", - " [0, 0.291, 6115.75933, 20.0, 155.0, 0.0, 40.0, 0.0, 7.0, 1.0, 0.8],\n", - " [1, 0.9, 1e-05, 0.0, 0.0, 1.0, 0.0, 1.0, 6.0, 1.0, 1.0],\n", - " [1, 0.9, 1212.76286, 60.0, 15.0, 2.0, 0.0, 1.0, 6.0, 1.0, 1.0],\n", - " [1, 0.9, 1e-05, 0.0, 0.0, 2.0, 0.0, 0.0, 7.0, 1.0, 1.0],\n", - " [1, 0.9, 1e-05, 0.0, 0.0, 1.0, 0.0, 1.0, 6.0, 1.0, 1.0],\n", - " [1, 0.9, 109.42554, 60.0, 100.0, 9.0, 0.0, 1.0, 6.0, 1.0, 1.0],\n", - " [1, 0.9, 35.45947, 30.0, 1000.0, 0.0, 0.0, 1.0, 4.0, 0.0185, 1.0],\n", - " [1, 0.937, 110.3676, 20.0, 2000.0, 0.0, 0.0, 1.0, 5.0, 0.0665, 1.0],\n", - " [0, 0.2, 197.12359, 31.0, 37.0, 3.0, 0.0, 1.0, 6.0, 1.0, 0.9],\n", - " [1, 0.708, 449.23798, 300.0, 141.0, 5.0, 0.0, 1.0, 6.0, 1.0, 0.9],\n", - " [1, 0.665, 654.87596, 4.0, 335.0, 4.0, 0.0, 1.0, 6.0, 1.0, 0.9],\n", - " [1, 0.977, 1464.26654, 73.0, 124.0, 3.0, 0.0, 1.0, 0.0, 0.3398, 0.9],\n", - " [0, 0.58, 1464.26654, 73.0, 124.0, 3.0, 0.0, 1.0, 0.0, 0.3398, 0.9],\n", - " [0, 0.18, 1521.49597, 73.0, 124.0, 2.0, 0.0, 1.0, 0.0, 0.3398, 0.9],\n", - " [0, 0.896, 1464.26654, 73.0, 34.0, 2.0, 0.0, 1.0, 0.0, 0.3398, 1.0],\n", - " [1, 0.934, 1464.26654, 73.0, 27.0, 15.0, 0.0, 1.0, 0.0, 0.3398, 1.0],\n", - " [1, 0.463, 417.90201, 16.0, 2400.0, 1.0, 0.0, 1.0, 1.0, 0.1443, 1.0],\n", - " [1, 0.616, 219.7928, 27.0, 2125.0, 3.0, 0.0, 1.0, 1.0, 0.1443, 1.0],\n", - " [0, 0.859, 94.61932, 30.0, 1250.0, 2.0, 0.0, 1.0, 1.0, 0.1443, 1.0],\n", - " [1, 0.975, 1519.82287, 3.0, 2000.0, 1.0, 0.0, 1.0, 6.0, 1.0, 1.0],\n", - " [1, 1.0, 292.32622, 3.0, 1000.0, 2.0, 0.0, 1.0, 1.0, 0.1443, 1.0],\n", - " [0, 0.335, 241.4764, 60.0, 1131.0, 0.0, 0.0, 1.0, 1.0, 0.1443, 0.8],\n", - " [0, 0.416, 122.07292, 60.0, 2500.0, 1.0, 0.0, 1.0, 2.0, 0.0177, 0.8],\n", - " [1, 0.781, 195.9066, 138.0, 406.0, 1.0, 0.0, 1.0, 2.0, 0.0177, 0.8],\n", - " [0, 0.153, 195.9066, 198.0, 792.0, 1.0, 0.0, 1.0, 2.0, 0.0177, 0.8],\n", - " [0, 0.17, 2684.99685, 20.0, 3000.0, 0.0, 0.0, 1.0, 6.0, 1.0, 1.0],\n", - " [0, 0.01, 7208.63284, 5.0, 3000.0, 0.0, 0.0, 1.0, 6.0, 1.0, 1.0],\n", - " [0, 0.67, 290.39551, 3.0, 9000.0, 0.0, 0.0, 1.0, 3.0, 0.1251, 1.0],\n", - " [0, 0.028, 227.20878, 360.0, 10200.0, 0.0, 0.0, 0.0, 8.0, 0.6225, 1.0],\n", - " [0, 0.026, 365.67578, 240.0, 2000.0, 0.0, 0.0, 1.0, 6.0, 1.0, 1.0]],\n", - " 'calib_cycles': [1586.420078106104,\n", - " 1586.420078106104,\n", - " 1586.420078106104,\n", - " 1586.420078106104,\n", - " 2.5939870954766694e-06,\n", - " 314.58912087133785,\n", - " 2.5939870954766694e-06,\n", - " 2.5939870954766694e-06,\n", - " 28.384843867556608,\n", - " 9.19814075924421,\n", - " 28.62921301587308,\n", - " 51.13360486740338,\n", - " 116.5317522918006,\n", - " 169.87397893778953,\n", - " 379.8288509098272,\n", - " 379.8288509098272,\n", - " 394.67409119997575,\n", - " 379.8288509098272,\n", - " 379.8288509098272,\n", - " 108.4032421113762,\n", - " 57.01396868786844,\n", - " 24.544129506277752,\n", - " 394.2400912190315,\n", - " 75.82904423494738,\n", - " 62.638666546216236,\n", - " 31.665557918715578,\n", - " 50.81791923187096,\n", - " 50.81791923187096,\n", - " 696.4847180295505,\n", - " 1869.9100562989333,\n", - " 75.3282205524366,\n", - " 58.93766432989975,\n", - " 94.85582544483654],\n", - " 'calib_scalar': [0.003826843089912523,\n", - " 0.0037691473479786264,\n", - " 0.0036060466920655927,\n", - " 0.0036857935539834656,\n", - " 1.0752260288383644e-11,\n", - " 0.0014146781169209353,\n", - " 4.935287472368093e-12,\n", - " 1.0752260288383644e-11,\n", - " 0.00011849368687317316,\n", - " 0.0020632759443043845,\n", - " 0.0017887584699843937,\n", - " 0.000213354264364235,\n", - " 0.0005648904862136316,\n", - " 0.0007061285303159479,\n", - " 0.005235041493391806,\n", - " 0.005235041493391806,\n", - " 0.005467396916244901,\n", - " 0.005235041493391806,\n", - " 0.005235041493391806,\n", - " 0.003136472643864102,\n", - " 0.0016482646205589915,\n", - " 0.0007071976423047182,\n", - " 0.001642203947105384,\n", - " 0.0021802732188093673,\n", - " 0.0018277931341477247,\n", - " 0.007474456171544179,\n", - " 0.01225708330402154,\n", - " 0.012418738299501174,\n", - " 0.0030638859582565268,\n", - " 0.008063403211194519,\n", - " 0.002498269929769884,\n", - " 0.0001877126782710789,\n", - " 0.0004341525716771488]}" - ] - }, - "execution_count": 4, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "vars(appliances)" - ] - }, - { - "cell_type": "code", - "execution_count": 8, - "metadata": {}, - "outputs": [], - "source": [ - "data = pd.read_excel(r'C:\\Users\\felix\\Programmieren\\tecdm\\src\\districtgenerator\\data\\Non-domestic-multi-zone-average-usage-profiles-for-Germany.xlsx')" - ] - }, - { - "cell_type": "code", - "execution_count": 14, - "metadata": {}, - "outputs": [ - { - "data": { - "text/html": [ - "
\n", - "\n", - "\n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - "
ID_Enob_lfdID_HK_UK_Enob_longBez_HK_EnobBez_HK_Enob_EngBez_UK_EnobBez_UK_Enob_Engt_startt_endt_nutz_dd_nutz_a...deltaTheta_i_NAtheta_i_h_mintheta_i_c_maxFeuchteVd_AVd_A_Gebc_RLTF_RLTq_I_pq_I_fac
01HK_UK_1-0Büro-, Verwaltungs- oder AmtsgebäudeOffice, Administrative or Government BuildingsNaNNaN6.94764518.18521911.237574256.563179...3.91073219.90037926.0330880.5815145.0131551.7366070.2303610.86095230.74468256.342308
12HK_UK_1-1Büro-, Verwaltungs- oder AmtsgebäudeOffice, Administrative or Government BuildingsParlaments- oder GerichtsgebäudeParliament or Court Building6.98715018.04892711.061778251.972117...3.99420620.00000026.0000000.4625204.0341341.4284280.1984280.85069622.22264832.672892
23HK_UK_1-2Büro-, Verwaltungs- oder AmtsgebäudeOffice, Administrative or Government BuildingsÖffentliches Verwaltungs- oder Ämtergebäude, R...Public Administration or Office Building, Town...7.05923218.16550611.106273253.662834...4.00000019.98692626.0081280.5805584.5429271.6183660.2186650.82790828.50819138.197157
34HK_UK_1-3Büro-, Verwaltungs- oder AmtsgebäudeOffice, Administrative or Government BuildingsBürogebäudeOffice Building6.82189218.28071211.458820261.808516...3.80605419.81847626.0688690.5299825.0473201.6450560.2303760.87816532.92560266.120123
45HK_UK_1-4Büro-, Verwaltungs- oder AmtsgebäudeOffice, Administrative or Government BuildingsRundfunk- oder FernsehanstaltBroadcasting or Television Station6.82189218.28071211.458820261.808516...3.80605419.81847626.0688690.5299825.0473201.6450560.2303760.87816532.92560266.120123
..................................................................
103104HK_UK_11-1VerkehrsgebäudeTransport BuildingsPark-/Garagengebäude, FahrradparkhausPark/Garage Building, Bicycle Parking Garage2.44127421.81298019.371706342.811152...0.76716615.21443127.3373980.0561761.8838920.3902440.0268720.9874727.91207320.636915
104105HK_UK_11-2VerkehrsgebäudeTransport BuildingsHalle für sonstige Verkehrsmittel (z.B. für Fl...Hall for Other Means of Transportation (e.g., ...2.44127421.81298019.371706342.811152...0.76716615.21443127.3373980.0561761.8838920.3902440.0268720.9874727.91207320.636915
105106HK_UK_11-3VerkehrsgebäudeTransport BuildingsGebäude zur Pflege von Fahrzeugen (z.B. Waschs...Building for Vehicle Maintenance (e.g., Car Wash)5.16771920.05770314.889984308.097599...3.98465220.00000026.0000000.2854043.4115001.0180000.1371380.94674836.048453518.719970
106107HK_UK_11-4VerkehrsgebäudeTransport BuildingsEmpfangsgebäude (Bahnhof, Busbahnhof, Flughafe...Terminal Building (Train Station, Bus Station,...7.44444918.96759611.523147268.656296...3.95265520.00000026.0000000.7982246.2880501.8967500.3868010.86870277.62639911.116274
107108HK_UK_12-0Sonstiges NichtwohngebäudeOther non-doemestic buildingsNaNNaN0.0000000.0000000.0000000.000000...0.0000000.0000000.0000000.0000000.0000000.0000000.0000000.0000000.0000000.000000
\n", - "

108 rows × 34 columns

\n", - "
" - ], - "text/plain": [ - " ID_Enob_lfd ID_HK_UK_Enob_long Bez_HK_Enob \\\n", - "0 1 HK_UK_1-0 Büro-, Verwaltungs- oder Amtsgebäude \n", - "1 2 HK_UK_1-1 Büro-, Verwaltungs- oder Amtsgebäude \n", - "2 3 HK_UK_1-2 Büro-, Verwaltungs- oder Amtsgebäude \n", - "3 4 HK_UK_1-3 Büro-, Verwaltungs- oder Amtsgebäude \n", - "4 5 HK_UK_1-4 Büro-, Verwaltungs- oder Amtsgebäude \n", - ".. ... ... ... \n", - "103 104 HK_UK_11-1 Verkehrsgebäude \n", - "104 105 HK_UK_11-2 Verkehrsgebäude \n", - "105 106 HK_UK_11-3 Verkehrsgebäude \n", - "106 107 HK_UK_11-4 Verkehrsgebäude \n", - "107 108 HK_UK_12-0 Sonstiges Nichtwohngebäude \n", - "\n", - " Bez_HK_Enob_Eng \\\n", - "0 Office, Administrative or Government Buildings \n", - "1 Office, Administrative or Government Buildings \n", - "2 Office, Administrative or Government Buildings \n", - "3 Office, Administrative or Government Buildings \n", - "4 Office, Administrative or Government Buildings \n", - ".. ... \n", - "103 Transport Buildings \n", - "104 Transport Buildings \n", - "105 Transport Buildings \n", - "106 Transport Buildings \n", - "107 Other non-doemestic buildings \n", - "\n", - " Bez_UK_Enob \\\n", - "0 NaN \n", - "1 Parlaments- oder Gerichtsgebäude \n", - "2 Öffentliches Verwaltungs- oder Ämtergebäude, R... \n", - "3 Bürogebäude \n", - "4 Rundfunk- oder Fernsehanstalt \n", - ".. ... \n", - "103 Park-/Garagengebäude, Fahrradparkhaus \n", - "104 Halle für sonstige Verkehrsmittel (z.B. für Fl... \n", - "105 Gebäude zur Pflege von Fahrzeugen (z.B. Waschs... \n", - "106 Empfangsgebäude (Bahnhof, Busbahnhof, Flughafe... \n", - "107 NaN \n", - "\n", - " Bez_UK_Enob_Eng t_start t_end \\\n", - "0 NaN 6.947645 18.185219 \n", - "1 Parliament or Court Building 6.987150 18.048927 \n", - "2 Public Administration or Office Building, Town... 7.059232 18.165506 \n", - "3 Office Building 6.821892 18.280712 \n", - "4 Broadcasting or Television Station 6.821892 18.280712 \n", - ".. ... ... ... \n", - "103 Park/Garage Building, Bicycle Parking Garage 2.441274 21.812980 \n", - "104 Hall for Other Means of Transportation (e.g., ... 2.441274 21.812980 \n", - "105 Building for Vehicle Maintenance (e.g., Car Wash) 5.167719 20.057703 \n", - "106 Terminal Building (Train Station, Bus Station,... 7.444449 18.967596 \n", - "107 NaN 0.000000 0.000000 \n", - "\n", - " t_nutz_d d_nutz_a ... deltaTheta_i_NA theta_i_h_min \\\n", - "0 11.237574 256.563179 ... 3.910732 19.900379 \n", - "1 11.061778 251.972117 ... 3.994206 20.000000 \n", - "2 11.106273 253.662834 ... 4.000000 19.986926 \n", - "3 11.458820 261.808516 ... 3.806054 19.818476 \n", - "4 11.458820 261.808516 ... 3.806054 19.818476 \n", - ".. ... ... ... ... ... \n", - "103 19.371706 342.811152 ... 0.767166 15.214431 \n", - "104 19.371706 342.811152 ... 0.767166 15.214431 \n", - "105 14.889984 308.097599 ... 3.984652 20.000000 \n", - "106 11.523147 268.656296 ... 3.952655 20.000000 \n", - "107 0.000000 0.000000 ... 0.000000 0.000000 \n", - "\n", - " theta_i_c_max Feuchte Vd_A Vd_A_Geb c_RLT F_RLT \\\n", - "0 26.033088 0.581514 5.013155 1.736607 0.230361 0.860952 \n", - "1 26.000000 0.462520 4.034134 1.428428 0.198428 0.850696 \n", - "2 26.008128 0.580558 4.542927 1.618366 0.218665 0.827908 \n", - "3 26.068869 0.529982 5.047320 1.645056 0.230376 0.878165 \n", - "4 26.068869 0.529982 5.047320 1.645056 0.230376 0.878165 \n", - ".. ... ... ... ... ... ... \n", - "103 27.337398 0.056176 1.883892 0.390244 0.026872 0.987472 \n", - "104 27.337398 0.056176 1.883892 0.390244 0.026872 0.987472 \n", - "105 26.000000 0.285404 3.411500 1.018000 0.137138 0.946748 \n", - "106 26.000000 0.798224 6.288050 1.896750 0.386801 0.868702 \n", - "107 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 \n", - "\n", - " q_I_p q_I_fac \n", - "0 30.744682 56.342308 \n", - "1 22.222648 32.672892 \n", - "2 28.508191 38.197157 \n", - "3 32.925602 66.120123 \n", - "4 32.925602 66.120123 \n", - ".. ... ... \n", - "103 7.912073 20.636915 \n", - "104 7.912073 20.636915 \n", - "105 36.048453 518.719970 \n", - "106 77.626399 11.116274 \n", - "107 0.000000 0.000000 \n", - "\n", - "[108 rows x 34 columns]" - ] - }, - "execution_count": 14, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "data" - ] - }, - { - "cell_type": "code", - "execution_count": 17, - "metadata": {}, - "outputs": [], - "source": [ - "filtered_data = data[data['Bez_UK_Enob'].isna()]\n", - "filtered_data.to_csv(r'C:\\Users\\felix\\Programmieren\\tecdm\\src\\districtgenerator\\data\\multi_zone_average\\Non-domestic-multi-zone-average-usage-profiles-for-Germany.csv', sep=\";\")" - ] - }, - { - "cell_type": "code", - "execution_count": 5, - "metadata": {}, - "outputs": [ - { - "ename": "TypeError", - "evalue": "list indices must be integers or slices, not numpy.float64", - "output_type": "error", - "traceback": [ - "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m", - "\u001b[1;31mTypeError\u001b[0m Traceback (most recent call last)", - "Cell \u001b[1;32mIn[5], line 9\u001b[0m\n\u001b[0;32m 7\u001b[0m df \u001b[38;5;241m=\u001b[39m pd\u001b[38;5;241m.\u001b[39mread_csv(\u001b[38;5;124mr\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mC:\u001b[39m\u001b[38;5;124m\\\u001b[39m\u001b[38;5;124mUsers\u001b[39m\u001b[38;5;124m\\\u001b[39m\u001b[38;5;124mfelix\u001b[39m\u001b[38;5;124m\\\u001b[39m\u001b[38;5;124mProgrammieren\u001b[39m\u001b[38;5;124m\\\u001b[39m\u001b[38;5;124mtecdm\u001b[39m\u001b[38;5;124m\\\u001b[39m\u001b[38;5;124msrc\u001b[39m\u001b[38;5;124m\\\u001b[39m\u001b[38;5;124mdistrictgenerator\u001b[39m\u001b[38;5;124m\\\u001b[39m\u001b[38;5;124mdata\u001b[39m\u001b[38;5;124m\\\u001b[39m\u001b[38;5;124moccupancy_schedules\u001b[39m\u001b[38;5;124m\\\u001b[39m\u001b[38;5;124mGarderobeDusche.csv\u001b[39m\u001b[38;5;124m\"\u001b[39m, sep\u001b[38;5;241m=\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124m;\u001b[39m\u001b[38;5;124m\"\u001b[39m)\n\u001b[0;32m 8\u001b[0m occupancy \u001b[38;5;241m=\u001b[39m \u001b[38;5;241m45\u001b[39m \u001b[38;5;241m*\u001b[39m df[\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mPeople\u001b[39m\u001b[38;5;124m\"\u001b[39m]\n\u001b[1;32m----> 9\u001b[0m \u001b[43mel_wrapper\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mpower_sim\u001b[49m\u001b[43m(\u001b[49m\u001b[43mirradiation\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mweekend\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mday\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43moccupancy\u001b[49m\u001b[43m)\u001b[49m\n", - "File \u001b[1;32mc:\\Users\\felix\\.conda\\envs\\districtgenerator\\Lib\\site-packages\\richardsonpy-0.2.1-py3.11.egg\\richardsonpy\\classes\\stochastic_el_load_wrapper.py:115\u001b[0m, in \u001b[0;36mElectricityProfile.power_sim\u001b[1;34m(self, irradiation, weekend, day, occupancy)\u001b[0m\n\u001b[0;32m 112\u001b[0m month \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_get_month(day)\n\u001b[0;32m 114\u001b[0m \u001b[38;5;66;03m# Lighting\u001b[39;00m\n\u001b[1;32m--> 115\u001b[0m demand_lighting \u001b[38;5;241m=\u001b[39m \u001b[43mlighting_model\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mrun_lighting_simulation\u001b[49m\u001b[43m(\u001b[49m\n\u001b[0;32m 116\u001b[0m \u001b[43m \u001b[49m\u001b[43mvOccupancyArray\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43moccupancy\u001b[49m\u001b[43m,\u001b[49m\n\u001b[0;32m 117\u001b[0m \u001b[43m \u001b[49m\u001b[43mvBulbArray\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mlightbulbs\u001b[49m\u001b[43m,\u001b[49m\n\u001b[0;32m 118\u001b[0m \u001b[43m \u001b[49m\u001b[43mvIrradianceArray\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mirradiation\u001b[49m\u001b[43m,\u001b[49m\n\u001b[0;32m 119\u001b[0m \u001b[43m \u001b[49m\u001b[43mlight_mod_config\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mlighting_config\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 121\u001b[0m \u001b[38;5;66;03m# Appliances\u001b[39;00m\n\u001b[0;32m 122\u001b[0m fun \u001b[38;5;241m=\u001b[39m appliance_model\u001b[38;5;241m.\u001b[39mrun_application_simulation\n", - "File \u001b[1;32mc:\\Users\\felix\\.conda\\envs\\districtgenerator\\Lib\\site-packages\\richardsonpy-0.2.1-py3.11.egg\\richardsonpy\\classes\\lighting.py:213\u001b[0m, in \u001b[0;36mrun_lighting_simulation\u001b[1;34m(vOccupancyArray, vBulbArray, vIrradianceArray, light_mod_config)\u001b[0m\n\u001b[0;32m 209\u001b[0m bLowIrradiance \u001b[38;5;241m=\u001b[39m ((iIrradiance \u001b[38;5;241m<\u001b[39m iIrradianceThreshold) \u001b[38;5;129;01mor\u001b[39;00m (\n\u001b[0;32m 210\u001b[0m random\u001b[38;5;241m.\u001b[39mrandom() \u001b[38;5;241m<\u001b[39m \u001b[38;5;241m0.05\u001b[39m))\n\u001b[0;32m 212\u001b[0m \u001b[38;5;66;03m# Get the effective occupancy for this number of active occupants to allow for sharing\u001b[39;00m\n\u001b[1;32m--> 213\u001b[0m fEffectiveOccupancy \u001b[38;5;241m=\u001b[39m \u001b[43mlight_mod_config\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43meff_occupancy\u001b[49m\u001b[43m[\u001b[49m\n\u001b[0;32m 214\u001b[0m \u001b[43m \u001b[49m\u001b[43miActiveOccupants\u001b[49m\u001b[43m]\u001b[49m\n\u001b[0;32m 216\u001b[0m \u001b[38;5;66;03m# Check the probability of a switch on at this time\u001b[39;00m\n\u001b[0;32m 217\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m (bLowIrradiance \u001b[38;5;129;01mand\u001b[39;00m (random\u001b[38;5;241m.\u001b[39mrandom() \u001b[38;5;241m<\u001b[39m (\n\u001b[0;32m 218\u001b[0m fEffectiveOccupancy \u001b[38;5;241m*\u001b[39m fCalibratedRelativeUseWeighting))):\n\u001b[0;32m 219\u001b[0m \n\u001b[0;32m 220\u001b[0m \u001b[38;5;66;03m# This is a switch on event\u001b[39;00m\n\u001b[0;32m 221\u001b[0m \n\u001b[0;32m 222\u001b[0m \u001b[38;5;66;03m# Determine how long this bulb is on for\u001b[39;00m\n", - "\u001b[1;31mTypeError\u001b[0m: list indices must be integers or slices, not numpy.float64" - ] - } - ], - "source": [ - "import pandas as pd\n", - "test_data = Datahandler()\n", - "test_data.generateEnvironment()\n", - "irradiation = test_data.site[\"SunTotal\"] \n", - "weekend = True\n", - "day = 6\n", - "df = pd.read_csv(r\"C:\\Users\\felix\\Programmieren\\tecdm\\src\\districtgenerator\\data\\occupancy_schedules\\GarderobeDusche.csv\", sep=\";\")\n", - "occupancy = 45 * df[\"People\"]\n", - "el_wrapper.power_sim(irradiation, weekend, day, occupancy)" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "import pandas as pd\n", - "test_data = Datahandler()\n", - "test_data.generateEnvironment()\n", - "irradiation = test_data.site[\"SunTotal\"] \n", - "weekend = True\n", - "day = 6\n", - "df = pd.read_csv(r\"C:\\Users\\felix\\Programmieren\\tecdm\\src\\districtgenerator\\data\\occupancy_schedules\\GarderobeDusche.csv\", sep=\";\")\n", - "occupancy = 45 * df[\"People\"]\n", - "appliances = 1000 * df[\"Appliances\"]" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "bldgs = {}\n", - "with open(r'C:\\Users\\felix\\Programmieren\\tecdm\\src\\districtgenerator\\data\\design_building_data.json') as json_file:\n", - " jsonData = json.load(json_file)\n", - " for subData in jsonData:\n", - " bldgs[subData[\"name\"]] = subData[\"value\"]" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "{'T_set_min': 20.0,\n", - " 'T_set_max': 26.0,\n", - " 'T_bivalent': -2.0,\n", - " 'T_heatlimit': 15.0,\n", - " 'ventilation_rate': 0.5,\n", - " 'buildings_short': ['SFH', 'MFH', 'TH', 'AB'],\n", - " 'buildings_long': ['single_family_house',\n", - " 'multi_family_house',\n", - " 'terraced_house',\n", - " 'apartment_block'],\n", - " 'retrofit_short': [0, 1, 2],\n", - " 'retrofit_long': ['tabula_standard',\n", - " 'tabula_retrofit',\n", - " 'tabula_adv_retrofit'],\n", - " 'dhwload': [4662.1, 4662.1, 4662.1, 3999.8],\n", - " 'mean_drawoff_vol_per_day': [40, 40, 40, 40]}" - ] - }, - "execution_count": 50, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "bldgs" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "4662.1" - ] - }, - "execution_count": 55, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "# building[\"dhwload\"] \n", - "bldgs[\"dhwload\"][bldgs[\"buildings_short\"].index(\"SFH\")] * 1" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [ - { - "data": { - "text/html": [ - "
\n", - "\n", - "\n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - "
DAYHOUROCCUPANCYAPPLIANCESLIGHTINGWATERHEATINGCOOLINGPROCESSESSERVERSELECTROMOBILITY
0110.00.10.10.0SETBACKOFF0.00.00.0
1120.00.10.10.0SETBACKOFF0.00.00.0
2130.00.10.10.0SETBACKOFF0.00.00.0
3140.00.10.10.0SETBACKOFF0.00.00.0
4150.00.10.10.0SETBACKOFF0.00.00.0
....................................
1396200.00.10.10.0OFFOFF0.00.00.0
1406210.00.10.10.0OFFOFF0.00.00.0
1416220.00.10.10.0OFFOFF0.00.00.0
1426230.00.10.10.0OFFOFF0.00.00.0
1436240.00.10.10.0OFFOFF0.00.00.0
\n", - "

144 rows × 11 columns

\n", - "
" - ], - "text/plain": [ - " DAY HOUR OCCUPANCY APPLIANCES LIGHTING WATER HEATING COOLING \\\n", - "0 1 1 0.0 0.1 0.1 0.0 SETBACK OFF \n", - "1 1 2 0.0 0.1 0.1 0.0 SETBACK OFF \n", - "2 1 3 0.0 0.1 0.1 0.0 SETBACK OFF \n", - "3 1 4 0.0 0.1 0.1 0.0 SETBACK OFF \n", - "4 1 5 0.0 0.1 0.1 0.0 SETBACK OFF \n", - ".. ... ... ... ... ... ... ... ... \n", - "139 6 20 0.0 0.1 0.1 0.0 OFF OFF \n", - "140 6 21 0.0 0.1 0.1 0.0 OFF OFF \n", - "141 6 22 0.0 0.1 0.1 0.0 OFF OFF \n", - "142 6 23 0.0 0.1 0.1 0.0 OFF OFF \n", - "143 6 24 0.0 0.1 0.1 0.0 OFF OFF \n", - "\n", - " PROCESSES SERVERS ELECTROMOBILITY \n", - "0 0.0 0.0 0.0 \n", - "1 0.0 0.0 0.0 \n", - "2 0.0 0.0 0.0 \n", - "3 0.0 0.0 0.0 \n", - "4 0.0 0.0 0.0 \n", - ".. ... ... ... \n", - "139 0.0 0.0 0.0 \n", - "140 0.0 0.0 0.0 \n", - "141 0.0 0.0 0.0 \n", - "142 0.0 0.0 0.0 \n", - "143 0.0 0.0 0.0 \n", - "\n", - "[144 rows x 11 columns]" - ] - }, - "execution_count": 9, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "from functions import schedule_reader as schedule_reader\n", - "schedule, schedule_type = schedule_reader.get_schedule('oag')\n", - "schedule" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "# Benutzerdefinierte Sortierfunktion definieren\n", - "def custom_sort(val):\n", - " if val < 7:\n", - " return float('inf') # Stellt sicher, dass Werte unter 7 am Ende kommen\n", - " elif val >= 7:\n", - " return -val # Umkehren der Reihenfolge für Werte ab 7\n", - " else:\n", - " return val # Fallback-Fall, falls irgendwie ein ungültiger Wert vorliegt\n" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "# schedules_sorted = schedule.sort_values(by=\"DAY\", key=custom_sort)\n", - "sorter = [ 5 , 6, 0 , 1 , 2, 3 ,4 ]\n", - "#schedule.sort_values(by=\"DAY\", key=lambda column: column.map(lambda e: sorter.index(e)), inplace=True)\n", - "schedule.sort_values(by=[\"DAY\", \"HOUR\"], key=lambda x: sorter.index(x) if x.name == \"DAY\" else x, inplace=True)\n", - "schedule" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "sorter = [ 5 , 6, 0 , 1 , 2, 3 ,4 ] \n", - "# Create a custom sorter index\n", - "sorter_index = {day: index for index, day in enumerate(sorter)}\n", - "\n", - "# Apply sorting\n", - "schedule['DAY'] = pd.Categorical(schedule['DAY'], categories=sorter, ordered=True)\n", - "schedule.sort_values(by=['DAY', 'HOUR'], inplace=True)\n" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "\n", - "def expand_dataframe(df, total_days):\n", - " unique_days = df['DAY'].unique()\n", - " num_days = len(unique_days)\n", - " \n", - " # Calculate the number of full weeks and extra days needed\n", - " full_cycles = total_days // num_days\n", - " extra_days = total_days % num_days\n", - " \n", - " # Replicate the DataFrame for the number of full cycles\n", - " result_df = pd.concat([df] * full_cycles, ignore_index=True)\n", - " \n", - " # If there are extra days, append the needed days from a new cycle\n", - " if extra_days > 0:\n", - " extra_data = df[df['DAY'].isin(unique_days[:extra_days])]\n", - " result_df = pd.concat([result_df, extra_data], ignore_index=True)\n", - " \n", - " return result_df\n" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "schedule_len = expand_dataframe(schedule, 14)\n" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "HOUR\n", - "1 14\n", - "2 14\n", - "3 14\n", - "4 14\n", - "5 14\n", - "6 14\n", - "7 14\n", - "8 14\n", - "9 14\n", - "10 14\n", - "11 14\n", - "12 14\n", - "13 14\n", - "14 14\n", - "15 14\n", - "16 14\n", - "17 14\n", - "18 14\n", - "19 14\n", - "20 14\n", - "21 14\n", - "22 14\n", - "23 14\n", - "24 14\n", - "Name: count, dtype: int64" - ] - }, - "execution_count": 94, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "schedule_len.value_counts(\"HOUR\")" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [ - { - "data": { - "text/html": [ - "
\n", - "\n", - "\n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - "
DAYHOUROCCUPANCYAPPLIANCESLIGHTINGWATERHEATINGCOOLINGPROCESSESSERVERSELECTROMOBILITY
96510.00.10.10.0SETBACKOFF0.00.00.0
97520.00.10.10.0SETBACKOFF0.00.00.0
98530.00.10.10.0SETBACKOFF0.00.00.0
99540.00.10.10.0SETBACKOFF0.00.00.0
100550.00.10.10.0SETBACKOFF0.00.00.0
....................................
914200.00.10.10.0SETBACKOFF0.00.00.0
924210.00.10.10.0SETBACKOFF0.00.00.0
934220.00.10.10.0SETBACKOFF0.00.00.0
944230.00.10.10.0SETBACKOFF0.00.00.0
954240.00.10.10.0SETBACKOFF0.00.00.0
\n", - "

144 rows × 11 columns

\n", - "
" - ], - "text/plain": [ - " DAY HOUR OCCUPANCY APPLIANCES LIGHTING WATER HEATING COOLING \\\n", - "96 5 1 0.0 0.1 0.1 0.0 SETBACK OFF \n", - "97 5 2 0.0 0.1 0.1 0.0 SETBACK OFF \n", - "98 5 3 0.0 0.1 0.1 0.0 SETBACK OFF \n", - "99 5 4 0.0 0.1 0.1 0.0 SETBACK OFF \n", - "100 5 5 0.0 0.1 0.1 0.0 SETBACK OFF \n", - ".. .. ... ... ... ... ... ... ... \n", - "91 4 20 0.0 0.1 0.1 0.0 SETBACK OFF \n", - "92 4 21 0.0 0.1 0.1 0.0 SETBACK OFF \n", - "93 4 22 0.0 0.1 0.1 0.0 SETBACK OFF \n", - "94 4 23 0.0 0.1 0.1 0.0 SETBACK OFF \n", - "95 4 24 0.0 0.1 0.1 0.0 SETBACK OFF \n", - "\n", - " PROCESSES SERVERS ELECTROMOBILITY \n", - "96 0.0 0.0 0.0 \n", - "97 0.0 0.0 0.0 \n", - "98 0.0 0.0 0.0 \n", - "99 0.0 0.0 0.0 \n", - "100 0.0 0.0 0.0 \n", - ".. ... ... ... \n", - "91 0.0 0.0 0.0 \n", - "92 0.0 0.0 0.0 \n", - "93 0.0 0.0 0.0 \n", - "94 0.0 0.0 0.0 \n", - "95 0.0 0.0 0.0 \n", - "\n", - "[144 rows x 11 columns]" - ] - }, - "execution_count": 91, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "schedule" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "def get_tek(building_type):\n", - " \"\"\"\n", - " Returns the TEK Warmwasser value according to the building type.\n", - " \n", - " Data is read from 'TEK_districtgenerator.csv' in the specified directory.\n", - "\n", - " Args:\n", - " building_type (str): The key representing the building type.\n", - "\n", - " Returns:\n", - " float: The TEK Warmwasser value for the specified building type.\n", - " str: The descriptive name of the building type.\n", - " \"\"\"\n", - " tek_assignment = {\n", - " \"oag\": \"Bürogebäude\",\n", - " \"IWU Research and University Teaching\": \"Hochschule und Forschung (allgemein)\",\n", - " \"IWU Health and Care\": \"Beherbergungsstätten (allgemein)\",\n", - " \"IWU School, Day Nursery and other Care\": \"Schulen\",\n", - " \"IWU Culture and Leisure\": \"Ausstellungsgebäude\",\n", - " \"IWU Sports Facilities\": \"Sporthallen\",\n", - " \"IWU Hotels, Boarding, Restaurants or Catering\": \"Hotels / Pensionen\",\n", - " \"IWU Production, Workshop, Warehouse or Operations\": \"Gewerbliche und industrielle Gebäude – Mischung aus leichter u. schwerer Arbeit\",\n", - " \"IWU Trade Buildings\": \"Verkaufsstätten (allgemein)\",\n", - " \"IWU Generalized (1) Services building\": \"Verwaltungsgebäude (allgemein)\",\n", - " \"IWU Generalized (2) Production buildings\": \"Gewerbliche und industrielle Gebäude – Mischung aus leichter u. schwerer Arbeit\"\n", - " }\n", - "\n", - " tek_name = tek_assignment.get(building_type)\n", - " if tek_name is None:\n", - " print(f\"No schedule for building type {building_type}\")\n", - " return None, None\n", - "\n", - " data_path = os.path.join(r'C:\\Users\\felix\\Programmieren\\tecdm\\src\\districtgenerator\\data\\TEKs\\TEK_districtgenerator.csv')\n", - "\n", - " try:\n", - " data_schedule = pd.read_csv(data_path, sep=',')\n", - " warm_water_value = data_schedule[data_schedule[\"TEK\"] == tek_name][\"TEK Warmwasser\"].iloc[0]\n", - " return warm_water_value, tek_name\n", - " except FileNotFoundError:\n", - " print(f\"File not found: {data_path}\")\n", - " return None, None\n", - " except IndexError:\n", - " print(f\"No data available for {tek_name}\")\n", - " return None, None" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "data_path = os.path.join(r'C:\\Users\\felix\\Programmieren\\tecdm\\src\\districtgenerator\\data\\TEKs\\TEK_districtgenerator.csv')\n" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "8.1 Bürogebäude\n" - ] - } - ], - "source": [ - "data, test = get_tek('oag')\n", - "print(data, test)" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "def getSchedule(hk_geb, uk_geb):\n", - " \"\"\"\n", - " Find occupancy schedule from SIA2024, depending on hk_geb, uk_geb\n", - " \n", - " \n", - " :external input data: ../auxiliary/occupancy_schedules/occupancy_schedules_zuweisungen.csv\n", - " \n", - " :param hk_geb: usage type (main category)\n", - " :type hk_geb: string\n", - " :param uk_geb: usage type (subcategory)\n", - " :type uk_geb: string\n", - "\n", - " :return: df_schedule, schedule_name\n", - " :rtype: DataFrame (with floats), string\n", - " \"\"\"\n", - " \n", - " zuweisungen = pd.read_csv(os.path.join('../auxiliary/occupancy_schedules/occupancy_schedules_zuweisungen.csv'), sep = ';', encoding = 'latin')\n", - " \n", - " if hk_geb in zuweisungen['hk_geb'].values:\n", - " \n", - " if uk_geb in zuweisungen['uk_geb'].values:\n", - " row = zuweisungen[zuweisungen['uk_geb'] == uk_geb]\n", - " schedule_name = row['schedule_name'].to_string(index = False).strip()\n", - " df_schedule = pd.read_csv(os.path.join('../auxiliary/occupancy_schedules/')+schedule_name+'.csv', sep = ';')\n", - " \n", - " return df_schedule, schedule_name\n", - " \n", - " else: \n", - " return print('uk_geb unbekannt')\n", - " \n", - " else:\n", - " return print('hk_geb unbekannt') \n" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [ - { - "data": { - "text/html": [ - "
\n", - "\n", - "\n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - "
PeopleAppliances
00.00.08
10.00.08
20.00.08
30.00.08
40.00.08
\n", - "
" - ], - "text/plain": [ - " People Appliances\n", - "0 0.0 0.08\n", - "1 0.0 0.08\n", - "2 0.0 0.08\n", - "3 0.0 0.08\n", - "4 0.0 0.08" - ] - }, - "execution_count": 122, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "data = pd.read_csv(r'C:\\Users\\felix\\Programmieren\\tecdm\\src\\districtgenerator\\data\\occupancy_schedules\\Parkhaus.csv', sep=';')\n", - "data.head()\n" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "Occupancy_Full_Usage_Hours = data.People.sum() # in h/a\n", - "Occupancy_Full_Usage_Hours\n", - "TEK_dhw_per_Occupancy_Full_Usage_Hour = 48.7 / Occupancy_Full_Usage_Hours\n" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "for hour in range(0, 120):\n", - " dhw_water = data.loc[hour, 'People'] * TEK_dhw_per_Occupancy_Full_Usage_Hour * 1000 * 240" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "We are about to generate a Non Residential building.\n", - "Test, 3 3.125\n", - "{'ow1': 0.541796301, 'win1': 0.345399313, 'rt1': 0.506728916, 'gf1': 0.369112228}\n", - " DAY HOUR OCCUPANCY APPLIANCES LIGHTING WATER HEATING COOLING \\\n", - "0 1 1 0.0 0.1 0.1 0.0 SETBACK OFF \n", - "1 1 2 0.0 0.1 0.1 0.0 SETBACK OFF \n", - "2 1 3 0.0 0.1 0.1 0.0 SETBACK OFF \n", - "3 1 4 0.0 0.1 0.1 0.0 SETBACK OFF \n", - "4 1 5 0.0 0.1 0.1 0.0 SETBACK OFF \n", - ".. ... ... ... ... ... ... ... ... \n", - "139 6 20 0.0 0.1 0.1 0.0 OFF OFF \n", - "140 6 21 0.0 0.1 0.1 0.0 OFF OFF \n", - "141 6 22 0.0 0.1 0.1 0.0 OFF OFF \n", - "142 6 23 0.0 0.1 0.1 0.0 OFF OFF \n", - "143 6 24 0.0 0.1 0.1 0.0 OFF OFF \n", - "\n", - " PROCESSES SERVERS ELECTROMOBILITY \n", - "0 0.0 0.0 0.0 \n", - "1 0.0 0.0 0.0 \n", - "2 0.0 0.0 0.0 \n", - "3 0.0 0.0 0.0 \n", - "4 0.0 0.0 0.0 \n", - ".. ... ... ... \n", - "139 0.0 0.0 0.0 \n", - "140 0.0 0.0 0.0 \n", - "141 0.0 0.0 0.0 \n", - "142 0.0 0.0 0.0 \n", - "143 0.0 0.0 0.0 \n", - "\n", - "[144 rows x 11 columns]\n", - "We are about to generate a Non Residential building.\n", - "Test, 3 3.125\n", - "{'ow1': 0.288649056, 'win1': 0.298723187, 'rt1': 0.331884826, 'gf1': 0.383291576}\n", - " DAY HOUR OCCUPANCY APPLIANCES LIGHTING WATER HEATING COOLING \\\n", - "0 1 1 0.0 0.1 0.1 0.0 SETBACK OFF \n", - "1 1 2 0.0 0.1 0.1 0.0 SETBACK OFF \n", - "2 1 3 0.0 0.1 0.1 0.0 SETBACK OFF \n", - "3 1 4 0.0 0.1 0.1 0.0 SETBACK OFF \n", - "4 1 5 0.0 0.1 0.1 0.0 SETBACK OFF \n", - ".. ... ... ... ... ... ... ... ... \n", - "139 6 20 0.0 0.1 0.1 0.0 OFF OFF \n", - "140 6 21 0.0 0.1 0.1 0.0 OFF OFF \n", - "141 6 22 0.0 0.1 0.1 0.0 OFF OFF \n", - "142 6 23 0.0 0.1 0.1 0.0 OFF OFF \n", - "143 6 24 0.0 0.1 0.1 0.0 OFF OFF \n", - "\n", - " PROCESSES SERVERS ELECTROMOBILITY \n", - "0 0.0 0.0 0.0 \n", - "1 0.0 0.0 0.0 \n", - "2 0.0 0.0 0.0 \n", - "3 0.0 0.0 0.0 \n", - "4 0.0 0.0 0.0 \n", - ".. ... ... ... \n", - "139 0.0 0.0 0.0 \n", - "140 0.0 0.0 0.0 \n", - "141 0.0 0.0 0.0 \n", - "142 0.0 0.0 0.0 \n", - "143 0.0 0.0 0.0 \n", - "\n", - "[144 rows x 11 columns]\n", - "Das ist der Wert 8.1\n" - ] - }, - { - "ename": "AttributeError", - "evalue": "'list' object has no attribute 'power_sim'", - "output_type": "error", - "traceback": [ - "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m", - "\u001b[1;31mAttributeError\u001b[0m Traceback (most recent call last)", - "Cell \u001b[1;32mIn[13], line 21\u001b[0m\n\u001b[0;32m 19\u001b[0m data\u001b[38;5;241m.\u001b[39minitializeBuildings(\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mexample_nrb\u001b[39m\u001b[38;5;124m'\u001b[39m)\n\u001b[0;32m 20\u001b[0m data\u001b[38;5;241m.\u001b[39mgenerateBuildings()\n\u001b[1;32m---> 21\u001b[0m \u001b[43mdata\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mgenerateDemands\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\n", - "File \u001b[1;32mc:\\Users\\felix\\Programmieren\\tecdm\\src\\districtgenerator\\districtgenerator\\datahandler.py:447\u001b[0m, in \u001b[0;36mDatahandler.generateDemands\u001b[1;34m(self, calcUserProfiles, saveUserProfiles, savePath)\u001b[0m\n\u001b[0;32m 445\u001b[0m \u001b[38;5;66;03m# calculate or load user profiles\u001b[39;00m\n\u001b[0;32m 446\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m calcUserProfiles:\n\u001b[1;32m--> 447\u001b[0m \u001b[43mbuilding\u001b[49m\u001b[43m[\u001b[49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43muser\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m]\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mcalcProfiles\u001b[49m\u001b[43m(\u001b[49m\u001b[43msite\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43msite\u001b[49m\u001b[43m,\u001b[49m\n\u001b[0;32m 448\u001b[0m \u001b[43m \u001b[49m\u001b[43mtime_horizon\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mtime\u001b[49m\u001b[43m[\u001b[49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43mdataLength\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m]\u001b[49m\u001b[43m,\u001b[49m\n\u001b[0;32m 449\u001b[0m \u001b[43m \u001b[49m\u001b[43mtime_resolution\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mtime\u001b[49m\u001b[43m[\u001b[49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43mtimeResolution\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m]\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 450\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m saveUserProfiles:\n\u001b[0;32m 451\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m savePath \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m:\n", - "File \u001b[1;32mc:\\Users\\felix\\Programmieren\\tecdm\\src\\districtgenerator\\districtgenerator\\non_residential_users.py:317\u001b[0m, in \u001b[0;36mcalcProfiles\u001b[1;34m(self, site, time_resolution, time_horizon, initital_day)\u001b[0m\n\u001b[0;32m 315\u001b[0m \n\u001b[0;32m 316\u001b[0m self.occ = np.zeros(int(time_horizon/time_resolution))\n\u001b[1;32m--> 317\u001b[0m self.dhw = np.zeros(int(time_horizon/time_resolution))\n\u001b[0;32m 318\u001b[0m self.elec = np.zeros(int(time_horizon/time_resolution))\n\u001b[0;32m 319\u001b[0m self.gains = np.zeros(int(time_horizon/time_resolution))\n", - "File \u001b[1;32mc:\\Users\\felix\\Programmieren\\tecdm\\src\\districtgenerator\\districtgenerator\\profils.py:660\u001b[0m, in \u001b[0;36mNonResidentialProfiles.generate_el_profile\u001b[1;34m(self, irradiance, el_wrapper, annual_demand, do_normalization)\u001b[0m\n\u001b[0;32m 644\u001b[0m day_of_the_year \u001b[38;5;241m=\u001b[39m \u001b[38;5;241m0\u001b[39m \n\u001b[0;32m 645\u001b[0m \u001b[38;5;66;03m# only necessary for electric heating\u001b[39;00m\n\u001b[0;32m 646\u001b[0m \u001b[38;5;66;03m# Perform lighting and appliance usage simulation for one day\u001b[39;00m\n\u001b[0;32m 647\u001b[0m \u001b[38;5;66;03m# Figure out, how to get el_p, light_p and app_p \u001b[39;00m\n\u001b[1;32m (...)\u001b[0m\n\u001b[0;32m 658\u001b[0m \u001b[38;5;66;03m# power_el_app : array\u001b[39;00m\n\u001b[0;32m 659\u001b[0m \u001b[38;5;66;03m# Array holding el. power values for appliance usage in Watt\u001b[39;00m\n\u001b[1;32m--> 660\u001b[0m (el_p_curve, light_p_curve, app_p_curve) \u001b[38;5;241m=\u001b[39m \u001b[43mel_wrapper\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mpower_sim\u001b[49m(irradiation\u001b[38;5;241m=\u001b[39mirrad_day_minutewise,\n\u001b[0;32m 661\u001b[0m weekend\u001b[38;5;241m=\u001b[39mweekend,\n\u001b[0;32m 662\u001b[0m day\u001b[38;5;241m=\u001b[39mi\u001b[38;5;241m+\u001b[39mday_of_the_year,)\n\u001b[0;32m 663\u001b[0m \u001b[38;5;66;03m# Substitution of caluclations \u001b[39;00m\n\u001b[0;32m 664\u001b[0m \u001b[38;5;66;03m# Lighniging \u001b[39;00m\n\u001b[0;32m 665\u001b[0m \u001b[38;5;66;03m# If occupancy -> occupancy electricity occupancy=current_occupancy)\u001b[39;00m\n\u001b[0;32m 666\u001b[0m \u001b[38;5;66;03m# Append results\u001b[39;00m\n\u001b[0;32m 667\u001b[0m demand\u001b[38;5;241m.\u001b[39mappend(el_p_curve)\n", - "\u001b[1;31mAttributeError\u001b[0m: 'list' object has no attribute 'power_sim'" - ] - } - ], - "source": [ - "data = Datahandler()\n", - "\n", - "data.setWeatherFile(r\"data\\weather\\EPW\\DEU_BE_Berlin-Schonefeld.AP.103850_TMYx.2004-2018.epw\")\n", - "\n", - "\n", - "# Next we generate an environment.\n", - "# Based on the location of the district this includes outside temperatures and sun radiation.\n", - "# The location can be changed in the site_data.json file. You find it in \\data.\n", - "# We create our first district in Aachen. When you open the site_data.json file, you should see, the \"location\"\n", - "# is [51.0,6.55], the \"climateZone\" 0 and the \"altitude\" 0.\n", - "# The time resolution can be changed in time_data.json. You also find it in \\data.\n", - "# For this example it should be 900 seconds, which equals 15 Minutes.\n", - "# The weather data is taken from a Test Reference Year Database from the DWD.\n", - "\n", - "# Generate Environment for the District\n", - "\n", - "data.generateEnvironment()\n", - "\n", - "data.initializeBuildings('example_nrb')\n", - "data.generateBuildings()\n" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "{'U': {'window': 1.08,\n", - " 'opaque': {'roof': 0.14,\n", - " 'intWall': [],\n", - " 'wall': 0.19,\n", - " 'ceiling': [],\n", - " 'floor': 0.21,\n", - " 'intFloor': [],\n", - " 'window': 1.08}},\n", - " 'd': {'window': [],\n", - " 'opaque': {'roof': [],\n", - " 'intWall': [],\n", - " 'wall': [],\n", - " 'ceiling': [],\n", - " 'floor': [],\n", - " 'intFloor': []}},\n", - " 'd_iso': {'window': [],\n", - " 'opaque': {'roof': [],\n", - " 'intWall': [],\n", - " 'wall': [],\n", - " 'ceiling': [],\n", - " 'floor': [],\n", - " 'intFloor': []}},\n", - " 'rho': {'window': [],\n", - " 'opaque': {'roof': [],\n", - " 'intWall': [],\n", - " 'wall': [],\n", - " 'ceiling': [],\n", - " 'floor': [],\n", - " 'intFloor': []}},\n", - " 'cp': {'window': [],\n", - " 'opaque': {'roof': [],\n", - " 'intWall': [],\n", - " 'wall': [],\n", - " 'ceiling': [],\n", - " 'floor': [],\n", - " 'intFloor': []}},\n", - " 'Lambda': {'window': [],\n", - " 'opaque': {'roof': [],\n", - " 'intWall': [],\n", - " 'wall': [],\n", - " 'ceiling': [],\n", - " 'floor': [],\n", - " 'intFloor': []}},\n", - " 'kappa': {'window': [],\n", - " 'opaque': {'roof': 405000.0,\n", - " 'intWall': 405000.0,\n", - " 'wall': 405000.0,\n", - " 'ceiling': 405000.0,\n", - " 'floor': 405000.0,\n", - " 'intFloor': 405000.0}},\n", - " 'g_gl': {'window': [],\n", - " 'opaque': {'roof': [],\n", - " 'intWall': [],\n", - " 'wall': [],\n", - " 'ceiling': [],\n", - " 'floor': [],\n", - " 'intFloor': []}},\n", - " 'R_se': {'window': 0.0476,\n", - " 'opaque': {'roof': 0.04,\n", - " 'intWall': [],\n", - " 'wall': 0.04,\n", - " 'ceiling': [],\n", - " 'floor': 0.0,\n", - " 'intFloor': []}},\n", - " 'R_si': {'window': 0.13,\n", - " 'opaque': {'roof': 0.13,\n", - " 'intWall': [],\n", - " 'wall': 0.13,\n", - " 'ceiling': [],\n", - " 'floor': 0.13,\n", - " 'intFloor': []}},\n", - " 'epsilon': {'window': 0.9,\n", - " 'opaque': {'roof': 0.9,\n", - " 'intWall': [],\n", - " 'wall': 0.9,\n", - " 'ceiling': [],\n", - " 'floor': 0.9,\n", - " 'intFloor': []}},\n", - " 'alpha_Sc': {'window': [],\n", - " 'opaque': {'roof': 0.6,\n", - " 'intWall': [],\n", - " 'wall': 0.6,\n", - " 'ceiling': [],\n", - " 'floor': 0.6,\n", - " 'intFloor': []}},\n", - " 'id': np.int64(0),\n", - " 'construction_year': np.int64(2022),\n", - " 'construction_type': None,\n", - " 'retrofit': np.int64(1),\n", - " 'usage_short': 'oag',\n", - " 'file_path': 'c:\\\\Users\\\\felix\\\\Programmieren\\\\tecdm\\\\src\\\\districtgenerator\\\\data',\n", - " 'c_p_air': 1000.0,\n", - " 'rho_air': 1.2,\n", - " 'T_set_min': 20.0,\n", - " 'T_set_max': 26.0,\n", - " 'ventilationRate': 0.5,\n", - " 'T_bivalent': -2.0,\n", - " 'T_heatlimit': 15.0,\n", - " 'attributes': [{'window': [],\n", - " 'opaque': {'roof': [],\n", - " 'intWall': [],\n", - " 'wall': [],\n", - " 'ceiling': [],\n", - " 'floor': [],\n", - " 'intFloor': []}},\n", - " {'window': [],\n", - " 'opaque': {'roof': [],\n", - " 'intWall': [],\n", - " 'wall': [],\n", - " 'ceiling': [],\n", - " 'floor': [],\n", - " 'intFloor': []}},\n", - " {'window': [],\n", - " 'opaque': {'roof': [],\n", - " 'intWall': [],\n", - " 'wall': [],\n", - " 'ceiling': [],\n", - " 'floor': [],\n", - " 'intFloor': []}},\n", - " {'window': [],\n", - " 'opaque': {'roof': [],\n", - " 'intWall': [],\n", - " 'wall': [],\n", - " 'ceiling': [],\n", - " 'floor': [],\n", - " 'intFloor': []}},\n", - " {'window': [],\n", - " 'opaque': {'roof': [],\n", - " 'intWall': [],\n", - " 'wall': [],\n", - " 'ceiling': [],\n", - " 'floor': [],\n", - " 'intFloor': []}},\n", - " {'window': 1.08,\n", - " 'opaque': {'roof': 0.14,\n", - " 'intWall': [],\n", - " 'wall': 0.19,\n", - " 'ceiling': [],\n", - " 'floor': 0.21,\n", - " 'intFloor': [],\n", - " 'window': 1.08}},\n", - " {'window': [],\n", - " 'opaque': {'roof': 405000.0,\n", - " 'intWall': 405000.0,\n", - " 'wall': 405000.0,\n", - " 'ceiling': 405000.0,\n", - " 'floor': 405000.0,\n", - " 'intFloor': 405000.0}},\n", - " {'window': 0.0476,\n", - " 'opaque': {'roof': 0.04,\n", - " 'intWall': [],\n", - " 'wall': 0.04,\n", - " 'ceiling': [],\n", - " 'floor': 0.0,\n", - " 'intFloor': []}},\n", - " {'window': 0.13,\n", - " 'opaque': {'roof': 0.13,\n", - " 'intWall': [],\n", - " 'wall': 0.13,\n", - " 'ceiling': [],\n", - " 'floor': 0.13,\n", - " 'intFloor': []}},\n", - " {'window': 0.9,\n", - " 'opaque': {'roof': 0.9,\n", - " 'intWall': [],\n", - " 'wall': 0.9,\n", - " 'ceiling': [],\n", - " 'floor': 0.9,\n", - " 'intFloor': []}},\n", - " {'window': [],\n", - " 'opaque': {'roof': 0.6,\n", - " 'intWall': [],\n", - " 'wall': 0.6,\n", - " 'ceiling': [],\n", - " 'floor': 0.6,\n", - " 'intFloor': []}},\n", - " {'window': [],\n", - " 'opaque': {'roof': [],\n", - " 'intWall': [],\n", - " 'wall': [],\n", - " 'ceiling': [],\n", - " 'floor': [],\n", - " 'intFloor': []}}],\n", - " 'opaque_ext': ['wall', 'roof', 'floor'],\n", - " 'opaque': {'ceiling', 'floor', 'intFloor', 'intWall', 'roof', 'wall'},\n", - " 'V': 1837.5,\n", - " 'A': {'f': 196.0,\n", - " 'opaque': {'south': 26.548018749,\n", - " 'north': 26.548018749,\n", - " 'west': 26.548018749,\n", - " 'east': 26.548018749,\n", - " 'roof': 99.318867536,\n", - " 'floor': 72.345996688,\n", - " 'wall': 106.192074996,\n", - " 'intFloor': 196.0,\n", - " 'ceiling': 72.345996688,\n", - " 'intWall': 159.28811249400002},\n", - " 'window': {'south': 16.924566336999998,\n", - " 'north': 16.924566336999998,\n", - " 'west': 16.924566336999998,\n", - " 'east': 16.924566336999998,\n", - " 'roof': 0.0,\n", - " 'floor': 0.0,\n", - " 'sum': 67.69826534799999}}}" - ] - }, - "execution_count": 34, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "vars(data.district[0]['envelope'])" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [ - { - "ename": "TypeError", - "evalue": "'Datahandler' object is not subscriptable", - "output_type": "error", - "traceback": [ - "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m", - "\u001b[1;31mTypeError\u001b[0m Traceback (most recent call last)", - "Cell \u001b[1;32mIn[25], line 1\u001b[0m\n\u001b[1;32m----> 1\u001b[0m \u001b[38;5;28mvars\u001b[39m(\u001b[43mdata\u001b[49m\u001b[43m[\u001b[49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[38;5;124;43mdistrict\u001b[39;49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[43m]\u001b[49m[\u001b[38;5;241m0\u001b[39m][\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mbuildingFeatures\u001b[39m\u001b[38;5;124m'\u001b[39m][\u001b[38;5;124m'\u001b[39m\u001b[38;5;124menvelope\u001b[39m\u001b[38;5;124m'\u001b[39m])\n", - "\u001b[1;31mTypeError\u001b[0m: 'Datahandler' object is not subscriptable" - ] - } - ], - "source": [ - "vars(data['district'][0]['buildingFeatures']['envelope'])" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "import pandas as pd" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [ - { - "ename": "ParserError", - "evalue": "Error tokenizing data. C error: Expected 14 fields in line 6, saw 16\n", - "output_type": "error", - "traceback": [ - "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m", - "\u001b[1;31mParserError\u001b[0m Traceback (most recent call last)", - "Cell \u001b[1;32mIn[36], line 1\u001b[0m\n\u001b[1;32m----> 1\u001b[0m data \u001b[38;5;241m=\u001b[39m \u001b[43mpd\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mread_csv\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;124;43mr\u001b[39;49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[38;5;124;43mC:\u001b[39;49m\u001b[38;5;124;43m\\\u001b[39;49m\u001b[38;5;124;43mUsers\u001b[39;49m\u001b[38;5;124;43m\\\u001b[39;49m\u001b[38;5;124;43mfelix\u001b[39;49m\u001b[38;5;124;43m\\\u001b[39;49m\u001b[38;5;124;43mProgrammieren\u001b[39;49m\u001b[38;5;124;43m\\\u001b[39;49m\u001b[38;5;124;43mtecdm\u001b[39;49m\u001b[38;5;124;43m\\\u001b[39;49m\u001b[38;5;124;43msrc\u001b[39;49m\u001b[38;5;124;43m\\\u001b[39;49m\u001b[38;5;124;43mdistrictgenerator\u001b[39;49m\u001b[38;5;124;43m\\\u001b[39;49m\u001b[38;5;124;43mdata\u001b[39;49m\u001b[38;5;124;43m\\\u001b[39;49m\u001b[38;5;124;43mconsumption_data\u001b[39;49m\u001b[38;5;124;43m\\\u001b[39;49m\u001b[38;5;124;43minternal_loads.csv\u001b[39;49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[43m)\u001b[49m\n", - "File \u001b[1;32mc:\\Users\\felix\\.conda\\envs\\districtgenerator\\Lib\\site-packages\\pandas-2.2.2-py3.11-win-amd64.egg\\pandas\\io\\parsers\\readers.py:1026\u001b[0m, in \u001b[0;36mread_csv\u001b[1;34m(filepath_or_buffer, sep, delimiter, header, names, index_col, usecols, dtype, engine, converters, true_values, false_values, skipinitialspace, skiprows, skipfooter, nrows, na_values, keep_default_na, na_filter, verbose, skip_blank_lines, parse_dates, infer_datetime_format, keep_date_col, date_parser, date_format, dayfirst, cache_dates, iterator, chunksize, compression, thousands, decimal, lineterminator, quotechar, quoting, doublequote, escapechar, comment, encoding, encoding_errors, dialect, on_bad_lines, delim_whitespace, low_memory, memory_map, float_precision, storage_options, dtype_backend)\u001b[0m\n\u001b[0;32m 1013\u001b[0m kwds_defaults \u001b[38;5;241m=\u001b[39m _refine_defaults_read(\n\u001b[0;32m 1014\u001b[0m dialect,\n\u001b[0;32m 1015\u001b[0m delimiter,\n\u001b[1;32m (...)\u001b[0m\n\u001b[0;32m 1022\u001b[0m dtype_backend\u001b[38;5;241m=\u001b[39mdtype_backend,\n\u001b[0;32m 1023\u001b[0m )\n\u001b[0;32m 1024\u001b[0m kwds\u001b[38;5;241m.\u001b[39mupdate(kwds_defaults)\n\u001b[1;32m-> 1026\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43m_read\u001b[49m\u001b[43m(\u001b[49m\u001b[43mfilepath_or_buffer\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mkwds\u001b[49m\u001b[43m)\u001b[49m\n", - "File \u001b[1;32mc:\\Users\\felix\\.conda\\envs\\districtgenerator\\Lib\\site-packages\\pandas-2.2.2-py3.11-win-amd64.egg\\pandas\\io\\parsers\\readers.py:626\u001b[0m, in \u001b[0;36m_read\u001b[1;34m(filepath_or_buffer, kwds)\u001b[0m\n\u001b[0;32m 623\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m parser\n\u001b[0;32m 625\u001b[0m \u001b[38;5;28;01mwith\u001b[39;00m parser:\n\u001b[1;32m--> 626\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43mparser\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mread\u001b[49m\u001b[43m(\u001b[49m\u001b[43mnrows\u001b[49m\u001b[43m)\u001b[49m\n", - "File \u001b[1;32mc:\\Users\\felix\\.conda\\envs\\districtgenerator\\Lib\\site-packages\\pandas-2.2.2-py3.11-win-amd64.egg\\pandas\\io\\parsers\\readers.py:1923\u001b[0m, in \u001b[0;36mTextFileReader.read\u001b[1;34m(self, nrows)\u001b[0m\n\u001b[0;32m 1916\u001b[0m nrows \u001b[38;5;241m=\u001b[39m validate_integer(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mnrows\u001b[39m\u001b[38;5;124m\"\u001b[39m, nrows)\n\u001b[0;32m 1917\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[0;32m 1918\u001b[0m \u001b[38;5;66;03m# error: \"ParserBase\" has no attribute \"read\"\u001b[39;00m\n\u001b[0;32m 1919\u001b[0m (\n\u001b[0;32m 1920\u001b[0m index,\n\u001b[0;32m 1921\u001b[0m columns,\n\u001b[0;32m 1922\u001b[0m col_dict,\n\u001b[1;32m-> 1923\u001b[0m ) \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_engine\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mread\u001b[49m\u001b[43m(\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;66;43;03m# type: ignore[attr-defined]\u001b[39;49;00m\n\u001b[0;32m 1924\u001b[0m \u001b[43m \u001b[49m\u001b[43mnrows\u001b[49m\n\u001b[0;32m 1925\u001b[0m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 1926\u001b[0m \u001b[38;5;28;01mexcept\u001b[39;00m \u001b[38;5;167;01mException\u001b[39;00m:\n\u001b[0;32m 1927\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mclose()\n", - "File \u001b[1;32mc:\\Users\\felix\\.conda\\envs\\districtgenerator\\Lib\\site-packages\\pandas-2.2.2-py3.11-win-amd64.egg\\pandas\\io\\parsers\\c_parser_wrapper.py:234\u001b[0m, in \u001b[0;36mCParserWrapper.read\u001b[1;34m(self, nrows)\u001b[0m\n\u001b[0;32m 232\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[0;32m 233\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mlow_memory:\n\u001b[1;32m--> 234\u001b[0m chunks \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_reader\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mread_low_memory\u001b[49m\u001b[43m(\u001b[49m\u001b[43mnrows\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 235\u001b[0m \u001b[38;5;66;03m# destructive to chunks\u001b[39;00m\n\u001b[0;32m 236\u001b[0m data \u001b[38;5;241m=\u001b[39m _concatenate_chunks(chunks)\n", - "File \u001b[1;32mparsers.pyx:838\u001b[0m, in \u001b[0;36mpandas._libs.parsers.TextReader.read_low_memory\u001b[1;34m()\u001b[0m\n", - "File \u001b[1;32mparsers.pyx:905\u001b[0m, in \u001b[0;36mpandas._libs.parsers.TextReader._read_rows\u001b[1;34m()\u001b[0m\n", - "File \u001b[1;32mparsers.pyx:874\u001b[0m, in \u001b[0;36mpandas._libs.parsers.TextReader._tokenize_rows\u001b[1;34m()\u001b[0m\n", - "File \u001b[1;32mparsers.pyx:891\u001b[0m, in \u001b[0;36mpandas._libs.parsers.TextReader._check_tokenize_status\u001b[1;34m()\u001b[0m\n", - "File \u001b[1;32mparsers.pyx:2061\u001b[0m, in \u001b[0;36mpandas._libs.parsers.raise_parser_error\u001b[1;34m()\u001b[0m\n", - "\u001b[1;31mParserError\u001b[0m: Error tokenizing data. C error: Expected 14 fields in line 6, saw 16\n" - ] - } - ], - "source": [ - "data = pd.read_csv(r'C:\\Users\\felix\\Programmieren\\tecdm\\src\\districtgenerator\\data\\consumption_data\\internal_loads.csv')" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "import pandas as pd\n", - "def getTryWeather(file_path: str) -> pd.DataFrame:\n", - " \"\"\"\n", - " Parse a TRY weather data file into a DataFrame with a timestamp index.\n", - " Assumes specific file formatting.\n", - " \n", - " Parameters:\n", - " - file_path: str, the path to the TRY weather data file.\n", - "\n", - " Returns:\n", - " - weather: pd.DataFrame, a DataFrame with a timestamp.\n", - " \"\"\"\n", - " if \"2015\" or \"2045\" in file_path:\n", - " if \"2015\" in file_path:\n", - " year = 2015\n", - " elif \"2045\" in file_path:\n", - " year = 2015\n", - " with open(file_path, \"r\") as file:\n", - " for line_number, line in enumerate(file, start=1):\n", - " if \"***\" in line:\n", - " header_row = (\n", - " line_number - 1 - 1\n", - " ) # -1 for header above *** and -1 for start to count at 0\n", - " break\n", - "\n", - " \n", - "\n", - " else:\n", - " raise ValueError(\"Unsupported format type for TRY files. Only 2015 and 2045 are supported.\")\n", - " df = pd.read_table(\n", - " filepath_or_buffer=file_path,\n", - " header=header_row,\n", - " sep='\\s+',\n", - " skip_blank_lines=False,\n", - " encoding=\"latin\",\n", - " )\n", - " df = df.iloc[1:]\n", - " df[\"YEAR\"] = year \n", - " df[\"MONTH\"] = df[\"MM\"].astype(int)\n", - " df[\"DAY\"] = df[\"DD\"].astype(int)\n", - " df[\"HOUR\"] = df[\"HH\"].astype(int)\n", - " df['Timestamp'] = pd.to_datetime(df[[\"YEAR\", 'MONTH', 'DAY', 'HOUR']])\n", - " return df" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "df = getTryWeather(r\"C:\\Users\\felix\\Programmieren\\tecdm\\src\\districtgenerator\\data\\weather\\DWD\\TRY2015_Zone8_kalt.txt\")" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [ - { - "data": { - "text/html": [ - "
\n", - "\n", - "\n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - "
RWHWMMDDHHtpWRWGN...BDAEILYEARMONTHDAYHOURTimestamp
140405002770500.01.01.01.0-5.7924.050.04.08.0...0.00.0265.0-288.00.020151112015-01-01 01:00:00
240405002770500.01.01.02.0-5.8924.050.03.68.0...0.00.0265.0-288.00.020151122015-01-01 02:00:00
340405002770500.01.01.03.0-5.9924.060.04.98.0...0.00.0265.0-287.00.020151132015-01-01 03:00:00
440405002770500.01.01.04.0-5.9924.070.04.48.0...0.00.0266.0-287.00.020151142015-01-01 04:00:00
540405002770500.01.01.05.0-5.8924.050.04.08.0...0.00.0267.0-286.00.020151152015-01-01 05:00:00
..................................................................
875640405002770500.012.031.020.0-4.6924.060.03.58.0...0.00.0259.0-293.00.020151231202015-12-31 20:00:00
875740405002770500.012.031.021.0-4.8924.060.03.67.0...0.00.0258.0-292.00.020151231212015-12-31 21:00:00
875840405002770500.012.031.022.0-5.0925.060.03.97.0...0.00.0249.0-291.00.020151231222015-12-31 22:00:00
875940405002770500.012.031.023.0-5.2925.070.03.58.0...0.00.0259.0-290.00.020151231232015-12-31 23:00:00
876040405002770500.012.031.024.0-5.6925.060.03.48.0...0.00.0267.0-289.00.020151231242016-01-01 00:00:00
\n", - "

8760 rows × 22 columns

\n", - "
" - ], - "text/plain": [ - " RW HW MM DD HH t p WR WG N ... \\\n", - "1 4040500 2770500.0 1.0 1.0 1.0 -5.7 924.0 50.0 4.0 8.0 ... \n", - "2 4040500 2770500.0 1.0 1.0 2.0 -5.8 924.0 50.0 3.6 8.0 ... \n", - "3 4040500 2770500.0 1.0 1.0 3.0 -5.9 924.0 60.0 4.9 8.0 ... \n", - "4 4040500 2770500.0 1.0 1.0 4.0 -5.9 924.0 70.0 4.4 8.0 ... \n", - "5 4040500 2770500.0 1.0 1.0 5.0 -5.8 924.0 50.0 4.0 8.0 ... \n", - "... ... ... ... ... ... ... ... ... ... ... ... \n", - "8756 4040500 2770500.0 12.0 31.0 20.0 -4.6 924.0 60.0 3.5 8.0 ... \n", - "8757 4040500 2770500.0 12.0 31.0 21.0 -4.8 924.0 60.0 3.6 7.0 ... \n", - "8758 4040500 2770500.0 12.0 31.0 22.0 -5.0 925.0 60.0 3.9 7.0 ... \n", - "8759 4040500 2770500.0 12.0 31.0 23.0 -5.2 925.0 70.0 3.5 8.0 ... \n", - "8760 4040500 2770500.0 12.0 31.0 24.0 -5.6 925.0 60.0 3.4 8.0 ... \n", - "\n", - " B D A E IL YEAR MONTH DAY HOUR Timestamp \n", - "1 0.0 0.0 265.0 -288.0 0.0 2015 1 1 1 2015-01-01 01:00:00 \n", - "2 0.0 0.0 265.0 -288.0 0.0 2015 1 1 2 2015-01-01 02:00:00 \n", - "3 0.0 0.0 265.0 -287.0 0.0 2015 1 1 3 2015-01-01 03:00:00 \n", - "4 0.0 0.0 266.0 -287.0 0.0 2015 1 1 4 2015-01-01 04:00:00 \n", - "5 0.0 0.0 267.0 -286.0 0.0 2015 1 1 5 2015-01-01 05:00:00 \n", - "... ... ... ... ... ... ... ... ... ... ... \n", - "8756 0.0 0.0 259.0 -293.0 0.0 2015 12 31 20 2015-12-31 20:00:00 \n", - "8757 0.0 0.0 258.0 -292.0 0.0 2015 12 31 21 2015-12-31 21:00:00 \n", - "8758 0.0 0.0 249.0 -291.0 0.0 2015 12 31 22 2015-12-31 22:00:00 \n", - "8759 0.0 0.0 259.0 -290.0 0.0 2015 12 31 23 2015-12-31 23:00:00 \n", - "8760 0.0 0.0 267.0 -289.0 0.0 2015 12 31 24 2016-01-01 00:00:00 \n", - "\n", - "[8760 rows x 22 columns]" - ] - }, - "execution_count": 50, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "df" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "def getEpWeather(file_path:str) -> pd.DataFrame:\n", - " \"\"\"\n", - " Function gets EPW weather data from a file and returns it as a pandas dataframe. \n", - "\n", - " Information about epw files: https://bigladdersoftware.com/epx/docs/8-3/auxiliary-programs/energyplus-weather-file-epw-data-dictionary.html#field-dry-bulb-temperature \n", - " Returns:\n", - " weather: pandas dataframe with the columns: \n", - " - DirNormRad\n", - " - DiffHorRad\n", - " - DryBulbTemp\n", - " Index is a timestamp in the yyyy-mm-dd-hh format. \n", - " \"\"\"\n", - "\n", - " # Define the column names as per EPW file documentation\n", - " col_names = [\"Year\", \"Month\", \"Day\", \"Hour\", \"Minute\", \n", - " \"Data Source and Uncertainty Flags\", \"Dry Bulb Temperature\", \n", - " \"Dew Point Temperature\", \"Relative Humidity\", \"Atmospheric Station Pressure\", \n", - " \"Extraterrestrial Horizontal Radiation\", \"Extraterrestrial Direct Normal Radiation\", \n", - " \"Horizontal Infrared Radiation Intensity\", \"Global Horizontal Radiation\", \n", - " \"Direct Normal Radiation\", \"Diffuse Horizontal Radiation\", \n", - " \"Global Horizontal Illuminance\", \"Direct Normal Illuminance\", \n", - " \"Diffuse Horizontal Illuminance\", \"Zenith Luminance\", \"Wind Direction\", \n", - " \"Wind Speed\", \"Total Sky Cover\", \"Opaque Sky Cover\", \"Visibility\", \n", - " \"Ceiling Height\", \"Present Weather Observation\", \"Present Weather Codes\", \n", - " \"Precipitable Water\", \"Aerosol Optical Depth\", \"Snow Depth\", \n", - " \"Days Since Last Snowfall\", \"Albedo\", \"Liquid Precipitation Depth\", \n", - " \"Liquid Precipitation Quantity\"]\n", - " \n", - " # Load the file\n", - " df = pd.read_csv(file_path, skiprows=8, header=None, names=col_names)\n", - " \n", - " # Creating a timestamp column in the required format\n", - " df['Timestamp'] = pd.to_datetime(df[['Year', 'Month', 'Day', 'Hour']]) - pd.Timedelta(hours=1)\n", - " \n", - " # Adjust the minute and second to 00:00, as EPW files do not contain this information\n", - " #df['Timestamp'] = df['Timestamp'].dt.strftime('%Y-%m-%d-%H-00-00')\n", - " \n", - " # Select the required columns\n", - " df = df[['Timestamp', 'Direct Normal Radiation', 'Diffuse Horizontal Radiation', 'Dry Bulb Temperature', \n", - " \"Direct Normal Illuminance\", \"Diffuse Horizontal Illuminance\",]]\n", - " \n", - " return df\n" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "1 2015-01-01 01:00:00\n", - "2 2015-01-01 02:00:00\n", - "3 2015-01-01 03:00:00\n", - "4 2015-01-01 04:00:00\n", - "5 2015-01-01 05:00:00\n", - " ... \n", - "8756 2015-12-31 20:00:00\n", - "8757 2015-12-31 21:00:00\n", - "8758 2015-12-31 22:00:00\n", - "8759 2015-12-31 23:00:00\n", - "8760 2016-01-01 00:00:00\n", - "Name: Timestamp, Length: 8760, dtype: datetime64[ns]" - ] - }, - "execution_count": 51, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "df[\"Timestamp\"]" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "8760" - ] - }, - "execution_count": 53, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "df[\"Timestamp\"].nunique()" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "df = getEpWeather(r'C:\\Users\\felix\\Programmieren\\tecdm\\src\\districtgenerator\\data\\weather\\EPW\\DEU_BE_Berlin-Schonefeld.AP.103850_TMYx.2004-2018.epw')" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [ - { - "data": { - "text/html": [ - "
\n", - "\n", - "\n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - "
TimestampDirect Normal RadiationDiffuse Horizontal RadiationDry Bulb TemperatureDirect Normal IlluminanceDiffuse Horizontal Illuminance
02011-01-01 00:00:00001.000
12011-01-01 01:00:00001.000
22011-01-01 02:00:00001.000
32011-01-01 03:00:00001.000
42011-01-01 04:00:00002.000
.....................
87552013-12-31 19:00:00001.000
87562013-12-31 20:00:00000.000
87572013-12-31 21:00:00000.000
87582013-12-31 22:00:00000.000
87592013-12-31 23:00:00000.000
\n", - "

8760 rows × 6 columns

\n", - "
" - ], - "text/plain": [ - " Timestamp Direct Normal Radiation \\\n", - "0 2011-01-01 00:00:00 0 \n", - "1 2011-01-01 01:00:00 0 \n", - "2 2011-01-01 02:00:00 0 \n", - "3 2011-01-01 03:00:00 0 \n", - "4 2011-01-01 04:00:00 0 \n", - "... ... ... \n", - "8755 2013-12-31 19:00:00 0 \n", - "8756 2013-12-31 20:00:00 0 \n", - "8757 2013-12-31 21:00:00 0 \n", - "8758 2013-12-31 22:00:00 0 \n", - "8759 2013-12-31 23:00:00 0 \n", - "\n", - " Diffuse Horizontal Radiation Dry Bulb Temperature \\\n", - "0 0 1.0 \n", - "1 0 1.0 \n", - "2 0 1.0 \n", - "3 0 1.0 \n", - "4 0 2.0 \n", - "... ... ... \n", - "8755 0 1.0 \n", - "8756 0 0.0 \n", - "8757 0 0.0 \n", - "8758 0 0.0 \n", - "8759 0 0.0 \n", - "\n", - " Direct Normal Illuminance Diffuse Horizontal Illuminance \n", - "0 0 0 \n", - "1 0 0 \n", - "2 0 0 \n", - "3 0 0 \n", - "4 0 0 \n", - "... ... ... \n", - "8755 0 0 \n", - "8756 0 0 \n", - "8757 0 0 \n", - "8758 0 0 \n", - "8759 0 0 \n", - "\n", - "[8760 rows x 6 columns]" - ] - }, - "execution_count": 56, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "df" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [ - { - "ename": "ValueError", - "evalue": "Column 'oag' does not exist in the table.", - "output_type": "error", - "traceback": [ - "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m", - "\u001b[1;31mValueError\u001b[0m Traceback (most recent call last)", - "Cell \u001b[1;32mIn[58], line 2\u001b[0m\n\u001b[0;32m 1\u001b[0m \u001b[38;5;28;01mimport\u001b[39;00m \u001b[38;5;21;01mfunctions\u001b[39;00m\u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01mschedule_reader\u001b[39;00m \u001b[38;5;28;01mas\u001b[39;00m \u001b[38;5;21;01mschedule_reader\u001b[39;00m\n\u001b[1;32m----> 2\u001b[0m \u001b[43mschedule_reader\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mget_schedule\u001b[49m\u001b[43m(\u001b[49m\u001b[43mbuilding_type\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[38;5;124;43moag\u001b[39;49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[43m)\u001b[49m\n", - "File \u001b[1;32mc:\\Users\\felix\\Programmieren\\tecdm\\src\\districtgenerator\\functions\\schedule_reader.py:58\u001b[0m, in \u001b[0;36mget_schedule\u001b[1;34m(building_type)\u001b[0m\n\u001b[0;32m 41\u001b[0m type_assignment \u001b[38;5;241m=\u001b[39m {\n\u001b[0;32m 42\u001b[0m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124moag\u001b[39m\u001b[38;5;124m\"\u001b[39m: \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124moffice.csv\u001b[39m\u001b[38;5;124m\"\u001b[39m,\n\u001b[0;32m 43\u001b[0m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mIWU Research and University Teaching\u001b[39m\u001b[38;5;124m\"\u001b[39m: \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mHörsaal, Auditorium.csv\u001b[39m\u001b[38;5;124m\"\u001b[39m,\n\u001b[1;32m (...)\u001b[0m\n\u001b[0;32m 54\u001b[0m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mIWU Generalized (2) Production buildings\u001b[39m\u001b[38;5;124m\"\u001b[39m: \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mLagerhalle.csv\u001b[39m\u001b[38;5;124m\"\u001b[39m\n\u001b[0;32m 55\u001b[0m }\n\u001b[0;32m 57\u001b[0m \u001b[38;5;66;03m#schedule_name = type_assignment.get(building_type)\u001b[39;00m\n\u001b[1;32m---> 58\u001b[0m schedule_name \u001b[38;5;241m=\u001b[39m \u001b[43mget_building_type\u001b[49m\u001b[43m(\u001b[49m\u001b[43mterm\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[38;5;124;43mSIA\u001b[39;49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mkind\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mbuilding_type\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 59\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m schedule_name \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m:\n\u001b[0;32m 60\u001b[0m \u001b[38;5;28mprint\u001b[39m(\u001b[38;5;124mf\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mNo schedule for building type \u001b[39m\u001b[38;5;132;01m{\u001b[39;00mbuilding_type\u001b[38;5;132;01m}\u001b[39;00m\u001b[38;5;124m\"\u001b[39m)\n", - "File \u001b[1;32mc:\\Users\\felix\\Programmieren\\tecdm\\src\\districtgenerator\\functions\\schedule_reader.py:18\u001b[0m, in \u001b[0;36mget_building_type\u001b[1;34m(term, kind)\u001b[0m\n\u001b[0;32m 16\u001b[0m \u001b[38;5;66;03m# Check if the kind column exists\u001b[39;00m\n\u001b[0;32m 17\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m kind \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;129;01min\u001b[39;00m df\u001b[38;5;241m.\u001b[39mcolumns:\n\u001b[1;32m---> 18\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m \u001b[38;5;167;01mValueError\u001b[39;00m(\u001b[38;5;124mf\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mColumn \u001b[39m\u001b[38;5;124m'\u001b[39m\u001b[38;5;132;01m{\u001b[39;00mkind\u001b[38;5;132;01m}\u001b[39;00m\u001b[38;5;124m'\u001b[39m\u001b[38;5;124m does not exist in the table.\u001b[39m\u001b[38;5;124m\"\u001b[39m)\n\u001b[0;32m 20\u001b[0m \u001b[38;5;66;03m# Find the row that matches the term in 'districtgenerator'\u001b[39;00m\n\u001b[0;32m 21\u001b[0m match \u001b[38;5;241m=\u001b[39m df[df[\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mdistrictgenerator\u001b[39m\u001b[38;5;124m'\u001b[39m] \u001b[38;5;241m==\u001b[39m term]\n", - "\u001b[1;31mValueError\u001b[0m: Column 'oag' does not exist in the table." - ] - } - ], - "source": [ - "import functions.schedule_reader as schedule_reader\n", - "schedule_reader.get_schedule(building_type='oag')" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "import json " - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [ - { - "ename": "TypeError", - "evalue": "the JSON object must be str, bytes or bytearray, not TextIOWrapper", - "output_type": "error", - "traceback": [ - "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m", - "\u001b[1;31mTypeError\u001b[0m Traceback (most recent call last)", - "Cell \u001b[1;32mIn[2], line 2\u001b[0m\n\u001b[0;32m 1\u001b[0m \u001b[38;5;28;01mwith\u001b[39;00m \u001b[38;5;28mopen\u001b[39m(\u001b[38;5;124mr\u001b[39m\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mC:\u001b[39m\u001b[38;5;124m\\\u001b[39m\u001b[38;5;124mUsers\u001b[39m\u001b[38;5;124m\\\u001b[39m\u001b[38;5;124mfelix\u001b[39m\u001b[38;5;124m\\\u001b[39m\u001b[38;5;124mProgrammieren\u001b[39m\u001b[38;5;124m\\\u001b[39m\u001b[38;5;124mtecdm\u001b[39m\u001b[38;5;124m\\\u001b[39m\u001b[38;5;124msrc\u001b[39m\u001b[38;5;124m\\\u001b[39m\u001b[38;5;124mdistrictgenerator\u001b[39m\u001b[38;5;124m\\\u001b[39m\u001b[38;5;124mdata\u001b[39m\u001b[38;5;124m\\\u001b[39m\u001b[38;5;124mnon_residential_envelope\u001b[39m\u001b[38;5;124m\\\u001b[39m\u001b[38;5;124mnon_residential_envelope.json\u001b[39m\u001b[38;5;124m'\u001b[39m) \u001b[38;5;28;01mas\u001b[39;00m f:\n\u001b[1;32m----> 2\u001b[0m data \u001b[38;5;241m=\u001b[39m \u001b[43mjson\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mloads\u001b[49m\u001b[43m(\u001b[49m\u001b[43mf\u001b[49m\u001b[43m)\u001b[49m\n", - "File \u001b[1;32mc:\\Users\\felix\\.conda\\envs\\districtgenerator\\Lib\\json\\__init__.py:339\u001b[0m, in \u001b[0;36mloads\u001b[1;34m(s, cls, object_hook, parse_float, parse_int, parse_constant, object_pairs_hook, **kw)\u001b[0m\n\u001b[0;32m 337\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[0;32m 338\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;28misinstance\u001b[39m(s, (\u001b[38;5;28mbytes\u001b[39m, \u001b[38;5;28mbytearray\u001b[39m)):\n\u001b[1;32m--> 339\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m \u001b[38;5;167;01mTypeError\u001b[39;00m(\u001b[38;5;124mf\u001b[39m\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mthe JSON object must be str, bytes or bytearray, \u001b[39m\u001b[38;5;124m'\u001b[39m\n\u001b[0;32m 340\u001b[0m \u001b[38;5;124mf\u001b[39m\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mnot \u001b[39m\u001b[38;5;132;01m{\u001b[39;00ms\u001b[38;5;241m.\u001b[39m\u001b[38;5;18m__class__\u001b[39m\u001b[38;5;241m.\u001b[39m\u001b[38;5;18m__name__\u001b[39m\u001b[38;5;132;01m}\u001b[39;00m\u001b[38;5;124m'\u001b[39m)\n\u001b[0;32m 341\u001b[0m s \u001b[38;5;241m=\u001b[39m s\u001b[38;5;241m.\u001b[39mdecode(detect_encoding(s), \u001b[38;5;124m'\u001b[39m\u001b[38;5;124msurrogatepass\u001b[39m\u001b[38;5;124m'\u001b[39m)\n\u001b[0;32m 343\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m (\u001b[38;5;28mcls\u001b[39m \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m \u001b[38;5;129;01mand\u001b[39;00m object_hook \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m \u001b[38;5;129;01mand\u001b[39;00m\n\u001b[0;32m 344\u001b[0m parse_int \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m \u001b[38;5;129;01mand\u001b[39;00m parse_float \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m \u001b[38;5;129;01mand\u001b[39;00m\n\u001b[0;32m 345\u001b[0m parse_constant \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m \u001b[38;5;129;01mand\u001b[39;00m object_pairs_hook \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m \u001b[38;5;129;01mand\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m kw):\n", - "\u001b[1;31mTypeError\u001b[0m: the JSON object must be str, bytes or bytearray, not TextIOWrapper" - ] - } - ], - "source": [ - "with open(r'C:\\Users\\felix\\Programmieren\\tecdm\\src\\districtgenerator\\data\\non_residential_envelope\\non_residential_envelope.json') as f:\n", - " data = json.loads(f)" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [ - { - "ename": "JSONDecodeError", - "evalue": "Expecting value: line 1 column 1 (char 0)", - "output_type": "error", - "traceback": [ - "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m", - "\u001b[1;31mJSONDecodeError\u001b[0m Traceback (most recent call last)", - "Cell \u001b[1;32mIn[3], line 1\u001b[0m\n\u001b[1;32m----> 1\u001b[0m data \u001b[38;5;241m=\u001b[39m \u001b[43mjson\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mloads\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;124;43mr\u001b[39;49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[38;5;124;43mC:\u001b[39;49m\u001b[38;5;124;43m\\\u001b[39;49m\u001b[38;5;124;43mUsers\u001b[39;49m\u001b[38;5;124;43m\\\u001b[39;49m\u001b[38;5;124;43mfelix\u001b[39;49m\u001b[38;5;124;43m\\\u001b[39;49m\u001b[38;5;124;43mProgrammieren\u001b[39;49m\u001b[38;5;124;43m\\\u001b[39;49m\u001b[38;5;124;43mtecdm\u001b[39;49m\u001b[38;5;124;43m\\\u001b[39;49m\u001b[38;5;124;43msrc\u001b[39;49m\u001b[38;5;124;43m\\\u001b[39;49m\u001b[38;5;124;43mdistrictgenerator\u001b[39;49m\u001b[38;5;124;43m\\\u001b[39;49m\u001b[38;5;124;43mdata\u001b[39;49m\u001b[38;5;124;43m\\\u001b[39;49m\u001b[38;5;124;43mnon_residential_envelope\u001b[39;49m\u001b[38;5;124;43m\\\u001b[39;49m\u001b[38;5;124;43mnon_residential_envelope.json\u001b[39;49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[43m)\u001b[49m\n", - "File \u001b[1;32mc:\\Users\\felix\\.conda\\envs\\districtgenerator\\Lib\\json\\__init__.py:346\u001b[0m, in \u001b[0;36mloads\u001b[1;34m(s, cls, object_hook, parse_float, parse_int, parse_constant, object_pairs_hook, **kw)\u001b[0m\n\u001b[0;32m 341\u001b[0m s \u001b[38;5;241m=\u001b[39m s\u001b[38;5;241m.\u001b[39mdecode(detect_encoding(s), \u001b[38;5;124m'\u001b[39m\u001b[38;5;124msurrogatepass\u001b[39m\u001b[38;5;124m'\u001b[39m)\n\u001b[0;32m 343\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m (\u001b[38;5;28mcls\u001b[39m \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m \u001b[38;5;129;01mand\u001b[39;00m object_hook \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m \u001b[38;5;129;01mand\u001b[39;00m\n\u001b[0;32m 344\u001b[0m parse_int \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m \u001b[38;5;129;01mand\u001b[39;00m parse_float \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m \u001b[38;5;129;01mand\u001b[39;00m\n\u001b[0;32m 345\u001b[0m parse_constant \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m \u001b[38;5;129;01mand\u001b[39;00m object_pairs_hook \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m \u001b[38;5;129;01mand\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m kw):\n\u001b[1;32m--> 346\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43m_default_decoder\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mdecode\u001b[49m\u001b[43m(\u001b[49m\u001b[43ms\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 347\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28mcls\u001b[39m \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m:\n\u001b[0;32m 348\u001b[0m \u001b[38;5;28mcls\u001b[39m \u001b[38;5;241m=\u001b[39m JSONDecoder\n", - "File \u001b[1;32mc:\\Users\\felix\\.conda\\envs\\districtgenerator\\Lib\\json\\decoder.py:337\u001b[0m, in \u001b[0;36mJSONDecoder.decode\u001b[1;34m(self, s, _w)\u001b[0m\n\u001b[0;32m 332\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21mdecode\u001b[39m(\u001b[38;5;28mself\u001b[39m, s, _w\u001b[38;5;241m=\u001b[39mWHITESPACE\u001b[38;5;241m.\u001b[39mmatch):\n\u001b[0;32m 333\u001b[0m \u001b[38;5;250m \u001b[39m\u001b[38;5;124;03m\"\"\"Return the Python representation of ``s`` (a ``str`` instance\u001b[39;00m\n\u001b[0;32m 334\u001b[0m \u001b[38;5;124;03m containing a JSON document).\u001b[39;00m\n\u001b[0;32m 335\u001b[0m \n\u001b[0;32m 336\u001b[0m \u001b[38;5;124;03m \"\"\"\u001b[39;00m\n\u001b[1;32m--> 337\u001b[0m obj, end \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mraw_decode\u001b[49m\u001b[43m(\u001b[49m\u001b[43ms\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43midx\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43m_w\u001b[49m\u001b[43m(\u001b[49m\u001b[43ms\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m0\u001b[39;49m\u001b[43m)\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mend\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 338\u001b[0m end \u001b[38;5;241m=\u001b[39m _w(s, end)\u001b[38;5;241m.\u001b[39mend()\n\u001b[0;32m 339\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m end \u001b[38;5;241m!=\u001b[39m \u001b[38;5;28mlen\u001b[39m(s):\n", - "File \u001b[1;32mc:\\Users\\felix\\.conda\\envs\\districtgenerator\\Lib\\json\\decoder.py:355\u001b[0m, in \u001b[0;36mJSONDecoder.raw_decode\u001b[1;34m(self, s, idx)\u001b[0m\n\u001b[0;32m 353\u001b[0m obj, end \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mscan_once(s, idx)\n\u001b[0;32m 354\u001b[0m \u001b[38;5;28;01mexcept\u001b[39;00m \u001b[38;5;167;01mStopIteration\u001b[39;00m \u001b[38;5;28;01mas\u001b[39;00m err:\n\u001b[1;32m--> 355\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m JSONDecodeError(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mExpecting value\u001b[39m\u001b[38;5;124m\"\u001b[39m, s, err\u001b[38;5;241m.\u001b[39mvalue) \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m\n\u001b[0;32m 356\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m obj, end\n", - "\u001b[1;31mJSONDecodeError\u001b[0m: Expecting value: line 1 column 1 (char 0)" - ] - } - ], - "source": [ - "data = json.loads(r'C:\\Users\\felix\\Programmieren\\tecdm\\src\\districtgenerator\\data\\non_residential_envelope\\non_residential_envelope.json')" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "with open(r'C:\\Users\\felix\\Programmieren\\tecdm\\src\\districtgenerator\\data\\non_residential_envelope\\non_residential_envelope.json', 'r', encoding='utf-8') as file:\n", - " data = json.load(file)" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "{'oag': {'building_age_group': {'1860 - 1978': {'u_aw': 1.29,\n", - " 'u_fen': 2.68,\n", - " 'u_d_opak': 0.44,\n", - " 'u_d_transp': 1.53,\n", - " 'u_ug': 1.07,\n", - " 'u_geb': 1.16,\n", - " 'wwr_north': 0.3,\n", - " 'wwr_south': 0.3,\n", - " 'wwr_east': 0.3,\n", - " 'wwr_west': 0.3},\n", - " '1979 - 2009': {'u_aw': 0.48,\n", - " 'u_fen': 1.89,\n", - " 'u_d_opak': 0.24,\n", - " 'u_d_transp': 2.14,\n", - " 'u_ug': 0.27,\n", - " 'u_geb': 0.6,\n", - " 'wwr_north': 0.39,\n", - " 'wwr_south': 0.39,\n", - " 'wwr_east': 0.39,\n", - " 'wwr_west': 0.39},\n", - " '2010 - 2030': {'u_aw': 0.19,\n", - " 'u_fen': 1.08,\n", - " 'u_d_opak': 0.14,\n", - " 'u_d_transp': 1.3,\n", - " 'u_ug': 0.21,\n", - " 'u_geb': 0.3,\n", - " 'wwr_north': 0.37,\n", - " 'wwr_south': 0.37,\n", - " 'wwr_east': 0.37,\n", - " 'wwr_west': 0.37}}},\n", - " 'IWU Research and University Teaching': {'building_age_group': {'1860 - 1978': {'u_aw': 1.28,\n", - " 'u_fen': 3.1,\n", - " 'u_d_opak': 0.4,\n", - " 'u_d_transp': 2.19,\n", - " 'u_ug': 0.82,\n", - " 'u_geb': 1.44,\n", - " 'wwr_north': 0.37,\n", - " 'wwr_south': 0.37,\n", - " 'wwr_east': 0.37,\n", - " 'wwr_west': 0.37},\n", - " '1979 - 2009': {'u_aw': 0.29,\n", - " 'u_fen': 1.74,\n", - " 'u_d_opak': 0.13,\n", - " 'u_d_transp': 0.62,\n", - " 'u_ug': 0.53,\n", - " 'u_geb': 0.58,\n", - " 'wwr_north': 0.4,\n", - " 'wwr_south': 0.4,\n", - " 'wwr_east': 0.4,\n", - " 'wwr_west': 0.4},\n", - " '2010 - 2030': {'u_aw': 0.2,\n", - " 'u_fen': 1.24,\n", - " 'u_d_opak': 0.14,\n", - " 'u_d_transp': 0.0,\n", - " 'u_ug': 0.23,\n", - " 'u_geb': 0.25,\n", - " 'wwr_north': 0.46,\n", - " 'wwr_south': 0.46,\n", - " 'wwr_east': 0.46,\n", - " 'wwr_west': 0.46}}},\n", - " 'IWU Health and Care': {'building_age_group': {'1860 - 1978': {'u_aw': 0.95,\n", - " 'u_fen': 2.72,\n", - " 'u_d_opak': 0.31,\n", - " 'u_d_transp': 0.76,\n", - " 'u_ug': 0.7,\n", - " 'u_geb': 1.31,\n", - " 'wwr_north': 0.27,\n", - " 'wwr_south': 0.27,\n", - " 'wwr_east': 0.27,\n", - " 'wwr_west': 0.27},\n", - " '1979 - 2009': {'u_aw': 0.44,\n", - " 'u_fen': 2.24,\n", - " 'u_d_opak': 0.23,\n", - " 'u_d_transp': 2.07,\n", - " 'u_ug': 0.25,\n", - " 'u_geb': 0.59,\n", - " 'wwr_north': 0.34,\n", - " 'wwr_south': 0.34,\n", - " 'wwr_east': 0.34,\n", - " 'wwr_west': 0.34},\n", - " '2010 - 2030': {'u_aw': 0.21,\n", - " 'u_fen': 1.25,\n", - " 'u_d_opak': 0.09,\n", - " 'u_d_transp': 0.0,\n", - " 'u_ug': 0.14,\n", - " 'u_geb': 0.31,\n", - " 'wwr_north': 0.47,\n", - " 'wwr_south': 0.47,\n", - " 'wwr_east': 0.47,\n", - " 'wwr_west': 0.47}}},\n", - " 'IWU School, Day Nursery and other Care': {'building_age_group': {'1860 - 1978': {'u_aw': 1.09,\n", - " 'u_fen': 2.22,\n", - " 'u_d_opak': 0.44,\n", - " 'u_d_transp': 3.17,\n", - " 'u_ug': 0.79,\n", - " 'u_geb': 1.12,\n", - " 'wwr_north': 0.4,\n", - " 'wwr_south': 0.4,\n", - " 'wwr_east': 0.4,\n", - " 'wwr_west': 0.4},\n", - " '1979 - 2009': {'u_aw': 0.51,\n", - " 'u_fen': 2.05,\n", - " 'u_d_opak': 0.25,\n", - " 'u_d_transp': 1.64,\n", - " 'u_ug': 0.44,\n", - " 'u_geb': 0.7,\n", - " 'wwr_north': 0.43,\n", - " 'wwr_south': 0.43,\n", - " 'wwr_east': 0.43,\n", - " 'wwr_west': 0.43},\n", - " '2010 - 2030': {'u_aw': 0.23,\n", - " 'u_fen': 1.17,\n", - " 'u_d_opak': 0.14,\n", - " 'u_d_transp': 1.27,\n", - " 'u_ug': 0.18,\n", - " 'u_geb': 0.33,\n", - " 'wwr_north': 0.36,\n", - " 'wwr_south': 0.36,\n", - " 'wwr_east': 0.36,\n", - " 'wwr_west': 0.36}}},\n", - " 'IWU Culture and Leisure': {'building_age_group': {'1860 - 1978': {'u_aw': 1.39,\n", - " 'u_fen': 2.56,\n", - " 'u_d_opak': 0.75,\n", - " 'u_d_transp': 2.68,\n", - " 'u_ug': 0.99,\n", - " 'u_geb': 1.16,\n", - " 'wwr_north': 0.3,\n", - " 'wwr_south': 0.3,\n", - " 'wwr_east': 0.3,\n", - " 'wwr_west': 0.3},\n", - " '1979 - 2009': {'u_aw': 0.53,\n", - " 'u_fen': 2.04,\n", - " 'u_d_opak': 0.33,\n", - " 'u_d_transp': 1.94,\n", - " 'u_ug': 0.44,\n", - " 'u_geb': 0.52,\n", - " 'wwr_north': 0.29,\n", - " 'wwr_south': 0.29,\n", - " 'wwr_east': 0.29,\n", - " 'wwr_west': 0.29},\n", - " '2010 - 2030': {'u_aw': 0.51,\n", - " 'u_fen': 0.96,\n", - " 'u_d_opak': 0.33,\n", - " 'u_d_transp': 0.9,\n", - " 'u_ug': 0.54,\n", - " 'u_geb': 0.3,\n", - " 'wwr_north': 0.51,\n", - " 'wwr_south': 0.51,\n", - " 'wwr_east': 0.51,\n", - " 'wwr_west': 0.51}}},\n", - " 'IWU Sports Facilities': {'building_age_group': {'1860 - 1978': {'u_aw': 1.35,\n", - " 'u_fen': 3.09,\n", - " 'u_d_opak': 0.4,\n", - " 'u_d_transp': 1.3,\n", - " 'u_ug': 0.57,\n", - " 'u_geb': 1.06,\n", - " 'wwr_north': 0.59,\n", - " 'wwr_south': 0.59,\n", - " 'wwr_east': 0.59,\n", - " 'wwr_west': 0.59},\n", - " '1979 - 2009': {'u_aw': 0.55,\n", - " 'u_fen': 2.56,\n", - " 'u_d_opak': 0.34,\n", - " 'u_d_transp': 1.05,\n", - " 'u_ug': 0.57,\n", - " 'u_geb': 0.66,\n", - " 'wwr_north': 0.27,\n", - " 'wwr_south': 0.27,\n", - " 'wwr_east': 0.27,\n", - " 'wwr_west': 0.27},\n", - " '2010 - 2030': {'u_aw': 0.27,\n", - " 'u_fen': 1.07,\n", - " 'u_d_opak': 0.15,\n", - " 'u_d_transp': 1.3,\n", - " 'u_ug': 0.99,\n", - " 'u_geb': 0.39,\n", - " 'wwr_north': 0.13,\n", - " 'wwr_south': 0.13,\n", - " 'wwr_east': 0.13,\n", - " 'wwr_west': 0.13}}},\n", - " 'IWU Hotels, Boarding, Restaurants or Catering': {'building_age_group': {'1860 - 1978': {'u_aw': 1.2,\n", - " 'u_fen': 2.76,\n", - " 'u_d_opak': 0.8,\n", - " 'u_d_transp': 2.3,\n", - " 'u_ug': 0.83,\n", - " 'u_geb': 1.24,\n", - " 'wwr_north': 0.3,\n", - " 'wwr_south': 0.3,\n", - " 'wwr_east': 0.3,\n", - " 'wwr_west': 0.3},\n", - " '1979 - 2009': {'u_aw': 0.47,\n", - " 'u_fen': 2.07,\n", - " 'u_d_opak': 0.29,\n", - " 'u_d_transp': 2.78,\n", - " 'u_ug': 0.37,\n", - " 'u_geb': 0.79,\n", - " 'wwr_north': 0.33,\n", - " 'wwr_south': 0.33,\n", - " 'wwr_east': 0.33,\n", - " 'wwr_west': 0.33},\n", - " '2010 - 2030': {'u_aw': 0.32,\n", - " 'u_fen': 1.24,\n", - " 'u_d_opak': 0.18,\n", - " 'u_d_transp': 0.0,\n", - " 'u_ug': 0.26,\n", - " 'u_geb': 0.38,\n", - " 'wwr_north': 0.32,\n", - " 'wwr_south': 0.32,\n", - " 'wwr_east': 0.32,\n", - " 'wwr_west': 0.32}}},\n", - " 'IWU Production, Workshop, Warehouse or Operations': {'building_age_group': {'1860 - 1978': {'u_aw': 1.03,\n", - " 'u_fen': 2.99,\n", - " 'u_d_opak': 0.53,\n", - " 'u_d_transp': 3.84,\n", - " 'u_ug': 1.01,\n", - " 'u_geb': 1.12,\n", - " 'wwr_north': 0.26,\n", - " 'wwr_south': 0.26,\n", - " 'wwr_east': 0.26,\n", - " 'wwr_west': 0.26},\n", - " '1979 - 2009': {'u_aw': 0.51,\n", - " 'u_fen': 2.17,\n", - " 'u_d_opak': 0.24,\n", - " 'u_d_transp': 2.05,\n", - " 'u_ug': 0.41,\n", - " 'u_geb': 0.54,\n", - " 'wwr_north': 0.21,\n", - " 'wwr_south': 0.21,\n", - " 'wwr_east': 0.21,\n", - " 'wwr_west': 0.21},\n", - " '2010 - 2030': {'u_aw': 0.24,\n", - " 'u_fen': 1.2,\n", - " 'u_d_opak': 0.11,\n", - " 'u_d_transp': 1.07,\n", - " 'u_ug': 0.22,\n", - " 'u_geb': 0.28,\n", - " 'wwr_north': 0.19,\n", - " 'wwr_south': 0.19,\n", - " 'wwr_east': 0.19,\n", - " 'wwr_west': 0.19}}},\n", - " 'IWU Trade Buildings': {'building_age_group': {'1860 - 1978': {'u_aw': 0.55,\n", - " 'u_fen': 3.03,\n", - " 'u_d_opak': 0.22,\n", - " 'u_d_transp': 0.07,\n", - " 'u_ug': 0.37,\n", - " 'u_geb': 1.32,\n", - " 'wwr_north': 0.2,\n", - " 'wwr_south': 0.2,\n", - " 'wwr_east': 0.2,\n", - " 'wwr_west': 0.2},\n", - " '1979 - 2009': {'u_aw': 0.4,\n", - " 'u_fen': 2.1,\n", - " 'u_d_opak': 0.31,\n", - " 'u_d_transp': 2.35,\n", - " 'u_ug': 0.5,\n", - " 'u_geb': 0.5,\n", - " 'wwr_north': 0.23,\n", - " 'wwr_south': 0.23,\n", - " 'wwr_east': 0.23,\n", - " 'wwr_west': 0.23},\n", - " '2010 - 2030': {'u_aw': 0.25,\n", - " 'u_fen': 1.05,\n", - " 'u_d_opak': 0.16,\n", - " 'u_d_transp': 0.9,\n", - " 'u_ug': 0.12,\n", - " 'u_geb': 0.33,\n", - " 'wwr_north': 0.4,\n", - " 'wwr_south': 0.4,\n", - " 'wwr_east': 0.4,\n", - " 'wwr_west': 0.4}}},\n", - " 'IWU Technical and Utility (supply and disposal)': {'building_age_group': {'1860 - 1978': {'u_aw': 1.98,\n", - " 'u_fen': 4.2,\n", - " 'u_d_opak': 0.99,\n", - " 'u_d_transp': 0.0,\n", - " 'u_ug': 1.51,\n", - " 'u_geb': 1.3,\n", - " 'wwr_north': 0.23,\n", - " 'wwr_south': 0.23,\n", - " 'wwr_east': 0.23,\n", - " 'wwr_west': 0.23},\n", - " '1979 - 2009': {'u_aw': 0.47,\n", - " 'u_fen': 2.02,\n", - " 'u_d_opak': 0.22,\n", - " 'u_d_transp': 0.0,\n", - " 'u_ug': 0.37,\n", - " 'u_geb': 0.55,\n", - " 'wwr_north': 0.12,\n", - " 'wwr_south': 0.12,\n", - " 'wwr_east': 0.12,\n", - " 'wwr_west': 0.12},\n", - " '2010 - 2030': {'u_aw': 0.16,\n", - " 'u_fen': 1.3,\n", - " 'u_d_opak': 0.15,\n", - " 'u_d_transp': 0.0,\n", - " 'u_ug': 0.24,\n", - " 'u_geb': 0.24,\n", - " 'wwr_north': 0.0,\n", - " 'wwr_south': 0.0,\n", - " 'wwr_east': 0.0,\n", - " 'wwr_west': 0.0}}},\n", - " 'IWU Transport': {'building_age_group': {'1860 - 1978': {'u_aw': 1.78,\n", - " 'u_fen': 5.0,\n", - " 'u_d_opak': 1.41,\n", - " 'u_d_transp': 5.0,\n", - " 'u_ug': 0.98,\n", - " 'u_geb': 1.43,\n", - " 'wwr_north': 0.42,\n", - " 'wwr_south': 0.42,\n", - " 'wwr_east': 0.42,\n", - " 'wwr_west': 0.42},\n", - " '1979 - 2009': {'u_aw': 0.63,\n", - " 'u_fen': 0.41,\n", - " 'u_d_opak': 0.41,\n", - " 'u_d_transp': 0.0,\n", - " 'u_ug': 0.61,\n", - " 'u_geb': 0.68,\n", - " 'wwr_north': 0.06,\n", - " 'wwr_south': 0.06,\n", - " 'wwr_east': 0.06,\n", - " 'wwr_west': 0.06},\n", - " '2010 - 2030': {'u_aw': 0.16,\n", - " 'u_fen': 1.3,\n", - " 'u_d_opak': 0.15,\n", - " 'u_d_transp': 0.0,\n", - " 'u_ug': 0.24,\n", - " 'u_geb': 0.22,\n", - " 'wwr_north': 0.0,\n", - " 'wwr_south': 0.0,\n", - " 'wwr_east': 0.0,\n", - " 'wwr_west': 0.0}}},\n", - " 'IWU Generalized (1) Services building, Includes categories (1) to (7) and (9)': {'building_age_group': {'1860 - 1978': {'u_aw': 1.11,\n", - " 'u_fen': 2.8,\n", - " 'u_d_opak': 0.45,\n", - " 'u_d_transp': 0.66,\n", - " 'u_ug': 0.64,\n", - " 'u_geb': 1.2,\n", - " 'wwr_north': 0.34,\n", - " 'wwr_south': 0.34,\n", - " 'wwr_east': 0.34,\n", - " 'wwr_west': 0.34},\n", - " '1979 - 2009': {'u_aw': 0.48,\n", - " 'u_fen': 2.1,\n", - " 'u_d_opak': 0.27,\n", - " 'u_d_transp': 2.03,\n", - " 'u_ug': 0.41,\n", - " 'u_geb': 0.62,\n", - " 'wwr_north': 0.34,\n", - " 'wwr_south': 0.34,\n", - " 'wwr_east': 0.34,\n", - " 'wwr_west': 0.34},\n", - " '2010 - 2030': {'u_aw': 0.25,\n", - " 'u_fen': 1.12,\n", - " 'u_d_opak': 0.13,\n", - " 'u_d_transp': 1.13,\n", - " 'u_ug': 0.2,\n", - " 'u_geb': 0.31,\n", - " 'wwr_north': 0.38,\n", - " 'wwr_south': 0.38,\n", - " 'wwr_east': 0.38,\n", - " 'wwr_west': 0.38}}},\n", - " 'IWU Generalized (2) Production buildings and similar, Includes cat. (8), (10), (11)': {'building_age_group': {'1860 - 1978': {'u_aw': 1.78,\n", - " 'u_fen': 5.0,\n", - " 'u_d_opak': 1.41,\n", - " 'u_d_transp': 5.0,\n", - " 'u_ug': 0.98,\n", - " 'u_geb': 1.43,\n", - " 'wwr_north': 0.26,\n", - " 'wwr_south': 0.26,\n", - " 'wwr_east': 0.26,\n", - " 'wwr_west': 0.26},\n", - " '1979 - 2009': {'u_aw': 0.63,\n", - " 'u_fen': 0.41,\n", - " 'u_d_opak': 0.41,\n", - " 'u_d_transp': 0.0,\n", - " 'u_ug': 0.61,\n", - " 'u_geb': 0.68,\n", - " 'wwr_north': 0.2,\n", - " 'wwr_south': 0.2,\n", - " 'wwr_east': 0.2,\n", - " 'wwr_west': 0.2},\n", - " '2010 - 2030': {'u_aw': 0.24,\n", - " 'u_fen': 1.2,\n", - " 'u_d_opak': 0.11,\n", - " 'u_d_transp': 1.07,\n", - " 'u_ug': 0.22,\n", - " 'u_geb': 0.28,\n", - " 'wwr_north': 0.19,\n", - " 'wwr_south': 0.19,\n", - " 'wwr_east': 0.19,\n", - " 'wwr_west': 0.19}}}}" - ] - }, - "execution_count": 5, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "data" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "# Values to add based on year range\n", - "values_to_add = {\n", - " '1860 - 1978': 0.78,\n", - " '1979 - 2009': 0.78, # Placeholder value\n", - " '2010 - 2030': 0.67 # Placeholder value\n", - "}\n", - "\n", - "# Loop through each key in the dictionary\n", - "for key in data:\n", - " # Check if 'building_age_group' is present\n", - " if 'building_age_group' in data[key]:\n", - " # Loop through the building_age_group and add the appropriate new value\n", - " for year_range, properties in data[key]['building_age_group'].items():\n", - " properties['g_gl_fen'] = values_to_add.get(year_range, 0.0) # Default value if year_range not found\n" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [ - { - "ename": "TypeError", - "evalue": "JSONEncoder.__init__() got an unexpected keyword argument 'fp'", - "output_type": "error", - "traceback": [ - "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m", - "\u001b[1;31mTypeError\u001b[0m Traceback (most recent call last)", - "Cell \u001b[1;32mIn[9], line 1\u001b[0m\n\u001b[1;32m----> 1\u001b[0m \u001b[43mjson\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mdumps\u001b[49m\u001b[43m(\u001b[49m\u001b[43m \u001b[49m\u001b[43mdata\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mfp\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;124;43mr\u001b[39;49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[38;5;124;43mC:\u001b[39;49m\u001b[38;5;124;43m\\\u001b[39;49m\u001b[38;5;124;43mUsers\u001b[39;49m\u001b[38;5;124;43m\\\u001b[39;49m\u001b[38;5;124;43mfelix\u001b[39;49m\u001b[38;5;124;43m\\\u001b[39;49m\u001b[38;5;124;43mProgrammieren\u001b[39;49m\u001b[38;5;124;43m\\\u001b[39;49m\u001b[38;5;124;43mtecdm\u001b[39;49m\u001b[38;5;124;43m\\\u001b[39;49m\u001b[38;5;124;43msrc\u001b[39;49m\u001b[38;5;124;43m\\\u001b[39;49m\u001b[38;5;124;43mdistrictgenerator\u001b[39;49m\u001b[38;5;124;43m\\\u001b[39;49m\u001b[38;5;124;43mdata\u001b[39;49m\u001b[38;5;124;43m\\\u001b[39;49m\u001b[38;5;124;43mnon_residential_envelope\u001b[39;49m\u001b[38;5;124;43m\\\u001b[39;49m\u001b[38;5;124;43mnon_residential_envelope.json\u001b[39;49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[43m)\u001b[49m\n", - "File \u001b[1;32mc:\\Users\\felix\\.conda\\envs\\districtgenerator\\Lib\\json\\__init__.py:234\u001b[0m, in \u001b[0;36mdumps\u001b[1;34m(obj, skipkeys, ensure_ascii, check_circular, allow_nan, cls, indent, separators, default, sort_keys, **kw)\u001b[0m\n\u001b[0;32m 232\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28mcls\u001b[39m \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m:\n\u001b[0;32m 233\u001b[0m \u001b[38;5;28mcls\u001b[39m \u001b[38;5;241m=\u001b[39m JSONEncoder\n\u001b[1;32m--> 234\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43mcls\u001b[39;49m\u001b[43m(\u001b[49m\n\u001b[0;32m 235\u001b[0m \u001b[43m \u001b[49m\u001b[43mskipkeys\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mskipkeys\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mensure_ascii\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mensure_ascii\u001b[49m\u001b[43m,\u001b[49m\n\u001b[0;32m 236\u001b[0m \u001b[43m \u001b[49m\u001b[43mcheck_circular\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mcheck_circular\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mallow_nan\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mallow_nan\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mindent\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mindent\u001b[49m\u001b[43m,\u001b[49m\n\u001b[0;32m 237\u001b[0m \u001b[43m \u001b[49m\u001b[43mseparators\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mseparators\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mdefault\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mdefault\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43msort_keys\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43msort_keys\u001b[49m\u001b[43m,\u001b[49m\n\u001b[0;32m 238\u001b[0m \u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mkw\u001b[49m\u001b[43m)\u001b[49m\u001b[38;5;241m.\u001b[39mencode(obj)\n", - "\u001b[1;31mTypeError\u001b[0m: JSONEncoder.__init__() got an unexpected keyword argument 'fp'" - ] - } - ], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "with open(r'C:\\Users\\felix\\Programmieren\\tecdm\\src\\districtgenerator\\data\\non_residential_envelope\\non_residential_envelope.json', 'w', encoding='utf-8') as file:\n", - " json.dump(data, file, indent=2)" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "import pandas as pd\n", - "\n", - "df = pd.read_csv(r'C:\\Users\\felix\\Programmieren\\CityEnergyAnalyst\\cea\\databases\\DE\\archetypes\\use_types\\OFFICE_1P.csv', skiprows=2)\n", - "# Filter out weekdays, Saturday, and Sunday\n", - "weekday_data = df[df['DAY'] == 'WEEKDAY']\n", - "saturday_data = df[df['DAY'] == 'SATURDAY']\n", - "sunday_data = df[df['DAY'] == 'SUNDAY']\n", - "\n", - "# Ensure each type of day has only 24 hours worth of data if there are duplicates\n", - "weekday_data = weekday_data.head(24)\n", - "saturday_data = saturday_data.head(24)\n", - "sunday_data = sunday_data.head(24)\n", - "\n", - "# Repeat the weekday data five times\n", - "repeated_weekdays = pd.concat([weekday_data] * 5, ignore_index=True)\n", - "\n", - "# Modify the 'DAY' column for repeated weekdays\n", - "day_mappings = {i: f\"weekday_{(i//24)+1}\" for i in range(120)} # Generate weekday labels\n", - "repeated_weekdays['DAY'] = [day_mappings[i] for i in range(120)] # Apply labels\n", - "\n", - "# Concatenate all data: five weekdays, one Saturday, one Sunday\n", - "final_df = pd.concat([repeated_weekdays, saturday_data, sunday_data], ignore_index=True)\n", - "\n", - "# Adjust the 'DAY' column to reflect the new day numbering (optional)\n", - "day_numbering = {**{f\"weekday_{i+1}\": i for i in range(5)}, 'SATURDAY': 5, 'SUNDAY': 6}\n", - "final_df['DAY'] = final_df['DAY'].map(day_numbering)\n", - "final_df = final_df.drop(columns=['Unnamed: 11', 'Unnamed: 12'])\n" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "final_df.to_csv(r'C:\\Users\\felix\\Programmieren\\tecdm\\src\\districtgenerator\\data\\occupancy_schedules\\OFFICE_1P.csv')" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "df = pd.read_csv(r'C:\\Users\\felix\\Programmieren\\CityEnergyAnalyst\\cea\\databases\\DE\\archetypes\\use_types\\OFFICE_1P.csv', skiprows=2)\n", - "# Filter out weekdays, Saturday, and Sunday\n", - "weekday_data = df[df['DAY'] == 'WEEKDAY']\n", - "saturday_data = df[df['DAY'] == 'SATURDAY']\n", - "sunday_data = df[df['DAY'] == 'SUNDAY']\n", - "\n", - "# Ensure each type of day has only 24 hours worth of data if there are duplicates\n", - "weekday_data = weekday_data.head(24)\n", - "saturday_data = saturday_data.head(24)\n", - "sunday_data = sunday_data.head(24)\n", - "\n", - "# Repeat the weekday data five times\n", - "repeated_weekdays = pd.concat([weekday_data] * 5, ignore_index=True)\n", - "\n", - "# Modify the 'DAY' column for repeated weekdays\n", - "day_mappings = {i: f\"weekday_{(i//24)+1}\" for i in range(120)} # Generate weekday labels\n", - "repeated_weekdays['DAY'] = [day_mappings[i] for i in range(120)] # Apply labels\n", - "\n", - "# Concatenate all data: five weekdays, one Saturday, one Sunday\n", - "final_df = pd.concat([repeated_weekdays, saturday_data, sunday_data], ignore_index=True)\n", - "\n", - "# Adjust the 'DAY' column to reflect the new day numbering (optional)\n", - "day_numbering = {**{f\"weekday_{i+1}\": i for i in range(5)}, 'SATURDAY': 5, 'SUNDAY': 6}\n", - "final_df['DAY'] = final_df['DAY'].map(day_numbering)\n", - "final_df = final_df.drop(columns=['Unnamed: 11', 'Unnamed: 12'])" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Processing file: C:\\Users\\felix\\Programmieren\\CityEnergyAnalyst\\cea\\databases\\DE\\archetypes\\use_types\\COOLROOM.csv\n" - ] - }, - { - "ename": "KeyError", - "evalue": "\"['Unnamed: 11', 'Unnamed: 12'] not found in axis\"", - "output_type": "error", - "traceback": [ - "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m", - "\u001b[1;31mKeyError\u001b[0m Traceback (most recent call last)", - "Cell \u001b[1;32mIn[45], line 34\u001b[0m\n\u001b[0;32m 31\u001b[0m df \u001b[38;5;241m=\u001b[39m pd\u001b[38;5;241m.\u001b[39mread_csv(file_path, skiprows\u001b[38;5;241m=\u001b[39m\u001b[38;5;241m2\u001b[39m)\n\u001b[0;32m 33\u001b[0m \u001b[38;5;66;03m# Process the DataFrame\u001b[39;00m\n\u001b[1;32m---> 34\u001b[0m processed_df \u001b[38;5;241m=\u001b[39m \u001b[43mprocess_dataframe\u001b[49m\u001b[43m(\u001b[49m\u001b[43mdf\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 35\u001b[0m \u001b[38;5;28mprint\u001b[39m(df\u001b[38;5;241m.\u001b[39mhead())\n\u001b[0;32m 37\u001b[0m \u001b[38;5;66;03m# Save the processed DataFrame\u001b[39;00m\n", - "Cell \u001b[1;32mIn[45], line 15\u001b[0m, in \u001b[0;36mprocess_dataframe\u001b[1;34m(df)\u001b[0m\n\u001b[0;32m 13\u001b[0m final_df[\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mDAY\u001b[39m\u001b[38;5;124m'\u001b[39m] \u001b[38;5;241m=\u001b[39m final_df\u001b[38;5;241m.\u001b[39mindex \u001b[38;5;241m/\u001b[39m\u001b[38;5;241m/\u001b[39m \u001b[38;5;241m24\u001b[39m \u001b[38;5;241m%\u001b[39m \u001b[38;5;241m7\u001b[39m\n\u001b[0;32m 14\u001b[0m final_df[\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mDAY\u001b[39m\u001b[38;5;124m'\u001b[39m] \u001b[38;5;241m=\u001b[39m final_df[\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mDAY\u001b[39m\u001b[38;5;124m'\u001b[39m]\u001b[38;5;241m.\u001b[39mmap({i: i \u001b[38;5;28;01mif\u001b[39;00m i \u001b[38;5;241m<\u001b[39m \u001b[38;5;241m5\u001b[39m \u001b[38;5;28;01melse\u001b[39;00m \u001b[38;5;241m5\u001b[39m \u001b[38;5;28;01mif\u001b[39;00m i \u001b[38;5;241m==\u001b[39m \u001b[38;5;241m5\u001b[39m \u001b[38;5;28;01melse\u001b[39;00m \u001b[38;5;241m6\u001b[39m \u001b[38;5;28;01mfor\u001b[39;00m i \u001b[38;5;129;01min\u001b[39;00m \u001b[38;5;28mrange\u001b[39m(\u001b[38;5;241m7\u001b[39m)})\n\u001b[1;32m---> 15\u001b[0m final_df \u001b[38;5;241m=\u001b[39m \u001b[43mfinal_df\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mdrop\u001b[49m\u001b[43m(\u001b[49m\u001b[43mcolumns\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43m[\u001b[49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[38;5;124;43mUnnamed: 11\u001b[39;49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[38;5;124;43mUnnamed: 12\u001b[39;49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[43m]\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 17\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m final_df\n", - "File \u001b[1;32mc:\\Users\\felix\\.conda\\envs\\districtgenerator\\Lib\\site-packages\\pandas-2.2.2-py3.11-win-amd64.egg\\pandas\\core\\frame.py:5581\u001b[0m, in \u001b[0;36mDataFrame.drop\u001b[1;34m(self, labels, axis, index, columns, level, inplace, errors)\u001b[0m\n\u001b[0;32m 5433\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21mdrop\u001b[39m(\n\u001b[0;32m 5434\u001b[0m \u001b[38;5;28mself\u001b[39m,\n\u001b[0;32m 5435\u001b[0m labels: IndexLabel \u001b[38;5;241m|\u001b[39m \u001b[38;5;28;01mNone\u001b[39;00m \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;01mNone\u001b[39;00m,\n\u001b[1;32m (...)\u001b[0m\n\u001b[0;32m 5442\u001b[0m errors: IgnoreRaise \u001b[38;5;241m=\u001b[39m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mraise\u001b[39m\u001b[38;5;124m\"\u001b[39m,\n\u001b[0;32m 5443\u001b[0m ) \u001b[38;5;241m-\u001b[39m\u001b[38;5;241m>\u001b[39m DataFrame \u001b[38;5;241m|\u001b[39m \u001b[38;5;28;01mNone\u001b[39;00m:\n\u001b[0;32m 5444\u001b[0m \u001b[38;5;250m \u001b[39m\u001b[38;5;124;03m\"\"\"\u001b[39;00m\n\u001b[0;32m 5445\u001b[0m \u001b[38;5;124;03m Drop specified labels from rows or columns.\u001b[39;00m\n\u001b[0;32m 5446\u001b[0m \n\u001b[1;32m (...)\u001b[0m\n\u001b[0;32m 5579\u001b[0m \u001b[38;5;124;03m weight 1.0 0.8\u001b[39;00m\n\u001b[0;32m 5580\u001b[0m \u001b[38;5;124;03m \"\"\"\u001b[39;00m\n\u001b[1;32m-> 5581\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43msuper\u001b[39;49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mdrop\u001b[49m\u001b[43m(\u001b[49m\n\u001b[0;32m 5582\u001b[0m \u001b[43m \u001b[49m\u001b[43mlabels\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mlabels\u001b[49m\u001b[43m,\u001b[49m\n\u001b[0;32m 5583\u001b[0m \u001b[43m \u001b[49m\u001b[43maxis\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43maxis\u001b[49m\u001b[43m,\u001b[49m\n\u001b[0;32m 5584\u001b[0m \u001b[43m \u001b[49m\u001b[43mindex\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mindex\u001b[49m\u001b[43m,\u001b[49m\n\u001b[0;32m 5585\u001b[0m \u001b[43m \u001b[49m\u001b[43mcolumns\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mcolumns\u001b[49m\u001b[43m,\u001b[49m\n\u001b[0;32m 5586\u001b[0m \u001b[43m \u001b[49m\u001b[43mlevel\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mlevel\u001b[49m\u001b[43m,\u001b[49m\n\u001b[0;32m 5587\u001b[0m \u001b[43m \u001b[49m\u001b[43minplace\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43minplace\u001b[49m\u001b[43m,\u001b[49m\n\u001b[0;32m 5588\u001b[0m \u001b[43m \u001b[49m\u001b[43merrors\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43merrors\u001b[49m\u001b[43m,\u001b[49m\n\u001b[0;32m 5589\u001b[0m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\n", - "File \u001b[1;32mc:\\Users\\felix\\.conda\\envs\\districtgenerator\\Lib\\site-packages\\pandas-2.2.2-py3.11-win-amd64.egg\\pandas\\core\\generic.py:4788\u001b[0m, in \u001b[0;36mNDFrame.drop\u001b[1;34m(self, labels, axis, index, columns, level, inplace, errors)\u001b[0m\n\u001b[0;32m 4786\u001b[0m \u001b[38;5;28;01mfor\u001b[39;00m axis, labels \u001b[38;5;129;01min\u001b[39;00m axes\u001b[38;5;241m.\u001b[39mitems():\n\u001b[0;32m 4787\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m labels \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m:\n\u001b[1;32m-> 4788\u001b[0m obj \u001b[38;5;241m=\u001b[39m \u001b[43mobj\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_drop_axis\u001b[49m\u001b[43m(\u001b[49m\u001b[43mlabels\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43maxis\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mlevel\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mlevel\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43merrors\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43merrors\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 4790\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m inplace:\n\u001b[0;32m 4791\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_update_inplace(obj)\n", - "File \u001b[1;32mc:\\Users\\felix\\.conda\\envs\\districtgenerator\\Lib\\site-packages\\pandas-2.2.2-py3.11-win-amd64.egg\\pandas\\core\\generic.py:4830\u001b[0m, in \u001b[0;36mNDFrame._drop_axis\u001b[1;34m(self, labels, axis, level, errors, only_slice)\u001b[0m\n\u001b[0;32m 4828\u001b[0m new_axis \u001b[38;5;241m=\u001b[39m axis\u001b[38;5;241m.\u001b[39mdrop(labels, level\u001b[38;5;241m=\u001b[39mlevel, errors\u001b[38;5;241m=\u001b[39merrors)\n\u001b[0;32m 4829\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[1;32m-> 4830\u001b[0m new_axis \u001b[38;5;241m=\u001b[39m \u001b[43maxis\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mdrop\u001b[49m\u001b[43m(\u001b[49m\u001b[43mlabels\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43merrors\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43merrors\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 4831\u001b[0m indexer \u001b[38;5;241m=\u001b[39m axis\u001b[38;5;241m.\u001b[39mget_indexer(new_axis)\n\u001b[0;32m 4833\u001b[0m \u001b[38;5;66;03m# Case for non-unique axis\u001b[39;00m\n\u001b[0;32m 4834\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n", - "File \u001b[1;32mc:\\Users\\felix\\.conda\\envs\\districtgenerator\\Lib\\site-packages\\pandas-2.2.2-py3.11-win-amd64.egg\\pandas\\core\\indexes\\base.py:7070\u001b[0m, in \u001b[0;36mIndex.drop\u001b[1;34m(self, labels, errors)\u001b[0m\n\u001b[0;32m 7068\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m mask\u001b[38;5;241m.\u001b[39many():\n\u001b[0;32m 7069\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m errors \u001b[38;5;241m!=\u001b[39m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mignore\u001b[39m\u001b[38;5;124m\"\u001b[39m:\n\u001b[1;32m-> 7070\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m \u001b[38;5;167;01mKeyError\u001b[39;00m(\u001b[38;5;124mf\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;132;01m{\u001b[39;00mlabels[mask]\u001b[38;5;241m.\u001b[39mtolist()\u001b[38;5;132;01m}\u001b[39;00m\u001b[38;5;124m not found in axis\u001b[39m\u001b[38;5;124m\"\u001b[39m)\n\u001b[0;32m 7071\u001b[0m indexer \u001b[38;5;241m=\u001b[39m indexer[\u001b[38;5;241m~\u001b[39mmask]\n\u001b[0;32m 7072\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mdelete(indexer)\n", - "\u001b[1;31mKeyError\u001b[0m: \"['Unnamed: 11', 'Unnamed: 12'] not found in axis\"" - ] - } - ], - "source": [ - "import os \n", - "def process_dataframe(df):\n", - " # Assuming df is the loaded DataFrame from each CSV\n", - " weekday_data = df[df['DAY'] == 'WEEKDAY'].head(24)\n", - " saturday_data = df[df['DAY'] == 'SATURDAY'].head(24)\n", - " sunday_data = df[df['DAY'] == 'SUNDAY'].head(24)\n", - "\n", - " # Repeat the weekday data five times and append Saturday and Sunday data\n", - " repeated_weekdays = pd.concat([weekday_data] * 5, ignore_index=True)\n", - " final_df = pd.concat([repeated_weekdays, saturday_data, sunday_data], ignore_index=True)\n", - " \n", - " # Re-assigning 'DAY' values to ensure continuity in the data (optional)\n", - " final_df['DAY'] = final_df.index // 24 % 7\n", - " final_df['DAY'] = final_df['DAY'].map({i: i if i < 5 else 5 if i == 5 else 6 for i in range(7)})\n", - " final_df = final_df.drop(columns=['Unnamed: 11', 'Unnamed: 12'])\n", - " \n", - " return final_df\n", - "\n", - "# List all files in the directory\n", - "dir_path = r'C:\\Users\\felix\\Programmieren\\CityEnergyAnalyst\\cea\\databases\\DE\\archetypes\\use_types'\n", - "files = os.listdir(dir_path)\n", - "save_folder= r'C:\\Users\\felix\\Programmieren\\tecdm\\src\\districtgenerator\\data\\occupancy_schedules'\n", - "\n", - "# Process each file\n", - "for file in files:\n", - " if file.endswith('.csv'): # Check if the file is a CSV\n", - " file_path = os.path.join(dir_path, file)\n", - " print(f\"Processing file: {file_path}\")\n", - " \n", - " # Load the DataFrame from CSV\n", - " df = pd.read_csv(file_path, skiprows=2)\n", - " \n", - " # Process the DataFrame\n", - " processed_df = process_dataframe(df)\n", - " print(df.head())\n", - " \n", - " # Save the processed DataFrame\n", - " save_path = os.path.join(save_folder, f\"{file}\")\n", - " processed_df.to_csv(save_path, index=False)\n", - " \n", - " \"\"\" \n", - " try: \n", - " processed_df.to_csv(save_path, index=False)\n", - " print(f\"Saved processed file to: {save_path}\")\n", - " except OSError:\n", - " print(f\"Could not save {file} in {file_path}\")\n", - " \"\"\"" - ] - } - ], - "metadata": { - "kernelspec": { - "display_name": "base", - "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.9" - } - }, - "nbformat": 4, - "nbformat_minor": 2 -}