Esempio n. 1
0
def string_notes(system, run=0.0, stationClass = 1):
    """page 5"""

    name, usaf = geo.closestUSAF( geo.zipToCoordinates(system.zipcode), stationClass)
    mintemp = epw.minimum(usaf)
    twopercentTemp = epw.twopercent(usaf)
    ac_rated = 0.0
    dc_rated = 0.0
    for i in system.shape:
        dc_rated += i.array.Pmax
        try:
            if i.phase == 1:
                ac_rated += i.current * i.ac_voltage
            else:
                ac_rated += i.phase * i.current * i.ac_voltage/ 3**.5
        except:
            ac_rated += i.Paco
            pass
    notes = []
    notes.append("%s KW AC RATED" % round(ac_rated/1000.0,2))
    notes.append("%s KW DC RATED" % round(dc_rated/1000.0,2))
    #BUG: This doesn't work for unbalanced 3 phase
    if system.phase == 1:
        Aac = round(ac_rated/i.ac_voltage,1)
    else:
        Aac = round(ac_rated/i.ac_voltage/3**.5,1)
    notes.append( "System AC Output Current: %s A" % Aac)

    notes.append("Nominal AC Voltage: %s V" % i.ac_voltage)
    notes.append("")
    notes.append("Minimum Temperature: %s C" % mintemp)
    notes.append("2 Percent Max Temperature: %s C" % twopercentTemp)
    notes.append("Weather Source: %s %s" % (name, usaf))
    notes.append("")
    di, dp = system.describe()
    aMax = 0
    for i in system.shape:
        if dp.has_key(i.array.panel.model):
            notes.append( "PV Module Ratings @ STC")
            notes.append("Module Make: %s" % i.array.panel.make)
            notes.append("Module Model: %s" % i.array.panel.model)
            notes.append("Quantity: %s" % dp[i.array.panel.model])
            notes.append("Max Power-Point Current (Imp): %s A" % i.array.panel.Impp)
            notes.append("Max Power-Point Voltage (Vmp): %s V" % i.array.panel.Vmpp)
            notes.append("Open-Circuit Voltage (Voc): %s V" % i.array.panel.Voc)
            notes.append("Short-Circuit Current (Isc): %s A" % i.array.panel.Isc)
            notes.append("Maximum Power (Pmax): %s W" % round(i.array.panel.Pmax,1))
            #notes.append("Module Rated Max Voltage: %s V" % i.array.panel.Vrated)

            notes.append("")
            dp.pop(i.array.panel.model)
        if di.has_key(i.model):
            notes.append("Inverter Make: %s" % i.make)
            notes.append("Inverter Model: %s" % i.model)
            notes.append("Quantity: %s" % di[i.model])
            notes.append("Max Power: %s KW" % round(i.Paco/1000.0,1))
            #this is hack... This should be calculated based upon power cores
            if hasattr(i,'current'):
                notes.append("Max AC Current: %s A" % round(i.current,1))
            elif i.ac_voltage == 480:
                notes.append("Max AC Current: %s A" % round(i.Paco*1.0/i.ac_voltage/3**.5,1))
            else:
                notes.append("Max AC Current: %s A" % round(i.Paco*1.0/i.ac_voltage,1))
            #greater than 1 in parallel
            if len(i.array.shape) > 1:
                pass
                notes.append("DC Operating Current: %s A" % \
                        round(i.array.panel.Impp*len(i.array.shape),1))
                notes.append("DC Short Circuit Current: %s A" % \
                        round(i.array.panel.Isc*len(i.array.shape),1))
            #greater than 1 in series
            if max(i.array.shape)> 1:
                notes.append("DC Operating Voltage: %s V" % round(i.array.Vdc(),1))
                notes.append("System Max DC Voltage: %s V" % round(i.array.Vmax(mintemp),1))
                if i.array.Vmax(mintemp) > 600:
                    print "WARNING: Array exceeds 600V DC"
                notes.append("Pnom Ratio: %s" % round((i.array.Pmax/i.Paco),2))
                if (i.array.Vdc(twopercentTemp) *.9) < i.mppt_low:
                    print "WARNING: Array IV Knee drops out of Inverter range"
                if (i.array.Pmax/i.Paco) < 1.1:
                    print "WARNING: Array potentially undersized"
            notes.append("")
            di.pop(i.model)
        if i.array.Vmax(mintemp) > aMax:
            aMax = i.array.Vmax(mintemp)

    notes.append("Array Azimuth: %s Degrees" % system.azimuth)
    notes.append("Array Tilt: %s Degrees" % system.tilt)
    s9 = system.solstice(9)
    s15 = system.solstice(15)
    notes.append("December 21 9:00 AM Sun Azimuth: %s Degrees" % \
            (round(degrees(s9[1]),1)))
    notes.append("December 21 9:00 AM Sun Altitude: %s Degrees" % \
            (round(degrees(s9[0]),1)))
    notes.append("December 21 3:00 PM Sun Azimuth: %s Degrees" % \
            (round(degrees(s15[1]),1)))
    notes.append("December 21 3:00 PM Sun Altitude: %s Degrees" % \
            (round(degrees(s9[0]),1)))
    if 'geomag' in sys.modules:
        notes.append("Magnetic declination: %s Degrees" % \
                round(geomag.declination(dlat=system.place[0],dlon=system.place[1])))
    notes.append("Minimum Row space ratio: %s" % \
            round(system.minRowSpace(1.0),2))
    print "\n".join(notes)

    print ""
    print "Minimum Bundle"
    minC = vd.vd(Aac,5,verbose=False)
    try:
        ee.assemble(minC,Aac,conduit='STEEL')
        if run > 0:
            print "Long Run"
            minC = vd.vd(Aac,run,v=i.ac_voltage,tAmb=15,pf=.95,material='AL',verbose=False)
            ee.assemble(minC,Aac,conduit='PVC')
    except:
        print "Warning: Multiple sets of conductors"
    return notes
