Example #1
0
    def add_diode(self, part_id, n1, n2, model_label, models=None, Area=None, T=None, ic=None, off=False):
        """Adds a diode to the circuit (also takes care that the nodes
        are added as well).

        Parameters:
        name (string): the diode name (eg "D1"). The first letter is always D.
        n1, n2 (string): the nodes to which the element is connected.
                    eg. "in" or "out_a"
        Area (float): Scaled device area (optional, defaults to 1.0)
        T (float): operating temperature (no temperature dependence yet)
        ic (float): initial condition (not really implemented yet)
        model_label (string): the diode model identifier. The model needs to be added
                              first, then the elements using it.
        models (dict(identifier:instance), optional): list of available model
            instances. If not set or None, the circuit models will be used (recommended).

        Returns: True
        """
        n1 = self.add_node(n1)
        n2 = self.add_node(n2)
        if models is None:
            models = self.models
        if not models.has_key(model_label):
            raise ModelError, "Unknown diode model id: " + model_label

        elem = diode.diode(part_id=part_id, n1=n1, n2=n2, model=models[
                           model_label], AREA=Area, T=T, ic=ic, off=off)
        self.append(elem)

        return True
Example #2
0
    def add_diode(self,
                  part_id,
                  n1,
                  n2,
                  model_label,
                  models=None,
                  Area=None,
                  T=None,
                  ic=None,
                  off=False):
        """Adds a diode to the circuit (also takes care that the nodes
        are added as well).

        Parameters:
        name (string): the diode name (eg "D1"). The first letter is always D.
        n1, n2 (string): the nodes to which the element is connected.
                    eg. "in" or "out_a"
        Area (float): Scaled device area (optional, defaults to 1.0)
        T (float): operating temperature (no temperature dependence yet)
        ic (float): initial condition (not really implemented yet)
        model_label (string): the diode model identifier. The model needs to be added
                              first, then the elements using it.
        models (dict(identifier:instance), optional): list of available model
            instances. If not set or None, the circuit models will be used (recommended).

        Returns: True
        """
        n1 = self.add_node(n1)
        n2 = self.add_node(n2)
        if models is None:
            models = self.models
        if not models.has_key(model_label):
            raise ModelError, "Unknown diode model id: " + model_label

        elem = diode.diode(part_id=part_id,
                           n1=n1,
                           n2=n2,
                           model=models[model_label],
                           AREA=Area,
                           T=T,
                           ic=ic,
                           off=off)
        self.append(elem)

        return True
Example #3
0
    def add_diode(self,
                  name,
                  ext_n1,
                  ext_n2,
                  model_label,
                  models=None,
                  Area=None,
                  T=None,
                  ic=None,
                  off=False):
        """Adds a diode to the circuit (also takes care that the nodes 
		are added as well).
	
		Parameters:
		name (string): the diode name (eg "D1"). The first letter is always D.
		ext_n1, ext_n2 (string): the nodes to which the element is connected. 
					eg. "in" or "out_a"
		Area (float): Scaled device area (optional, defaults to 1.0)
		T (float): operating temperature (no temperature dependence yet)
		ic (float): initial condition (not really mplemented yet)

		Returns: True
		"""
        n1 = self.add_node(ext_n1)
        n2 = self.add_node(ext_n2)

        if models is None:
            models = self.models
        if not models.has_key(model_label):
            raise ModelError, "Unknown diode model id: " + model_label

        elem = diode.diode(n1=n1,
                           n2=n2,
                           model=models[model_label],
                           AREA=Area,
                           T=T,
                           ic=ic,
                           off=off)
        elem.descr = name[1:]
        self.elements = self.elements + [elem]

        return True
Example #4
0
physics.append(Gravity)
Sound = usound.sound(left, size, plot2d, msgwin)
Sound.label = 'Study Sound with 40KHz Piezo '
physics.append(Sound)
Pt100 = pt100.pt100(left, size, plot2d, msgwin)
Pt100.label = 'Temperature (PT100)'
physics.append(Pt100)
Rad = radiation.rad(left, size, plot2d, msgwin)
Rad.label = 'Radiation Detection (MCA)'
physics.append(Rad)
Gm = gm.gm(left, size, plot2d, msgwin)
Gm.label = 'GM Counter'
physics.append(Gm)

#List of Electronics Experiments
Diode = diode.diode(left, size, plot2d, msgwin)
Diode.label = 'Diode Characteristic'
electronics.append(Diode)
Osc555 = osc555.osc(left, size, plot2d, msgwin)
Osc555.label = 'Oscillator (555)'
electronics.append(Osc555)
Mono555 = mono555.mono(left, size, plot2d, msgwin)
Mono555.label = 'Mono Shot (555)'
electronics.append(Mono555)

#Add the Menus
menubar = Menu(root)
first = Menu(menubar, tearoff=0)
first.add_radiobutton(label='USBReConnect', command = reconnect)
first.add_radiobutton(label='Connect Hardware', command = connect)
menubar.add_cascade(label="Connection", menu=first)
Example #5
0
def parse_elem_diode(line, circ, line_elements=None, models=None):
	"""Parses a diode from the line supplied, adds its nodes to the circuit
	instance circ and returns a list holding the diode element and a resistor,
	if the diode has Rs != 0.
	
	Diode syntax:
	#DX N+ N- <MODEL_LABEL> <AREA=xxx>
	
	Parameters:
	line: the line, if you have already .split()-ed it, set this to None 
	and supply the elements through line_elements.
	circ: the circuit instance.
	line_elements: will be generated by the function from line.split() 
	if set to None.
	
	Returns: a list with the diode element and a optional resistor Rs
	"""
	#sarebbe bello implementare anche: <IC=VD> <TEMP=T>
	if line_elements is None:
		line_elements = line.split()
	
	Area = None
	T  = None
	ic = None
	off = False
	
	if (len(line_elements) < 4):
		raise NetlistParseError, ""
	
	model_label = line_elements[3] 

	for index in range(4, len(line_elements)):
		if line_elements[index][0] == '*':
			break
		(param, value) = parse_param_value_from_string(line_elements[index])
		
		value = convert_units(value)
		if param == "area":
			Area = value
		elif param == "t":
			T = value
		elif param == "ic":
			ic = value
		elif param == "off":
			if not len(value):
				off = True
			else:
				off = convert_boolean(value)
		else:
			raise NetlistParseError, "unknown parameter " + param
		
	ext_n1 = line_elements[1]
	ext_n2 = line_elements[2]
	n1 = circ.add_node(ext_n1)
	n2 = circ.add_node(ext_n2)
	
	#if Rs: #we need to add a Rs on the anode
	#	new_node = n1
	#	n1 = circ.generate_internal_only_node_label()
	#	#print "-<<<<<<<<"+str(n1)+" "+str(n2) +" "+str(new_node)
	#	rs_elem = devices.resistor(n1=new_node, n2=n1, R=Rs)
	#	rs_elem.descr = "INT"
	#	return_list = return_list + [rs_elem]
	
	if not models.has_key(model_label):
		raise NetlistParseError, "Unknown model id: "+model_label
	elem = diode.diode(n1=n1, n2=n2, model=models[model_label], AREA=Area, T=T, ic=ic, off=off)
	elem.descr = line_elements[0][1:]
	return [elem]