Example #1
0
        public void doStep(Circuit sim, double voltdiff)
        {
            // used to have .1 here, but needed .01 for peak detector
            if (Math.Abs(voltdiff - lastvoltdiff) > 0.01)
            {
                sim.converged = false;
            }

            voltdiff     = limitStep(sim, voltdiff, lastvoltdiff);
            lastvoltdiff = voltdiff;

            if (voltdiff >= 0 || zvoltage == 0)
            {
                // regular diode or forward-biased zener
                double eval = Math.Exp(voltdiff * vdcoef);
                // make diode linear with negative voltages; aids convergence
                if (voltdiff < 0)
                {
                    eval = 1;
                }

                double geq = vdcoef * leakage * eval;
                double nc  = (eval - 1) * leakage - geq * voltdiff;
                sim.stampConductance(nodes[0], nodes[1], geq);
                sim.stampCurrentSource(nodes[0], nodes[1], nc);
            }
            else
            {
                // Zener diode
                // I(Vd) = Is * (exp[Vd*C] - exp[(-Vd-Vz)*C] - 1 )
                // geq is I'(Vd) nc is I(Vd) + I'(Vd)*(-Vd)
                double geq = leakage * vdcoef * (Math.Exp(voltdiff * vdcoef) + Math.Exp((-voltdiff - zoffset) * vdcoef));
                double nc  = leakage * (Math.Exp(voltdiff * vdcoef) - Math.Exp((-voltdiff - zoffset) * vdcoef) - 1) + geq * (-voltdiff);
                sim.stampConductance(nodes[0], nodes[1], geq);
                sim.stampCurrentSource(nodes[0], nodes[1], nc);
            }
        }
Example #2
0
        public override void step(Circuit sim)
        {
            double voltdiff = lead_volt[0] - lead_volt[1];

            if (Math.Abs(voltdiff - lastvoltdiff) > 0.01)
            {
                sim.converged = false;
            }
            voltdiff     = limitStep(voltdiff, lastvoltdiff);
            lastvoltdiff = voltdiff;
            double i = pip * Math.Exp(-pvpp / pvt) * (Math.Exp(voltdiff / pvt) - 1)
                       + pip * (voltdiff / pvp) * Math.Exp(1 - voltdiff / pvp) + piv
                       * Math.Exp(voltdiff - pvv);
            double geq = pip * Math.Exp(-pvpp / pvt) * Math.Exp(voltdiff / pvt)
                         / pvt + pip * Math.Exp(1 - voltdiff / pvp) / pvp
                         - Math.Exp(1 - voltdiff / pvp) * pip * voltdiff / (pvp * pvp)
                         + Math.Exp(voltdiff - pvv) * piv;
            double nc = i - geq * voltdiff;

            sim.stampConductance(lead_node[0], lead_node[1], geq);
            sim.stampCurrentSource(lead_node[0], lead_node[1], nc);
        }
Example #3
0
 public void doStep(Circuit sim, double voltdiff)
 {
     sim.stampCurrentSource(nodes[0], nodes[1], curSourceValue);
 }
Example #4
0
 public override void step(Circuit sim)
 {
     sim.stampCurrentSource(lead_node[0], lead_node[2], curSourceValue1);
     sim.stampCurrentSource(lead_node[1], lead_node[3], curSourceValue2);
 }
Example #5
0
 public override void stamp(Circuit sim)
 {
     sim.stampCurrentSource(lead_node[0], lead_node[1], sourceCurrent);
 }
Example #6
0
        public override void step(Circuit sim)
        {
            double voltdiff = lead_volt[0] - lead_volt[1];

            sim.stampCurrentSource(nodes[0], nodes[1], curSourceValue);
        }