示例#1
0
 private void WriteFile(string path, FRATableFormat tableFormat)
 {
     using (StreamWriter wr = new StreamWriter(path))
     {
         wr.AutoFlush = true;
         wr.WriteLine(FRAResult.ToStringTitles(tableFormat));
         foreach (FRAResult result in m_FRAResults)
         {
             wr.WriteLine(result.ToStringValues(tableFormat));
         }
     }
 }
示例#2
0
 public string GetDataTable(FRATableFormat tableFormat)
 {
     using (StringWriter wr = new StringWriter())
     {
         wr.WriteLine(FRAResult.ToStringTitles(tableFormat));
         foreach (FRAResult result in m_FRAResults)
         {
             wr.WriteLine(result.ToStringValues(tableFormat));
         }
         return(wr.ToString());
     }
 }
        public static string ToStringTitles(FRATableFormat tableFormat)
        {
            switch (tableFormat)
            {
            case FRATableFormat.CSV_FRA4PicoScope:
                return("Frequency Log(Hz), Gain(dB), Phase(deg)");

            case FRATableFormat.CSV_RhodeSchwarz:
                return("in Sa,Frequency in Hz,Gain in dB,Phase in °,Amplitude in Vpp");

            case FRATableFormat.CSV_Keysight:
                return("#, Frequency (Hz), Amplitude (Vpp), Gain (dB), Phase (°)");

            case FRATableFormat.Excel_ALL:
                return("Frequency(Hz)" + "\t" + "Gain(dB)" + "\t" + "Phase(°)" + "\t" + "Impedance(MilliOhms)" + "\t" +
                       "Capacitance(pF)" + "\t" + "Inductance(nH)" + "\t" + "ESR(MilliOhms)" + "\t" + "Q(Capacitor)" + "\t" + "Q(Inductor)");

            default:
                return("");
            }
        }
        public string ToStringValues(FRATableFormat tableFormat)
        {
            switch (tableFormat)
            {
            case FRATableFormat.CSV_FRA4PicoScope:
                return(FrequencyLogHz.ToString(CultureInfo.InvariantCulture) + "," + GainFRA_DB.ToString(CultureInfo.InvariantCulture) + "," + PhaseDegrees.ToString(CultureInfo.InvariantCulture));

            case FRATableFormat.CSV_Keysight:
                throw new NotImplementedException("TODO Keysight Formatting");     // currently also not used for saving

            case FRATableFormat.CSV_RhodeSchwarz:
                throw new NotImplementedException("TODO RhodeSchwarz Formatting");     // currently also not used for saving

            case FRATableFormat.Excel_ALL:
                return(FrequencyHz.ToString() + "\t" + GainFRA_DB.ToString() + "\t" + PhaseDegrees.ToString() + "\t" +
                       DUTImpedanceMilliOhms.ToString() + "\t" + DUTSeriesCapacitancePicoFarad.ToString() + "\t" +
                       DUTSeriesInductanceNanoHenry.ToString() + "\t" + DUT_ESR_MilliOhms.ToString() + "\t" + DUT_QCapacitor.ToString() + "\t" + DUT_QInductor.ToString());

            default:
                return("");
            }
        }