{ "cells": [ { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Working on a Windows 10\n", "Python version 3.9.12 (main, Apr 4 2022, 05:22:27) [MSC v.1916 64 bit (AMD64)]\n", "Pandas version 1.4.2\n", "bifacial_radiance version 0.4.4.dev26+ge667a7c\n" ] } ], "source": [ "# This information helps with debugging and getting support :)\n", "import sys, platform\n", "import pandas as pd\n", "import bifacial_radiance as br\n", "print(\"Working on a \", platform.system(), platform.release())\n", "print(\"Python version \", sys.version)\n", "print(\"Pandas version \", pd.__version__)\n", "print(\"bifacial_radiance version \", br.__version__)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# 3 - Single Axis Tracking Hourly\n", "\n", "Example demonstrating the use of doing hourly smiulations with Radiance gendaylit for 1-axis tracking. This is a medium level example because it also explores a couple subtopics:\n", "\n", "***Subtopics:***\n", "* The structure of the tracker dictionary \"trackerDict\".\n", "* How to calculate GCR \n", "* How to make a cell-level module\n", "* Various methods to use the trackerdictionary for analysis.\n", " \n", "***Doing full year simulations with gendaylit:***\n", "\n", "Performing the simulation hour by hour requires either a good computer or some patience, since there are ~4000 daylight-hours in the year. With a 32GB RAM, Windows 10 i7-8700 CPU @ 3.2GHz with 6 cores this takes 1 day. The code also allows for multiple cores or HPC use -- there is documentation/examples inside the software at the moment, but that is an advanced topic. The procedure can be broken into shorter steps for one day or a single timestamp simulation which is exemplified below.\n", "\n", "***Steps:***\n", "1. Load bifacial_radiance \n", "2. Define all your system variables \n", "3. Create Radiance Object, Set Albedo and Weather \n", "4. Make Module: Cell Level Module Example \n", "5. Calculate GCR\n", "6. Set Tracking Angles \n", "7. Generate the Sky \n", "8. Make Scene 1axis \n", "9. Make Oct and AnalyzE 1 HOUR \n", "10. Make Oct and Analye Range of Hours \n", "11. Make Oct and Analyze All Tracking Dictionary \n", "\n", "And finally: Condensed Version: All Tracking Dictionary " ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "\n", "## 1. Load bifacial_radiance \n", "\n", "Pay attention: different importing method:\n", "\n", "So far we've used \"from bifacial_radiance import *\" to import all the bifacial_radiance files into our working space in jupyter. For this journal we will do a \"import bifacial_radiance\" . This method of importing requires a different call for some functions as you'll see below. For example, instead of calling demo = RadianceObj(path = testfolder) as on Tutorial 2, in this case we will neeed to do demo = bifacial_radiance.RadianceObj(path = testfolder). " ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [], "source": [ "import bifacial_radiance\n", "import numpy as np\n", "import os # this operative system to do teh relative-path testfolder for this example.\n", "import pprint # We will be pretty-printing the trackerdictionary throughout to show its structure.\n", "from pathlib import Path" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## 2. Define all your system variables\n", "\n", "Just like in the condensed version show at the end of Tutorial 2, for this tutorial we will be starting all of our system variables from the beginning of the jupyter journal, instead than throughout the different cells (for the most part)" ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [], "source": [ "testfolder = Path().resolve().parent.parent / 'bifacial_radiance' / 'TEMP' / 'Tutorial_03'\n", "if not os.path.exists(testfolder):\n", " os.makedirs(testfolder)\n", " \n", " \n", "simulationName = 'tutorial_03' # For adding a simulation name when defning RadianceObj. This is optional.\n", "moduletype = 'test-module' # We will define the parameters for this below in Step 4.\n", "albedo = \"litesoil\" # this is one of the options on ground.rad\n", "lat = 37.5 \n", "lon = -77.6\n", "\n", "# Scene variables\n", "nMods = 20\n", "nRows = 7\n", "hub_height = 2.3 # meters\n", "pitch = 10 # meters # We will be using pitch instead of GCR for this example.\n", "\n", "# Traking parameters\n", "cumulativesky = False\n", "limit_angle = 45 # tracker rotation limit angle\n", "angledelta = 0.01 # we will be doing hourly simulation, we want the angle to be as close to real tracking as possible.\n", "backtrack = True \n", "\n", "#makeModule parameters\n", "# x and y will be defined later on Step 4 for this tutorial!!\n", "xgap = 0.01\n", "ygap = 0.10\n", "zgap = 0.05\n", "numpanels = 2\n", "axisofrotation = True # the scene will rotate around the torque tube, and not the middle of the bottom surface of the module\n", "diameter = 0.1\n", "tubetype = 'Oct' # This will make an octagonal torque tube.\n", "material = 'black' # Torque tube of this material (0% reflectivity)\n", "\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## 3. Create Radiance Object, Set Albedo and Weather\n", "\n", "Same steps as previous two tutorials, so condensing it into one step. You hopefully have this down by now! :)\n", "\n", "\n", "
\n", "Notice that we are doing bifacial_radiance.RadianceObj because we change the import method for this example!\n", "
\n", "\n", "We now constrain the days of our analysis in the readWeatherFile import step. For this example we are doing just two days in January. Format has to be a 'MM_DD' or 'YYYY-MM-DD_HHMM'" ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "path = C:\\Users\\cdeline\\Documents\\Python Scripts\\Bifacial_Radiance\\bifacial_radiance\\TEMP\\Tutorial_03\n", "Loading albedo, 1 value(s), 0.213 avg\n", "1 nonzero albedo values.\n", "Getting weather file: USA_VA_Richmond.724010_TMY2.epw\n", " ... OK!\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 2021\n", "Filtering dates\n", "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" ] } ], "source": [ "demo = bifacial_radiance.RadianceObj(simulationName, path = str(testfolder)) # Adding a simulation name. This is optional.\n", "demo.setGround(albedo) \n", "epwfile = demo.getEPW(lat=lat, lon=lon) \n", "\n", "starttime = '01_13'; endtime = '01_14'\n", "metdata = demo.readWeatherFile(weatherFile=epwfile, starttime=starttime, endtime=endtime) \n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## 4. Make Module: Cell Level Module Example\n", "\n", "Instead of doing a opaque, flat single-surface module, in this tutorial we will create a module made up by cells. We can define variuos parameters to make a cell-level module, such as cell size and spacing between cells. To do this, we will pass a dicitonary with the needed parameters to makeModule, as shown below. \n", "\n", "NOTE: in v0.4.0 some keywords and methods for doing a CellModule and Torquetube simulation were changed.\n", "\n", "
\n", "Since we are making a cell-level module, the dimensions for x and y of the module will be calculated by the software -- dummy values can be initially passed just to get started, but these values are overwritten by addCellModule()\n", "
" ] }, { "cell_type": "code", "execution_count": 5, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\n", "Module Name: test-module\n", "Module test-module updated in module.json\n", "Pre-existing .rad file objects\\test-module.rad will be overwritten\n", "\n", "Module test-module updated in module.json\n", "Pre-existing .rad file objects\\test-module.rad will be overwritten\n", "\n", "Module was shifted by 0.078 in X to avoid sensors on air\n", "This is a Cell-Level detailed module with Packaging Factor of 0.81 \n", "Module test-module updated in module.json\n", "Pre-existing .rad file objects\\test-module.rad will be overwritten\n", "\n", "New module created. x=1.036m, y=2.092m\n", "Cell-module parameters: {'numcellsx': 6, 'numcellsy': 12, 'xcell': 0.156, 'ycell': 0.156, 'xcellgap': 0.02, 'ycellgap': 0.02, 'centerJB': None}\n" ] } ], "source": [ "numcellsx = 6\n", "numcellsy = 12\n", "xcell = 0.156\n", "ycell = 0.156\n", "xcellgap = 0.02\n", "ycellgap = 0.02\n", "\n", "\n", "mymodule = demo.makeModule(name=moduletype, x=1, y=1, xgap=xgap, ygap=ygap, \n", " zgap=zgap, numpanels=numpanels) \n", "mymodule.addTorquetube(diameter=diameter, material=material,\n", " axisofrotation=axisofrotation, tubetype=tubetype)\n", "mymodule.addCellModule(numcellsx=numcellsx, numcellsy=numcellsy,\n", " xcell=xcell, ycell=ycell, xcellgap=xcellgap, ycellgap=ycellgap)\n", "\n", "print(f'New module created. x={mymodule.x}m, y={mymodule.y}m')\n", "print(f'Cell-module parameters: {mymodule.cellModule}')" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## 5. Calculate GCR\n", "\n", "In this example we passed the parameter \"pitch\". Pitch is the spacing between rows (for example, between hub-posts) in a field.\n", "To calculate Ground Coverage Ratio (GCR), we must relate the pitch to the collector-width by:\n", " \n", "![GCR = CW / pitch](../images_wiki/Journal3Pics/Equation_GCR.PNG)\n", "\n", "The collector width for our system must consider the number of panels and the y-gap:\n", " \n", "![CW](../images_wiki/Journal3Pics/Equation_CW.PNG)\n", " \n", "Collector Width gets saved in your module parameters (and later on your scene and trackerdict) as \"sceney\". You can calculate your collector width with the equation, or you can use this method to know your GCR:" ] }, { "cell_type": "code", "execution_count": 6, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "The GCR is : 0.4284\n", "\n", "ModuleObj data keys: ['x', 'y', 'z', 'modulematerial', 'scenex', 'sceney', 'scenez', 'numpanels', 'bifi', 'text', 'modulefile', 'glass', 'glassEdge', 'offsetfromaxis', 'xgap', 'ygap', 'zgap']\n" ] } ], "source": [ "# For more options on makemodule, see the help description of the function. \n", "# Details about the module are stored in the new ModuleObj \n", "CW = mymodule.sceney\n", "gcr = CW / pitch\n", "print (\"The GCR is :\", gcr)\n", "print(f\"\\nModuleObj data keys: {mymodule.keys}\")" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## 6. Set Tracking Angles\n", "\n", "This function will read the weather file, and based on the sun position it will calculate the angle the tracker should be at for each hour. It will create metdata files for each of the tracker angles considered.\n", "\n", "For doing hourly simulations, remember to set **cumulativesky = False** here!" ] }, { "cell_type": "code", "execution_count": 7, "metadata": {}, "outputs": [], "source": [ "trackerdict = demo.set1axis(metdata=metdata, limit_angle=limit_angle, backtrack=backtrack, \n", " gcr=gcr, cumulativesky=False)" ] }, { "cell_type": "code", "execution_count": 8, "metadata": { "scrolled": true }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Trackerdict created by set1axis: 20 \n" ] } ], "source": [ "print (\"Trackerdict created by set1axis: %s \" % (len(demo.trackerdict))) " ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "set1axis initializes the trackerdictionary Trackerdict. Trackerdict contains all hours selected from the weatherfile as keys. For example: trackerdict['2021-01-13_1200']. It is a return variable on many of the 1axis functions, but it is also stored inside of your Radiance Obj (i.e. demo.trackerdict). In this journal we are storing it as a variable to mute the option (otherwise it prints the returned trackerdict contents every time)\n" ] }, { "cell_type": "code", "execution_count": 9, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "{'dhi': np.int64(200),\n", " 'dni': np.int64(97),\n", " 'ghi': np.int64(249),\n", " 'surf_azm': 90.0,\n", " 'surf_tilt': 21.2,\n", " 'temp_air': np.float64(6.5),\n", " 'theta': -21.2,\n", " 'wind_speed': np.float64(3.9)}\n" ] } ], "source": [ "pprint.pprint(trackerdict['2021-01-13_1200'])\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "All of the following functions add up elements to trackerdictionary to keep track (ba-dum tupzz) of the Scene and simulation parameters. In advanced journals we will explore the inner structure of trackerdict. For now, just now it exists :)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## 7. Generate the Sky\n", "\n", "\n", "We will create skies for each hour we want to model with the function gendaylit1axis. \n", "\n", "For this example we are doing just two days in January. The ability to limit the time using gendaylit1axis is deprecated. Use readWeatherFile instead." ] }, { "cell_type": "code", "execution_count": 10, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Creating ~20 skyfiles. \n", "Created 20 skyfiles in /skies/\n" ] } ], "source": [ "trackerdict = demo.gendaylit1axis() " ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Since we passed startdate and enddate to gendaylit, it will prune our trackerdict to only the desired days.\n", "Let's explore our trackerdict:" ] }, { "cell_type": "code", "execution_count": 11, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Trackerdict option of hours are: ['2021-01-13_0800', '2021-01-13_0900', '2021-01-13_1000', '2021-01-13_1100', '2021-01-13_1200', '2021-01-13_1300', '2021-01-13_1400', '2021-01-13_1500', '2021-01-13_1600', '2021-01-13_1700', '2021-01-14_0800', '2021-01-14_0900', '2021-01-14_1000', '2021-01-14_1100', '2021-01-14_1200', '2021-01-14_1300', '2021-01-14_1400', '2021-01-14_1500', '2021-01-14_1600', '2021-01-14_1700']\n", "\n", "Contents of trackerdict for sample hour:\n", "{'dhi': np.int64(22),\n", " 'dni': np.int64(13),\n", " 'ghi': np.int64(23),\n", " 'skyfile': 'skies\\\\sky2_37.5_-77.33_2021-01-13_0800.rad',\n", " 'surf_azm': 90.0,\n", " 'surf_tilt': 3.74,\n", " 'temp_air': np.float64(0.2),\n", " 'theta': -3.74,\n", " 'wind_speed': np.float64(2.6)}\n" ] } ], "source": [ "trackerkeys = sorted(trackerdict.keys())\n", "print (\"Trackerdict option of hours are: \", trackerkeys)\n", "print (\"\")\n", "print (\"Contents of trackerdict for sample hour:\")\n", "pprint.pprint(trackerdict[trackerkeys[0]])" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## 8. Make Scene 1axis\n", "\n", "We can use gcr or pitch fo our scene dictionary." ] }, { "cell_type": "code", "execution_count": 12, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\n", "Making ~20 .rad files for gendaylit 1-axis workflow (this takes a minute..)\n", "20 Radfiles created in /objects/\n" ] } ], "source": [ "sceneDict = {'pitch': pitch,'hub_height':hub_height, 'nMods':nMods, 'nRows': nRows} \n", "\n", "# making the different scenes for the 1-axis tracking for the dates in trackerdict2.\n", "trackerdict = demo.makeScene1axis(trackerdict=trackerdict, module=mymodule, sceneDict=sceneDict) " ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "The scene parameteres are now stored in the trackerdict. To view them and to access them:\n", " " ] }, { "cell_type": "code", "execution_count": 13, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "{'dhi': np.int64(22),\n", " 'dni': np.int64(13),\n", " 'ghi': np.int64(23),\n", " 'scenes': [ : {'gcr': np.float64(0.4284), 'hpc': False, 'module': : {'x': np.float64(1.036), 'y': np.float64(2.092), 'z': 0.02, 'modulematerial': 'black', 'scenex': np.float64(1.046), 'sceney': np.float64(4.284), 'scenez': np.float64(0.1), 'numpanels': 2, 'bifi': 1, 'text': '! genbox black cellPVmodule 0.156 0.156 0.02 | xform -t -0.44 -2.142 0.1 -a 6 -t 0.176 0 0 -a 12 -t 0 0.176 0 -a 2 -t 0 2.192 0\\r\\n! genbox black octtube1a 1.046 0.04142135623730951 0.1 | xform -t -0.523 -0.020711 -0.05\\r\\n! genbox black octtube1b 1.046 0.04142135623730951 0.1 | xform -t -0.445 -0.020711 -0.05 -rx 45 -t 0 0 0\\r\\n! genbox black octtube1c 1.046 0.04142135623730951 0.1 | xform -t -0.445 -0.020710678118654756 -0.05 -rx 90 -t 0 0 0\\r\\n! genbox black octtube1d 1.046 0.04142135623730951 0.1 | xform -t -0.445 -0.020710678118654756 -0.05 -rx 135 -t 0 0 0 ', 'modulefile': 'objects\\\\test-module.rad', 'glass': False, 'glassEdge': 0.01, 'offsetfromaxis': np.float64(0.1), 'xgap': 0.01, 'ygap': 0.1, 'zgap': 0.05}, 'modulefile': 'objects\\\\test-module.rad', 'name': 'Scene0', 'radfiles': 'objects\\\\1axis2021-01-13_0800__C_2.17_rtr_10.00_tilt_4_20modsx7rows_origin0,0.rad', 'sceneDict': {'pitch': 10, 'nMods': 20, 'nRows': 7, 'tilt': 3.74, 'clearance_height': np.float64(2.166802445305938), 'azimuth': 90.0, 'modulez': 0.02, 'axis_tilt': 0, 'originx': 0, 'originy': 0, 'hub_height': np.float64(2.3)}, 'text': '!xform -rx 3.74 -t 0 0 2.3 -a 20 -t 1.046 0 0 -a 7 -t 0 10 0 -i 1 -t -9.414 -30.0 0 -rz 90.0 -t 0 0 0 \"objects\\\\test-module.rad\"'}],\n", " 'skyfile': 'skies\\\\sky2_37.5_-77.33_2021-01-13_0800.rad',\n", " 'surf_azm': 90.0,\n", " 'surf_tilt': 3.74,\n", " 'temp_air': np.float64(0.2),\n", " 'theta': -3.74,\n", " 'wind_speed': np.float64(2.6)}\n" ] } ], "source": [ "pprint.pprint(trackerdict[trackerkeys[0]])" ] }, { "cell_type": "code", "execution_count": 15, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "{'gcr': np.float64(0.4284),\n", " 'hpc': False,\n", " 'module': : {'x': np.float64(1.036), 'y': np.float64(2.092), 'z': 0.02, 'modulematerial': 'black', 'scenex': np.float64(1.046), 'sceney': np.float64(4.284), 'scenez': np.float64(0.1), 'numpanels': 2, 'bifi': 1, 'text': '! genbox black cellPVmodule 0.156 0.156 0.02 | xform -t -0.44 -2.142 0.1 -a 6 -t 0.176 0 0 -a 12 -t 0 0.176 0 -a 2 -t 0 2.192 0\\r\\n! genbox black octtube1a 1.046 0.04142135623730951 0.1 | xform -t -0.523 -0.020711 -0.05\\r\\n! genbox black octtube1b 1.046 0.04142135623730951 0.1 | xform -t -0.445 -0.020711 -0.05 -rx 45 -t 0 0 0\\r\\n! genbox black octtube1c 1.046 0.04142135623730951 0.1 | xform -t -0.445 -0.020710678118654756 -0.05 -rx 90 -t 0 0 0\\r\\n! genbox black octtube1d 1.046 0.04142135623730951 0.1 | xform -t -0.445 -0.020710678118654756 -0.05 -rx 135 -t 0 0 0 ', 'modulefile': 'objects\\\\test-module.rad', 'glass': False, 'glassEdge': 0.01, 'offsetfromaxis': np.float64(0.1), 'xgap': 0.01, 'ygap': 0.1, 'zgap': 0.05},\n", " 'modulefile': 'objects\\\\test-module.rad',\n", " 'name': 'Scene0',\n", " 'radfiles': 'objects\\\\1axis2021-01-13_1300__C_2.11_rtr_10.00_tilt_-5_20modsx7rows_origin0,0.rad',\n", " 'sceneDict': {'axis_tilt': 0,\n", " 'azimuth': 90.0,\n", " 'clearance_height': np.float64(2.111024390776987),\n", " 'hub_height': np.float64(2.3),\n", " 'modulez': 0.02,\n", " 'nMods': 20,\n", " 'nRows': 7,\n", " 'originx': 0,\n", " 'originy': 0,\n", " 'pitch': 10,\n", " 'tilt': -5.31},\n", " 'text': '!xform -rx -5.31 -t 0 0 2.3 -a 20 -t 1.046 0 0 -a 7 -t 0 10 0 -i 1 '\n", " '-t -9.414 -30.0 0 -rz 90.0 -t 0 0 0 \"objects\\\\test-module.rad\"'}\n" ] } ], "source": [ "pprint.pprint(demo.trackerdict[trackerkeys[5]]['scene'][0].__dict__)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## 9. Make Oct and Analyze \n", "\n", "### A. Make Oct and Analyze 1Hour\n", "\n", "There are various options now to analyze the trackerdict hours we have defined. We will start by doing just one hour, because it's the fastest. Make sure to select an hour that exists in your trackerdict!\n", "\n", "Options of hours:" ] }, { "cell_type": "code", "execution_count": 16, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "['2021-01-13_0800',\n", " '2021-01-13_0900',\n", " '2021-01-13_1000',\n", " '2021-01-13_1100',\n", " '2021-01-13_1200',\n", " '2021-01-13_1300',\n", " '2021-01-13_1400',\n", " '2021-01-13_1500',\n", " '2021-01-13_1600',\n", " '2021-01-13_1700',\n", " '2021-01-14_0800',\n", " '2021-01-14_0900',\n", " '2021-01-14_1000',\n", " '2021-01-14_1100',\n", " '2021-01-14_1200',\n", " '2021-01-14_1300',\n", " '2021-01-14_1400',\n", " '2021-01-14_1500',\n", " '2021-01-14_1600',\n", " '2021-01-14_1700']\n" ] } ], "source": [ "pprint.pprint(trackerkeys)" ] }, { "cell_type": "code", "execution_count": 16, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\n", "Making 1 octfiles in root directory.\n", "Created 1axis_2021-01-13_0800.oct\n", "Linescan in process: 1axis_2021-01-13_0800_Scene0_Row4_Module10_Front\n", "Linescan in process: 1axis_2021-01-13_0800_Scene0_Row4_Module10_Back\n", "Saved: results\\irr_1axis_2021-01-13_0800_Scene0_Row4_Module10.csv\n", "Index: 2021-01-13_0800. Wm2Front: 23.62973037037037. Wm2Back: 2.8466184074074072\n", "\n", "\n", "Hourly bifi gain: 0.125\n" ] } ], "source": [ "demo.makeOct1axis(singleindex='2021-01-13_0800')\n", "results = demo.analysis1axis(singleindex='2021-01-13_0800')\n", "print('\\n\\nHourly bifi gain: {:0.3}'.format(sum(sum(demo.results.Wm2Back)) / sum(sum(demo.results.Wm2Front))))" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "The trackerdict now contains information about the octfile, as well as the Analysis Object results" ] }, { "cell_type": "code", "execution_count": 17, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\n", " Contents of trackerdict for sample hour after analysis1axis: \n", "{'AnalysisObj': [ : {'Back/FrontRatio': [0.125, 0.123, 0.12, 0.118, 0.342, 0.114, 0.117, 0.118, 0.119], 'Wm2Back': [2.944, 2.899, 2.833, 2.786, 2.991, 2.694, 2.765, 2.804, 2.831], 'Wm2Front': [23.6, 23.602, 23.604, 23.605, 8.742, 23.691, 23.696, 23.702, 23.74], 'backRatio': [0.125, 0.123, 0.12, 0.118, 0.342, 0.114, 0.117, 0.118, 0.119], 'hpc': False, 'mattype': array(['a9.3.a2.2.0.cellPVmodule.6457', 'a9.3.a2.4.0.cellPVmodule.6457',\n", " 'a9.3.a2.7.0.cellPVmodule.6457', 'a9.3.a2.9.0.cellPVmodule.6457',\n", " 'a9.3.octtube1a.6457', 'a9.3.a2.2.1.cellPVmodule.6457',\n", " 'a9.3.a2.4.1.cellPVmodule.6457', 'a9.3.a2.7.1.cellPVmodule.6457',\n", " 'a9.3.a2.9.1.cellPVmodule.6457'], dtype=object), 'modWanted': 10, 'name': '1axis_2021-01-13_0800_Scene0', 'octfile': '1axis_2021-01-13_0800.oct', 'power_data': None, 'rearMat': array(['a9.3.a2.2.0.cellPVmodule.2310', 'a9.3.a2.4.0.cellPVmodule.2310',\n", " 'a9.3.a2.7.0.cellPVmodule.2310', 'a9.3.a2.9.0.cellPVmodule.2310',\n", " 'sky', 'a9.3.a2.2.1.cellPVmodule.2310',\n", " 'a9.3.a2.4.1.cellPVmodule.2310', 'a9.3.a2.7.1.cellPVmodule.2310',\n", " 'a9.3.a2.9.1.cellPVmodule.2310'], dtype=object), 'rearX': [1.716, 1.288, 0.861, 0.434, 0.006, -0.421, -0.849, -1.276, -1.704], 'rearY': [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], 'rearZ': [2.283, 2.31, 2.34, 2.367, 2.395, 2.422, 2.451, 2.479, 2.506], 'rowWanted': 4, 'sceneNum': 0, 'x': [1.718, 1.29, 0.863, 0.436, 0.008, -0.419, -0.847, -1.274, -1.702], 'y': [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], 'z': [2.312, 2.34, 2.37, 2.396, 2.424, 2.453, 2.48, 2.508, 2.535]},\n", " : {'Back/FrontRatio': [0.124, 0.122, 0.12, 0.118, 0.133, 0.114, 0.117, 0.118, 0.119], 'Wm2Back': [2.946, 2.896, 2.844, 2.803, 2.991, 2.716, 2.791, 2.803, 2.829], 'Wm2Front': [23.785, 23.781, 23.777, 23.77, 22.482, 23.769, 23.769, 23.768, 23.768], 'backRatio': [0.124, 0.122, 0.12, 0.118, 0.133, 0.114, 0.117, 0.118, 0.119], 'hpc': False, 'mattype': array(['a9.3.a2.2.0.cellPVmodule.6457', 'a9.3.a2.4.0.cellPVmodule.6457',\n", " 'a9.3.a2.7.0.cellPVmodule.6457', 'a9.3.a2.9.0.cellPVmodule.6457',\n", " 'a9.3.octtube1a.6457', 'a9.3.a2.2.1.cellPVmodule.6457',\n", " 'a9.3.a2.4.1.cellPVmodule.6457', 'a9.3.a2.7.1.cellPVmodule.6457',\n", " 'a9.3.a2.9.1.cellPVmodule.6457'], dtype=object), 'modWanted': 10, 'name': '1axis_2021-01-13_0800_Scene0', 'octfile': '1axis_2021-01-13_0800.oct', 'power_data': None, 'rearMat': array(['a9.3.a2.2.0.cellPVmodule.2310', 'a9.3.a2.4.0.cellPVmodule.2310',\n", " 'a9.3.a2.7.0.cellPVmodule.2310', 'a9.3.a2.9.0.cellPVmodule.2310',\n", " 'sky', 'a9.3.a2.2.1.cellPVmodule.2310',\n", " 'a9.3.a2.4.1.cellPVmodule.2310', 'a9.3.a2.7.1.cellPVmodule.2310',\n", " 'a9.3.a2.9.1.cellPVmodule.2310'], dtype=object), 'rearX': [1.716, 1.288, 0.861, 0.434, 0.006, -0.421, -0.849, -1.276, -1.704], 'rearY': [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], 'rearZ': [2.283, 2.31, 2.34, 2.367, 2.395, 2.422, 2.451, 2.479, 2.506], 'rowWanted': 4, 'sceneNum': 0, 'x': [1.718, 1.29, 0.863, 0.436, 0.008, -0.419, -0.847, -1.274, -1.702], 'y': [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], 'z': [2.312, 2.34, 2.37, 2.396, 2.424, 2.453, 2.48, 2.508, 2.535]}],\n", " 'dhi': np.int64(22),\n", " 'dni': np.int64(13),\n", " 'ghi': np.int64(23),\n", " 'octfile': '1axis_2021-01-13_0800.oct',\n", " 'scenes': [ : {'gcr': np.float64(0.4284), 'hpc': False, 'module': : {'x': np.float64(1.036), 'y': np.float64(2.092), 'z': 0.02, 'modulematerial': 'black', 'scenex': np.float64(1.046), 'sceney': np.float64(4.284), 'scenez': np.float64(0.1), 'numpanels': 2, 'bifi': 1, 'text': '! genbox black cellPVmodule 0.156 0.156 0.02 | xform -t -0.44 -2.142 0.1 -a 6 -t 0.176 0 0 -a 12 -t 0 0.176 0 -a 2 -t 0 2.192 0\\r\\n! genbox black octtube1a 1.046 0.04142135623730951 0.1 | xform -t -0.523 -0.020711 -0.05\\r\\n! genbox black octtube1b 1.046 0.04142135623730951 0.1 | xform -t -0.445 -0.020711 -0.05 -rx 45 -t 0 0 0\\r\\n! genbox black octtube1c 1.046 0.04142135623730951 0.1 | xform -t -0.445 -0.020710678118654756 -0.05 -rx 90 -t 0 0 0\\r\\n! genbox black octtube1d 1.046 0.04142135623730951 0.1 | xform -t -0.445 -0.020710678118654756 -0.05 -rx 135 -t 0 0 0 ', 'modulefile': 'objects\\\\test-module.rad', 'glass': False, 'glassEdge': 0.01, 'offsetfromaxis': np.float64(0.1), 'xgap': 0.01, 'ygap': 0.1, 'zgap': 0.05}, 'modulefile': 'objects\\\\test-module.rad', 'name': 'Scene0', 'radfiles': 'objects\\\\1axis2021-01-13_0800__C_2.17_rtr_10.00_tilt_4_20modsx7rows_origin0,0.rad', 'sceneDict': {'pitch': 10, 'nMods': 20, 'nRows': 7, 'tilt': 3.74, 'azimuth': 90.0, 'modulez': 0.02, 'axis_tilt': 0, 'originx': 0, 'originy': 0, 'hub_height': np.float64(2.3)}, 'text': '!xform -rx 3.74 -t 0 0 2.3 -a 20 -t 1.046 0 0 -a 7 -t 0 10 0 -i 1 -t -9.414 -30.0 0 -rz 90.0 -t 0 0 0 \"objects\\\\test-module.rad\"'}],\n", " 'skyfile': 'skies\\\\sky2_37.5_-77.33_2021-01-13_0800.rad',\n", " 'surf_azm': 90.0,\n", " 'surf_tilt': 3.74,\n", " 'temp_air': np.float64(0.2),\n", " 'theta': -3.74,\n", " 'wind_speed': np.float64(2.6)}\n" ] } ], "source": [ "print (\"\\n Contents of trackerdict for sample hour after analysis1axis: \")\n", "pprint.pprint(trackerdict[trackerkeys[0]])\n" ] }, { "cell_type": "code", "execution_count": 18, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "[ : {'Back/FrontRatio': [0.125, 0.123, 0.12, 0.118, 0.342, 0.114, 0.117, 0.118, 0.119], 'Wm2Back': [2.944, 2.899, 2.833, 2.786, 2.991, 2.694, 2.765, 2.804, 2.831], 'Wm2Front': [23.6, 23.602, 23.604, 23.605, 8.742, 23.691, 23.696, 23.702, 23.74], 'backRatio': [0.125, 0.123, 0.12, 0.118, 0.342, 0.114, 0.117, 0.118, 0.119], 'hpc': False, 'mattype': array(['a9.3.a2.2.0.cellPVmodule.6457', 'a9.3.a2.4.0.cellPVmodule.6457',\n", " 'a9.3.a2.7.0.cellPVmodule.6457', 'a9.3.a2.9.0.cellPVmodule.6457',\n", " 'a9.3.octtube1a.6457', 'a9.3.a2.2.1.cellPVmodule.6457',\n", " 'a9.3.a2.4.1.cellPVmodule.6457', 'a9.3.a2.7.1.cellPVmodule.6457',\n", " 'a9.3.a2.9.1.cellPVmodule.6457'], dtype=object), 'modWanted': 10, 'name': '1axis_2021-01-13_0800_Scene0', 'octfile': '1axis_2021-01-13_0800.oct', 'power_data': None, 'rearMat': array(['a9.3.a2.2.0.cellPVmodule.2310', 'a9.3.a2.4.0.cellPVmodule.2310',\n", " 'a9.3.a2.7.0.cellPVmodule.2310', 'a9.3.a2.9.0.cellPVmodule.2310',\n", " 'sky', 'a9.3.a2.2.1.cellPVmodule.2310',\n", " 'a9.3.a2.4.1.cellPVmodule.2310', 'a9.3.a2.7.1.cellPVmodule.2310',\n", " 'a9.3.a2.9.1.cellPVmodule.2310'], dtype=object), 'rearX': [1.716, 1.288, 0.861, 0.434, 0.006, -0.421, -0.849, -1.276, -1.704], 'rearY': [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], 'rearZ': [2.283, 2.31, 2.34, 2.367, 2.395, 2.422, 2.451, 2.479, 2.506], 'rowWanted': 4, 'sceneNum': 0, 'x': [1.718, 1.29, 0.863, 0.436, 0.008, -0.419, -0.847, -1.274, -1.702], 'y': [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], 'z': [2.312, 2.34, 2.37, 2.396, 2.424, 2.453, 2.48, 2.508, 2.535]},\n", " : {'Back/FrontRatio': [0.124, 0.122, 0.12, 0.118, 0.133, 0.114, 0.117, 0.118, 0.119], 'Wm2Back': [2.946, 2.896, 2.844, 2.803, 2.991, 2.716, 2.791, 2.803, 2.829], 'Wm2Front': [23.785, 23.781, 23.777, 23.77, 22.482, 23.769, 23.769, 23.768, 23.768], 'backRatio': [0.124, 0.122, 0.12, 0.118, 0.133, 0.114, 0.117, 0.118, 0.119], 'hpc': False, 'mattype': array(['a9.3.a2.2.0.cellPVmodule.6457', 'a9.3.a2.4.0.cellPVmodule.6457',\n", " 'a9.3.a2.7.0.cellPVmodule.6457', 'a9.3.a2.9.0.cellPVmodule.6457',\n", " 'a9.3.octtube1a.6457', 'a9.3.a2.2.1.cellPVmodule.6457',\n", " 'a9.3.a2.4.1.cellPVmodule.6457', 'a9.3.a2.7.1.cellPVmodule.6457',\n", " 'a9.3.a2.9.1.cellPVmodule.6457'], dtype=object), 'modWanted': 10, 'name': '1axis_2021-01-13_0800_Scene0', 'octfile': '1axis_2021-01-13_0800.oct', 'power_data': None, 'rearMat': array(['a9.3.a2.2.0.cellPVmodule.2310', 'a9.3.a2.4.0.cellPVmodule.2310',\n", " 'a9.3.a2.7.0.cellPVmodule.2310', 'a9.3.a2.9.0.cellPVmodule.2310',\n", " 'sky', 'a9.3.a2.2.1.cellPVmodule.2310',\n", " 'a9.3.a2.4.1.cellPVmodule.2310', 'a9.3.a2.7.1.cellPVmodule.2310',\n", " 'a9.3.a2.9.1.cellPVmodule.2310'], dtype=object), 'rearX': [1.716, 1.288, 0.861, 0.434, 0.006, -0.421, -0.849, -1.276, -1.704], 'rearY': [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], 'rearZ': [2.283, 2.31, 2.34, 2.367, 2.395, 2.422, 2.451, 2.479, 2.506], 'rowWanted': 4, 'sceneNum': 0, 'x': [1.718, 1.29, 0.863, 0.436, 0.008, -0.419, -0.847, -1.274, -1.702], 'y': [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], 'z': [2.312, 2.34, 2.37, 2.396, 2.424, 2.453, 2.48, 2.508, 2.535]}]\n" ] } ], "source": [ "pprint.pprint(trackerdict[trackerkeys[0]]['AnalysisObj'])" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### B. Make Oct and Analye Range of Hours" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "You could do a list of indices following a similar procedure:" ] }, { "cell_type": "code", "execution_count": 19, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\n", "Making 1 octfiles in root directory.\n", "Created 1axis_2021-01-13_0900.oct\n", "Linescan in process: 1axis_2021-01-13_0900_Scene0_Row4_Module10_Front\n", "Linescan in process: 1axis_2021-01-13_0900_Scene0_Row4_Module10_Back\n", "Saved: results\\irr_1axis_2021-01-13_0900_Scene0_Row4_Module10.csv\n", "Index: 2021-01-13_0900. Wm2Front: 90.91053000000001. Wm2Back: 7.274867259259259\n", "\n", "Making 1 octfiles in root directory.\n", "Created 1axis_2021-01-13_1300.oct\n", "Linescan in process: 1axis_2021-01-13_1300_Scene0_Row4_Module10_Front\n", "Linescan in process: 1axis_2021-01-13_1300_Scene0_Row4_Module10_Back\n", "Saved: results\\irr_1axis_2021-01-13_1300_Scene0_Row4_Module10.csv\n", "Index: 2021-01-13_1300. Wm2Front: 218.4903. Wm2Back: 31.121771111111116\n", "Accumulated hourly bifi gain: 0.124\n" ] } ], "source": [ "for time in ['2021-01-13_0900','2021-01-13_1300']: \n", " demo.makeOct1axis(singleindex=time)\n", " results=demo.analysis1axis(singleindex=time)\n", "print('Accumulated hourly bifi gain: {:0.3}'.format(sum(sum(demo.results.Wm2Back)) / sum(sum(demo.results.Wm2Front))))" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Note that the bifacial gain printed above is for the accumulated irradiance between the hours modeled so far. \n", "Results are stored in demo.results for each module, row, scene and timestamp. " ] }, { "cell_type": "code", "execution_count": 20, "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", "
timestampnamemodNumrowNumsceneNumxyzrearZmattyperearMatWm2FrontWm2BackbackRatiorearXrearYsurf_azmsurf_tilttheta
02021-01-13_08001axis_2021-01-13_0800_Scene01040[1.718, 1.29, 0.863, 0.4355, 0.007812, -0.419,...[0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0][2.312, 2.34, 2.37, 2.396, 2.424, 2.453, 2.48,...[2.283, 2.31, 2.34, 2.367, 2.395, 2.422, 2.451...[a9.3.a2.2.0.cellPVmodule.6457, a9.3.a2.4.0.ce...[a9.3.a2.2.0.cellPVmodule.2310, a9.3.a2.4.0.ce...[23.600226666666668, 23.60168, 23.60356, 23.60...[2.944065666666667, 2.8991749999999996, 2.8331...[0.1247420614295754, 0.12283244953539171, 0.12...[1.716, 1.288, 0.861, 0.4336, 0.00586, -0.421,...[0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]90.03.74-3.74
12021-01-13_08001axis_2021-01-13_0800_Scene01040[1.718, 1.29, 0.863, 0.4355, 0.007812, -0.419,...[0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0][2.312, 2.34, 2.37, 2.396, 2.424, 2.453, 2.48,...[2.283, 2.31, 2.34, 2.367, 2.395, 2.422, 2.451...[a9.3.a2.2.0.cellPVmodule.6457, a9.3.a2.4.0.ce...[a9.3.a2.2.0.cellPVmodule.2310, a9.3.a2.4.0.ce...[23.78451, 23.78058, 23.77708, 23.770213333333...[2.9459510000000004, 2.895887333333333, 2.8438...[0.12385485953422903, 0.12177018235682124, 0.1...[1.716, 1.288, 0.861, 0.4336, 0.00586, -0.421,...[0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]90.03.74-3.74
22021-01-13_09001axis_2021-01-13_0900_Scene01040[1.664, 1.258, 0.852, 0.4463, 0.04004, -0.3652...[0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0][1.871, 2.008, 2.145, 2.281, 2.418, 2.555, 2.6...[1.843, 1.9795, 2.117, 2.254, 2.39, 2.527, 2.6...[a9.3.a2.2.0.cellPVmodule.6457, a9.3.a2.4.0.ce...[a9.3.a2.2.0.cellPVmodule.2310, a9.3.a2.4.0.ce...[95.69555666666668, 96.40040333333333, 98.3446...[7.239717333333334, 7.025711333333334, 6.65101...[0.0756528509019499, 0.07287976202006188, 0.06...[1.654, 1.248, 0.8423, 0.4365, 0.03027, -0.375...[0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]90.018.64-18.64
32021-01-13_13001axis_2021-01-13_1300_Scene01040[1.694, 1.268, 0.8413, 0.415, -0.01172, -0.438...[0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0][2.584, 2.545, 2.504, 2.465, 2.426, 2.387, 2.3...[2.553, 2.514, 2.473, 2.434, 2.395, 2.355, 2.3...[a9.3.a2.2.0.cellPVmodule.6457, a9.3.a2.4.0.ce...[a9.3.a2.2.0.cellPVmodule.2310, a9.3.a2.4.0.ce...[218.81786666666667, 218.82646666666665, 218.8...[27.896079999999998, 26.794673333333332, 25.55...[0.12748480249874858, 0.12244657282510545, 0.1...[1.697, 1.2705, 0.844, 0.418, -0.00879, -0.435...[0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]90.0-5.315.31
\n", "
" ], "text/plain": [ " timestamp name modNum rowNum sceneNum \\\n", "0 2021-01-13_0800 1axis_2021-01-13_0800_Scene0 10 4 0 \n", "1 2021-01-13_0800 1axis_2021-01-13_0800_Scene0 10 4 0 \n", "2 2021-01-13_0900 1axis_2021-01-13_0900_Scene0 10 4 0 \n", "3 2021-01-13_1300 1axis_2021-01-13_1300_Scene0 10 4 0 \n", "\n", " x \\\n", "0 [1.718, 1.29, 0.863, 0.4355, 0.007812, -0.419,... \n", "1 [1.718, 1.29, 0.863, 0.4355, 0.007812, -0.419,... \n", "2 [1.664, 1.258, 0.852, 0.4463, 0.04004, -0.3652... \n", "3 [1.694, 1.268, 0.8413, 0.415, -0.01172, -0.438... \n", "\n", " y \\\n", "0 [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0] \n", "1 [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0] \n", "2 [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0] \n", "3 [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0] \n", "\n", " z \\\n", "0 [2.312, 2.34, 2.37, 2.396, 2.424, 2.453, 2.48,... \n", "1 [2.312, 2.34, 2.37, 2.396, 2.424, 2.453, 2.48,... \n", "2 [1.871, 2.008, 2.145, 2.281, 2.418, 2.555, 2.6... \n", "3 [2.584, 2.545, 2.504, 2.465, 2.426, 2.387, 2.3... \n", "\n", " rearZ \\\n", "0 [2.283, 2.31, 2.34, 2.367, 2.395, 2.422, 2.451... \n", "1 [2.283, 2.31, 2.34, 2.367, 2.395, 2.422, 2.451... \n", "2 [1.843, 1.9795, 2.117, 2.254, 2.39, 2.527, 2.6... \n", "3 [2.553, 2.514, 2.473, 2.434, 2.395, 2.355, 2.3... \n", "\n", " mattype \\\n", "0 [a9.3.a2.2.0.cellPVmodule.6457, a9.3.a2.4.0.ce... \n", "1 [a9.3.a2.2.0.cellPVmodule.6457, a9.3.a2.4.0.ce... \n", "2 [a9.3.a2.2.0.cellPVmodule.6457, a9.3.a2.4.0.ce... \n", "3 [a9.3.a2.2.0.cellPVmodule.6457, a9.3.a2.4.0.ce... \n", "\n", " rearMat \\\n", "0 [a9.3.a2.2.0.cellPVmodule.2310, a9.3.a2.4.0.ce... \n", "1 [a9.3.a2.2.0.cellPVmodule.2310, a9.3.a2.4.0.ce... \n", "2 [a9.3.a2.2.0.cellPVmodule.2310, a9.3.a2.4.0.ce... \n", "3 [a9.3.a2.2.0.cellPVmodule.2310, a9.3.a2.4.0.ce... \n", "\n", " Wm2Front \\\n", "0 [23.600226666666668, 23.60168, 23.60356, 23.60... \n", "1 [23.78451, 23.78058, 23.77708, 23.770213333333... \n", "2 [95.69555666666668, 96.40040333333333, 98.3446... \n", "3 [218.81786666666667, 218.82646666666665, 218.8... \n", "\n", " Wm2Back \\\n", "0 [2.944065666666667, 2.8991749999999996, 2.8331... \n", "1 [2.9459510000000004, 2.895887333333333, 2.8438... \n", "2 [7.239717333333334, 7.025711333333334, 6.65101... \n", "3 [27.896079999999998, 26.794673333333332, 25.55... \n", "\n", " backRatio \\\n", "0 [0.1247420614295754, 0.12283244953539171, 0.12... \n", "1 [0.12385485953422903, 0.12177018235682124, 0.1... \n", "2 [0.0756528509019499, 0.07287976202006188, 0.06... \n", "3 [0.12748480249874858, 0.12244657282510545, 0.1... \n", "\n", " rearX \\\n", "0 [1.716, 1.288, 0.861, 0.4336, 0.00586, -0.421,... \n", "1 [1.716, 1.288, 0.861, 0.4336, 0.00586, -0.421,... \n", "2 [1.654, 1.248, 0.8423, 0.4365, 0.03027, -0.375... \n", "3 [1.697, 1.2705, 0.844, 0.418, -0.00879, -0.435... \n", "\n", " rearY surf_azm surf_tilt theta \n", "0 [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0] 90.0 3.74 -3.74 \n", "1 [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0] 90.0 3.74 -3.74 \n", "2 [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0] 90.0 18.64 -18.64 \n", "3 [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0] 90.0 -5.31 5.31 " ] }, "execution_count": 20, "metadata": {}, "output_type": "execute_result" } ], "source": [ "demo.results" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "To print the specific bifacial gain for a specific hour, you can refer back to the trackerdict:" ] }, { "cell_type": "code", "execution_count": 21, "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", "
namemodNumrowNumsceneNumxyzrearZmattyperearMatWm2FrontWm2BackbackRatiorearXrearY
01axis_2021-01-13_1300_Scene01040[1.694, 1.268, 0.8413, 0.415, -0.01172, -0.438...[0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0][2.584, 2.545, 2.504, 2.465, 2.426, 2.387, 2.3...[2.553, 2.514, 2.473, 2.434, 2.395, 2.355, 2.3...[a9.3.a2.2.0.cellPVmodule.6457, a9.3.a2.4.0.ce...[a9.3.a2.2.0.cellPVmodule.2310, a9.3.a2.4.0.ce...[218.81786666666667, 218.82646666666665, 218.8...[27.896079999999998, 26.794673333333332, 25.55...[0.12748480249874858, 0.12244657282510545, 0.1...[1.697, 1.2705, 0.844, 0.418, -0.00879, -0.435...[0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
\n", "
" ], "text/plain": [ " name modNum rowNum sceneNum \\\n", "0 1axis_2021-01-13_1300_Scene0 10 4 0 \n", "\n", " x \\\n", "0 [1.694, 1.268, 0.8413, 0.415, -0.01172, -0.438... \n", "\n", " y \\\n", "0 [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0] \n", "\n", " z \\\n", "0 [2.584, 2.545, 2.504, 2.465, 2.426, 2.387, 2.3... \n", "\n", " rearZ \\\n", "0 [2.553, 2.514, 2.473, 2.434, 2.395, 2.355, 2.3... \n", "\n", " mattype \\\n", "0 [a9.3.a2.2.0.cellPVmodule.6457, a9.3.a2.4.0.ce... \n", "\n", " rearMat \\\n", "0 [a9.3.a2.2.0.cellPVmodule.2310, a9.3.a2.4.0.ce... \n", "\n", " Wm2Front \\\n", "0 [218.81786666666667, 218.82646666666665, 218.8... \n", "\n", " Wm2Back \\\n", "0 [27.896079999999998, 26.794673333333332, 25.55... \n", "\n", " backRatio \\\n", "0 [0.12748480249874858, 0.12244657282510545, 0.1... \n", "\n", " rearX \\\n", "0 [1.697, 1.2705, 0.844, 0.418, -0.00879, -0.435... \n", "\n", " rearY \n", "0 [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0] " ] }, "execution_count": 21, "metadata": {}, "output_type": "execute_result" } ], "source": [ "trackerdict['2021-01-13_1300']['AnalysisObj'][0].results" ] }, { "cell_type": "code", "execution_count": 49, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "np.float64(0.1422167846598289)" ] }, "execution_count": 49, "metadata": {}, "output_type": "execute_result" } ], "source": [ "sum(sum(trackerdict['2021-01-13_1300']['AnalysisObj'][0].results.Wm2Back)) / sum(sum(trackerdict['2021-01-13_1300']['AnalysisObj'][0].results.Wm2Front))" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### C. Make Oct and Analyze All Tracking Dictionary\n", "\n", "This takes considerably more time, depending on the number of entries on the trackerdictionary. If no **starttime** and **endtime** were specified on STEP **readWeatherFile, this will run ALL of the hours in the year (~4000 hours).**\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "demo.makeOct1axis()\n", "results = demo.analysis1axis()\n", "print('Accumulated hourly bifi gain for all the trackerdict: {:0.3}'.format(sum(sum(demo.results.Wm2Back)) / sum(sum(demo.results.Wm2Front))))\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "
\n", "Remember you should clean your results first! This will have torquetube and sky results if performed this way so don't trust this simplistic bifacial_gain examples.\n", "
" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Condensed Version: All Tracking Dictionary\n", "\n", "This is the summarized version to run gendaylit for each entry in the trackingdictionary." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "import bifacial_radiance\n", "import os \n", "\n", "simulationName = 'Tutorial 3'\n", "moduletype = 'Custom Cell-Level Module' \n", "testfolder = os.path.abspath(r'..\\..\\bifacial_radiance\\TEMP')\n", "albedo = \"litesoil\" \n", "lat = 37.5 \n", "lon = -77.6\n", "\n", "# Scene variables\n", "nMods = 20\n", "nRows = 7\n", "hub_height = 2.3 # meters\n", "pitch = 10 # meters \n", "\n", "# Traking parameters\n", "cumulativesky = False\n", "limit_angle = 45 # degrees \n", "angledelta = 0.01 # \n", "backtrack = True \n", "\n", "#makeModule parameters\n", "# x and y will do not need to be defined as they are calculated internally for cell-level modules\n", "xgap = 0.01\n", "ygap = 0.10\n", "zgap = 0.05\n", "numpanels = 2\n", "\n", "cellModuleParams = {'numcellsx': 6, \n", "'numcellsy': 12,\n", "'xcell': 0.156,\n", "'ycell': 0.156,\n", "'xcellgap': 0.02,\n", "'ycellgap': 0.02}\n", "\n", "\n", "\n", "torquetube = True\n", "axisofrotation = True # the scene will rotate around the torque tube, and not the middle of the bottom surface of the module\n", "diameter = 0.1\n", "tubetype = 'Oct' # This will make an octagonal torque tube.\n", "material = 'black' # Torque tube material (0% reflectivity)\n", "tubeParams = {'diameter':diameter,\n", " 'tubetype':tubetype,\n", " 'material':material,\n", " 'axisofrotation':axisofrotation}\n", "\n", "startdate = '11_06' \n", "enddate = '11_06'\n", "demo = bifacial_radiance.RadianceObj(simulationName, path=testfolder) \n", "demo.setGround(albedo) \n", "epwfile = demo.getEPW(lat,lon) \n", "metdata = demo.readWeatherFile(epwfile, starttime=startdate, endtime=enddate) \n", "mymodule = bifacial_radiance.ModuleObj(name=moduletype, xgap=xgap, ygap=ygap, \n", " zgap=zgap, numpanels=numpanels, cellModule=cellModuleParams, tubeParams=tubeParams)\n", "sceneDict = {'pitch':pitch, 'hub_height':hub_height, 'nMods': nMods, 'nRows':nRows} \n", "demo.set1axis(limit_angle=limit_angle, backtrack=backtrack, gcr=gcr, cumulativesky=cumulativesky)\n", "demo.gendaylit1axis()\n", "demo.makeScene1axis(module=mymodule, sceneDict=sceneDict) #makeScene creates a .rad file with 20 modules per row, 7 rows.\n", "demo.makeOct1axis()\n", "demo.analysis1axis()" ] } ], "metadata": { "anaconda-cloud": {}, "kernelspec": { "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.9.12" } }, "nbformat": 4, "nbformat_minor": 4 }