Beispiel #1
0
 DiodeModel(DiodeModel copy)
 {
     flags               = copy.flags;
     SaturationCurrent   = copy.SaturationCurrent;
     SeriesResistance    = copy.SeriesResistance;
     EmissionCoefficient = copy.EmissionCoefficient;
     BreakdownVoltage    = copy.BreakdownVoltage;
     updateModel();
 }
Beispiel #2
0
        static DiodeModel getModelWithName(string name)
        {
            createModelMap();
            var lm = modelMap[name];

            if (lm != null)
            {
                return(lm);
            }
            lm      = new DiodeModel();
            lm.Name = name;
            modelMap.Add(name, lm);
            return(lm);
        }
Beispiel #3
0
        public static DiodeModel GetModelWithNameOrCopy(string name, DiodeModel oldmodel)
        {
            createModelMap();
            var lm = modelMap[name];

            if (lm != null)
            {
                return(lm);
            }
            if (oldmodel == null)
            {
                Console.WriteLine("model not found: " + name);
                return(GetDefaultModel());
            }
            lm      = new DiodeModel(oldmodel);
            lm.Name = name;
            modelMap.Add(name, lm);
            return(lm);
        }
Beispiel #4
0
        public void Setup(DiodeModel model)
        {
            leakage  = model.SaturationCurrent;
            zvoltage = model.BreakdownVoltage;
            vscale   = model.VScale;
            vdcoef   = model.VdCoef;

            /* critical voltage for limiting; current is vscale/sqrt(2) at this voltage */
            vcrit = vscale * Math.Log(vscale / (Math.Sqrt(2) * leakage));

            /* translated, *positive* critical voltage for limiting in Zener breakdown region;
             * limitstep() uses this with translated voltages in an analogous fashion to vcrit. */
            vzcrit = VT * Math.Log(VT / (Math.Sqrt(2) * leakage));
            if (zvoltage == 0)
            {
                zoffset = 0;
            }
            else
            {
                /* calculate offset which will give us 5mA at zvoltage */
                double i = -0.005;
                zoffset = zvoltage - Math.Log(-(1 + i / leakage)) / VZ_COEF;
            }
        }
Beispiel #5
0
 int compareTo(DiodeModel dm)
 {
     return(Name.CompareTo(dm.Name));
 }
Beispiel #6
0
 static void addDefaultModel(string name, DiodeModel dm)
 {
     modelMap.Add(name, dm);
     dm.ReadOnly = dm.BuiltIn = true;
     dm.Name     = name;
 }
Beispiel #7
0
 public void SetupForDefaultModel()
 {
     Setup(DiodeModel.GetDefaultModel());
 }