def NewtonMethodAclineMonCalcResult_Fun(self, *args):
        #点击理论线损
        self.driver.find_element_by_id(self.LineLoss_ID).click()
        time.sleep(1)
        #点击输电网计算结果查询
        self.driver.find_element_by_xpath(
            self.WholelossCalcResultQuery_Xpath).click()
        time.sleep(1)
        #点击月报表
        self.driver.find_element_by_xpath(self.MonCalcResult_Xpath).click()
        time.sleep(1)
        #点击导线损耗表
        self.driver.find_element_by_xpath(self.AclineLossResult_Xpath).click()
        time.sleep(5)

        #切换到报表的frame
        self.driver.switch_to_frame(self.AclineLossResultIframe_ID)

        #点击查询
        self.driver.find_element_by_id(self.Query_ID).click()
        time.sleep(5)
        #点击导出
        self.driver.find_element_by_id(self.Export_ID).click()
        time.sleep(5)
        self.data_file = u'C:\\Users\\' + GetUsername(
        ) + u'\\Downloads\\导线损耗月报表.xls'
        self.sheetname = u'导线损耗月报表'
        self.Excel = ExcelData(self.data_file, self.sheetname)
        self.Excel_Data = self.Excel.readExcel()
        #print self.Excel_Data
        return self.Excel_Data
 def DistrictEleQuamonWirecalcResult_Fun(self):
     # 点击理论线损计算
     self.driver.find_element_by_id(self.TheoreticalLineLoss_ID).click()
     time.sleep(2)
     # 点击配电线路计算结果查询
     self.driver.find_element_by_xpath(self.TheoreticalLineLossManualcal_Xpath).click()
     time.sleep(2)
     # 点击月报表
     self.driver.find_element_by_xpath(self.DistributionLineMonthlyReport_Xpath).click()
     time.sleep(2)
     # 点击台区线路线损表
     self.driver.find_element_by_xpath(self.LinelosswireofDistrict_Xpath).click()
     time.sleep(2)
     #切换到结果frame
     self.driver.switch_to_frame(self.TheoreticalwireResult_frame)
     time.sleep(5)
     self.driver.implicitly_wait(30)
     ##点击电表损耗链接
     self.driver.find_element_by_xpath(self.Transformerwire_Xpath).click()
     time.sleep(5)
     self.driver.switch_to.parent_frame()
     ## 跳出当前iframe
     self.driver.implicitly_wait(10)
     ##切换到变压器损耗明细结果frame
     self.driver.switch_to_frame(self.DistrictCalcResult_frame)
     self.driver.implicitly_wait(30)
     # 导出按钮id
     self.driver.find_element_by_id(self.export_id).click()
     time.sleep(10)
     self.data_path = u'C:\\Users\\'+GetUsername()+u'\\Downloads\\低压台区导线损耗报表(月).xls'
     self.sheetname = u'低压台区导线损耗报表(月)'
     self.Excel = ExcelData(self.data_path, self.sheetname)
     self.ExcelDataa = self.Excel.readExcel()
     return self.ExcelDataa
