/// <summary> /// Returns <see cref="Bifilar"/> from user input. /// /// As of 04/04/2019 no input checking is provided. /// </summary> /// <param name="value">Enum value to find with name of.</param> /// <returns>Corresponding bifilar value.</returns> public static Bifilar GetBifilar(string value) { Bifilar bifilar = Bifilar._1H1W; if (Enum.TryParse(value, out bifilar)) return bifilar; return Bifilar._1H1W; }
/// <summary> /// Constructor. /// /// If <see cref="Bifilar"/> is <see cref="Data.Constants.Bifilar._1H1W"/> the cost of the wire is the sum of the fabrication <paramref name="cost"/> and the material price. /// If <see cref="Bifilar"/> is not <see cref="Data.Constants.Bifilar._1H1W"/> the cost of the wire will be the product of the cost and the <see cref="Functions.Functions.BifilarMultiplier(Bifilar, Wire)"/>. /// </summary> /// <param name="name">Name of the wire.</param> /// <param name="wireMaterial">Conductor material of the wire.</param> /// <param name="wireShape">Shape of the wire. </param> /// <param name="bifilar">Bifilar of the wire.</param> /// <param name="width">Conductor width of the wire.</param> /// <param name="thickness">Conductor material of the wire.</param> /// <param name="insThickness">Insulation thickness around the wire.</param> /// <param name="resistance">Resistance in Ohms of the wire per 1000 inches.</param> /// <param name="weight">Weight of the wire in Lbs. per 1000 inches.</param> /// <param name="cost">Fabrication cost of a single wire.</param> /// <param name="skew_factor">Skew factor of the wire, 1 for rectangular and round wire and 0 for foil.</param> protected internal Wire(string name, WireMaterial wireMaterial, WireShape wireShape, Bifilar bifilar, double width, double thickness, double insThickness, double resistance, double weight, double cost, int skew_factor) { this.Name = name; this.WireMaterial = wireMaterial; this.WireShape = wireShape; this.Bifilar = bifilar; this.ConductorWidth = width; this.ConductorThickness = thickness; this.InsulationThickness = insThickness; this.ResistancePer1000Inches = resistance / BifilarMultiplier(bifilar); this.WeightPer1000Inches = weight * BifilarMultiplier(bifilar); if (Bifilar != Bifilar._1H1W) { this.Cost = cost; } else { this.Cost = (cost + (double)(wireMaterial == WireMaterial.ALUMINUM ? AluminumPrice : CopperPrice));// * BifilarMultiplier(bifilar); } this.SkewFactor = skew_factor; }