Пример #1
0
 public static void Analyze(Analysis Mna, string Name, Node Anode, Node Cathode, Expression V)
 {
     // Unknown current.
     Mna.AddPassiveComponent(Anode, Cathode, Mna.AddUnknown("i" + Name));
     // Set the voltage.
     Mna.AddEquation(Anode.V - Cathode.V, V);
 }
Пример #2
0
 public static Expression Analyze(Analysis Mna, string Name, Node Anode, Node Cathode)
 {
     Expression i = Mna.AddUnknown("i" + Name);
     Mna.AddPassiveComponent(Anode, Cathode, i);
     Mna.AddEquation(Anode.V, Cathode.V);
     return i;
 }
Пример #3
0
 public override void Analyze(Analysis Mna)
 {
     Mna.PushContext(Name, Nodes);
     foreach (Component c in Components)
         c.Analyze(Mna);
     Mna.PopContext();
 }
Пример #4
0
 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);
 }
Пример #5
0
 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);
 }
Пример #6
0
 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);
 }
Пример #7
0
 public Analysis Analyze()
 {
     Analysis mna = new Analysis();
     mna.PushContext(null, Nodes);
     foreach (Component c in Components)
         c.Analyze(mna);
     mna.PopContext();
     return mna;
 }
Пример #8
0
        public static Expression Analyze(Analysis Mna, string Name, Node Anode, Node Cathode, Expression L)
        {
            // Define a new unknown for the current through the inductor.
            Expression i = Mna.AddUnknown("i" + Name);
            Mna.AddPassiveComponent(Anode, Cathode, i);
            // V = L*di/dt
            Mna.AddEquation(Anode.V - Cathode.V, L * D(i, t));

            return i;
        }
Пример #9
0
        protected override void Analyze(Analysis Mna, Expression Vpk, Expression Vgk, out Expression Ip, out Expression Ig)
        {
            Expression ex = Kp * (1.0 / Mu + Vgk * (Kvb + Vpk * Vpk) ^ (-0.5));

            // ln(1+e^x) = x for large x, and large x causes numerical issues.
            Expression E1 = Call.If(ex > 5, ex, Call.Ln(1 + LinExp(ex))) * Vpk / Kp;

            Ip = Call.If(E1 > 0, (E1 ^ Ex) / Kg, 0);
            Ig = Call.If(Vgk > Vg, (Vgk - Vg) / Rgk, 0);
        }
Пример #10
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));
 }
Пример #11
0
        public override void Analyze(Analysis Mna)
        {
            Expression Ip = Mna.AddUnknown("i" + Name + "p");
            Mna.AddPassiveComponent(pa, pc, Ip);
            Expression Is = Mna.AddUnknown("i" + Name + "s");
            Mna.AddPassiveComponent(sc, sa, Is);
            Mna.AddEquation(Ip * turns, Is);

            Expression Vp = pa.V - pc.V;
            Expression Vs = sa.V - sc.V;
            Mna.AddEquation(Vp, turns * Vs);
        }
Пример #12
0
        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));
        }
Пример #13
0
        public static Expression Analyze(Analysis Mna, string Name, Node Anode, Node Cathode, Expression IS, Expression n, Expression VT)
        {
            // V = Va - Vc
            Expression Vac = Mna.AddUnknownEqualTo("V" + Name, Anode.V - Cathode.V);

            // Evaluate the model.
            Expression i = IS * (LinExp(Vac / (n * VT)) - 1);
            i = Mna.AddUnknownEqualTo("i" + Name, i);

            Mna.AddPassiveComponent(Anode, Cathode, i);

            return i;
        }
Пример #14
0
 public static Expression Analyze(Analysis Mna, string Name, Node Anode, Node Cathode, Expression R)
 {
     // i = V/R
     if (R.EqualsZero())
     {
         return Conductor.Analyze(Mna, Name, Anode, Cathode);
     }
     else
     {
         Expression i = (Anode.V - Cathode.V) / R;
         Mna.AddPassiveComponent(Anode, Cathode, i);
         return i;
     }
 }
Пример #15
0
        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);
        }
Пример #16
0
 public override void Analyze(Analysis Mna)
 {
     Resistor.Analyze(Mna, Name, Anode, Cathode, Impedance);
 }
Пример #17
0
 public static void Analyze(Analysis Mna, Node Anode, Node Cathode, Expression V)
 {
     Analyze(Mna, Mna.AnonymousName(), Anode, Cathode, V);
 }
Пример #18
0
 public static void Analyze(Analysis Mna, string Name, Node Anode, Node Cathode, Expression V, Arrow InitialConditions)
 {
     Analyze(Mna, Name, Anode, Cathode, V);
     Mna.AddInitialConditions(InitialConditions);
 }
Пример #19
0
 public static Expression Analyze(Analysis Mna, Node Anode, Node Cathode)
 {
     return(Analyze(Mna, Mna.AnonymousName(), Anode, Cathode));
 }
Пример #20
0
 public override void Analyze(Analysis Mna)
 {
     Analyze(Mna, Name, Anode, Cathode);
 }
Пример #21
0
 public static Expression Analyze(Analysis Mna, Node Anode, Node Cathode, Expression IS, Expression n, Expression VT)
 {
     return Analyze(Mna, Mna.AnonymousName(), Anode, Cathode, IS, n, VT);
 }
Пример #22
0
        public override void Analyze(Analysis Mna)
        {
            Expression P = AdjustWipe(wipe, sweep);

            Resistor.Analyze(Mna, Name, Anode, Cathode, (Expression)Resistance * P);
        }
Пример #23
0
        public override void Analyze(Analysis Mna)
        {
            Expression P = AdjustWipe(wipe, sweep);

            Resistor.Analyze(Mna, Name, Anode, Cathode, (Expression)Resistance * P);
        }
Пример #24
0
 public override void Analyze(Analysis Mna)
 {
 }
Пример #25
0
        public override void Analyze(Analysis Mna)
        {
            Expression Vin = DependentVariable(Name, t);

            VoltageSource.Analyze(Mna, Anode, Cathode, Vin, Arrow.New(Vin.Evaluate(t, 0), 0));
        }
Пример #26
0
 public override void Analyze(Analysis Mna)
 {
     if (0 <= position && position < Throws.Length)
         Conductor.Analyze(Mna, Name, Common, Throws[Position]);
 }
Пример #27
0
 public override void Analyze(Analysis Mna)
 {
 }
Пример #28
0
 /// <summary>
 /// Add any extra MNA equations required by this component.
 /// </summary>
 /// <param name="Mna"></param>
 /// <param name="Unknowns"></param>
 public virtual void Analyze(Analysis Mna)
 {
 }
Пример #29
0
 public static void Analyze(Analysis Mna, Node Anode, Node Cathode, Expression V, Arrow InitialConditions)
 {
     Analyze(Mna, Mna.AnonymousName(), Anode, Cathode, V, InitialConditions);
 }
Пример #30
0
        public override void Analyze(Analysis Mna)
        {
            Expression P = VariableResistor.AdjustWipe(wipe, sweep);

            Expression R1 = Resistance * P;
            Expression R2 = Resistance * (1 - P);

            Resistor.Analyze(Mna, Cathode, Wiper, R1);
            Resistor.Analyze(Mna, Anode, Wiper, R2);
        }
Пример #31
0
 public static void Analyze(Analysis Mna, Node Input, Node Output)
 {
     Analyze(Mna, Mna.AnonymousName(), Input, Output);
 }
Пример #32
0
 public override void Analyze(Analysis Mna)
 {
     AssertImpl(); impl.Analyze(Mna);
 }
Пример #33
0
 public override void Analyze(Analysis Mna)
 {
     Analyze(Mna, Name, Anode, Cathode);
 }
Пример #34
0
 public override void Analyze(Analysis Mna)
 {
     if (closed)
         Conductor.Analyze(Mna, Name, Anode, Cathode);
 }
Пример #35
0
 public static Expression Analyze(Analysis Mna, Node Anode, Node Cathode, Expression R)
 {
     return Analyze(Mna, "", Anode, Cathode, R);
 }
Пример #36
0
 protected abstract void Analyze(Analysis Mna, Expression Vgk, Expression Vpk, out Expression ip, out Expression ig);
Пример #37
0
 public override sealed void Analyze(Analysis Mna)
 {
 }
        public override void Analyze(Analysis Mna)
        {
            Diode.Analyze(Mna, Gate, Source, IS, 1, VT);
            Diode.Analyze(Mna, Gate, Drain, IS, 1, VT);

            // The drain and source terminals are reversible in the JFET model, this
            // formulation is simpler than explicitly identifying normal/inverted mode.
            Expression Vgs = Gate.V - Call.Min(Source.V, Drain.V);
            Expression Vds = Call.Abs(Drain.V - Source.V);

            //Vgs = Mna.AddNewUnknownEqualTo(Name + "gs", Vgs);

            Expression Vgst0 = Vgs - Vt0;

            Expression id = (Vgs >= Vt0) * Beta * (1 + Lambda * Vds) *
                Call.If(Vds < Vgst0,
                    // Linear region.
                    Vds * (2 * Vgst0 - 1),
                    // Saturation region.
                    Vgst0 ^ 2);

            id = Mna.AddUnknownEqualTo("i" + Name + "d", id);
            CurrentSource.Analyze(Mna, Drain, Source, id);
        }
Пример #39
0
 public override sealed void Analyze(Analysis Mna)
 {
 }