Beispiel #1
0
        /*Evaluate a Kirchoff-based function for the currents in the pins connected to the net,
         * available for both DC and transient simulations
         * (irrelevant for fixed-voltage nets)
         */
        public double DCFunction(DCSolver solver)
        {
            double sum = 0;

            foreach (NetConnection iter in connections)
            {
                sum -= solver.GetPinCurrent(iter.component, iter.pin);
            }
            return(sum);
        }
Beispiel #2
0
 // f0: (V1 - V2) / R - I
 public override double DCFunction(DCSolver solver, int f)
 {
     if (f == 0)
     {
         double L = (solver.GetNetVoltage(PinConnections[0]) - solver.GetNetVoltage(PinConnections[1])) / Resistance;
         double R = solver.GetPinCurrent(this, 0);
         return(L - R);
     }
     else
     {
         return(0.0d);
     }
 }
Beispiel #3
0
 // f0: Is * (e ^ ((Vd - IRs)/(n*Vt)) - 1) - I
 public override double DCFunction(DCSolver solver, int f)
 {
     if (f == 0)
     {
         double L = SaturationCurrent *
                    (Math.exp_safe(((solver.GetNetVoltage(PinConnections[0]) - solver.GetNetVoltage(PinConnections[1])) - SeriesResistance * solver.GetPinCurrent(this, 0)) / (IdealityFactor * Math.vTherm)) - 1);
         double R = solver.GetPinCurrent(this, 0);
         return(L - R);
     }
     else
     {
         return(0.0d);
     }
 }
Beispiel #4
0
 public override double DCDerivative(DCSolver solver, int f, VariableIdentifier var)
 {
     if (f == 0)
     {
         if (var.type == VariableType.NET)
         {
             if (var.net == PinConnections[0])
             {
                 return(SaturationCurrent * (1 / (IdealityFactor * Math.vTherm)) * Math.exp_deriv(((solver.GetNetVoltage(PinConnections[0]) - solver.GetNetVoltage(PinConnections[1]) - SeriesResistance * solver.GetPinCurrent(this, 0))) / (IdealityFactor * Math.vTherm)));
             }
             else if (var.net == PinConnections[1])
             {
                 return(-1 * SaturationCurrent * (1 / (IdealityFactor * Math.vTherm)) * Math.exp_deriv(((solver.GetNetVoltage(PinConnections[0]) - solver.GetNetVoltage(PinConnections[1]) - SeriesResistance * solver.GetPinCurrent(this, 0))) / (IdealityFactor * Math.vTherm)));
             }
         }
         else
         {
             if ((var.component == this) && (var.pin == 0))
             {
                 return(-1 * SeriesResistance * SaturationCurrent * (1 / (IdealityFactor * Math.vTherm)) * Math.exp_deriv(((solver.GetNetVoltage(PinConnections[0]) - solver.GetNetVoltage(PinConnections[1]) - SeriesResistance * solver.GetPinCurrent(this, 0))) / (IdealityFactor * Math.vTherm)) - 1);
             }
         }
     }
     return(0.0d);
 }