示例#1
0
文件: unit.py 项目: lyuyfshi/solpy
 def test_annual_output2(self):
     p1 = """{"system_name":"HAPPY CUSTOMER",
     "address":"15013 Denver W Pkwy, Golden, CO",
     "zipcode":"80401",
     "tilt":23,
     "azimuth":180,
     "phase":1,
     "voltage":240,
     "array":[
         {"inverter":"SMA America: SB11000TL-US-12 (240V) 240V",
         "panel":"Axitec : AC-250P-156-60S *",
         "series":14,
         "parallel":4,
         "quantity":7
         },
         {"inverter":"SMA America: SB8000TL-US-12 (240V) 240V",
         "panel":"Axitec : AC-250P-156-60S *",
         "series":14,
         "parallel":3,
         "quantity":1
         }
         ]}
         """
     js1 = json.loads(p1)
     plant1 = pv.json_system(js1)
     rs1 = plant1.model()
     js2 = json.loads(json.dumps(plant1.dump()))
     plant2 = pv.json_system(js2)
     js3 = json.loads(json.dumps(plant2.dump()))
     rs2 = plant2.model()
     self.assertEqual(js2, js3)
     self.assertAlmostEquals(rs1.annual_output, rs2.annual_output)
示例#2
0
 def test_annual_output2(self):
     p1 = """{"system_name":"HAPPY CUSTOMER",
     "address":"15013 Denver W Pkwy, Golden, CO",
     "zipcode":"80401",
     "tilt":23,
     "azimuth":180,
     "phase":1,
     "voltage":240,
     "array":[
         {"inverter":"SMA America: SB11000TL-US-12 (240V) 240V",
         "panel":"Axitec : AC-250P-156-60S *",
         "series":14,
         "parallel":4,
         "quantity":7
         },
         {"inverter":"SMA America: SB8000TL-US-12 (240V) 240V",
         "panel":"Axitec : AC-250P-156-60S *",
         "series":14,
         "parallel":3,
         "quantity":1
         }
         ]}
         """
     js1 = json.loads(p1)
     plant1 = pv.json_system(js1)
     rs1 = plant1.model()
     js2 = json.loads(json.dumps(plant1.dump()))
     plant2 = pv.json_system(js2)
     js3 = json.loads(json.dumps(plant2.dump()))
     rs2 = plant2.model()
     self.assertEqual(js2, js3)
     self.assertAlmostEquals(rs1.annual_output, rs2.annual_output)
示例#3
0
def model_plant(json_def):
    """model sub task"""
    plant = pv.json_system(json_def)
    yearone = plant.model(single_thread=True)
    p_dc = sum([i.array.output(1000) for i in plant.shape])
    plant_dict = plant.dump()
    plant_dict['yearone'] = yearone.annual_output
    plant_dict['DCnominal'] = int(p_dc)
    return plant_dict
示例#4
0
def performance_model_plant(json_def):
    """model performance of a system"""
    plant = pv.json_system(json_def)
    yearone = plant.model()
    p_dc = sum([i.array.output(1000) for i in plant.shape])
    plant_dict = plant.dump()
    plant_dict['yearone'] = yearone.annual_output
    plant_dict['DCnominal'] = int(p_dc)
    return plant_dict
示例#5
0
文件: pmodel.py 项目: lyuyfshi/solpy
def model_plant(json_def):
    """model sub task"""
    plant = pv.json_system(json_def)
    yearone = plant.model(single_thread=True)
    p_dc = sum([i.array.output(1000) for i in plant.shape])
    plant_dict = plant.dump()
    plant_dict['yearone'] = yearone.annual_output
    plant_dict['DCnominal'] = int(p_dc)
    return plant_dict
示例#6
0
 def test_annual_output1(self):
     p1 = """{"system_name":"HAPPY CUSTOMER",
     "address":"15013 Denver W Pkwy, Golden, CO",
     "zipcode":"80401",
     "phase":1,
     "voltage":240,
     "array":[
         {"inverter":"Enphase Energy: M215-60-2LL-S2x-IG-NA (240 V) 240V",
         "panel":"Mage Solar : Powertec Plus 250-6 PL",
         "quantity":20,
         "azimuth":180,
         "tilt":25
         }
         ]}"""
     plant = pv.json_system(json.loads(p1))
     rs = plant.model()
     self.assertAlmostEquals(rs.annual_output, 7689.05)
