From 803bdf922a47ceca525fc367be0bcebc2fb67e85 Mon Sep 17 00:00:00 2001 From: Silvana Ovaitt Date: Fri, 26 Apr 2024 06:34:47 -0600 Subject: [PATCH] Frames test journal --- .../Frames_redevelopment_test.ipynb | 367 ++++++++++++++++++ 1 file changed, 367 insertions(+) create mode 100644 docs/development/Frames_redevelopment_test.ipynb diff --git a/docs/development/Frames_redevelopment_test.ipynb b/docs/development/Frames_redevelopment_test.ipynb new file mode 100644 index 00000000..eaa0c902 --- /dev/null +++ b/docs/development/Frames_redevelopment_test.ipynb @@ -0,0 +1,367 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": 1, + "id": "45812529", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Your simulation will be stored in C:\\Users\\sayala\\Documents\\GitHub\\bifacial_radiance\\bifacial_radiance\\TEMP\\August\n" + ] + } + ], + "source": [ + "import os\n", + "from pathlib import Path\n", + "import pandas as pd\n", + "\n", + "testfolder = Path().resolve().parent.parent / 'bifacial_radiance' / 'TEMP' / 'August'\n", + "\n", + "# Another option using relative address; for some operative systems you might need '/' instead of '\\'\n", + "# testfolder = os.path.abspath(r'..\\..\\bifacial_radiance\\TEMP') \n", + "\n", + "print (\"Your simulation will be stored in %s\" % testfolder)\n", + "\n", + "if not os.path.exists(testfolder):\n", + " os.makedirs(testfolder)" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "id": "bbb29c6f", + "metadata": {}, + "outputs": [], + "source": [ + "import bifacial_radiance" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "id": "18636405", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "path = C:\\Users\\sayala\\Documents\\GitHub\\bifacial_radiance\\bifacial_radiance\\TEMP\\August\n" + ] + } + ], + "source": [ + "demo = bifacial_radiance.RadianceObj('frames',str(testfolder)) " + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "id": "481d4709", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Loading albedo, 1 value(s), 0.200 avg\n", + "1 nonzero albedo values.\n" + ] + } + ], + "source": [ + "demo.setGround(0.2) # This prints available materials." + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "id": "3f60fa6a", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Getting weather file: USA_VA_Richmond.724010_TMY2.epw\n", + " ... OK!\n", + "COLUMN DATAS Index(['year', 'month', 'day', 'hour', 'minute', 'data_source_unct', 'DryBulb',\n", + " 'temp_dew', 'relative_humidity', 'atmospheric_pressure', 'etr', 'etrn',\n", + " 'ghi_infrared', 'GHI', 'DNI', 'DHI', 'global_hor_illum',\n", + " 'direct_normal_illum', 'diffuse_horizontal_illum', 'zenith_luminance',\n", + " 'wind_direction', 'Wspd', 'total_sky_cover', 'opaque_sky_cover',\n", + " 'visibility', 'ceiling_height', 'present_weather_observation',\n", + " 'present_weather_codes', 'precipitable_water', 'aerosol_optical_depth',\n", + " 'snow_depth', 'days_since_last_snowfall', 'Alb',\n", + " 'liquid_precipitation_depth', 'liquid_precipitation_quantity'],\n", + " dtype='object')\n", + " year month day hour minute \\\n", + "1965-01-01 01:00:00-05:00 1965 1 1 1 60 \n", + "1965-01-01 02:00:00-05:00 1965 1 1 2 60 \n", + "1965-01-01 03:00:00-05:00 1965 1 1 3 60 \n", + "1965-01-01 04:00:00-05:00 1965 1 1 4 60 \n", + "1965-01-01 05:00:00-05:00 1965 1 1 5 60 \n", + "... ... ... ... ... ... \n", + "1970-12-31 20:00:00-05:00 1970 12 31 20 60 \n", + "1970-12-31 21:00:00-05:00 1970 12 31 21 60 \n", + "1970-12-31 22:00:00-05:00 1970 12 31 22 60 \n", + "1970-12-31 23:00:00-05:00 1970 12 31 23 60 \n", + "1971-01-01 00:00:00-05:00 1970 12 31 24 60 \n", + "\n", + " data_source_unct \\\n", + "1965-01-01 01:00:00-05:00 A7A7A7A7*0?0?0?0?0?0?0?0A7A7A7A7A7A7E7F8A7E7 \n", + "1965-01-01 02:00:00-05:00 B8E7B8B8*0?0?0?0?0?0?0?0B8B8B8B8*0*0E7F8A7E7 \n", + "1965-01-01 03:00:00-05:00 B8E7B8B8*0?0?0?0?0?0?0?0B8B8B8B8*0*0E7F8A7E7 \n", + "1965-01-01 04:00:00-05:00 A7A7A7A7*0?0?0?0?0?0?0?0B8A7A7A7A7A7E7F8A7E7 \n", + "1965-01-01 05:00:00-05:00 B8E7B8B8*0?0?0?0?0?0?0?0B8B8B8B8*0*0E7F8A7E7 \n", + "... ... \n", + "1970-12-31 20:00:00-05:00 B8E7B8B8*0?0?0?0?0?0?0?0B8B8B8B8*0*0E7F8A7E7 \n", + "1970-12-31 21:00:00-05:00 B8E7B8B8*0?0?0?0?0?0?0?0B8B8B8B8*0*0E7F8A7E7 \n", + "1970-12-31 22:00:00-05:00 A7A7A7A7*0?0?0?0?0?0?0?0A7A7A7A7A7A7E7F8A7E7 \n", + "1970-12-31 23:00:00-05:00 B8E7B8B8*0?0?0?0?0?0?0?0B8B8B8B8*0*0E7F8A7E7 \n", + "1971-01-01 00:00:00-05:00 B8E7B8B8*0?0?0?0?0?0?0?0B8B8B8B8*0*0E7F8A7E7 \n", + "\n", + " DryBulb temp_dew relative_humidity \\\n", + "1965-01-01 01:00:00-05:00 -1.1 -5.6 72 \n", + "1965-01-01 02:00:00-05:00 -1.3 -5.2 72 \n", + "1965-01-01 03:00:00-05:00 -1.5 -5.4 72 \n", + "1965-01-01 04:00:00-05:00 -1.7 -6.1 72 \n", + "1965-01-01 05:00:00-05:00 -1.3 -5.2 72 \n", + "... ... ... ... \n", + "1970-12-31 20:00:00-05:00 -0.7 -1.7 92 \n", + "1970-12-31 21:00:00-05:00 -0.4 -1.4 92 \n", + "1970-12-31 22:00:00-05:00 0.0 -1.1 92 \n", + "1970-12-31 23:00:00-05:00 -0.6 -1.5 93 \n", + "1971-01-01 00:00:00-05:00 -1.1 -1.7 95 \n", + "\n", + " atmospheric_pressure ... ceiling_height \\\n", + "1965-01-01 01:00:00-05:00 102600 ... 77777 \n", + "1965-01-01 02:00:00-05:00 102600 ... 77777 \n", + "1965-01-01 03:00:00-05:00 102600 ... 77777 \n", + "1965-01-01 04:00:00-05:00 102700 ... 77777 \n", + "1965-01-01 05:00:00-05:00 102700 ... 77777 \n", + "... ... ... ... \n", + "1970-12-31 20:00:00-05:00 99500 ... 152 \n", + "1970-12-31 21:00:00-05:00 99300 ... 152 \n", + "1970-12-31 22:00:00-05:00 99000 ... 152 \n", + "1970-12-31 23:00:00-05:00 99000 ... 152 \n", + "1971-01-01 00:00:00-05:00 98900 ... 152 \n", + "\n", + " present_weather_observation present_weather_codes \\\n", + "1965-01-01 01:00:00-05:00 0 999999999 \n", + "1965-01-01 02:00:00-05:00 0 999999999 \n", + "1965-01-01 03:00:00-05:00 0 999999999 \n", + "1965-01-01 04:00:00-05:00 0 999999999 \n", + "1965-01-01 05:00:00-05:00 0 999999999 \n", + "... ... ... \n", + "1970-12-31 20:00:00-05:00 0 999999999 \n", + "1970-12-31 21:00:00-05:00 0 999999999 \n", + "1970-12-31 22:00:00-05:00 0 969999099 \n", + "1970-12-31 23:00:00-05:00 0 999999999 \n", + "1971-01-01 00:00:00-05:00 0 999999999 \n", + "\n", + " precipitable_water aerosol_optical_depth \\\n", + "1965-01-01 01:00:00-05:00 8 0.056 \n", + "1965-01-01 02:00:00-05:00 8 0.056 \n", + "1965-01-01 03:00:00-05:00 8 0.056 \n", + "1965-01-01 04:00:00-05:00 8 0.056 \n", + "1965-01-01 05:00:00-05:00 8 0.056 \n", + "... ... ... \n", + "1970-12-31 20:00:00-05:00 10 0.056 \n", + "1970-12-31 21:00:00-05:00 10 0.056 \n", + "1970-12-31 22:00:00-05:00 10 0.056 \n", + "1970-12-31 23:00:00-05:00 10 0.056 \n", + "1971-01-01 00:00:00-05:00 10 0.056 \n", + "\n", + " snow_depth days_since_last_snowfall Alb \\\n", + "1965-01-01 01:00:00-05:00 0 0 0.0 \n", + "1965-01-01 02:00:00-05:00 0 0 0.0 \n", + "1965-01-01 03:00:00-05:00 0 0 0.0 \n", + "1965-01-01 04:00:00-05:00 0 0 0.0 \n", + "1965-01-01 05:00:00-05:00 0 0 0.0 \n", + "... ... ... ... \n", + "1970-12-31 20:00:00-05:00 0 0 0.0 \n", + "1970-12-31 21:00:00-05:00 0 0 0.0 \n", + "1970-12-31 22:00:00-05:00 0 0 0.0 \n", + "1970-12-31 23:00:00-05:00 0 0 0.0 \n", + "1971-01-01 00:00:00-05:00 0 0 0.0 \n", + "\n", + " liquid_precipitation_depth \\\n", + "1965-01-01 01:00:00-05:00 0.0 \n", + "1965-01-01 02:00:00-05:00 0.0 \n", + "1965-01-01 03:00:00-05:00 0.0 \n", + "1965-01-01 04:00:00-05:00 0.0 \n", + "1965-01-01 05:00:00-05:00 0.0 \n", + "... ... \n", + "1970-12-31 20:00:00-05:00 0.0 \n", + "1970-12-31 21:00:00-05:00 0.0 \n", + "1970-12-31 22:00:00-05:00 0.0 \n", + "1970-12-31 23:00:00-05:00 0.0 \n", + "1971-01-01 00:00:00-05:00 0.0 \n", + "\n", + " liquid_precipitation_quantity \n", + "1965-01-01 01:00:00-05:00 0.0 \n", + "1965-01-01 02:00:00-05:00 0.0 \n", + "1965-01-01 03:00:00-05:00 0.0 \n", + "1965-01-01 04:00:00-05:00 0.0 \n", + "1965-01-01 05:00:00-05:00 0.0 \n", + "... ... \n", + "1970-12-31 20:00:00-05:00 0.0 \n", + "1970-12-31 21:00:00-05:00 0.0 \n", + "1970-12-31 22:00:00-05:00 0.0 \n", + "1970-12-31 23:00:00-05:00 0.0 \n", + "1971-01-01 00:00:00-05:00 0.0 \n", + "\n", + "[8760 rows x 35 columns]\n", + "8760 line in WeatherFile. Assuming this is a standard hourly WeatherFile for the year for purposes of saving Gencumulativesky temporary weather files in EPW folder.\n", + "Coercing year to 2001\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Saving file EPWs\\metdata_temp.csv, # points: 8760\n", + "Calculating Sun position for Metdata that is right-labeled with a delta of -30 mins. i.e. 12 is 11:30 sunpos\n" + ] + }, + { + "data": { + "text/plain": [ + "'skies\\\\sky2_37.5_-77.33_2001-06-17_1400.rad'" + ] + }, + "execution_count": 5, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "epwfile = demo.getEPW(lat = 37.5, lon = -77.6) # This location corresponds to Richmond, VA.\n", + "metdata = demo.readWeatherFile(epwfile, coerce_year=2001) \n", + "timeindex = metdata.datetime.index(pd.to_datetime('2001-06-17 12:0:0 -7'))\n", + "demo.gendaylit(timeindex) # Noon, June 17th (timepoint # 4020)" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "id": "377b36b1", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "\n", + "Module Name: framemodule\n", + "Module framemodule updated in module.json\n", + "Pre-existing .rad file objects\\framemodule.rad will be overwritten\n", + "\n" + ] + } + ], + "source": [ + "frameParams = {'frame_material' : 'Metal_Grey', \n", + " 'frame_thickness' : 0.05,\n", + " 'nSides_frame' : 4,\n", + " 'frame_width' : 0.08,\n", + " 'frame_z': 0.03}\n", + "\n", + "module_type = 'PVmodule' \n", + "#module = demo.makeModule(name=module_type,x=2, y=1, frameParams=frameParams) # Offset of frame is off, so lets manually add it\n", + "module = demo.makeModule(name=module_type,x=2, y=1) #, frameParams=frameParams)\n" + ] + }, + { + "cell_type": "code", + "execution_count": 12, + "id": "dae38811", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "\n", + "Module Name: framemodule\n", + "Module framemodule updated in module.json\n", + "Pre-existing .rad file objects\\framemodule.rad will be overwritten\n", + "\n" + ] + } + ], + "source": [ + "customtext = '! genbox {} {} {} {} {} | xform -t {} {} {}'.format('Metal_Grey', 'frame', 2, 0.02, 0.05, -1, -0.5, -0.05) # ADD HERE YOUR FRAME GEOMETRY FOR 1 Singlem module\n", + "module = demo.makeModule(name=module_type,x=2, y=1, numpanels=1, customtext=customtext) #, frameParams=frameParams)\n" + ] + }, + { + "cell_type": "code", + "execution_count": 13, + "id": "a7073bac", + "metadata": {}, + "outputs": [], + "source": [ + "demo.module.showModule()" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "bda03de7", + "metadata": {}, + "outputs": [], + "source": [ + "sceneDict = {'tilt':90,'pitch':0.00001,'clearance_height':0.2,'azimuth':180, 'nMods': 1, 'nRows': 1} \n", + "\n", + "scene = demo.makeScene(module,sceneDict)\n", + "\n", + "octfile = demo.makeOct(demo.getfilelist()) \n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "b2ca2ed7", + "metadata": {}, + "outputs": [], + "source": [ + "!rvu -vf views\\front.vp -e .01 frames.oct" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "59cc3eb1", + "metadata": {}, + "outputs": [], + "source": [] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.11.4" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +}