Example #1
0
    def __init__(self, feedername='feeder2'):
        """
        string of the file names
        """
        self.directory = os.getcwd()
        self.feedername = feedername
        self.cap_data = 'Cap Data.xls'
        self.distributed_load = 'Distriuted Load Data.xls'
        self.line_data = 'Line Data.xls'
        self.spot_load = 'Spot Load Data.xls'

        tmp = Line(self.directory + '/' + self.feedername + '/' +
                   self.line_data,
                   feedername)  #the node set is inferred from Line Data.xls
        self.node_set = tmp.node_set
        self.node_dict = tmp.node_dict

        tmp = Spot_Load(
            self.directory + '/' + self.feedername + '/' + self.spot_load,
            self.node_set, self.node_dict)
        tmp = Cap(self.directory + '/' + self.feedername + '/' + self.cap_data,
                  self.node_set, self.node_dict)

        #for n in self.node_set:
        #    print n
        #self.node_set[1].lower_control=np.array([-10j,-10j,-10j],dtype=complex)

        algorithm = Alg.Algorithm(self.node_set)
        pRes, dRes, exeTime, var, obj = algorithm.getResult()

        print "************Simulation Result*************"
        self.disp = Disp.Display(pRes, dRes, exeTime, var, obj,
                                 self.feedername)
        self.disp.plot_primalDualRes()
        self.disp.plot_normal_primalDualRes()
        self.disp.write_log()
Example #2
0
 def test_multiple_words(self):
     text = 'monthy python'
     result = Cap.cap_text(text)
     self.assertEqual(result, 'Monthy Python')
Example #3
0
 def test_one_word(self):  ##Define the methods to test your script
     text = 'python'
     result = Cap.cap_text(text)
     self.assertEqual(result, 'Python')
 def testOneWord(self):
     text = "python"
     result = Cap.capText(text)
     self.assertEqual(result, "Python")
 def testMultipleWords(self):
     text = "testing python"
     result = Cap.capText(text)
     self.assertEqual(result, "Testing Python")
Example #6
0
 def test_one_word(self):
     text = 'python'
     result = Cap.cap_word(text)
     self.assertEqual(result , 'Python')
Example #7
0
 def test_multiple_words(self):
     text = 'learn python'
     result = Cap.cap_word(text)
     self.assertEqual(result,'Monty Python')
Example #8
0
 def test_multiple_words(self):
     text = 'monty python'
     result2 = Cap.Cap_text(text)
     self.assertEqual(result2, 'Monty Python')
Example #9
0
# -*- coding:utf-8 -*-
import Cap
import FigureOut
import csv

import time
start=time.clock()

show_all = input("Do you want to show all pictures? Please edit 1(Yes) or 0(No):")
r1 = input("Please input R1:") #输入上一级的r1,l1,允许的最大错误
l1 = input("Please input L1:")
err_k = input("Please choose error. Please edit 1 or 2:")
err = input("Please input Max_error:") if show_all == 0 else float("inf")
count = input("Please input max number of cap:")

my_cap = Cap.CapList(count).final() #生成所有电容组合

print len(my_cap)
temp = []
for i in my_cap:
    name, c, r, l, num = i
    if num != 0 and err_k == 2:
        now_error = FigureOut.Myfigure(R1=r1, L1=l1, R2=r, C2=c, L2=l, Name=','.join(name), Num=num).error2(err)

        temp.append([now_error, name, c, r, l]) if now_error != False else None

    if num != 0 and err_k == 1:
        now_error = FigureOut.Myfigure(R1=r1, L1=l1, R2=r, C2=c, L2=l, Name=','.join(name), Num=num).error(err)
        #if now_error <= err:
        temp.append([now_error, name, c, r, l]) if now_error != False else None
temp = sorted(temp, cmp=lambda x,y:cmp(x[0],y[0]))