示例#7
0
文件: unit.py 项目: lyuyfshi/solpy
 def test_annual_output1(self):
     p1 = """{"system_name":"HAPPY CUSTOMER",
     "address":"15013 Denver W Pkwy, Golden, CO",
     "zipcode":"80401",
     "phase":1,
     "voltage":240,
     "array":[
         {"inverter":"Enphase Energy: M215-60-2LL-S2x-IG-NA (240 V) 240V",
         "panel":"Mage Solar : Powertec Plus 250-6 PL",
         "quantity":20,
         "azimuth":180,
         "tilt":25
         }
         ]}"""
     plant = pv.json_system(json.loads(p1))
     rs = plant.model()
     self.assertAlmostEquals(rs.annual_output, 7689.05)
示例#8
0
 def test_hourlyNoShading(self):
     p1 = """{"system_name":"Another Happy Customer",
     "zipcode":"44654",
     "tilt":25,
     "azimuth":180,
     "phase":1,
     "voltage":240,
     "array":[
         {"inverter":"Enphase Energy: M215-60-2LL-S2x-IG-NA (240 V) 240V",
         "derate":0.98,
         "panel":"Mage Solar : Powertec Plus 250-6 PL",
         "series":1,
         "parallel":1,
         "scale":36
         }
         ]}"""
     js1 = json.loads(p1)
     plant1 = pv.json_system(js1)
     rs1 = plant1.model()
     self.assertAlmostEquals(rs1.annual_output, 12939.9)
示例#9
0
文件: unit.py 项目: lyuyfshi/solpy
 def test_hourlyNoShading(self):
     p1 = """{"system_name":"Another Happy Customer",
     "zipcode":"44654",
     "tilt":25,
     "azimuth":180,
     "phase":1,
     "voltage":240,
     "array":[
         {"inverter":"Enphase Energy: M215-60-2LL-S2x-IG-NA (240 V) 240V",
         "derate":0.98,
         "panel":"Mage Solar : Powertec Plus 250-6 PL",
         "series":1,
         "parallel":1,
         "scale":36
         }
         ]}"""
     js1 = json.loads(p1)
     plant1 = pv.json_system(js1)
     rs1 = plant1.model()
     self.assertAlmostEquals(rs1.annual_output, 12939.9)
示例#10
0
 def test_hourlyShading(self):
     p1 = """{"system_name":"Another Happy Customer",
     "zipcode":"44654",
     "tilt":25,
     "azimuth":180,
     "phase":1,
     "voltage":240,
     "shade":{"0": [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.1, 1.0, 1.0, 1.0, 1.0, 0.5, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], "1": [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.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.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], "10": [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.4, 1.0, 1.0, 1.0, 1.0, 0.8, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], "11": [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.1, 1.0, 1.0, 0.2, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]},
     "array":[
         {"inverter":"Enphase Energy: M215-60-2LL-S2x-IG-NA (240 V) 240V",
         "derate":0.98,
         "panel":"Mage Solar : Powertec Plus 250-6 PL",
         "series":1,
         "parallel":1,
         "scale":36
         }
         ]}"""
     js1 = json.loads(p1)
     plant1 = pv.json_system(js1)
     rs1 = plant1.model()
     self.assertAlmostEquals(rs1.annual_output, 9098.56)
示例#11
0
文件: unit.py 项目: lyuyfshi/solpy
 def test_hourlyShading(self):
     p1 = """{"system_name":"Another Happy Customer",
     "zipcode":"44654",
     "tilt":25,
     "azimuth":180,
     "phase":1,
     "voltage":240,
     "shade":{"0": [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.1, 1.0, 1.0, 1.0, 1.0, 0.5, 0.0, 0.0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 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.9, 1.0, 0.1, 0.0, 0.1, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], "10": [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.4, 1.0, 1.0, 1.0, 1.0, 0.8, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], "11": [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.1, 1.0, 1.0, 0.2, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]},
     "array":[
         {"inverter":"Enphase Energy: M215-60-2LL-S2x-IG-NA (240 V) 240V",
         "derate":0.98,
         "panel":"Mage Solar : Powertec Plus 250-6 PL",
         "series":1,
         "parallel":1,
         "scale":36
         }
         ]}"""
     js1 = json.loads(p1)
     plant1 = pv.json_system(js1)
     rs1 = plant1.model()
     self.assertAlmostEquals(rs1.annual_output, 9098.56)
