public override void Analyze(Analysis Mna) { Expression Vpk = Mna.AddUnknownEqualTo(Name + "pk", p.V - k.V); Expression Vgk = Mna.AddUnknownEqualTo(Name + "gk", g.V - k.V); Expression ip, ig; switch (model) { case TriodeModel.ChildLangmuir: Expression Ed = Mu * Vgk + Vpk; ip = Call.If(Ed > 0, K * (Ed ^ 1.5), 0); ig = 0; break; case TriodeModel.Koren: Expression E1 = Ln1Exp(Kp * (1.0 / Mu + Vgk * (Kvb + Vpk ^ 2) ^ (-0.5))) * Vpk / Kp; ip = (Call.Max(E1, 0) ^ Ex) / Kg; ig = Call.Max(Vgk - Vg, 0) / Rgk; break; default: throw new NotImplementedException("Triode model " + model.ToString()); } ip = Mna.AddUnknownEqualTo("i" + Name + "p", ip); ig = Mna.AddUnknownEqualTo("i" + Name + "g", ig); Mna.AddTerminal(p, ip); Mna.AddTerminal(g, ig); Mna.AddTerminal(k, -(ip + ig)); }
public override void Analyze(Analysis Mna) { int sign; switch (Type) { case BjtType.NPN: sign = 1; break; case BjtType.PNP: sign = -1; break; default: throw new NotSupportedException("Unknown BJT structure."); } Expression Vbc = Mna.AddUnknownEqualTo(Name + "bc", sign * (Base.V - Collector.V)); Expression Vbe = Mna.AddUnknownEqualTo(Name + "be", sign * (Base.V - Emitter.V)); Expression aR = BR / (1 + (Expression)BR); Expression aF = BF / (1 + (Expression)BF); Expression iF = IS * (LinExp(Vbe / VT) - 1); Expression iR = IS * (LinExp(Vbc / VT) - 1); // TODO: Algebraically rearranging these results in dramatically different stability behavior. // It would be nice to understand this. //Expression ie = iF - aR * iR; Expression ic = aF * iF - iR; Expression ib = (1 - aF) * iF + (1 - aR) * iR; ic = Mna.AddUnknownEqualTo("i" + Name + "c", ic); ib = Mna.AddUnknownEqualTo("i" + Name + "b", ib); Mna.AddTerminal(Collector, sign * ic); Mna.AddTerminal(Base, sign * ib); Mna.AddTerminal(Emitter, -sign * (ic + ib)); }
public override void Analyze(Analysis Mna) { Expression Vpk = Mna.AddUnknownEqualTo(Name + "pk", p.V - k.V); Expression Vgk = Mna.AddUnknownEqualTo(Name + "gk", g.V - k.V); Expression ip, ig; Analyze(Mna, Vgk, Vpk, out ip, out ig); ip = Mna.AddUnknownEqualTo("i" + Name + "p", ip); ig = Mna.AddUnknownEqualTo("i" + Name + "g", ig); Mna.AddTerminal(p, ip); Mna.AddTerminal(g, ig); Mna.AddTerminal(k, -(ip + ig)); }
public override void Analyze(Analysis Mna) { // Unknown output current. Mna.AddTerminal(Cathode, Mna.AddUnknown("i" + Name)); // V-[t] = V+[t - T], i.e. the voltage at the previous timestep. Mna.AddEquation(Anode.V.Evaluate(t, t - T), Cathode.V); }
public static void Analyze(Analysis Mna, string Name, Node Input, Node Output) { // Unknown output current. Mna.AddTerminal(Output, Mna.AddUnknown("i" + Name)); // Follow voltage. Mna.AddEquation(Input.V, Output.V); }
public static void Analyze(Analysis Mna, string Name, Node Input, Node Output) { // Unknown output current. Mna.AddTerminal(Output, Mna.AddUnknown("i" + Name)); // Follow voltage. Mna.AddEquation(Input.V, Output.V); }
public static void Analyze(Analysis Mna, Node G) { // Nodes connected to ground have V = 0. Mna.AddEquation(G.V, 0); // Ground doesn't care about current. Mna.AddTerminal(G, null); }
public override void Analyze(Analysis Mna) { // Unknown output current. Mna.AddTerminal(Cathode, Mna.AddUnknown("i" + Name)); // V-[t] = V+[t - T], i.e. the voltage at the previous timestep. Mna.AddEquation(Anode.V.Evaluate(t, t - T), Cathode.V); }
public static void Analyze(Analysis Mna, Node G) { // Nodes connected to ground have V = 0. Mna.AddEquation(G.V, 0); // Ground doesn't care about current. Mna.AddTerminal(G, null); }
public override void Analyze(Analysis Mna) { Expression Ip = Mna.AddUnknown("i" + Name + "p"); Mna.AddPassiveComponent(pa, pc, Ip); Expression Isa = Mna.AddUnknown("i" + Name + "sa"); Expression Isc = Mna.AddUnknown("i" + Name + "sc"); Mna.AddTerminal(sa, -Isa); Mna.AddTerminal(sc, Isc); Mna.AddTerminal(st, Isa - Isc); Mna.AddEquation(Ip * turns, Isa + Isc); Expression Vp = pa.V - pc.V; Expression Vs1 = sa.V - st.V; Expression Vs2 = st.V - sc.V; Mna.AddEquation(Vp, Vs1 * turns * 2); Mna.AddEquation(Vp, Vs2 * turns * 2); }
public override void Analyze(Analysis Mna) { Expression Vpk = p.V - k.V; Expression Vgk = g.V - k.V; //Vpk = Mna.AddUnknownEqualTo(Name + "pk", Vpk); //Vgk = Mna.AddUnknownEqualTo(Name + "gk", Vgk); Expression ip, ig, ik; switch (model) { case TriodeModel.ChildLangmuir: Expression Ed = Mu * Vgk + Vpk; ip = Call.If(Ed > 0, K * (Ed ^ 1.5), 0); //ip = Mna.AddUnknownEqualTo("i" + Name + "p", ip); ig = 0; ik = -(ip + ig); break; case TriodeModel.Koren: Expression E1 = Ln1Exp(Kp * (1.0 / Mu + Vgk * Binary.Power(Kvb + Vpk * Vpk, -0.5))) * Vpk / Kp; ip = Call.If(E1 > 0, (E1 ^ Ex) / Kg, 0); ig = Call.Max(Vgk - Vg, 0) / Rgk; //ip = Mna.AddUnknownEqualTo("i" + Name + "p", ip); //ig = Mna.AddUnknownEqualTo("i" + Name + "g", ig); ik = -(ip + ig); break; case TriodeModel.DempwolfZolzer: Expression exg = Cg * Vgk; ig = Call.If(exg > -50, Gg * Binary.Power(Ln1Exp(exg) / Cg, Xi), 0) + Ig0; Expression exk = C * ((Vpk / Mu) + Vgk); ik = Call.If(exk > -50, -G * Binary.Power(Ln1Exp(exk) / C, Gamma), 0); //ig = Mna.AddUnknownEqualTo("i" + Name + "g", ig); //ik = Mna.AddUnknownEqualTo("i" + Name + "k", ik); ip = -(ik + ig); break; default: throw new NotImplementedException("Triode model " + model.ToString()); } Mna.AddTerminal(p, ip); Mna.AddTerminal(g, ig); Mna.AddTerminal(k, ik); }
public override void Analyze(Analysis Mna) { // Infinite input impedance. Mna.AddPassiveComponent(Positive, Negative, 0); // Unknown output current. Mna.AddTerminal(Out, Mna.AddUnknown("i" + Name)); // The voltage between the positive and negative terminals is 0. Mna.AddEquation(Positive.V, Negative.V); }
public override void Analyze(Analysis Mna) { Expression Ip = Mna.AddUnknown("i" + Name + "p"); Mna.AddPassiveComponent(pa, pc, Ip); Expression Isa = Mna.AddUnknown("i" + Name + "sa"); Expression Isc = Mna.AddUnknown("i" + Name + "sc"); Mna.AddTerminal(sa, -Isa); Mna.AddTerminal(sc, Isc); Mna.AddTerminal(st, Isa - Isc); Mna.AddEquation(Ip * turns, Isa + Isc); Expression Vp = pa.V - pc.V; Expression Vs1 = sa.V - st.V; Expression Vs2 = st.V - sc.V; Mna.AddEquation(Vp, Vs1 * turns * 2); Mna.AddEquation(Vp, Vs2 * turns * 2); }
public override void Analyze(Analysis Mna) { // Unknown current. Mna.AddTerminal(Terminal, Mna.AddUnknown("i" + Name)); // Set voltage equal to the rail. Mna.AddEquation(V, Voltage); // Add initial conditions, if necessary. Expression V0 = ((Expression)Voltage).Evaluate(t, 0); if (!(V0 is Constant)) Mna.AddInitialConditions(Arrow.New(V0, 0)); }
public override void Analyze(Analysis Mna) { // Unknown current. Mna.AddTerminal(Terminal, Mna.AddUnknown("i" + Name)); // Set voltage equal to the rail. Mna.AddEquation(V, Voltage); // Add initial conditions, if necessary. Expression V0 = ((Expression)Voltage).Evaluate(t, 0); if (!(V0 is Constant)) { Mna.AddInitialConditions(Arrow.New(V0, 0)); } }
public override void Analyze(Analysis Mna) { // Implement Voltage gain. Node pp1 = new Node() { Name = "pp1" }; Node np1 = new Node() { Name = "np1" }; Mna.PushContext(Name, pp1, np1); // The input terminals are connected by a resistor Rin. Resistor.Analyze(Mna, Negative, Positive, Rin); Expression VRin = Negative.V - Positive.V; Expression Rp1 = 1000; CurrentSource.Analyze(Mna, pp1, np1, VRin * Aol / Rp1); Resistor.Analyze(Mna, pp1, np1, Rp1); Capacitor.Analyze(Mna, pp1, np1, 1 / (2 * Math.PI * Rp1 * GBP / Aol)); Ground.Analyze(Mna, np1); // Implement voltage limiter. if (vcc.IsConnected && vee.IsConnected) { Node ncc = new Node() { Name = "ncc" }; Node nee = new Node() { Name = "nee" }; Mna.DeclNodes(ncc, nee); VoltageSource.Analyze(Mna, vcc, ncc, 2); Diode.Analyze(Mna, pp1, ncc, 8e-16, 1, VT); VoltageSource.Analyze(Mna, vee, nee, -2); Diode.Analyze(Mna, nee, pp1, 8e-16, 1, VT); } // Output current is buffered. Mna.AddTerminal(Out, (pp1.V - Out.V) / Rout); Mna.PopContext(); }
public override void Analyze(Analysis Mna) { int sign; switch (Type) { case BjtType.NPN: sign = 1; break; case BjtType.PNP: sign = -1; break; default: throw new NotSupportedException("Unknown BJT structure."); } Expression Vbc = sign * (Base.V - Collector.V); Expression Vbe = sign * (Base.V - Emitter.V); Vbc = Mna.AddUnknownEqualTo(Name + "bc", Vbc); Vbe = Mna.AddUnknownEqualTo(Name + "be", Vbe); Expression aR = BR / (1 + (Expression)BR); Expression aF = BF / (1 + (Expression)BF); Expression iF = IS * LinExpm1(Vbe / VT); Expression iR = IS * LinExpm1(Vbc / VT); Expression ie = iF - aR * iR; Expression ic = aF * iF - iR; Expression ib = (1 - aF) * iF + (1 - aR) * iR; ic = Mna.AddUnknownEqualTo("i" + Name + "c", ic); ib = Mna.AddUnknownEqualTo("i" + Name + "b", ib); ie = Mna.AddUnknownEqualTo("i" + Name + "e", ie); Mna.AddTerminal(Collector, sign * ic); Mna.AddTerminal(Base, sign * ib); Mna.AddTerminal(Emitter, -sign * ie); }
public override void Analyze(Analysis Mna) { int sign; switch (Type) { case BjtType.NPN: sign = 1; break; case BjtType.PNP: sign = -1; break; default: throw new NotSupportedException("Unknown BJT structure."); } Expression Vbc = Mna.AddUnknownEqualTo(Name + "bc", sign * (Base.V - Collector.V)); Expression Vbe = Mna.AddUnknownEqualTo(Name + "be", sign * (Base.V - Emitter.V)); Expression aR = BR / (1 + (Expression)BR); Expression aF = BF / (1 + (Expression)BF); Expression iF = IS * (LinExp(Vbe / VT) - 1); Expression iR = IS * (LinExp(Vbc / VT) - 1); // TODO: Algebraically rearranging these results in dramatically different stability behavior. // It would be nice to understand this. //Expression ie = iF - aR * iR; Expression ic = aF * iF - iR; Expression ib = (1 - aF) * iF + (1 - aR) * iR; ic = Mna.AddUnknownEqualTo("i" + Name + "c", ic); ib = Mna.AddUnknownEqualTo("i" + Name + "b", ib); Mna.AddTerminal(Collector, sign * ic); Mna.AddTerminal(Base, sign * ib); Mna.AddTerminal(Emitter, -sign * (ic + ib)); }
public override void Analyze(Analysis Mna) { Expression Vpk = Mna.AddUnknownEqualTo(Name + "pk", p.V - k.V); Expression Vgk = Mna.AddUnknownEqualTo(Name + "gk", g.V - k.V); Expression ip, ig; Analyze(Mna, Vgk, Vpk, out ip, out ig); ip = Mna.AddUnknownEqualTo("i" + Name + "p", ip); ig = Mna.AddUnknownEqualTo("i" + Name + "g", ig); Mna.AddTerminal(p, ip); Mna.AddTerminal(g, ig); Mna.AddTerminal(k, -(ip + ig)); }
public override void Analyze(Analysis Mna) { // Infinite input impedance. Mna.AddPassiveComponent(Positive, Negative, 0); // Unknown output current. Mna.AddTerminal(Out, Mna.AddUnknown("i" + Name)); // The voltage between the positive and negative terminals is 0. Mna.AddEquation(Positive.V, Negative.V); }
public override void Analyze(Analysis Mna) { // Implement Voltage gain. Node pp1 = new Node() { Name = "pp1" }; Node np1 = new Node() { Name = "np1" }; Mna.PushContext(Name, pp1, np1); // The input terminals are connected by a resistor Rin. Resistor.Analyze(Mna, Negative, Positive, Rin); Expression VRin = Negative.V - Positive.V; Expression Rp1 = 1000; CurrentSource.Analyze(Mna, pp1, np1, VRin * Aol / Rp1); Resistor.Analyze(Mna, pp1, np1, Rp1); Capacitor.Analyze(Mna, pp1, np1, 1 / (2 * Math.PI * Rp1 * GBP / Aol)); Ground.Analyze(Mna, np1); // Implement voltage limiter. if (vcc.IsConnected && vee.IsConnected) { Node ncc = new Node() { Name = "ncc" }; Node nee = new Node() { Name = "nee" }; Mna.DeclNodes(ncc, nee); VoltageSource.Analyze(Mna, vcc, ncc, 2); Diode.Analyze(Mna, pp1, ncc, 8e-16, 1, VT); VoltageSource.Analyze(Mna, vee, nee, -2); Diode.Analyze(Mna, nee, pp1, 8e-16, 1, VT); } // Output current is buffered. Mna.AddTerminal(Out, (pp1.V - Out.V) / Rout); Mna.PopContext(); }