Esempio n. 2
0
def micro_calcs(system,d,Vnominal=240):
    """page 4"""
    print ""
    print vd.vd(sum([i.Paco for i in system.shape])/Vnominal,d)
    pass
Esempio n. 3
0
def act(ir, t, s):

    v = varix(ir, t)

    try:
        vc = ir.valcs(v)
    except:
        return "Illegal variable index: %d!" % v

    if isinstance(v, str): return v

    if len(t) == 1:
        try:
            l = int(t[0])
        except:
            if t[0] in ir.valcs.values:
                l = list(ir.values).index(t[0])
            else:
                return "Not good for value index or name: %s!" % l

        if not 0 <= l < vc:
            return "Illegal value index: %d!" % v
        e = [0.0] * vc
        e[l] = 1.0

    else:
        try:
            e = map(float, t)
            if len(e) != vc:
                return "Evidence vector of length %d expected (got %d)!" \
                       % (vc, len(e))
        except:
            return "Could not convert values to float!"

    bns = s['bn_o']

    # create bna twin

    vrc = len(ir.valcs.varnames)
    v2 = v + vrc
    vns2 = ir.valcs.varnames + tuple([vn + '*' for vn in ir.valcs.varnames])
    vls2 = ir.valcs.values + ir.valcs.values
    valcs2 = vd.vd(vns2, vls2)

    bn2 = bn.BN(2 * vrc)

    for (f, t) in bns.arcs():
        bn2.addarc((f, t))
        if bns.parents(f):
            bn2.addarc((f + vrc, t + vrc))
        else:
            bn2.addarc((f, t + vrc))

    # Now cut remove the arcs by action

    for p in bn2.parents(v2):
        bn2.delarc((p, v2))

    # create thta by bna

    tht2 = s['tht_o'][:] + s['tht_o'][:]
    tht2[v2] = {(): [1.0 / vc] * vc}

    # get inferer for the acted model

    needed = ['ifr_o']
    haved = {'bn_o': bn2, 'tht_o': tht2, 'vd_o': valcs2}
    inout.inout(needed, haved)
    ir2 = haved['ifr_o']

    s2 = s.copy()
    w2 = s2['watch'][:]
    for i in s['watch']:
        w2.append(i + vrc)
    s2['watch'] = w2

    print bn2.arcs()

    evidence(ir2, ["D", "1"], s2)
    ir2.insert_evidence(v2, e)
    infer(ir2, [], s2)
Esempio n. 4
0
File: ee.py Progetto: todun/solpy
    #print a.vd()
    #print b.vd()
    #print a.a
    #print "Voltage Drop"
    #print voltagedrop(w1, w1, b)
    print "resistance"
    print resistance(conductor("400","AL"),"STEEL",.77)
    print resistance(conductor("400","AL"),"STEEL","DC")
    print "transformer"
    t1 = transformer(1000000,8404,2143)
    print t1.output(0)
    print t1.output(500000)
    bund=  [conductor("400","AL"),conductor("400","AL"),conductor("6","CU"),conductor("6","CU")]
    print conductorArea(bund)
    print findConduit(conductorArea(bund))
    print "CU EGC", findEGC(conductor("400",'AL'),100)
    print "AL EGC", findEGC(conductor("400",'AL'),100,'AL')
    print "AL EGC", findEGC(conductor("1/0",'AL'),40)
    print "AL EGC", findEGC(conductor("1/0",'AL'),40,'AL')
    print "AL EGC", findEGC(conductor("1",'AL'),100)
    import vd
    cond = vd.vd(18,250,material='AL')
    print "found",cond
    print "EGC", findEGC(cond,18*1.25,'AL')
    print ocpSize(10.1)
    print ocpSize(9)
    print findConductor(.001)
    print conductorAmpacity(200,"CU")
    print checkAmpacity(cond, 20, ambient = 30)
