def test_calc_pct_bridges(): pct492_bridges = copy(PCT492) pct492_bridges[0][0][2]['crosstie'] = True pct492_bridges[0][2][2]['crosstie'] = True pct492_bridges[0][4][2]['crosstie'] = True pvmod = PVmodule(cell_pos=pct492_bridges) return pvmod
def __init__(self, numberMods=NUMBERMODS, pvmods=None, pvconst=None): # is pvmods a list? try: pvmod0 = pvmods[0] except TypeError: # is pvmods an object? try: pvconst = pvmods.pvconst except AttributeError: # try to use the pvconst arg or create one if none if not pvconst: pvconst = PVconstants() # create pvmod pvmods = PVmodule(pvconst=pvconst) # expand pvmods to list pvmods = [pvmods] * numberMods else: pvconst = pvmod0.pvconst numberMods = len(pvmods) for p in pvmods: if p.pvconst is not pvconst: raise Exception('pvconst must be the same for all modules') self.pvconst = pvconst #: ``PVconstants`` used in ``PVstring`` self.numberMods = numberMods #: number of module in string self.pvmods = pvmods #: list of ``PVModule`` in ``PVstring`` # calculate string self.Istring, self.Vstring, self.Pstring = self.calcString()
def test_calc_pct_mod(): pvmod = PVmodule(cell_pos=PCT492) isc = np.interp(np.float64(0), pvmod.Vmod, pvmod.Imod) voc = np.interp(np.float64(0), np.flipud(pvmod.Imod), np.flipud(pvmod.Vmod)) ok_(np.isclose(isc, 37.8335982026)) ok_(np.isclose(voc, 55.2798357318)) return pvmod
def __init__(self, numberMods=NUMBERMODS, pvmods=None, pvconst=PVconstants()): self.pvconst = pvconst self.numberMods = numberMods if pvmods is None: # use deepcopy instead of making each object in for-loop, 2x faster pvmods = PVmodule(pvconst=self.pvconst) if isinstance(pvmods, PVmodule): pvmods = [pvmods] * self.numberMods # reset pvconsts in all pvcells and pvmodules for p in pvmods: for c in p.pvcells: c.pvconst = self.pvconst p.pvconst = self.pvconst if len(pvmods) != self.numberMods: # TODO: use pvmismatch exceptions raise Exception("Number of modules doesn't match.") self.pvmods = pvmods self.Istring, self.Vstring, self.Pstring = self.calcString()
def test_bypass_diode_configurations(): # No bypass diodes pvm = PVmodule(Vbypass=[None, None, None]) assert (np.isclose(pvm.Vmod.min(), -530.6169665707829)) # only one cell string has a bypass diode pvm = PVmodule(Vbypass=[None, None, -0.5]) assert (np.isclose(pvm.Vmod.min(), -398.46272492808714)) # two bypass diodes (middle removed) pvm = PVmodule(Vbypass=[-0.5, None, -0.5]) assert (np.isclose(pvm.Vmod.min(), -266.30848328539145)) # all bypass diodes - same values pvm = PVmodule(Vbypass=-0.2) assert (np.isclose(pvm.Vmod.min(), -0.6)) # one bypass diode across the module pvm = PVmodule(Vbypass=[-0.7]) assert (np.isclose(pvm.Vmod.min(), -0.7)) # default case pvm = PVmodule() assert (np.isclose(pvm.Vmod.min(), pvm.Vbypass * 3))
def test_pvmodule_with_no_pvcells(): pvmod = PVmodule() check_same_pvconst_and_lengths(pvmod)
def test_pvmodule_with_pvcells_obj(): pvcells = PVcell() pvmod = PVmodule(pvcells=pvcells) check_same_pvconst_and_lengths(pvmod)
def test_pvmodule_with_pvcells_list(): pvcells = [PVcell()] * 96 pvmod = PVmodule(pvcells=pvcells) check_same_pvconst_and_lengths(pvmod)
def test_calc_mod(): pvmod = PVmodule() assert (isinstance(pvmod, PVmodule)) return pvmod