def test_tools_fill(self): m = "Mage Solar : USA Powertec Plus 250-6 MNCS" ms = modules.Module(m) zc = '27713' system = inverters.Inverter("SMA America: SB7000US-11 277V", \ modules.Array(ms, [{'series':14}])) sols = design.tools_fill(system, zc, mount="Roof") ans = ['8266.5W : 11S x 3P : ratio 1.18 : 265.0 - 467.0 V', \ '6012.0W : 12S x 2P : ratio 0.86 : 290.0 - 510.0 V', \ '9018.0W : 12S x 3P : ratio 1.29 : 290.0 - 510.0 V', \ '6513.0W : 13S x 2P : ratio 0.93 : 314.0 - 552.0 V', \ '9769.5W : 13S x 3P : ratio 1.4 : 314.0 - 552.0 V', \ '7014.0W : 14S x 2P : ratio 1.0 : 338.0 - 595.0 V', \ '10521.0W : 14S x 3P : ratio 1.5 : 338.0 - 595.0 V'] ans1 = [ '6513.0W : channel 0: 13S x 2P Mage Solar : USA Powertec Plus 250-6 MNCS : ratio 0.93 : 323.0 - 552.0 V', '7014.0W : channel 0: 14S x 2P Mage Solar : USA Powertec Plus 250-6 MNCS : ratio 1.0 : 348.0 - 595.0 V', '8266.5W : channel 0: 11S x 3P Mage Solar : USA Powertec Plus 250-6 MNCS : ratio 1.18 : 274.0 - 467.0 V', '9018.0W : channel 0: 12S x 3P Mage Solar : USA Powertec Plus 250-6 MNCS : ratio 1.29 : 298.0 - 510.0 V', '9769.5W : channel 0: 13S x 3P Mage Solar : USA Powertec Plus 250-6 MNCS : ratio 1.4 : 323.0 - 552.0 V', '10521.0W : channel 0: 14S x 3P Mage Solar : USA Powertec Plus 250-6 MNCS : ratio 1.5 : 348.0 - 595.0 V' ] #print 'ans', '\n'.join(ans) #print 'sols', '\n'.join(sols) self.assertListEqual(ans1, sols)
def test_module(self): model = modules.model_search('Powertec 250 PL')[0] p = modules.Module(model) self.assertAlmostEquals(p.v_max(-10), 42.3129) self.assertAlmostEquals(p.v_dc(), 31.28) self.assertAlmostEquals(p.i_dc(), 8.01) self.assertAlmostEquals(p.v_min(40), 24.931724) self.assertAlmostEquals(p.output(900), 225.49752)
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 json_system(json_description): """Load a system from a json description""" #todo: this is getting unweildy should probably be refactored json_shape = [] orientations = [] for i in json_description["array"]: o = {} scale = 1 if "scale" in i: scale = i["scale"] if "quantity" in i: scale = i["quantity"] if "shape" in i: shape = i["shape"] elif "series" in i: if "parallel" in i: parallel = i["parallel"] else: parallel = 1 shape = [{"series": i["series"], "parallel": parallel}] else: shape = [{'series': 1}] if "tilt" in i: o["tilt"] = i["tilt"] else: o["tilt"] = json_description["tilt"] if "azimuth" in i: o["azimuth"] = i["azimuth"] else: o["azimuth"] = json_description["azimuth"] orientations.append(o) block = inverters.Inverter(i["inverter"], \ modules.Array(modules.Module(i["panel"]),\ shape), (o["azimuth"], o["tilt"])) #i["series"],i["parallel"])) if "derate" in i: block.derate = i["derate"] json_shape += [block] * scale plant = System(json_shape) if 'station_class' in json_description: plant.set_zipcode(json_description["zipcode"], \ json_description['station_class']) else: plant.set_zipcode(json_description["zipcode"]) if "address" in json_description: plant.address = json_description["address"] try: geocoder = geocoders.GoogleV3() place, (lat, lng) = geocoder.geocode(plant.address) plant.place = lat, lng except: pass #print "%s, %s location from zipcode" % plant.place #print orientations #print set(["%s_%s" % (i['azimuth'],i['tilt']) for i in orientations]) if len(set(["%s_%s" % (i['azimuth'], i['tilt']) for i in orientations])) \ > 1: print "WARNING: multiple tilts not implimented" plant.tilt = o[0]["tilt"] plant.azimuth = o[0]["azimuth"] elif "tilt" in json_description and "azimuth" in json_description: plant.tilt = json_description["tilt"] plant.azimuth = json_description["azimuth"] else: #"maybe incomplete" plant.tilt = orientations[0]["tilt"] plant.azimuth = orientations[0]["azimuth"] if 'shade' in json_description: plant.hourly_shade = pathfinder.Hourly(json_description['shade']) plant.phase = json_description["phase"] plant.voltage = json_description["voltage"] plant.system_name = json_description["system_name"] return plant