def find_best(err, lower, upper):
'''wrapper around scipy optimisation function'''
+ if upper == lower:
+ return lower
if upper <= lower:
raise Exception('lower<upper')
def err1(x):
cell_Vmp += (cell_VT/cell_scale) * (t-25)
cell_Imp += cell_IT * (t-25)
+def irradiance_adjust(i):
+ '''adjust irradiance sensitive coefficients. This is very rough'''
+ global cell_Voc, cell_Isc, cell_Vmp, cell_Imp
+ v_scale=1e6
+ cell_Voc *= math.log(v_scale*(i+1))/math.log(v_scale*1001)
+ cell_Vmp *= math.log(v_scale*(i+1))/math.log(v_scale*1001)
+ cell_Isc *= i/1000.0
+ cell_Imp *= i/1000.0
+
# a cache hack ... we evaluate the same parms a lot of times
# assumes that return only depends on function args
pylab.show()
def panel_T():
- '''panel temperature sensitivity'''
+ '''panel power temperature sensitivity'''
global cell_Voc, cell_Isc, cell_Vmp, cell_Imp
saved = (cell_Isc, cell_Voc, cell_Imp, cell_Vmp)
for t in range(-5, 65, 10):
pylab.legend()
pylab.show()
-def panel_VI_T():
- '''panel VI temperature sensitivity'''
+def panel_IV_T():
+ '''panel IV temperature sensitivity'''
global cell_Voc, cell_Isc, cell_Vmp, cell_Imp
saved = (cell_Isc, cell_Voc, cell_Imp, cell_Vmp)
for t in range(-5, 65, 10):
(cell_Isc, cell_Voc, cell_Imp, cell_Vmp) = saved
pylab.xlabel('Voltage (V)')
pylab.ylabel('Current (A)')
- pylab.title("Panel VI temperature effect")
+ pylab.title("Panel IV temperature effect")
+ pylab.legend()
+ pylab.show()
+
+def panel_L():
+ '''panel power light sensitivity'''
+ global cell_Voc, cell_Isc, cell_Vmp, cell_Imp
+ saved = (cell_Isc, cell_Voc, cell_Imp, cell_Vmp)
+ for w in range(0, 1500, 250):
+ irradiance_adjust(w)
+ c=panel()
+ plotit(c.P, 0, round(c.V(0), 20), label='%d W/m2' % w)
+ (cell_Isc, cell_Voc, cell_Imp, cell_Vmp) = saved
+ pylab.xlabel('Voltage (V)')
+ pylab.ylabel('Power (W)')
+ pylab.title("Panel light effect")
+ pylab.legend()
+ pylab.show()
+
+def panel_IV_L():
+ '''panel VI light sensitivity'''
+ global cell_Voc, cell_Isc, cell_Vmp, cell_Imp
+ saved = (cell_Isc, cell_Voc, cell_Imp, cell_Vmp)
+ for w in range(0, 1500, 250):
+ irradiance_adjust(w)
+ c=panel()
+ plotit(c.I, 0, round(c.V(0), 20), label='%d W/m2' % w)
+ (cell_Isc, cell_Voc, cell_Imp, cell_Vmp) = saved
+ pylab.xlabel('Voltage (V)')
+ pylab.ylabel('Current (A)')
+ pylab.title("Panel VI light effect")
pylab.legend()
pylab.show()
"panel_VI" : panel_VI,
"panel_P" : panel_P,
"panel_T" : panel_T,
- "panel_VI_T" : panel_VI_T,
+ "panel_IV_T" : panel_IV_T,
+ "panel_L" : panel_L,
+ "panel_IV_L" : panel_IV_L,
"string_P" : string_P,
"string_P" : string_P,
"2MPP-loss" : mpp_loss,
parser.add_option("", "--cell-Vmp", dest="cell_Vmp", help="max power cell voltage", type='float')
parser.add_option("", "--inverter-MPP-min", dest="inverter_MPP_min", help="inverter MPP minimum", type='int')
parser.add_option("", "--inverter-MPP-max", dest="inverter_MPP_max", help="inverter MPP maximum", type='int')
- parser.add_option("", "--temperature", dest="temperature", help="cell temperature (C)",type='float')
+ parser.add_option("", "--temperature", dest="temperature", help="cell temperature (C)",type='float', default=25)
+ parser.add_option("", "--irradiance", dest="irradiance", help="light level (W/m2)",type='float', default=1000)
parser.add_option("", "--subpanels", dest="num_subpanels", help="subpanels per panel",
type='int', default=1)
parser.add_option("", "--cells-per-subpanel", dest="cells_per_subpanel", help="cells per subpanel",
inverter_range[0] = float(opts.inverter_MPP_min)
if opts.inverter_MPP_max:
inverter_range[1] = float(opts.inverter_MPP_max)
- if opts.temperature:
- temperature_adjust(opts.temperature)
+
+ temperature_adjust(opts.temperature)
+ irradiance_adjust(opts.irradiance)
try:
functions[f]()