예제 #3
0
 def DistributionlineVoluMonthCalcResult_Fun(self):
     # 点击理论线损树
     time.sleep(1)
     self.driver.find_element_by_id(
         self.DistributionlineLossTree_id).click()
     # 点击配电网计算结果查询
     time.sleep(1)
     self.driver.find_element_by_xpath(
         self.TheoreticalLineLossCalResult_Xpath).click()
     time.sleep(1)
     # 点击月报表
     self.driver.find_element_by_xpath(
         self.DistributionLineMonthlyReport_Xpath).click()
     time.sleep(1)
     # 点击配电线路线损表
     self.driver.find_element_by_xpath(
         self.LinelossmeterDistributionline_Xpath).click()
     time.sleep(1)
     # 切换frame到配电线路线损表frame
     self.driver.switch_to.frame(self.DistributionLineCalcResult_frame)
     time.sleep(1)
     # 点击左下方的导出按钮
     self.driver.find_element_by_id(self.Export_id).click()
     time.sleep(10)
     #读取导出文件execl内容,生成列表返回
     self.ExportExecl = ExcelData(
         u"C:\\Users\\" + GetUsername() + u"\\Downloads\\配电线路损耗报表(月).xls",
         u"配电线路损耗报表(月)")
     return self.ExportExecl.readExcel()
 def DistributionlineEleQuamoncalcResult_Fun(self):
     '''620kv月电量法计算结果验证'''
     #点击理论线损
     self.driver.find_element_by_id(self.TheoreticalLineLoss_ID).click()
     time.sleep(2)
     #点击配电线路计算结果查询xpath
     self.driver.find_element_by_xpath(
         self.TheoreticalLineLossManualcal_Xpath).click()
     time.sleep(2)
     #点击配线月报表
     self.driver.find_element_by_xpath(
         self.DistributionLineMonthlyReport_Xpath).click()
     time.sleep(2)
     #点击配电线路线损表
     self.driver.find_element_by_xpath(
         self.Linelossmeterofdistributionline_Xpath).click()
     time.sleep(2)
     #切换到结果frame
     self.driver.switch_to_frame(self.DistributionLineCalcResult_frame)
     self.driver.implicitly_wait(30)
     #点击导出按钮
     self.driver.find_element_by_id(self.Daochu_id).click()
     time.sleep(10)
     self.data_path = u'C:\\Users\\' + GetUsername(
     ) + u'\\Downloads\\配电线路损耗报表(月).xls'
     self.sheetname = u'配电线路损耗报表(月)'
     self.Excel = ExcelData(self.data_path, self.sheetname)
     self.ExcelDataa = self.Excel.readExcel()
     #return json.dumps(self.ExcelDataa, encoding="UTF-8", ensure_ascii=False)
     return self.ExcelDataa
     '''for i in range(self.BeginNum,self.EndNum):
예제 #5
0
 def DistrictEleQuamoncalcResult_Fun(self):
     '''400V月电量法计算结果验证'''
     #点击理论线损
     self.driver.find_element_by_id(self.TheoreticalLineLoss_ID).click()
     time.sleep(2)
     #点击配电线路计算结果查询xpath
     self.driver.find_element_by_xpath(
         self.TheoreticalLineLossManualcal_Xpath).click()
     time.sleep(2)
     #点击配线月报表
     self.driver.find_element_by_xpath(
         self.DistributionLineMonthlyReport_Xpath).click()
     time.sleep(2)
     #点击台区线路线损表
     self.driver.find_element_by_xpath(
         self.LinelossmeterofDistrict_Xpath).click()
     time.sleep(2)
     #切换到结果frame
     self.driver.switch_to_frame(self.DistrictCalcResult_frame)
     #self.driver.implicitly_wait(30)
     time.sleep(4)
     # a=self.driver.find_element_by_id(self.export_id).text
     # print  a
     #点击导出按钮
     self.driver.find_element_by_id(self.export_id).click()
     time.sleep(5)
     self.data_path = u'C:\\Users\\' + GetUsername(
     ) + u'\\Downloads\\低压台区损耗表报表(月).xls'
     self.sheetname = u'低压台区损耗表报表(月)'
     self.Excel = ExcelData(self.data_path, self.sheetname)
     self.ExcelDataa = self.Excel.readExcel()
     #return json.dumps(self.ExcelDataa, encoding="UTF-8", ensure_ascii=False)
     return self.ExcelDataa
    def NewtonMethodWholelossDayVoltCalcResult_Fun(self, *args):
        #点击理论线损
        self.driver.find_element_by_id(self.LineLoss_ID).click()
        time.sleep(1)
        #点击输电网计算结果查询
        self.driver.find_element_by_xpath(
            self.WholelossCalcResultQuery_Xpath).click()
        time.sleep(1)
        #点击日报表
        self.driver.find_element_by_xpath(self.DayCalcResult_Xpath).click()
        time.sleep(1)
        #点击输电网分压线损表
        self.driver.find_element_by_xpath(
            self.WholelossDayVoltCalcResult_Xpath).click()
        time.sleep(5)

        #切换到报表的frame
        self.driver.switch_to_frame(self.WholelossDayVoltCalcResultIframe_ID)
        #点击导出
        self.driver.find_element_by_id(self.Export_ID).click()
        time.sleep(5)
        self.data_file = u'C:\\Users\\' + GetUsername(
        ) + u'\\Downloads\\全网分电压损耗报表(日).xls'
        self.sheetname = u'全网分电压损耗报表(日)'
        self.Excel = ExcelData(self.data_file, self.sheetname)
        self.Excel_Data = self.Excel.readExcel()
        #print self.Excel_Data
        return self.Excel_Data
    def NewtonMethodWholeLossAnalysisDayTrans_Fun(self,*args):
        #点击线损分析
        self.driver.find_element_by_id(self.LineLossAnalysis_ID).click()
        time.sleep(1)
        #点击输电网结果分析
        self.driver.find_element_by_xpath(self.WholeLossResultAnalysis_xpath).click()
        time.sleep(1)
        #点击日分析
        self.driver.find_element_by_xpath(self.MonAnalysis_xpath).click()
        time.sleep(1)
        #点击输电网综合分析
        self.driver.find_element_by_xpath(self.WholeLossAnalysis_xpath).click()
        time.sleep(5)

        #切换到报表的frame
        self.driver.switch_to_frame(self.WholelossAnalysisIframe_ID)
        #点击查询
        self.driver.find_element_by_id(self.Query_ID).click()
        time.sleep(5)
        #点击导线追溯链接
        self.driver.find_element_by_xpath(self.Trans_xpath).click()
        time.sleep(5)
        self.driver.switch_to.parent_frame()
        #切换Iframe
        self.driver.switch_to_frame(self.TransIframe_ID)
        #点击导出
        self.driver.find_element_by_id(self.Export_ID).click()
        time.sleep(5)
        self.data_file=u'C:\\Users\\'+GetUsername()+ u'\\Downloads\\输电网高损变压器分析(日).xls'
        self.sheetname=u'输电网高损变压器分析(日)'
        self.Excel=ExcelData(self.data_file,self.sheetname)
        self.Excel_Data=self.Excel.readExcel()
        #print self.Excel_Data
        return self.Excel_Data
예제 #8
0
    def NewtonMethodTransAnalysisMonRetrospect_Fun(self,*args):
        #点击线损分析
        self.driver.find_element_by_id(self.LineLossAnalysis_ID).click()
        time.sleep(1)
        #点击输电网结果分析
        self.driver.find_element_by_xpath(self.WholeLossResultAnalysis_xpath).click()
        time.sleep(1)
        #点击月分析
        self.driver.find_element_by_xpath(self.MonAnalysis_xpath).click()
        time.sleep(1)
        #点击变压器经济运行分析
        self.driver.find_element_by_xpath(self.TransAnalysis_xpath).click()
        time.sleep(5)

        #切换到报表的frame
        self.driver.switch_to_frame(self.TransAnalysisIframe_ID)
        time.sleep(1)
        #激活月份选择框
        self.driver.find_element_by_id(self.Month_ID).click()
        time.sleep(1)
        #选择2015
        self.driver.find_element_by_xpath(self.Year_xpath).click()
        time.sleep(1)
        #选择八月
        self.driver.find_element_by_xpath(self.Month_xpath).click()
        time.sleep(1)
        #点击确定
        self.driver.find_element_by_id(self.ConfirmButton_ID).click()
        time.sleep(1)

        #点击查询
        self.driver.find_element_by_id(self.Query_ID).click()
        time.sleep(5)
        #点击重载变追溯链接
        self.driver.find_element_by_xpath(self.TransRetrospect_xpath).click()
        time.sleep(5)
        self.driver.switch_to.parent_frame()
        #切换Iframe
        self.driver.switch_to_frame(self.TransRetrospect_Iframe)
        #点击导出
        self.driver.find_element_by_id(self.Export_ID).click()
        time.sleep(5)
        self.data_file=u'C:\\Users\\'+GetUsername()+ u'\\Downloads\\输电网变压器损耗明细(月)-重载变.xls'
        self.sheetname=u'输电网变压器损耗明细(月)-重载变'
        self.Excel=ExcelData(self.data_file,self.sheetname)
        self.Excel_Data=self.Excel.readExcel()
        #print self.Excel_Data
        return self.Excel_Data
 def TranotherlosshourCalcResult_Fun(self):
     #进入理论线损模块
     self.driver.find_element_by_id(self.TheoreticalLineLoss_ID).click()
     time.sleep(2)
     #进入输电网计算结果查询
     self.driver.find_element_by_xpath(
         self.TranotherlossManualcal_Xpath).click()
     time.sleep(2)
     #进入整点报表
     self.driver.find_element_by_xpath(
         self.TranotherlosshourReport_Xpath).click()
     time.sleep(2)
     #进入其他损耗表
     self.driver.find_element_by_xpath(
         self.TranotherlosshourCalcResult_Xpath).click()
     time.sleep(5)
     #进入查询frame框
     self.driver.switch_to_frame(self.TranotherlosshourCalcResult_frame)
     time.sleep(3)
     #打开日期控件
     self.driver.find_element_by_id(self.Day_box_xpath).click()
     time.sleep(2)
     #选择20140801
     self.driver.find_element_by_xpath(self.DayResult_xpath).click()
     time.sleep(2)
     #选择零点
     self.driver.find_element_by_id(self.ZeroHour_ID).clear()
     time.sleep(2)
     self.driver.find_element_by_id(self.ZeroHour_ID).send_keys('0')
     time.sleep(2)
     #点击日期控件确定
     self.driver.find_element_by_id(self.DayQueding_id).click()
     time.sleep(2)
     #点击查询
     self.driver.find_element_by_id(self.Chaxun_id).click()
     time.sleep(3)
     #点击导出
     self.driver.find_element_by_id(self.Daochu_id).click()
     time.sleep(10)
     self.data_file = u'C:\\Users\\' + GetUsername(
     ) + u'\\Downloads\\输电网其他损耗报表(小时).xls'
     self.sheetname = u'输电网其他损耗报表(小时)'
     self.Excel = ExcelData(self.data_file, self.sheetname)
     self.Excel_Data = self.Excel.readExcel()
     #print self.Excel_Data
     return self.Excel_Data
    def NewtonMethodLosspartVoltHourCalcResult_Fun(self, *args):
        #点击理论线损
        self.driver.find_element_by_id(self.LineLoss_ID).click()
        time.sleep(1)
        #点击输电网计算结果查询
        self.driver.find_element_by_xpath(
            self.WholelossCalcResultQuery_Xpath).click()
        time.sleep(1)
        #点击整点报表
        self.driver.find_element_by_xpath(self.HourCalcResult_Xpath).click()
        time.sleep(1)
        #点击分片分压线损表
        self.driver.find_element_by_xpath(
            self.LossPartVoltResult_Xpath).click()
        time.sleep(5)

        #切换到报表的frame
        self.driver.switch_to_frame(self.LossPartVoltResultIframe_ID)
        #选择开始时间
        self.driver.find_element_by_xpath(self.StartTimeWindow_xpath).click()
        time.sleep(0.2)
        self.driver.find_element_by_xpath(self.StartTimeDate_xpath).click()
        time.sleep(0.2)
        for i in range(0, 23):
            self.driver.find_element_by_id(self.StartTimeAdjust_ID).click()
            i = i + 1
            time.sleep(0.1)
        time.sleep(0.2)
        self.driver.find_element_by_xpath(self.StartTimeButton_xpath).click()

        #点击查询
        self.driver.find_element_by_id(self.Query_ID).click()
        time.sleep(5)
        #点击导出
        self.driver.find_element_by_id(self.Export_ID).click()
        time.sleep(5)
        self.data_file = u'C:\\Users\\' + GetUsername(
        ) + u'\\Downloads\\全网分片分压线损报表(小时).xls'
        self.sheetname = u'全网分片分压线损报表(小时)'
        self.Excel = ExcelData(self.data_file, self.sheetname)
        self.Excel_Data = self.Excel.readExcel()
        #print self.Excel_Data
        return self.Excel_Data
 def DistAclinesegeEleQuaMonCalResult_Fun(self):
     '''导线损耗表链接页面结果验证'''
     #点击理论线损计算
     self.driver.find_element_by_id(self.TheoreticalLineLoss_ID).click()
     time.sleep(2)
     #点击配电线路计算结果查询
     self.driver.find_element_by_xpath(
         self.TheoreticalLineLossManualcalResult_Xpath).click()
     time.sleep(2)
     #点击月报表
     self.driver.find_element_by_xpath(
         self.TheoreticalLineloss620kVMonth_Xpath).click()
     time.sleep(2)
     #点击配电线路线损表
     self.driver.find_element_by_xpath(self.WiringReport_Xpath).click()
     time.sleep(2)
     ###切换到结果frame
     self.driver.switch_to_frame(self.TheoreticalLinelossResult_frame)
     time.sleep(2)
     self.driver.implicitly_wait(30)
     ##点击导线损耗链接
     self.driver.find_element_by_xpath(self.WireLosslj_Xpath).click()
     time.sleep(3)
     self.driver.switch_to.parent_frame()  ## 跳出当前iframe
     self.driver.implicitly_wait(10)
     ##切换到导线结果frame
     self.driver.switch_to_frame(self.WireCalculateResult_frame)
     self.driver.implicitly_wait(30)
     #导出按钮id
     self.driver.find_element_by_id(self.Daochu_ID).click()
     time.sleep(10)
     self.data_path = u'C:\\Users\\' + GetUsername(
     ) + u'\\Downloads\\配电线路导线损耗报表(月).xls'
     self.sheetname = u'配电线路导线损耗报表(月)'
     self.Excel = ExcelData(self.data_path, self.sheetname)
     self.ExcelDataa = self.Excel.readExcel()
     return self.ExcelDataa
예제 #12
0
 def DistributionlineVoluDayCalcTransLoss_Fun(self):
     # 点击理论线损树
     time.sleep(1)
     self.driver.find_element_by_id(
         self.DistributionlineLossTree_id).click()
     # 点击配电网计算结果查询
     time.sleep(1)
     self.driver.find_element_by_xpath(
         self.TheoreticalLineLossCalResult_Xpath).click()
     time.sleep(1)
     # 点击月报表
     self.driver.find_element_by_xpath(
         self.DistributionLineDaylyReport_Xpath).click()
     time.sleep(1)
     # 点击配电线路线损表
     self.driver.find_element_by_xpath(
         self.LinelossmeterDistributionline_Xpath).click()
     time.sleep(1)
     # 切换frame到配电线路线损表frame
     self.driver.switch_to.frame(self.DistributionLineCalcResult_frame)
     self.driver.implicitly_wait(30)
     #点击变压器损耗的连接
     self.driver.find_element_by_xpath(self.TransLossLink_Path).click()
     time.sleep(1)
     #切换到变压器损耗的frame中
     self.driver.switch_to.parent_frame()
     time.sleep(1)
     self.driver.switch_to.frame(self.TransLossFrame_id)
     time.sleep(1)
     # 点击左下方的导出按钮
     self.driver.find_element_by_id(self.Export_id).click()
     time.sleep(10)
     #读取导出文件execl内容,生成列表返回
     self.ExportExecl = ExcelData(
         u"C:\\Users\\" + GetUsername() + u"\\Downloads\\配电变压器损耗表报表(日).xls",
         u"配电变压器损耗表报表(日)")
     return self.ExportExecl.readExcel()
 def DistTransformerEleQuaDayCalResult_Fun(self):
     '''配电日电量法变压器损耗表链接页面结果验证'''
     #点击理论线损计算
     self.driver.find_element_by_id(self.TheoreticalLineLoss_ID).click()
     time.sleep(2)
     #点击配电线路计算结果查询
     self.driver.find_element_by_xpath(
         self.TheoreticalLineLossManualcalResult_Xpath).click()
     time.sleep(2)
     #点击月报表
     self.driver.find_element_by_xpath(
         self.TheoreticalLineloss620kVMonth_Xpath).click()
     time.sleep(2)
     #点击配电线路线损表
     self.driver.find_element_by_xpath(self.WiringReport_Xpath).click()
     time.sleep(2)
     ###切换到结果frame
     self.driver.switch_to_frame(self.TheoreticalLinelossResult_frame)
     time.sleep(2)
     self.driver.implicitly_wait(30)
     ##点击变压器损耗链接
     self.driver.find_element_by_xpath(self.Transformerlosslj_Xpath).click()
     time.sleep(3)
     self.driver.switch_to.parent_frame()  ## 跳出当前iframe
     self.driver.implicitly_wait(10)
     ##切换到变压器损耗明细结果frame
     self.driver.switch_to_frame(self.TransformerlossCalcResult_frame)
     self.driver.implicitly_wait(30)
     #导出按钮id
     self.driver.find_element_by_id(self.Daochu_ID).click()
     time.sleep(10)
     self.data_path = u"C:\\Users\\" + GetUsername(
     ) + u"\\Downloads\\配电变压器损耗表报表(日).xls"
     self.sheetname = u'配电变压器损耗表报表(日)'
     self.Excel = ExcelData(self.data_path, self.sheetname)
     self.ExcelDataa = self.Excel.readExcel()
     return self.ExcelDataa
예제 #14
0
import pandas as pd
import operator
import numpy
from pandas import Series,DataFrame

class ExcelData:
    def __init__(self,data_path):
        self.data_path=data_path
    def readExcel(self):
        book = xlrd.open_workbook(self.data_path,encoding_override='gbk')
        L=[]
        for sheet in book.sheets():
            df = pd.read_excel(self.data_path,sheet.name,index_col = None,na_values= ['9999'])
            #df = pd.read_excel(self.data_path,sheet.name,index_col = 0)
            pd.set_option('display.width',None)
            #pd.set_option('expand_frame_repr',False)
            df1=df.head()
            df2 = numpy.array(df1).tolist()
            L.append(df2)
        return L

if __name__=='__main__':
    data_path=u'C:\\Users\\'+GetUsername()+u'\\Downloads\\低压台区综合分析报表(月).xls'
    get_data=ExcelData(data_path)
    print(get_data.readExcel())
    data_path1 = u'C:\\Users\\'+GetUsername()+u'\\Downloads\\低压台区综合分析报表(月) (1).xls'
    get_data1 = ExcelData(data_path1)
    print(get_data1.readExcel())
    result = operator.eq(get_data,get_data1)
    print(result)
예제 #15
0
     可以通过'Image.open(path)'进行创建。
     'size' 重新将 image 对象的尺寸进行重置,默认大小为256 * 256 .
     'part_size' 定义了分割图片的大小.默认大小为64*64 .
     返回值是 'image1' 和 'image2'对比后的相似度,相似度越高,图片越接近,达到100.0说明图片完全相同。
    '''
    img1 = image1.resize(size).convert("RGB")
    sub_image1 = split_image(img1, part_size)

    img2 = image2.resize(size).convert("RGB")
    sub_image2 = split_image(img2, part_size)

    sub_data = 0
    for im1, im2 in zip(sub_image1, sub_image2):
        sub_data += calculate(im1, im2)

    x = size[0] / part_size[0]
    y = size[1] / part_size[1]

    pre = round((sub_data / (x * y)), 6)
    print(pre * 100)
    return pre * 100


if __name__ == '__main__':
    data_path = u'C:\\Users\\' + GetUsername(
    ) + u'\\Downloads\\低压台区综合分析历史数据图表(月).png'
    data_path1 = u'C:\\Users\\' + GetUsername(
    ) + u'\\Downloads\\低压台区综合分析历史数据图表(月) 1.png'
    image1 = Image.open(data_path)
    image2 = Image.open(data_path1)
    classfiy_histogram_with_split(image1, image2)