示例#12
0
 def test_virr1(self):
     import datetime
     p1 = """{"system_name":"HAPPY CUSTOMER",
     "address":"15013 Denver W Pkwy, Golden, CO",
     "zipcode":"80401",
     "phase":1,
     "voltage":240,
     "array":[
         {"inverter":"Enphase Energy: M215-60-2LL-S2x-IG-NA (240 V) 240V",
         "panel":"Mage Solar : Powertec Plus 250-6 PL",
         "quantity":20,
         "azimuth":180,
         "tilt":25
         }
         ]}"""
     plant = pv.json_system(json.loads(p1))
     ts = datetime.datetime(2000, 9, 22, 19)
     weatherData = {}
     weatherData['temperature'] = 25
     weatherData['windSpeed'] = 0
     virrRec = plant.virr(2000, ts, weatherData)
     self.assertAlmostEquals(virrRec['girr'], 437.0)
示例#13
0
文件: unit.py 项目: lyuyfshi/solpy
 def test_virr1(self):
     import datetime
     p1 = """{"system_name":"HAPPY CUSTOMER",
     "address":"15013 Denver W Pkwy, Golden, CO",
     "zipcode":"80401",
     "phase":1,
     "voltage":240,
     "array":[
         {"inverter":"Enphase Energy: M215-60-2LL-S2x-IG-NA (240 V) 240V",
         "panel":"Mage Solar : Powertec Plus 250-6 PL",
         "quantity":20,
         "azimuth":180,
         "tilt":25
         }
         ]}"""
     plant = pv.json_system(json.loads(p1))
     ts = datetime.datetime(2000, 9, 22, 19)
     weatherData = {}
     weatherData['temperature'] = 25
     weatherData['windSpeed'] = 0
     virrRec = plant.virr(2000, ts, weatherData)
     self.assertAlmostEquals(virrRec['girr'], 437.0)
示例#14
0
    rc = call(cmd)
    return rc

if __name__ == "__main__":  # pragma: no cover
    import argparse
    import json
    PARSER = argparse.ArgumentParser(description="Model a PV system. " \
            "Currently displays annual output and graph")
    PARSER.add_argument('-f', '--file')
    ARGS = vars(PARSER.parse_args())
    try:
        #start program
        JSON_P = json.loads(open(ARGS['file']).read())
        if 'address' in JSON_P:
            print '%s - %s %s' % \
                (JSON_P['system_name'].upper(), JSON_P['address'], \
                JSON_P['zipcode'])
        PLANT = pv.json_system(JSON_P)
        if "run" in JSON_P:
            string_notes(PLANT, JSON_P["run"])
        else:

            string_notes(PLANT)
        #graph = plant.model()
        #graph.savefig('pv_output_%s.png' % plant.zipcode)

    except (KeyboardInterrupt, SystemExit):
        sys.exit(1)
    except:
        raise
示例#15
0
            0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]}
            }"""

    PARSER = argparse.ArgumentParser(description='Design a PV system')
    PARSER.add_argument('-f', '--file')
    PARSER.add_argument('-t', '--test', action='store_true')
    ARGS = vars(PARSER.parse_args())
    if not ARGS['test'] or ARGS['file']:
        PARSER.print_help()
        sys.exit(1)

    try:
        #start program
        if ARGS['test']:
            REQS = TEST
        if ARGS['file']:
            REQS = open(ARGS['file']).read()

        for proposed_d in design(json.loads(REQS)):
            proposed_plant = pv.json_system(proposed_d)
            logger.info(json.dumps(proposed_plant.dump(), sort_keys=True, \
                    indent=4, separators=(',', ': ')))
            logger.info(proposed_d['algorithm'])
            if proposed_d['array']:
                expedite.string_notes(proposed_plant, 1)

    except (KeyboardInterrupt, SystemExit):
        sys.exit(1)
    except:
        raise
示例#16
0
    return rc


if __name__ == "__main__":  # pragma: no cover
    import argparse
    import json
    PARSER = argparse.ArgumentParser(description="Model a PV system. " \
            "Currently displays annual output and graph")
    PARSER.add_argument('-f', '--file')
    ARGS = vars(PARSER.parse_args())
    try:
        #start program
        JSON_P = json.loads(open(ARGS['file']).read())
        if 'address' in JSON_P:
            print '%s - %s %s' % \
                (JSON_P['system_name'].upper(), JSON_P['address'], \
                JSON_P['zipcode'])
        PLANT = pv.json_system(JSON_P)
        if "run" in JSON_P:
            string_notes(PLANT, JSON_P["run"])
        else:

            string_notes(PLANT)
        #graph = plant.model()
        #graph.savefig('pv_output_%s.png' % plant.zipcode)

    except (KeyboardInterrupt, SystemExit):
        sys.exit(1)
    except:
        raise