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.pvArray(ms,[14]*2)) 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'] self.assertAlmostEquals(ans,sols)
# fill has moved to design if __name__ == "__main__": from design import tools_fill as fill import inverters import modules zc='44701' zc='27713' #zc='44050' #zc='23173' #m = "Suntech Power : STP245-20-Wd" #m = "Mage Solar : Powertec Plus 285-6 PL" #m = "Mage Solar : Powertec Plus 245-6 PL *" m = "Mage Solar : USA Powertec Plus 250-6 MNCS" ms = modules.module(m) system = inverters.inverter("Refusol: 20 kW 480V",modules.pvArray(ms,[11]*6)) print fill(system,zc) #system = inverters.inverter("Refusol: 24 kW 480V",modules.pvArray(ms,11,6)) print fill(system,zc) system = inverters.inverter("SMA America: SB7000US-11 277V",modules.pvArray(ms,[14]*2)) print fill(system,zc,mount="Roof") system = inverters.inverter("SMA America: SB8000US-11 277V",modules.pvArray(ms,[14]*2)) print fill(system,zc) #iname = "Shanghai Chint Power Systems: CPS SCE7KTL-O US (240V) 240V" iname = "Refusol: 24 kW 480V" #system = inverters.inverter(iname,modules.pvArray(m,1,1)) #system = inverters.inverter(iname,modules.pvArray(modules.module(m),1,1)) #fill(system,zc,1000)
def jsonToSystem(jsonDescription): """Load a system from a json description""" #todo: this is getting unweildy should probably be refactored jsonShape = [] orientations = [] for i in jsonDescription["array"]: o = {} scale = 1 if "scale" in i: scale = i["scale"] if "quantity" in i: scale = i["quantity"] if "shape" in i: shape = [] for string in i["shape"]: if "parallel" in string: shape +=[string["series"]]*string["parallel"] else: shape.append(string["series"]) else: if "series" in i: series = i["series"] else: series = 1 if "parallel" in i: parallel = i["parallel"] else: parallel = 1 shape = [series]*parallel if "tilt" in i: o["tilt"] = i["tilt"] else: o["tilt"] = jsonDescription["tilt"] if "azimuth" in i: o["azimuth"] = i["azimuth"] else: o["azimuth"] = jsonDescription["azimuth"] orientations.append(o) block = inverters.inverter(i["inverter"], \ modules.pvArray(modules.module(i["panel"]),\ shape),(o["azimuth"],o["tilt"])) #i["series"],i["parallel"])) if "derate" in i: block.derate = i["derate"] jsonShape += [ block ] * scale plant = system(jsonShape) plant.setZipcode(jsonDescription["zipcode"]) if "address" in jsonDescription: plant.address = jsonDescription["address"] try: g = geocoders.GoogleV3() place, (lat, lng) = g.geocode(plant.address) plant.place = lat,lng #print "%s, %s Geolocated" % plant.place 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 jsonDescription and "azimuth" in jsonDescription): plant.tilt = jsonDescription["tilt"] plant.azimuth = jsonDescription["azimuth"] else: "maybe incomplete" plant.tilt = orientations[0]["tilt"] plant.azimuth = orientations[0]["azimuth"] if 'shade' in jsonDescription: plant.hourlyShade = pathfinder.hourly(jsonDescription['shade']) plant.phase = jsonDescription["phase"] plant.voltage = jsonDescription["voltage"] plant.systemName = jsonDescription["system_name"] return plant