示例#1
0
def doall(dicufile, bndryfile):
    sum = net_dicu(dicufile, [334, 333, 332, 331, 330])
    pathname = sum.getPathname().toString()
    pathname = set_part(pathname, 'NET_DICU_NORTH_OF_FREEPORT',
                        Pathname.B_PART)
    pathname = set_part(pathname, 'FLOW', Pathname.C_PART)
    writedss(dicufile, pathname, sum.getData())
示例#2
0
def doall(dicufile, bndryfile):
    sum = net_dicu(dicufile, [335, 336, 337, 338, 339, 340, 341, 342])
    pathname = sum.getPathname().toString()
    pathname = set_part(pathname, 'NET_DICU_RSAC155_TO_RSAC128',
                        Pathname.B_PART)
    pathname = set_part(pathname, 'FLOW', Pathname.C_PART)
    writedss(dicufile, pathname, sum.getData())
def compare_dss_files(file1, file2, showPlot=False, outputFile=None, outputPathFile=None):
    """
    Simply compares the files and outputs differences if any of those that differ and lists mismatching pathnames in either
    """
    g1 = vutils.opendss(file1)
    g2 = vutils.opendss(file2)
    print 'Comparing %s to %s' % (file1, file2)
    print '%12s\t%32s' % ('DIFFERENCE', 'PATHNAME')
    if outputPathFile:
        opf_handle=open(outputPathFile, 'wb')
        opf = csv.writer(opf_handle, delimiter=",", quotechar='"', quoting=csv.QUOTE_MINIMAL)
        opf.writerow([file1,file2])
    no_diff=True
    for ref1 in g1:
        p1 = ref1.pathname
        found = False
        for ref2 in g2:
            p2 = ref2.pathname
            if matches(p1, p2):
                found = True
                diff = ref2.data - ref1.data
                absdiff = diff.createSlice(diff.getTimeWindow())
                vtimeseries.apply(absdiff, math.fabs)
                diff_total = vtimeseries.total(absdiff)
                if (diff_total > 1e-06) :
                    no_diff=False
                    if showPlot: plot(ref1.data, ref2.data)
                    print '%10.2f\t%32s' % (diff_total, p1)
                    if outputFile:
                        diffp = set_part(p1, 'DIFF-%s-%s' % (os.path.basename(file1), os.path.basename(file2)), Pathname.A_PART)
                        writedss(outputFile, str(diffp), diff)
                    if outputPathFile:
                        opf.writerow([p1, p1, diff_total])
                break
        if (not found):
            no_diff=False
            print 'No matching path: %s in file %s NOT found in file %s' % (p1, file1, file2)
            if outputPathFile: opf.writerow([p1, "", "M"])
    for ref2 in g2:
        p2 = ref2.pathname
        found = False
        for ref1 in g1:
            p1 = ref1.pathname
            if matches(p1, p2):
                found = True
                break
        if (not found):
            no_diff=False
            print 'No matching path: %s in file %s NOT found in file %s' % (p2, file2, file1)
            if outputPathFile: opf.writerow(["", p2, "M"])
    if no_diff:
        print 'NO DIFFERENCE ACROSS ENTIRE FILEs %s and %s'%(file1,file2)
    if outputPathFile: opf_handle.close()
def doall(dicufile,bndryfile):
    sum=net_dicu(dicufile,[334,333,332,331,330])
    pathname=sum.getPathname().toString()
    pathname=set_part(pathname,'NET_DICU_NORTH_OF_FREEPORT',Pathname.B_PART)
    pathname=set_part(pathname,'FLOW',Pathname.C_PART)
    writedss(dicufile,pathname,sum.getData())
def doall(dicufile,bndryfile):
    sum=net_dicu(dicufile,[335,336,337,338,339,340,341,342])
    pathname=sum.getPathname().toString()
    pathname=set_part(pathname,'NET_DICU_RSAC155_TO_RSAC128',Pathname.B_PART)
    pathname=set_part(pathname,'FLOW',Pathname.C_PART)
    writedss(dicufile,pathname,sum.getData())
示例#6
0
def compare_dss_files(file1,
                      file2,
                      showPlot=False,
                      outputFile=None,
                      outputPathFile=None):
    """
    Simply compares the files and outputs differences if any of those that differ and lists mismatching pathnames in either
    """
    g1 = vutils.opendss(file1)
    g2 = vutils.opendss(file2)
    print 'Comparing %s to %s' % (file1, file2)
    print '%12s\t%32s' % ('DIFFERENCE', 'PATHNAME')
    if outputPathFile:
        opf_handle = open(outputPathFile, 'wb')
        opf = csv.writer(opf_handle,
                         delimiter=",",
                         quotechar='"',
                         quoting=csv.QUOTE_MINIMAL)
        opf.writerow([file1, file2])
    no_diff = True
    for ref1 in g1:
        p1 = ref1.pathname
        found = False
        for ref2 in g2:
            p2 = ref2.pathname
            if matches(p1, p2):
                found = True
                diff = ref2.data - ref1.data
                absdiff = diff.createSlice(diff.getTimeWindow())
                vtimeseries.apply(absdiff, math.fabs)
                diff_total = vtimeseries.total(absdiff)
                if (diff_total > 1e-06):
                    no_diff = False
                    if showPlot: plot(ref1.data, ref2.data)
                    print '%10.2f\t%32s' % (diff_total, p1)
                    if outputFile:
                        diffp = set_part(
                            p1, 'DIFF-%s-%s' %
                            (os.path.basename(file1), os.path.basename(file2)),
                            Pathname.A_PART)
                        writedss(outputFile, str(diffp), diff)
                    if outputPathFile:
                        opf.writerow([p1, p1, diff_total])
                break
        if (not found):
            no_diff = False
            print 'No matching path: %s in file %s NOT found in file %s' % (
                p1, file1, file2)
            if outputPathFile: opf.writerow([p1, "", "M"])
    for ref2 in g2:
        p2 = ref2.pathname
        found = False
        for ref1 in g1:
            p1 = ref1.pathname
            if matches(p1, p2):
                found = True
                break
        if (not found):
            no_diff = False
            print 'No matching path: %s in file %s NOT found in file %s' % (
                p2, file2, file1)
            if outputPathFile: opf.writerow(["", p2, "M"])
    if no_diff:
        print 'NO DIFFERENCE ACROSS ENTIRE FILEs %s and %s' % (file1, file2)
    if outputPathFile: opf_handle.close()