DiodeModel(DiodeModel copy) { flags = copy.flags; SaturationCurrent = copy.SaturationCurrent; SeriesResistance = copy.SeriesResistance; EmissionCoefficient = copy.EmissionCoefficient; BreakdownVoltage = copy.BreakdownVoltage; updateModel(); }
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); }
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); }
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; } }
int compareTo(DiodeModel dm) { return(Name.CompareTo(dm.Name)); }
static void addDefaultModel(string name, DiodeModel dm) { modelMap.Add(name, dm); dm.ReadOnly = dm.BuiltIn = true; dm.Name = name; }
public void SetupForDefaultModel() { Setup(DiodeModel.GetDefaultModel()); }