예제 #1
0
    def circuit(self):
        super().circuit()
        
        sensor = Bipolar(type='npn', common='emitter')(
            base = Resistor()(self.R_sensor_in),
            collector = Resistor()(self.R_sensor_collector),
        )

        holder = Bipolar(type='npn', common='emitter')(
            base = Resistor()( self.R_holder_base)
        )
        holder.v_ref += sensor.output
        holder.gnd += self.gnd

        self.C_width = (self.width / self.R_pulse_base) * 1.4
        pulsar_width = RLC(series='C', vref='R')(
            C_series = self.C_width,
            R_vref = self.R_pulse_base)
        pulsar_width.v_ref += self.v_ref

        pulsar = Bipolar(type='npn', common='emitter')(
            base = pulsar_width,
            collector = Resistor()(self.R_pulse_collector)
        )
    
        output = Net('onHightPulse')

        pulse = self & sensor & pulsar & output & holder

        self.output = output
예제 #2
0
    def circuit(self):
        up = Bipolar(type='npn')()
        down = Bipolar(type='pnp')()

        self.wire_input(up, down)
        self.output & up.emitter & down.emitter

        self.v_ref & up.v_ref
        self.v_inv & down.collector
예제 #3
0
    def mirror(self, programmer):
        mirror = Bipolar(type='pnp', follow='collector', common='base')()
        stabilizer = Bipolar(type='pnp', follow='collector', common='base')()
        mirroring = mirror.base & programmer.base & stabilizer

        self.R_g = (self.V - stabilizer.V_je) / self.I_load
        generator = Resistor()(self.R_g)
        sink = self.ref_input(
        ) & programmer & stabilizer.base & generator & self.gnd
        v_ref = self.ref_input() & mirror

        return stabilizer.output
예제 #4
0
    def circuit(self, **kwargs):
        programmer = Bipolar(type='pnp', follow='collector', common='base')()

        self.V_drop += programmer.V_je

        mirror = self.mirror(programmer)
        load = mirror & self.output
예제 #5
0
    def circuit(self):
        via = self.props.get('via', None)
        buffer = None

        if via == 'opamp':
            """
            1. Use the op-amp linear output operating range, which is usually specified under the AOL test conditions.
            2. The small-signal bandwidth is determined by the unity-gain bandwidth of the amplifier.
            3. Check the maximum output voltage swing versus frequency graph in the datasheet to minimize slewinduced distortion.
            4. The common mode voltage is equal to the input signal.
            5. Do not place capacitive loads directly on the output that are greater than the values recommended in
            the datasheet.
            6. High output current amplifiers may be required if driving low impedance loads
            """
            buffer = OpAmp()(frequency=self.Frequency)
            buffer.input_n & buffer.output & self.output

        if via == 'bipolar':
            buffer = Bipolar(type='npn', emitter='follower')()
            buffer & self.output

        if buffer:
            self.input & buffer

            buffer.v_ref & self.v_ref
            buffer.gnd & self.gnd
        else:
            self.input & self.output
예제 #6
0
    def circuit(self):
        R = Resistor()
        Gate = Bipolar(type='npn', follow='collector', common='emitter')

        rectifier = Signal(clamp='rectifier')(V=self.V,
                                              Load=self.Load,
                                              frequency=self.frequency)

        trigger = Gate(collector=R(self.R_load, ref='Trigger_Collector'),
                       base=R(self.R_load * 10, ref='Trigger_Base'))

        pulse = Gate(collector=lambda T: Resistor()
                     ((self.V - (T['VCE'] or 0.3) @ u_V) / self.I_load,
                      ref='Pulse_Collector'))
        delay = Decay()(V=self.V,
                        V_out=self.V / 2,
                        Time_to_V_out=self.width,
                        Load=(self.V - trigger.V_je) /
                        (3 * self.I_load / pulse.Beta),
                        reverse=True)

        self.v_ref & trigger.v_ref & pulse.v_ref
        self.gnd & trigger.gnd & pulse.gnd & rectifier.gnd

        self.input & rectifier & trigger.base

        pulse & trigger & delay.gnd
        self.v_ref & delay & pulse & self.output
예제 #7
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
예제 #8
0
    def circuit(self):
        for signal in self.inputs:
            or_gate = Bipolar(type='npn', common='emitter',
                              follow='emitter')(collector=self.v_ref,
                                                base=Resistor()(10000),
                                                emitter=self.output)
            signal & or_gate.input

        pulldown = self.output & Resistor()(10000) & self.gnd
예제 #9
0
 def circuit(self):
     super().circuit()
 
     rc = self \
         & Resistor()(10000) \
             & Bipolar(
                 type='npn',
                 common='emitter'
             )(collector=self.load_block) & self.gnd
예제 #10
0
    def mirror(self, programmer):
        self.R_g = (self.V - self.V_drop) / self.I_load
        mirror = Bipolar(type='pnp', follow='collector', common='base')()
        mirroring = mirror.base & programmer.base
        generator = Resistor()(self.R_g)
        sink = self.ref_input(
        ) & programmer & programmer.base & generator & self.gnd
        load = self.ref_input() & mirror

        return mirror.output
예제 #11
0
    def circuit(self):
        super().circuit()

        rc = self \
            & Resistor()(10000) \
                & Bipolar(
                    type='pnp',
                    common='collector',
                    follow='collector'
                )(collector = self.load_block) & self.gnd
