/// <summary> /// Formats a Table into the AMPS box readable time Table. /// </summary> /// <param name="table"> /// </param> /// <param name="converter"> /// The converter. /// </param> /// <returns> /// The <see cref="string"/>. /// </returns> public string FormatTable(AmpsSignalTable table, ITimeUnitConverter <double> converter) { string eventData = string.Empty; TimeUnits units = TimeUnits.Ticks; foreach (var point in table.Points) { StringBuilder timeBuilder = new StringBuilder(); // timeBuilder.AppendFormat("\tTime\t{0:F0}\n", converter.ConvertTo(table.ExecutionData.TimeUnits, units, time)); foreach (var signal in point.DcBiasElements) { timeBuilder.AppendFormat( "\t\tChannel\t{0}\tdouble\t{1:F0}\n", signal.Key, signal.Value); } foreach (var digitalOutputElement in point.DigitalOutputElements) { timeBuilder.AppendFormat( "\t\tChannel\t{0}\tTTL State\t{1:F0}\n", digitalOutputElement.Key, digitalOutputElement.Value); } string events = timeBuilder.ToString().TrimEnd(':'); eventData += events; } eventData = eventData.TrimEnd(','); return(string.Format( m_commandFormat, eventData)); }
/// <summary> /// Formats a Table into the AMPS box readable time Table. /// </summary> /// <param name="table"> /// </param> /// <param name="converter"> /// The converter. /// </param> /// <returns> /// The <see cref="string"/>. /// </returns> public string FormatTable(AmpsSignalTable table, ITimeUnitConverter <double> converter) { //IEnumerable<double> times = table.StartTimes; //times = times.OrderBy(x => x); //StringBuilder timeBuilder = new StringBuilder(); //TimeUnits units = TimeUnits.Seconds; //foreach (double time in times) //{ // IEnumerable<SignalElement> signals = table.GetSignals(time); // timeBuilder.AppendFormat("\t-----------------------------------------------\n"); // foreach (var signal in signals) // { // double xTime = converter.ConvertTo(table.ExecutionData.TimeUnits, units, signal.StartTime); // var output = signal as AnalogStepElement; // if (output != null) // { // timeBuilder.AppendFormat("\t{0}\t{1}\t{2:F0}\n", xTime, signal.Channel, output.Value); // } // } //} //string eventData = timeBuilder.ToString(); //return string.Format( // "Table: {0}\n\tLength:\t{1}\n\tTime Units:\t{2}\n{3}", // table.ExecutionData.Name, // converter.ConvertTo(table.ExecutionData.TimeUnits, units, table.Length), // units, // eventData); throw new NotImplementedException(); }