<jupyter_start><jupyter_text>13 - Medium Level Example - Modeling Modules with GlassThis journal shows how to add glass to the modules. It also shows how to sample irradiance on the surface of the glass, as well as on the surface of the module. Surface of the module is slightlyt less irradiance due to fresnel losses (a.k.a. Angle of Incidence losses (AOI))Some examples of the module with glass we'll create:![Bottom Reflection](../images_wiki/Journal13Pics/Glass_bottom_reflection.PNG)![Side closeup](../images_wiki/Journal13Pics/Glass_side_closeup.PNG)![Tiled view](../images_wiki/Journal13Pics/Glass_tilted_reflection.PNG)<jupyter_code>import os
from bifacial_radiance import *
from pathlib import Path

testfolder = str(Path().resolve().parent.parent / 'bifacial_radiance' / 'TEMP')

# Another option using relative address; for some operative systems you might need '/' instead of '\'
# testfolder = os.path.abspath(r'..\..\bifacial_radiance\TEMP')  
print ("Your simulation will be stored in %s" % testfolder)

demo = RadianceObj('bifacial_example',str(testfolder))  
demo.setGround(0.30)  # This prints available materials.
epwfile = demo.getEPW(lat = 37.5, lon = -77.6)  # This location corresponds to Richmond, VA.
metdata = demo.readWeatherFile(epwfile) 
demo.gendaylit(8)  # Noon, June 17th (timepoint # 4020)\<jupyter_output>path = C:\Users\sayala\Documents\GitHub\bifacial_radiance\bifacial_radiance\TEMP
Getting weather file: USA_VA_Richmond.Intl.AP.724010_TMY.epw
 ... OK!
Saving file EPWs\epw_temp.csv, # points: 8760<jupyter_text>Modeling example with glass<jupyter_code>module_type = 'Bi60' 

numcellsx = 6
numcellsy = 12
xcell = 0.156
ycell = 0.156
xcellgap = 0.02
ycellgap = 0.02

torquetube = True
diameter = 0.15
tubetype = 'round'
material = 'Metal_Grey'
xgap = 0.1
ygap = 0
zgap = 0.05
numpanels = 1
axisofrotationTorqueTube = False
glass = True

cellLevelModuleParams = {'numcellsx': numcellsx, 'numcellsy':numcellsy, 
                         'xcell': xcell, 'ycell': ycell, 'xcellgap': xcellgap, 'ycellgap': ycellgap}

mymodule = demo.makeModule(name=module_type, torquetube=torquetube, diameter=diameter, tubetype=tubetype, material=material, 
                xgap=xgap, ygap=ygap, zgap=zgap, numpanels=numpanels, 
                cellLevelModuleParams=cellLevelModuleParams, 
                axisofrotationTorqueTube=axisofrotationTorqueTube, glass=glass, z=0.0002)

sceneDict = {'tilt':25,'pitch':5.5,'hub_height':1.0,'azimuth':90, 'nMods': 20, 'nRows': 1, originx=0, originy=0} 
scene = demo.makeScene(module_type,sceneDict)
octfile = demo.makeOct(demo.getfilelist())  
sceneDict = {'tilt':25,'pitch':5.5,'hub_height':1.0,'azimuth':90, 'nMods': 20, 'nRows': 10, 'originx':0, 'originy':0} 
scene = demo.makeScene(module_type,sceneDict)
octfile = demo.makeOct(demo.getfilelist())<jupyter_output>Created bifacial_example.oct<jupyter_text>Advanced Rendering:The images at the beginning of the journal can be made pretty with advanced rendering. This is the workflow:    rvu -> rpict -> pcond -> pfilt -> ra_tiff -> convertIn detail: 1.	Use rvu to view the oct file.     rvu 1axis_07_01_08.oct Use aim and origin to move around, zoom in/out, etc. Save a view file with view render. 2.	Run rpict to render the image to hdr. This is the time consuming step. It takes between 1 and 3 hours depending on how complex the geometry is.    rpict -x 4800 -y 4800 -i -ps 1 -dp 530 -ar 964 -ds 0.016 -dj 1 -dt 0.03 -dc 0.9 -dr 5 -st 0.12 -ab 5 -aa 0.11 -ad 5800 -as 5800 -av 25 25 25 -lr 14 -lw 0.0002 -vf render.vf bifacial_example.oct > render.hdr 3.	Run pcond to mimic human visual response    pcond -h render.hdr > render.pcond.hdr 4.	Resize and adjust exposure with pfilt    pfilt -e +0.2 -x /4 -y /4 render.pcond.hdr > render.pcond.pfilt.hdr 5.	Convert hdr to tif    ra_tiff render.pcond.pfilt.hdr render.tif 6.	Convert tif to png with imagemagick convert utility    convert render.tif render.png 7.	Annotate the image with convert    convert render.png -fill black -gravity South -annotate +0+5 'Created with NREL bifacial_radiance https://github.com/NREL/bifacial_radiance' render_annotated.png<jupyter_code>analysis = AnalysisObj(octfile, demo.basename)<jupyter_output><empty_output><jupyter_text>Scanning Outside of the module, the surface of the glass<jupyter_code>frontscan, backscan = analysis.moduleAnalysis(scene)
results = analysis.analysis(octfile, demo.basename, frontscan, backscan)  
load.read1Result('results\irr_bifacial_example.csv')<jupyter_output>Linescan in process: bifacial_example_Front
Linescan in process: bifacial_example_Back
Saved: results\irr_bifacial_example.csv<jupyter_text>Scanning Inside of the module, the surface of the cells<jupyter_code>frontscan, backscan = analysis.moduleAnalysis(scene, frontsurfaceoffset=0.02, backsurfaceoffset = 0.02)
results = analysis.analysis(octfile, demo.basename, frontscan, backscan)  
load.read1Result('results\irr_bifacial_example.csv')<jupyter_output>Linescan in process: bifacial_example_Front
Linescan in process: bifacial_example_Back
Saved: results\irr_bifacial_example.csv
{'fraction_non_alphanumeric': 0.10491027410767106, 'fraction_numerical': 0.03529875764149083, 'mean_word_length': 4.90454016298021, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 25, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '5', 'dir': 'jupyter-structured-clean-dedup', 'id': '438822', 'license': 'BSD-3-Clause', 'n_tokens_mistral': 1922, 'n_tokens_neox': 1718, 'n_words': 480, 'path': 'docs/tutorials/13 - Medium Level Example - Modeling Modules with Glass.ipynb', 'repo_name': 'tjcoathu/bifacial_radiance', 'size': '5071'}