Skip to content

Commit

Permalink
New pytests for desired makeModule behavior (1mm absorber and z = gla…
Browse files Browse the repository at this point in the history
…ss thickness)
  • Loading branch information
cdeline committed Sep 8, 2024
1 parent d8c4452 commit d66cd4b
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 5 deletions.
5 changes: 2 additions & 3 deletions bifacial_radiance/module.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def __init__(self, name=None, x=None, y=None, z=None, bifi=1,
Length of module (meters)
z : numeric
Thickness of the module (meters), or of the glass if glass = True,
in which case absorber thickness will be 0.002 and glass whatever
in which case absorber thickness will be 0.001 and glass whatever
thickness is given, with absorber in the middle of the glass.
bifi : numeric
Bifaciality of the panel (not currently used). Between 0
Expand Down Expand Up @@ -173,8 +173,7 @@ def __init__(self, name=None, x=None, y=None, z=None, bifi=1,
self.modulefile = os.path.join('objects',
self.name + '.rad')
print("\nModule Name:", self.name)

# @Chris 8/24 should this be a radObj check for hpc value?

if hpc:
self.compileText(rewriteModulefile, json=False)
else:
Expand Down
3 changes: 2 additions & 1 deletion docs/sphinx/source/whatsnew/pending.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ Bugfix Release ...

API Changes
~~~~~~~~~~~~
*
* New input parameter to :py:class:`~bifacial_radiance.ModuleObj and :py:class:`~bifacial_radiance.RadianceObj.makeModule`: `glassEdge`. If :py:class:`~bifacial_radiance.RadianceObj.makeModule` `glass` = True, then this extends the glass past the absorber edge by this total amount (half in each x and y direction). Default 10mm.
* Module glass thickness can be changed. In :py:class:`~bifacial_radiance.RadianceObj.makeModule`, if `glass` = True, then setting the `z` parameter will indicate the total (front + back) glass thickness with the 1mm absorber in the middle. The default is z = 10mm.

Enhancements
~~~~~~~~~~~~
Expand Down
18 changes: 17 additions & 1 deletion tests/test_module.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,4 +147,20 @@ def test_moduleFrameandOmegas():
scene = demo.makeScene(module, sceneDict)
analysis = bifacial_radiance.AnalysisObj() # return an analysis object including the scan dimensions for back irradiance
frontscan, backscan = analysis.moduleAnalysis(scene, sensorsy=10) # Gives us the dictionaries with coordinates
assert backscan['xstart'] == pytest.approx(0.792)
assert backscan['xstart'] == pytest.approx(0.792)

def test_GlassModule():
# test the cell-level module generation
name = "_test_GlassModule"
# default glass=True with .001 absorber and 0.01 glass
demo = bifacial_radiance.RadianceObj(name) # Create a RadianceObj 'object'
module = demo.makeModule(name='test-module', rewriteModulefile=True, glass=True, x=1, y=2)
assert module.text == '! genbox black test-module 1 2 0.001 | xform -t -0.5 -1.0 0 -a 1 -t 0 2.0' +\
' 0\r\n! genbox stock_glass test-module_Glass 1.01 2.01 0.01 | xform -t -0.505 -1.005 -0.005 -a 1 -t 0 2.0 0'
# custom glass=True with .001 absorber and 0.005 glass
module = demo.makeModule(name='test-module', glass=True, x=1, y=2, z=0.005)
assert module.text == '! genbox black test-module 1 2 0.001 | xform -t -0.5 -1.0 0 -a 1 -t 0 2.0' +\
' 0\r\n! genbox stock_glass test-module_Glass 1.01 2.01 0.005 | xform -t -0.505 -1.005 -0.0025 -a 1 -t 0 2.0 0'



0 comments on commit d66cd4b

Please sign in to comment.