Пример #1
0
    def circuit(self):
        super().circuit()

        self.C_in = (1 / (2 * pi * self.f_3db * self.R_in)) @ u_F
        self.C_out = (1 / ((2 * pi * self.f_3db) *
                           (self.R_e + self.R_load))) @ u_F
        signal = self.input
        self.input = Net('ACGainInput')
        ac_input = self.input & Capacitor()(self.C_in) & signal

        output = self.output
        self.output = Net('ACGainOutput')
        ac_output = output & Capacitor()(self.C_out) & self.output
Пример #2
0
    def circuit(self):
        super().circuit()

        R = Resistor()
        stiff_voltage = Divider(type='resistive')(V=self.V,
                                                  V_out=self.V_split +
                                                  0.6 @ u_V,
                                                  Load=self.I_b)
        stiff_voltage.input += self.v_ref
        stiff_voltage.gnd += self.gnd
        stiff_voltage.v_ref += self.v_ref

        splitter = Bipolar(type='npn', common='emitter',
                           follow='collector')(collector=R(self.R_out),
                                               emitter=R(self.R_out))

        split = stiff_voltage & self & splitter
        self.output = Net('OutputInverse')
        self.output_n += splitter.collector
        self.output += splitter.emitter
        R_in = R.parallel_sum(
            R,
            [self.R_out * 2, stiff_voltage.R_in, stiff_voltage.R_out]) @ u_Ohm

        self.C_in = (1 / (2 * pi * self.f_3db * R_in)) @ u_F

        signal = Net('VoltageShiftAcInput')
        ac_coupling = signal & Capacitor()(self.C_in) & self.input
        self.input = signal
Пример #3
0
    def circuit(self):
        super().circuit()

        signal = self.output
        self.output = Net('GndCapacitorOutput')

        C_gnd = signal & self.output & Capacitor()(self.C_gnd) & self.gnd
Пример #4
0
    def circuit(self):
        """
            C_integrator -- `(integrator) = 1 / (2 * pi * (sensor) * (Frequency))`
        """
        R = Resistor()

        # Set R_input to a standard value
        sensor = R(100 @ u_kOhm)
        # Calculate C_integrator to set the unety-gain integration frequency.
        integrator = Capacitor()(
            (1 / (2 * pi * sensor.value * self.Frequency)) @ u_F)
        # Calculate R_feedback to set the lower cutoff frequency a decade less than the minimum operating frequency
        feedback = R(
            (10 /
             (2 * pi * integrator.value * self.Frequency / self.Q)) @ u_Ohm)

        self.H = -1 / (sensor.value * integrator.value)

        # Select an amplifier with a gain bandwidth at least 10 times the desired maximum operating frequency
        buffer = OpAmp()(Frequency=self.Frequency * self.Q)
        buffer.connect_power_bus(self)

        self.input & sensor & buffer.input_n & (
            feedback | integrator) & buffer.output & self.output
        self.gnd & buffer.input
Пример #5
0
    def circuit(self):
        super().circuit()

        signal = self.output
        self.output = Net('RLCOutput')

        C_parallel = signal & Capacitor()(self.C_parallel) & self.output
Пример #6
0
    def circuit(self):
        super().circuit()

        signal = self.output
        self.output = Net('VrefCapacitorOutput')

        C_v_ref = self.v_ref & Capacitor()(self.C_vref) & self.output & signal
Пример #7
0
    def circuit(self):
        super().circuit()

        signal = self.output
        self.output = Net('SeriesCapacitorOutput')

        C_series = signal & Capacitor()(self.C_series) & self.output
Пример #8
0
    def circuit(self):
        super().circuit()

        signal = self.output
        self.output = Net('FilterLowpassOutput')

        low_pass = signal & Resistor()(self.R_low) & self.output & Capacitor()(
            self.C_pass) & self.gnd
Пример #9
0
    def circuit(self):
        super().circuit()

        signal = self.output
        self.output = Net('FilterHighpassOutput')

        high_pass = signal & Capacitor()(
            self.C_block) & self.output & Resistor()(self.R_shunt) & self.gnd
Пример #10
0
    def circuit(self, *args, **kwargs):
        super().circuit(*args, **kwargs)

        signal = self.output
        self.output = Net('SignalClampedOutput')

        restoration = signal & Capacitor()(
            value=1 @ u_uF) & self.output & Diode(
                type='generic')()['K', 'A'] & self.gnd
Пример #11
0
    def circuit(self):
        period = 1 / self.Frequency
        quant = period / 4
        rate = self.V / quant

        self.tau = u(self.V / rate)

        discharger = Resistor()(self.R_load / 10)
        integrator = Capacitor()((self.tau / discharger.value) @ u_F)

        self.input & self.v_ref & discharger & self.output & integrator & self.gnd
