diff --git a/docs/tutorials/22 - Mirrors and Modules.html b/docs/tutorials/22 - Mirrors and Modules.html deleted file mode 100644 index 03aa2133..00000000 --- a/docs/tutorials/22 - Mirrors and Modules.html +++ /dev/null @@ -1,15520 +0,0 @@ - - -
- - -Doing an example tutorial for example brought up in Issue #372
- - -import os
-from pathlib import Path
-
-testfolder = str(Path().resolve().parent.parent / 'bifacial_radiance' / 'TEMP' / 'Tutorial_22')
-if not os.path.exists(testfolder):
- os.makedirs(testfolder)
-
-print ("Your simulation will be stored in %s" % testfolder)
-
Your simulation will be stored in C:\Users\sayala\Documents\GitHub\bifacial_radiance\bifacial_radiance\TEMP\Tutorial_22 --
import bifacial_radiance
-import numpy as np
-import pprint
-import pandas as pd
-
demo = bifacial_radiance.RadianceObj('tutorial_22', path=testfolder) # Adding a simulation name. This is optional.
-demo.setGround(0.2)
-epwfile = demo.getEPW(lat=37.5, lon=-77.6)
-metdata = demo.readWeatherFile(weatherFile=epwfile, coerce_year=2021)
-timeindex = metdata.datetime.index(pd.to_datetime('2021-01-01 12:0:0 -5'))
-demo.gendaylit(timeindex) # Choosing a december time when the sun is lower in the horizon
-
path = C:\Users\sayala\Documents\GitHub\bifacial_radiance\bifacial_radiance\TEMP\Tutorial_22 -Making path: images -Making path: objects -Making path: results -Making path: skies -Making path: EPWs -Making path: materials -Loading albedo, 1 value(s), 0.200 avg -1 nonzero albedo values. -Getting weather file: USA_VA_Richmond.724010_TMY2.epw - ... OK! -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. -Coercing year to 2021 -Saving file EPWs\metdata_temp.csv, # points: 8760 -Calculating Sun position for Metdata that is right-labeled with a delta of -30 mins. i.e. 12 is 11:30 sunpos --
'skies\\sky2_37.5_-77.33_2021-01-01_1200.rad'-
tilt = 75
-sceneDict1 = {'tilt':tilt,'pitch':5,'clearance_height':0.05,'azimuth':180,
- 'nMods': 1, 'nRows': 1, 'originx': 0, 'originy': 0, 'appendRadfile':True}
-mymodule1 = demo.makeModule(name='test-module',x=2,y=1, numpanels=1)
-sceneObj1 = demo.makeScene(mymodule1, sceneDict1)
-
-Module Name: test-module -Module test-module updated in module.json --
octfile = demo.makeOct(demo.getfilelist())
-analysis = bifacial_radiance.AnalysisObj(octfile, demo.basename)
-frontscan, backscan = analysis.moduleAnalysis(sceneObj1, sensorsy=1)
-results = analysis.analysis(octfile, demo.basename, frontscan, backscan)
-
Created tutorial_22.oct -Linescan in process: tutorial_22_Row1_Module1_Front -Linescan in process: tutorial_22_Row1_Module1_Back -Saved: results\irr_tutorial_22_Row1_Module1.csv --
pwd
-
'C:\\Users\\sayala\\Documents\\GitHub\\bifacial_radiance\\bifacial_radiance\\TEMP\\Tutorial_22'-
withoutMirror = bifacial_radiance.load.read1Result('results\irr_tutorial_22_Row1_Module1.csv')
-withoutMirror
-
- | x | -y | -z | -rearZ | -mattype | -rearMat | -Wm2Front | -Wm2Back | -Back/FrontRatio | -
---|---|---|---|---|---|---|---|---|---|
0 | -2.484128e-18 | --0.020284 | -0.538398 | -0.532704 | -a0.0.a0.test-module.6457 | -a0.0.a0.test-module.2310 | -140.0834 | -64.92755 | -0.463489 | -
We start by creating the mirror material in our ground.rad file, in case it is not there. For mirror or glass primitives (material classes), pecularity and roughness are not needed.
-You could alternatively do a plastic material, and increase the specularity and lower the roughness to get a very reflective surface.
- -demo.addMaterial(material='testmirror', Rrefl=0.94, Grefl=0.96, Brefl=0.96,
- materialtype = 'mirror') # specularity and roughness not needed for mirrors or glass.
-
Added material testmirror to file ground.rad --
mymodule2 = demo.makeModule(name='test-mirror',x=2,y=1, numpanels=1, modulematerial='testmirror')
-
-Module Name: test-mirror -Module test-mirror updated in module.json --
We calculate the displacement of the morrir as per the equations show in the image at the beginning of the tutorial
- -originy = -(0.5*mymodule2.sceney + 0.5*mymodule1.sceney*np.cos(np.radians(tilt)))
-
sceneDict2 = {'tilt':0,'pitch':0.00001,'clearance_height':0.05,'azimuth':180,
- 'nMods': 1, 'nRows': 1, 'originx': 0, 'originy': originy, 'appendRadfile':True}
-sceneObj2 = demo.makeScene(mymodule2, sceneDict2)
-
octfile = demo.makeOct(demo.getfilelist())
-
Created tutorial_22.oct --
Use rvu in the terminal or by commenting out the cell below to view the generated geometry, it should look like this:
- - -## Comment the line below to run rvu from the Jupyter notebook instead of your terminal.
-## Simulation will stop until you close the rvu window
-
-# !rvu -vf views\front.vp -e .01 -vp 4 -0.6 1 -vd -0.9939 0.1104 0.0 tutorial_22.oct
-
analysis = bifacial_radiance.AnalysisObj(octfile, demo.basename)
-frontscan, backscan = analysis.moduleAnalysis(sceneObj1, sensorsy=1)
-results = analysis.analysis(octfile, name=demo.basename+'_withMirror', frontscan=frontscan, backscan=backscan)
-
Linescan in process: tutorial_22_withMirror_Row1_Module1_Front -Linescan in process: tutorial_22_withMirror_Row1_Module1_Back -Saved: results\irr_tutorial_22_withMirror_Row1_Module1.csv --
withMirror = bifacial_radiance.load.read1Result('results\irr_tutorial_22_withMirror_Row1_Module1.csv')
-withMirror
-
- | x | -y | -z | -rearZ | -mattype | -rearMat | -Wm2Front | -Wm2Back | -Back/FrontRatio | -
---|---|---|---|---|---|---|---|---|---|
0 | -2.484128e-18 | --0.020284 | -0.538398 | -0.532704 | -a0.0.a0.test-module.6457 | -a0.0.a0.test-module.2310 | -172.065067 | -64.88283 | -0.377081 | -
Just as a sanity check, we could sample the mirror...
- -frontscan, backscan = analysis.moduleAnalysis(sceneObj2, sensorsy=1)
-results = analysis.analysis(octfile, name=demo.basename+'_Mirroritself', frontscan=frontscan, backscan=backscan)
-bifacial_radiance.load.read1Result('results\irr_tutorial_22_Mirroritself_Row1_Module1.csv')
-
Linescan in process: tutorial_22_Mirroritself_Row1_Module1_Front -Linescan in process: tutorial_22_Mirroritself_Row1_Module1_Back -Saved: results\irr_tutorial_22_Mirroritself_Row1_Module1.csv --
- | x | -y | -z | -rearZ | -mattype | -rearMat | -Wm2Front | -Wm2Back | -Back/FrontRatio | -
---|---|---|---|---|---|---|---|---|---|
0 | -0.0 | --0.629409 | -0.071 | -0.049 | -a0.0.a0.test-mirror.6457 | -a0.0.a0.test-mirror.2310 | -160.196767 | -0.311144 | -0.001942 | -
And we can calculate the increase in front irradiance from the mirror:
- -print("Gain from mirror:", round((withMirror.Wm2Front[0] - withoutMirror.Wm2Front[0] )*100/withoutMirror.Wm2Front[0],1 ), "%" )
-
Gain from mirror: 22.8 % --
Create mirrors as their own objects and Append to Scene, like on tutorial 5. Sample code below:
- -# name='Mirror1'
-# text='! genbox black cuteMirror 2 1 0.02 | xform -t -1 -0.5 0 -t 0 {} 0'.format(originy)
-# customObject = demo.makeCustomObject(name,text)
-# demo.appendtoScene(radfile=scene.radfiles, customObject=customObject, text="!xform -rz 0")
-# sceneObj2 = demo.makeScene(mymodule2, sceneDict2)
-
and then you do your Scene, Oct, and Analysis as usual.
- -