private PhaseVSWR[] ParseVSWRString(string info) { try { List <PhaseVSWR> phaseVSWRList = new List <PhaseVSWR>(); if (info != null) { string[] returnLines = info.Split('\n'); foreach (string line in returnLines) { string[] items = Regex.Split(line, @"\s+"); if (items[0].Contains("MHz")) { PhaseVSWR phaseVSWR = new PhaseVSWR { VSWR = Convert.ToDouble(items[2]), DegreePhase = Convert.ToDouble(items[3]) }; phaseVSWRList.Add(phaseVSWR); } } } return(phaseVSWRList.ToArray()); } catch (Exception ex) when(ex is IndexOutOfRangeException || ex is FormatException) { ArgumentException argEx = new ArgumentException("Unable to parse VSWRs and Phases from the command return value.", ex); throw argEx; } }
/// <summary> /// Adjusts positions of the tuner axes to present the specified voltage standing wave ratio (VSWR) in magnitude and phase in the device reference plane. /// The tuner calibration data, the adapter de-embedding data and the termination data are used to determine the positions. /// Use <see cref="WaitForOperationComplete"/> to wait until the tuner has moved each of its axes to the new position. /// Alternatively, use <see cref="QueryTunerStatus"/> in a loop to monitor the repositioning of each tuner axis. /// </summary> /// <param name="phaseVSWR"> /// Specifies the desired voltage standing wave ratio and desired phase of the reflection coefficient in the device reference plane.</param> public void MoveTunerPerVSWR(PhaseVSWR phaseVSWR) { _tuner.SetVSWR(phaseVSWR.VSWR, phaseVSWR.DegreePhase); ErrorQuery(); }