/// <summary> /// Generate a resistor /// </summary> /// <param name="name">Name</param> /// <param name="parameters">Parameters</param> /// <param name="netlist">Netlist</param> /// <returns></returns> protected ICircuitObject GenerateRes(CircuitIdentifier name, List <Token> parameters, Netlist netlist) { Resistor res = new Resistor(name); res.ReadNodes(netlist.Path, parameters); // We have two possible formats: // Normal: RXXXXXXX N1 N2 VALUE if (parameters.Count == 3) { res.RESresist.Set(netlist.ParseDouble(parameters[2])); } else { // Read the model res.SetModel(netlist.FindModel <ResistorModel>(parameters[2])); netlist.ReadParameters(res, parameters, 3); if (!res.RESlength.Given) { throw new ParseException(parameters[parameters.Count - 1], "L needs to be specified", false); } } return(res); }