Exemplo n.º 1
0
    def OnClick(self, event):
        """ Event bind to 'Generate' button """
        #Validation
        valid = self.validation()
        if valid == True:
            pass
        else:
            return None
	
	pyplot.close("all")
        filter_ = Filter(self.fp, self.fs, self.gpass, self.gstop, ftype=self.ftype, btype=self.btype)
        filter_.step_response()
        filter_.phase_response()
        filter_.poles_zeros() 
        filter_.freq_response()

        if self.ftype == "ellip":
            pass
        else:
            ladder = LCladder(self.R1, self.R2, self.fp, self.fs, self.gpass, self.gstop, ftype=self.ftype, btype=self.btype) 
            if filter_.btype == "lowpass":
                if self.R1 == self.R2:
                    lc_ladder_elements = ladder.load_matched()
                else:
                    lc_ladder_elements = ladder.load_not_matched()
                    
                scheme = Scheme(self.R1, self.R2, filter_.ord)
                scheme.design(lc_ladder_elements) 
                
                frame = wx.Frame(None, size=(scheme.img_size[0], 250))
                panel = SchemePanel(frame)
                frame.Show()
        pyplot.show()
Exemplo n.º 2
0
    def OnClick(self, event):
        """ Event bind to 'Generate' button """
        # Validation
        valid = self.validation()
        if valid == True:
            pass
        else:
            return None

        pyplot.close("all")
        filter_ = Filter(self.fp,
                         self.fs,
                         self.gpass,
                         self.gstop,
                         ftype=self.ftype,
                         btype=self.btype)
        filter_.step_response()
        filter_.phase_response()
        filter_.poles_zeros()
        filter_.freq_response()

        if self.ftype == "ellip":
            pass
        else:
            ladder = LCladder(self.R1,
                              self.R2,
                              self.fp,
                              self.fs,
                              self.gpass,
                              self.gstop,
                              ftype=self.ftype,
                              btype=self.btype)
            if filter_.btype == "lowpass":
                if self.R1 == self.R2:
                    lc_ladder_elements = ladder.load_matched()
                else:
                    lc_ladder_elements = ladder.load_not_matched()

                scheme = Scheme(self.R1, self.R2, filter_.ord)
                scheme.design(lc_ladder_elements)

                frame = wx.Frame(None, size=(scheme.img_size[0], 250))
                panel = SchemePanel(frame)
                frame.Show()
        pyplot.show()
Exemplo n.º 3
0
        """ Private method. Add element picture to scheme """
        if element == "cap":
            element = self.cap_copy
            element_label = "C" + str(m)
            print self.lc_ladder_elements
            element_label = element_label + "=" + str(self.lc_ladder_elements[element_label])
            print element_label
            pos = (self.width + 5, 150)
        elif element == "coil":
            element = self.coil_copy
            element_label = "L" + str(m)
            element_label = element_label + "=" + str(self.lc_ladder_elements[element_label])
            print element_label
            pos = (self.width, 35)
        else:
            raise Exception("Element not recognized!")
            sys.exit(1)
  
        self.img.paste(element, (self.width, 0))
        self.width = self.width + self.element_size[0]

        self.draw.text(pos, element_label, font=self.font, fill="black") 
   
if __name__ == "__main__":
    ladder = LCladder(1500.0, 222.0, 500, 700, 1.0, 20, 'butter', 'lowpass')
    lc_ladder_elements = ladder.load_not_matched()

    print lc_ladder_elements

    scheme = Scheme(ladder.R1, ladder.R2, 7)
    scheme.design(lc_ladder_elements)
Exemplo n.º 4
0
            element_label = "C" + str(m)
            print(self.lc_ladder_elements)
            element_label = element_label + "=" + str(
                self.lc_ladder_elements[element_label])
            print(element_label)
            pos = (self.width + 5, 150)
        elif element == "coil":
            element = self.coil_copy
            element_label = "L" + str(m)
            element_label = element_label + "=" + str(
                self.lc_ladder_elements[element_label])
            print(element_label)
            pos = (self.width, 35)
        else:
            raise Exception("Element not recognized!")
            sys.exit(1)

        self.img.paste(element, (self.width, 0))
        self.width = self.width + self.element_size[0]

        self.draw.text(pos, element_label, font=self.font, fill="black")


if __name__ == "__main__":
    ladder = LCladder(1500.0, 222.0, 500, 700, 1.0, 20, 'butter', 'lowpass')
    lc_ladder_elements = ladder.load_not_matched()

    print(lc_ladder_elements)

    scheme = Scheme(ladder.R1, ladder.R2, 7)
    scheme.design(lc_ladder_elements)