Skip to content

Commit

Permalink
Clean up makeModule sig figs for cellModule, torqueTube, frames and o…
Browse files Browse the repository at this point in the history
…megas.
  • Loading branch information
cdeline committed Oct 2, 2024
1 parent 6dad504 commit d03f4e0
Showing 1 changed file with 13 additions and 15 deletions.
28 changes: 13 additions & 15 deletions bifacial_radiance/module.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,9 +172,6 @@ def __init__(self, name=None, x=None, y=None, z=None, bifi=1, modulefile=None,
for key in self.keys:
setattr(self, key, eval(key))

if cellModule:
self.addCellModule(**cellModule, recompile=False)

if tubeParams:
if 'bool' in tubeParams: # backward compatible with pre-0.4
tubeParams['visible'] = tubeParams.pop('bool')
Expand All @@ -187,7 +184,8 @@ def __init__(self, name=None, x=None, y=None, z=None, bifi=1, modulefile=None,
if frameParams:
self.addFrame(**frameParams, recompile=False)


if cellModule:
self.addCellModule(**cellModule, recompile=False)

self.addCEC(CECMod, glass, bifi=bifi)

Expand Down Expand Up @@ -620,15 +618,15 @@ def _makeModuleFromDict(self, x=None, y=None, z=None, xgap=None, ygap=None,
'One or the other must be specified.')


self.scenex = x + xgap
self.scenex = np.round(x + xgap, 6)
self.sceney = np.round(y*numpanels + ygap*(numpanels-1), 8)
self.scenez = np.round(zgap + diam / 2.0, 6)


if hasattr(self, 'frame'):
_zinc, frametext = self.frame._makeFrames(
x=x,y=y, ygap=ygap,numpanels=Ny,
offsetfromaxis= self.offsetfromaxis- 0.5*zglass)
offsetfromaxis=self.offsetfromaxis- 0.5*zglass)
else:
frametext = ''
_zinc = 0 # z increment from frame thickness
Expand Down Expand Up @@ -659,9 +657,9 @@ def _makeModuleFromDict(self, x=None, y=None, z=None, xgap=None, ygap=None,
self.glassEdge = glassEdge

text = text+'\r\n! genbox stock_glass {} {} {} {} '.format(self.name+'_Glass',x+glassEdge, y+glassEdge, zglass)
text +='| xform -t {} {} {} '.format(np.round(-x/2.0-0.5*glassEdge + _cc, 6),
np.round((-y*Ny/2.0)-(ygap*(Ny-1)/2.0)-0.5*glassEdge, 6),
np.round(self.offsetfromaxis - 0.5*zglass, 6) )
text +='| xform -t {} {} {} '.format(round(-x/2.0-0.5*glassEdge + _cc, 6),
round((-y*Ny/2.0)-(ygap*(Ny-1)/2.0)-0.5*glassEdge, 6),
round(self.offsetfromaxis - 0.5*zglass, 6) )
text += '-a {} -t 0 {} 0'.format(Ny, y+ygap)


Expand Down Expand Up @@ -1113,7 +1111,7 @@ def _makeFrames(self, x, y, ygap, numpanels, offsetfromaxis):
#frame legs for east-west

flw_xt = -x_temp/2 + f_thickness
fle_xt = x_temp/2 - f_thickness-fl_x
fle_xt = round(x_temp/2 - f_thickness-fl_x,6)
flew_yt = -y_half-y_trans_shift
flew_zt = offsetfromaxis-f_height

Expand All @@ -1127,18 +1125,18 @@ def _makeFrames(self, x, y, ygap, numpanels, offsetfromaxis):
fns_z = f_height-f_thickness

fns_xt = -x_temp/2+f_thickness
fn_yt = -y_half+y-f_thickness
fn_yt = round(-y_half+y-f_thickness,6)
fs_yt = -y_half
fns_zt = offsetfromaxis-f_height+f_thickness

# the filler legs

filleg_x = x_temp-2*f_thickness-2*fl_x
filleg_x = round(x_temp-2*f_thickness-2*fl_x, 6)
filleg_y = f_thickness + fl_x
filleg_z = f_thickness

filleg_xt = -x_temp/2+f_thickness+fl_x
fillegn_yt = -y_half+y-f_thickness-fl_x
filleg_xt = round(-x_temp/2+f_thickness+fl_x, 6)
fillegn_yt = round(-y_half+y-f_thickness-fl_x, 6)
fillegs_yt = -y_half
filleg_zt = offsetfromaxis-f_height

Expand Down Expand Up @@ -1359,7 +1357,7 @@ def _makeCellLevelModule(self, module, z, Ny, ygap,
c['xcell'], c['ycell'], z)
text +='xform -t {} {} {} '.format(round(-x/2.0 + _cc, 6),
round((-y*Ny / 2.0)-(ygap*(Ny-1) / 2.0)-centerJB/2.0, 6),
offsetfromaxis)
round(offsetfromaxis, 6))

text += '-a {} -t {} 0 0 '.format(c['numcellsx'], c['xcell'] + c['xcellgap'])

Expand Down

0 comments on commit d03f4e0

Please sign in to comment.