Пример #12
0
    def circuit(self):
        period = 1 / self.Frequency
        quant = period / 4
        rate = self.V / quant

        self.tau = u(self.V / rate)

        current_sensing = Resistor()(self.R_load * 2)
        differetiator = Capacitor()((self.tau / current_sensing.value) @ u_F)

        self.input & self.v_ref & differetiator & self.output & current_sensing & self.gnd
Пример #13
0
    def circuit(self):
        self.element = self.part()

        # Power Supply
        self.v_ref & self['vcc'] & self['avcc']
        self.gnd & self.element['gnd']
        if self['agnd']:
            self.gnd & self['agnd']

        v_stable = self['vcc'] & (Capacitor()(0.1 @ u_uF) | Capacitor()
                                  (4.7 @ u_uF)) & self.element['gnd']

        # External resonator if frequency non 0
        if self.frequency != 0:
            oscillator = Crystal()(frequency=self.frequency)
            # Creating resonation circuit
            cap = self.gnd & Capacitor()(22 @ u_pF) \
                    & self['XTAL1'] \
                        & oscillator \
                    & self['XTAL2'] \
                & Capacitor()(22 @ u_pF) & self.gnd
Пример #14
0
    def circuit(self):
        current_source = Resistor()(self.R_load / 2)
        discharger = Capacitor()(
            (self.Time_to_V_out / (current_source.value * log(self.V / (self.V - self.V_out)))) @ u_F
        )

        if self.reverse:

            self.input & current_source & self.output
            self.gnd & discharger & self.output
        else:
            self.input & current_source & self.output & discharger & self.gnd
Пример #15
0
    def circuit(self):
        super().circuit()

        self.output_inverse = self.output_n
        self.output_n = Net('BridgeOutputGround')

        C = Capacitor(**self.mods, **self.props)
        self.C_ripple = self.I_load / (self.Frequency * self.V_ripple) @ u_F

        C_ripple_out = C(self.C_ripple)
        C_ripple_inv = C(self.C_ripple)

        circuit = self.output & C_ripple_out & self.output_n & C_ripple_inv & self.output_inverse
Пример #16
0
    def circuit(self):
        super().circuit()

        output = Net('FilterBandpassOutput')

        # Sink resistor
        R_band = Resistor()(self.R_band)
        # Inductor tanker
        L_tank = Inductor()(self.L_tank)
        C_tank = Capacitor()(self.C_tank)

		# Filter Network
        self & R_band & output & (L_tank | C_tank) & self.gnd

        self.output = output
Пример #17
0
    def circuit(self):
        super().circuit()
        """
        The reset line has an internal pull-up resistor. If the environment is noisy, it can be insufficient and reset
        may occur sporadically. Refer to the device datasheet for the value of the pull-up resistor that must be
        used for specific devices.
        """
        pull_up = self['RESET'] & Resistor()(4.7 @ u_kOhm) & self.v_ref
        """
        If an external switch is connected to the RESET pin, it is important to add a series resistance. Whenever
        the switch is pressed, it will short the capacitor and the current (I) through the switch can have high peak
        values. This causes the switch to bounce and generate steep spikes in 2ms - 10ms (t) periods until the
        capacitor is discharged. The PCB tracks and the switch metal introduces a small inductance (L) and the
        high current through these tracks can generate high voltages up to `VL = L * dI/dt`.

        This spike voltage VL is most likely outside the specification of the RESET pin. By adding a series resistor
        between the switch and the capacitor, the peak currents generated will be significantly low and it will not
        be large enough to generate high voltages at the RESET pin. An example connection is shown in the
        following diagram.
        """
        reset = self['RESET'] & Resistor()(
            330 @ u_Ohm, V=1) & Switch(input='physical')() & self.gnd
        """
        To protect the RESET line from further noise, connect a capacitor from the RESET pin to ground. This is
        not directly required since the AVR internally have a low-pass filter to eliminate spikes and noise that
        could cause reset. Using an extra capacitor is an additional protection. However, such extra capacitor
        cannot be used when DebugWIRE or PDI is used.
        """
        noise_protect = self['RESET'] & Capacitor()(100 @ u_nF) & self.gnd
        """
        ESD protection diode is not provided internally from RESET to VCC in order to allow HVPP. If HVPP is not
        used, it is recommended to add an ESD protection diode externally from RESET to VCC. Alternatively, a
        Zener diode can be used to limit the RESET voltage relative to GND. A Zener diode is highly
        recommended in noisy environments. The components should be located physically close to the RESET
        pin of the AVR.Recommended circuit of a RESET line is shown in the following circuit diagram.
        """
        esd_protection = self['RESET'] & Diode(
            type='generic')()['A, K'] & self.v_ref
Пример #18
0
 def C_bypass(index):
     values = models[self.model]
     return Capacitor()(values[index])