Esempio n. 5
0
def string_notes(system, run=0.0):
    """page 5"""
    stationClass = 3
    name, usaf = geo.closestUSAF( geo.zipToCoordinates(system.zipcode), stationClass)
    mintemp = epw.minimum(usaf)
    twopercentTemp = epw.twopercent(usaf)
    ac_rated = 0
    dc_rated = 0
    for i in system.shape:
        dc_rated += i.array.Pmax
        ac_rated += i.Paco
    notes = []
    notes.append("%s KW AC RATED" % round(ac_rated/1000.0,2))
    notes.append("%s KW DC RATED" % round(dc_rated/1000.0,2))
    #BUG: This doesn't work for 3 phase
    if system.phase == 1:
        Aac = round(sum([i.Paco for i in system.shape])/i.ac_voltage,1)
    else:
        Aac = round(sum([i.Paco for i in system.shape])/i.ac_voltage/3**.5,1)
    notes.append( "System AC Output Current: %s A" % Aac)

    notes.append("Nominal AC Voltage: %s V" % i.ac_voltage)
    notes.append("")
    notes.append("Minimum Temperature: %s C" % mintemp)
    notes.append("2 Percent Max Temperature: %s C" % twopercentTemp)
    notes.append("")
    di, dp = system.describe()
    aMax = 0
    for i in system.shape:
        if dp.has_key(i.array.panel.model):
            notes.append( "PV Module Ratings @ STC")
            notes.append("Module Make: %s" % i.array.panel.make)
            notes.append("Module Model: %s" % i.array.panel.model)
            notes.append("Quantity: %s" % dp[i.array.panel.model])
            notes.append("Max Power-Point Current (Imp): %s A" % i.array.panel.Impp)
            notes.append("Max Power-Point Voltage (Vmp): %s V" % i.array.panel.Vmpp)
            notes.append("Open-Circuit Voltage (Voc): %s V" % i.array.panel.Voc)
            notes.append("Short-Circuit Current (Isc): %s A" % i.array.panel.Isc)
            notes.append("Maximum Power (Pmax): %s W" % round(i.array.panel.Pmax,1))
            #notes.append("Module Rated Max Voltage: %s V" % i.array.panel.Vrated)

            notes.append("")
            dp.pop(i.array.panel.model)
        if di.has_key(i.model):
            notes.append("Inverter Make: %s" % i.make)
            notes.append("Inverter Model: %s" % i.model)
            notes.append("Quantity: %s" % di[i.model])
            notes.append("Max Power: %s KW" % round(i.Paco/1000.0,1))
            #this is hack... This should be calculated based upon power cores
            if i.ac_voltage == 480:
                notes.append("Max AC Current: %s A" % round(i.Paco*1.0/i.ac_voltage/3**.5,1))
            else:
                notes.append("Max AC Current: %s A" % round(i.Paco*1.0/i.ac_voltage,1))
            #greater than 1 in parallel
            if len(i.array.shape) > 1:
                pass
                notes.append("DC Operating Current: %s A" % \
                        round(i.array.panel.Impp*len(i.array.shape),1))
                notes.append("DC Short Circuit Current: %s A" % \
                        round(i.array.panel.Isc*len(i.array.shape),1))
            #greater than 1 in series
            if max(i.array.shape)> 1:
                notes.append("DC Operating Voltage: %s V" % round(i.array.Vdc(),1))
                notes.append("System Max DC Voltage: %s V" % round(i.array.Vmax(mintemp),1))
                notes.append("Pnom Ratio: %s" % round((i.array.Pmax/i.Paco),2))
            notes.append("")
            di.pop(i.model)
        if i.array.Vmax(mintemp) > aMax:
            aMax = i.array.Vmax(mintemp)

    notes.append("Array Azimuth: %s Degrees" % system.azimuth)
    notes.append("Array Tilt: %s Degrees" % system.tilt)
    notes.append("December 21 9:00 AM Sun Azimuth: %s Degrees" % \
            int(round(degrees(system.solstice(9)[1]),0)))
    notes.append("December 21 3:00 PM Sun Azimuth: %s Degrees" % \
            int(round(degrees(system.solstice(15)[1]),0)))
    if sys.modules['geomag']:
        notes.append("Magnetic declination: %s Degrees" % \
                round(geomag.declination(dlat=system.place[0],dlon=system.place[1])))
    notes.append("Minimum Row space ratio: %s" % \
            round(system.minRowSpace(1.0),2))
    print "\n".join(notes)

    print ""
    print "Minimum Bundle"
    minC = vd.vd(Aac,5)
    ee.assemble(minC,Aac,conduit='STEEL')
    if run > 0:
        print "Long Run"
        minC = vd.vd(Aac,run,v=i.ac_voltage,tAmb=15,pf=.95,material='AL')
        ee.assemble(minC,Aac,conduit='PVC')
    return notes