def test_settemp_cell(): """ Test setTemp method for a wide range of temperatures. Test added after implementing Isat2 as Isat2(Tcell) """ pvc = PVcell() Pmp_arr = [] Vmp_arr = [] Voc_arr = [] Isc_arr = [] temps = [-85, -60, -40, -25, 0, 25, 40, 60, 85] for t in temps: pvc.Tcell = float(t) + 273.15 Pmp_arr.append(pvc.Pcell.max()) Vmp_arr.append(pvc.Vcell[pvc.Pcell.argmax()]) Voc_arr.append(pvc.calcVcell(0)) Isc_arr.append(pvc.Isc) assert(np.all(np.gradient(np.squeeze(Vmp_arr)) < 0)) assert(np.all(np.gradient(np.squeeze(Voc_arr)) < 0)) assert(np.all(np.gradient(Isc_arr) > 0))
def test_pvcell_setattr_recalc(): pvc = PVcell() i183 = pvc.Icell[183] pvc.Tcell = 323 pvc.Ee = 0.65 ok_(pvc.Icell[183] != i183)