def vd(amperage, length, size=None, v=240, pf=-1, t_amb=30, percent=1, material="CU", c="STEEL", verbose=True): """Solve for conductor voltage drop. >>> print vd(10,100) Allowed Voltage drop: 2.4V Conductor 10 CU Drop: 2.08 V 10 CU >>> print vd(10,100,'8') Percent drop: 0.56% 8 CU """ oc = amperage * 1.25 ocp = ee.ocp_size(oc) vdrop = v * percent / 100.0 if size: conductor = ee.Conductor(size, material) conductor = ee.check_ampacity(conductor, ocp, t_amb) vdrop = conductor.vd(amperage, length, v=v, pf=pf, t_amb=t_amb, c=c) vdp = vdrop * 100 / v if verbose: print "Percent drop: %s%%" % round(vdp, 2) return conductor else: if verbose: print "Allowed Voltage drop: %sV" % vdrop sets = 0 conductor = None # todo: refactor for recursive. may take away the need for nec import while conductor is None: sets += 1 for s in nec.CONDUCTOR_STANDARD_SIZES: # print s, material conductor = ee.Conductor(s, material) # print conductor if conductor.vd(amperage * 1.0 / sets, length, v=v, pf=pf, t_amb=t_amb, c=c) < vdrop: break else: conductor = None if sets > 1: print "%s sets of %s" % (sets, conductor) # print "EGC Size: %s" % incEGC(conductor,egc,ratio) return [conductor] * sets # return [conductor for i in range(sets)] else: if verbose: print "Conductor %s" % conductor conductor = ee.check_ampacity(conductor, ocp / sets, t_amb) if verbose: print "Drop: %s V" % round(conductor.vd(amperage * 1.0 / sets, length, v=v, pf=pf, t_amb=t_amb, c=c), 2) return conductor
def write_notes(system, filename='output', v_nominal=240.0): """file out expedited permit form with system details""" station_class = 1 dummy, usaf = geo.closest_usaf(geo.zip_coordinates(system.zipcode), \ station_class) mintemp = eere.minimum(usaf) twopercent_temp = eere.twopercent(usaf) fields = [] for i in set(system.shape): module_name = i.array.dump()['panel'] module = modules.Module(module_name) print "PV Module Ratings @ STC" print "Module Make:", module.make fields.append(('Text1ModuleMake', module.make)) print "Module Model:", module.model fields.append(('Text1ModuleModel', module.model)) print "Max Power-Point Current (Imp):", module.i_mpp fields.append(('MAX POWERPOINT CURRENT IMP', module.i_mpp)) print "Max Power-Point Voltage (Vmp):", module.v_mpp fields.append(('MAX POWERPOINT VOLTAGE VMP', module.v_mpp)) print "Open-Circuit Voltage (v_oc):", module.v_oc fields.append(('OPENCIRCUIT VOLTAGE VOC', module.v_oc)) print "Short-Circuit Current (i_sc):", module.i_sc fields.append(('SHORTCIRCUIT CURRENT ISC', module.i_sc)) fields.append(('MAX SERIES FUSE OCPD', '15')) print "Maximum Power (p_max):", module.p_max fields.append(('MAXIMUM POWER PMAX', module.p_max)) print "Module Rated Max Voltage:", module.Vrated fields.append(('MAX VOLTAGE TYP 600VDC', module.Vrated)) fields.append(('VOC TEMP COEFF mVoC or oC', round(module.tk_v_oc, 2))) fields.append(('VOC TEMP COEFF mVoC', 'On')) print "Inverter Make:", i.make fields.append(('INVERTER MAKE', i.make)) print "Inverter Model:", i.model fields.append(('INVERTER MODEL', i.model)) print "Max Power", i.p_aco fields.append(('MAX POWER 40oC', i.p_aco)) fields.append(('NOMINAL AC VOLTAGE', 240)) print "Max AC Current: %s" % round(i.p_aco/v_nominal, 2) fields.append(('MAX AC CURRENT', round(i.p_aco/v_nominal, 2))) fields.append(('MAX DC VOLT RATING', i.mppt_hi)) print "Max AC OCPD Rating: %s" % ee.ocp_size(i.p_aco/v_nominal*1.25) print "Max System Voltage:", round(module.v_max(mintemp), 1) print "AC Output Current: %s" % \ round(sum([i.p_aco for i in system.shape])/v_nominal, 2) fields.append(('AC OUTPUT CURRENT', \ round(sum([i.p_aco for i in system.shape])/v_nominal, 2))) print "Nominal AC Voltage: %s" % v_nominal fields.append(('NOMINAL AC VOLTAGE_2', i.ac_voltage)) print "Minimum Temperature: %s C" % mintemp print "2 Percent Max: %s C" % twopercent_temp from fdfgen import forge_fdf fdf = forge_fdf("", fields, [], [], []) fdf_file = open("data.fdf", "w") fdf_file.write(fdf) fdf_file.close() import shlex from subprocess import call cmd = shlex.split("pdftk Example2-Micro-Inverter.pdf fill_form data.fdf" \ "%s output.pdf flatten" % filename) rc = call(cmd) return rc
def vd(amperage, length, size=None, v=240, pf=-1, t_amb=30, percent=1, material='CU', c='STEEL', verbose=True): """Solve for conductor voltage drop. >>> print vd(10,100) Allowed Voltage drop: 2.4V Conductor 10 CU Drop: 2.08 V 10 CU >>> print vd(10,100,'8') Percent drop: 0.56% 8 CU """ oc = amperage * 1.25 ocp = ee.ocp_size(oc) vdrop = v * percent / 100.0 if size: conductor = ee.Conductor(size, material) conductor = ee.check_ampacity(conductor, ocp, t_amb) vdrop = conductor.vd(amperage, length, v=v, pf=pf, t_amb=t_amb, c=c) vdp = (vdrop * 100 / v) if verbose: print "Percent drop: %s%%" % round(vdp, 2) return conductor else: if verbose: print "Allowed Voltage drop: %sV" % vdrop sets = 0 conductor = None # todo: refactor for recursive. may take away the need for nec import while conductor is None: sets += 1 for s in nec.CONDUCTOR_STANDARD_SIZES: # print s, material conductor = ee.Conductor(s, material) # print conductor if conductor.vd(amperage * 1.0 / sets, length, v=v, pf=pf, t_amb=t_amb, c=c) < vdrop: break else: conductor = None if sets > 1: print "%s sets of %s" % (sets, conductor) # print "EGC Size: %s" % incEGC(conductor,egc,ratio) return [conductor] * sets # return [conductor for i in range(sets)] else: if verbose: print "Conductor %s" % conductor conductor = ee.check_ampacity(conductor, ocp / sets, t_amb) if verbose: print "Drop: %s V" % round( conductor.vd(amperage * 1.0 / sets, length, v=v, pf=pf, t_amb=t_amb, c=c), 2) return conductor
def write_notes(system, filename='output', v_nominal=240.0): """file out expedited permit form with system details""" station_class = 1 dummy, usaf = geo.closest_usaf(geo.zip_coordinates(system.zipcode), \ station_class) mintemp = eere.minimum(usaf) twopercent_temp = eere.twopercent(usaf) fields = [] for i in set(system.shape): module_name = i.array.dump()['panel'] module = modules.Module(module_name) print "PV Module Ratings @ STC" print "Module Make:", module.make fields.append(('Text1ModuleMake', module.make)) print "Module Model:", module.model fields.append(('Text1ModuleModel', module.model)) print "Max Power-Point Current (Imp):", module.i_mpp fields.append(('MAX POWERPOINT CURRENT IMP', module.i_mpp)) print "Max Power-Point Voltage (Vmp):", module.v_mpp fields.append(('MAX POWERPOINT VOLTAGE VMP', module.v_mpp)) print "Open-Circuit Voltage (v_oc):", module.v_oc fields.append(('OPENCIRCUIT VOLTAGE VOC', module.v_oc)) print "Short-Circuit Current (i_sc):", module.i_sc fields.append(('SHORTCIRCUIT CURRENT ISC', module.i_sc)) fields.append(('MAX SERIES FUSE OCPD', '15')) print "Maximum Power (p_max):", module.p_max fields.append(('MAXIMUM POWER PMAX', module.p_max)) print "Module Rated Max Voltage:", module.Vrated fields.append(('MAX VOLTAGE TYP 600VDC', module.Vrated)) fields.append(('VOC TEMP COEFF mVoC or oC', round(module.tk_v_oc, 2))) fields.append(('VOC TEMP COEFF mVoC', 'On')) print "Inverter Make:", i.make fields.append(('INVERTER MAKE', i.make)) print "Inverter Model:", i.model fields.append(('INVERTER MODEL', i.model)) print "Max Power", i.p_aco fields.append(('MAX POWER 40oC', i.p_aco)) fields.append(('NOMINAL AC VOLTAGE', 240)) print "Max AC Current: %s" % round(i.p_aco / v_nominal, 2) fields.append(('MAX AC CURRENT', round(i.p_aco / v_nominal, 2))) fields.append(('MAX DC VOLT RATING', i.mppt_hi)) print "Max AC OCPD Rating: %s" % ee.ocp_size( i.p_aco / v_nominal * 1.25) print "Max System Voltage:", round(module.v_max(mintemp), 1) print "AC Output Current: %s" % \ round(sum([i.p_aco for i in system.shape])/v_nominal, 2) fields.append(('AC OUTPUT CURRENT', \ round(sum([i.p_aco for i in system.shape])/v_nominal, 2))) print "Nominal AC Voltage: %s" % v_nominal fields.append(('NOMINAL AC VOLTAGE_2', i.ac_voltage)) print "Minimum Temperature: %s C" % mintemp print "2 Percent Max: %s C" % twopercent_temp from fdfgen import forge_fdf fdf = forge_fdf("", fields, [], [], []) fdf_file = open("data.fdf", "w") fdf_file.write(fdf) fdf_file.close() import shlex from subprocess import call cmd = shlex.split("pdftk Example2-Micro-Inverter.pdf fill_form data.fdf" \ "%s output.pdf flatten" % filename) rc = call(cmd) return rc