예제 #12
0
    def circuit(self):
        v_ref = self.v_ref

        for signal in self.inputs:
            and_input = Bipolar(type='npn',
                                follow='emitter')(collector=v_ref,
                                                  base=Resistor()(10000))
            and_input.input += signal
            v_ref = and_input.output

        self.outputs = [v_ref]

        pulldown = v_ref & Resistor()(10000) & self.gnd
예제 #13
0
    def circuit(self):
        new_outputs = []
        for signal in self.inputs:
            inverted = Net('LogicInverted')
            inverter = Bipolar(type='npn', common='emitter', follow='collector')(
                collector = Resistor()(1000),
                base = Resistor()(10000)
            )
            inverter.v_ref += self.v_ref
            inverter.gnd += self.gnd
            circuit = signal & inverter & inverted

            new_outputs.append(inverted)

        self.outputs = new_outputs
예제 #14
0
    def circuit(self, **kwargs):
        generator = Bipolar(type='npn', follow='emitter')()

        self.V_e = generator.V_je + randint(1, int(u(self.V) / 2)) @ u_V
        self.V_b = self.V_e + generator.V_je
        self.R_e = self.V_e / self.I_load

        generator.collector += self.output_n

        controller = Divider(type='resistive')(V=self.V,
                                               V_out=self.V_b,
                                               Load=self.I_load)

        controller.input += self.v_ref
        controller.gnd += self.gnd

        source = controller.output & generator & Resistor()(
            self.R_e) & self.gnd
예제 #15
0
    def circuit(self):
        Gate = Bipolar(type='npn', follow='collector', common='emitter')
        R = Resistor()
        D = Diode(type='generic')

        def Oscillator(controller, width):
            # R1 & R2 should be chosen such that it should give the required collector current during saturation state.
            # Min. Base Current, Ibmin = Ic / β, where β is the hFE of the transistor
            # Safe Base Current,Ib = 10 * Ibmin = 3 x Ic / β
            return Decay()(
                V_out = self.V * 0.5,
                Time_to_V_out = width,
                Load = (self.V - controller.V_je) / (3 * self.I_load / controller.Beta), # * 10 because in Decay Load / 10
                reverse = True
            )

        def State():
            return Gate(
                # The resistance R should be designed to limit the collector current Ic with in a safe limit.
                # In normal cases, V = (Vcc – Vce) 
                collector = lambda T: R((self.V - T.V_ce) / self.I_load)
            )

        def Sharp(state, oscillator):
            oscillator.gnd & R(self.R_load) & self.v_ref

            return state & oscillator.gnd & D(V=self.V, Load=self.Load)

        set = State()
        set_oscillator = Oscillator(set, self.set_period)

        reset = State()
        reset_oscillator = Oscillator(reset, self.reset_period)

        self.v_ref & reset_oscillator.input & set_oscillator.input & set.v_ref & reset.v_ref

        Sharp(set, reset_oscillator) & self.output
        Sharp(reset, set_oscillator) & self.output_n

        reset_oscillator & reset.input
        set_oscillator & set.input

        self.gnd & set.gnd & reset.gnd
예제 #16
0
    def circuit(self):
        super().circuit()
        """
        The collector resistor  can be added to protect the transistor from momentary output
        short circuits by limiting the current, even though it is not essential to the emitter follower
        function.

        Choose value so that the voltage drop across it is less than the drop across resistor for the highest
        normal load current (i.e., so that the transistor does not saturate at maximum load).
        """
        protect = Resistor()(self.R_load * 5)
        """
        By using an emitter follower to isolate the zener, you get the improved circuit.

        Zener current can be made relatively independent
        of load current, since the transistor base current is small, and far lower zener power
        dissipation is possible (reduced by as much as a factor of `β`).
        """
        follower = Bipolar(type='npn', follow='emitter')(base=protect)

        follower.input & self.output
        follower.v_ref & self.input
        self.output = follower.output
예제 #17
0
    def circuit(self):
        R = Resistor()

        self.R_c = self.V / 2 / self.I_quiescent
        self.R_e = self.R_load
        self.R_out = (0 @ u_V - self.V_inv) / (self.I_quiescent * 2)
        self.r_e = 0.026 @ u_V / self.I_quiescent
        self.G_diff = u(self.R_c / (2 * (self.r_e + self.R_e)))
        self.G_cm = u(-1 * self.R_c / (2 * self.R_out + self.R_e + self.r_e))
        self.CMMR = u(self.R_out / (self.R_e + self.r_e))

        amplifier = Bipolar(type='npn', common='emitter', follow='collector')

        # First amplifier INVERTING
        left = amplifier(
            collector=R(self.R_c),
            emitter=R(self.R_e)  # Emitter resistore conected to bipolar
        )
        right = amplifier(collector=R(self.R_c), emitter=R(self.R_e))
        power = self.v_ref & left.v_ref & right.v_ref
        left_input = self.input & left & self.output_n
        right_input = self.input_n & right & self.output

        sink = left.gnd & right.gnd & R(self.R_out) & self.v_inv
예제 #18
0
 def State():
     return Bipolar(type='npn', follow='collector',
                    common='emitter')(base=Resistor()(self.R_load * 10),
                                      collector=Resistor()(self.R_load))