AnsweredAssumed Answered

AF SDK transpose interpolated data

Question asked by mdspath on Jul 14, 2015
Latest reply on Jul 14, 2015 by dng

Hello:

I'm trying to find a good way to transpose the data that is coming from the interpolated values call. Each iteration of sIdObjVal below gives the tagname and data but we need to build rows. see code below for reference.

 

public class VesselData
 {
public VesselData()
 {
this.parameterValues = new ObservableCollection<ParameterTag>();
 }

private DateTime timestamp;

public DateTime Timestamp
 {
get { return timestamp; }
set { timestamp = value; }
 }

private ObservableCollection<ParameterTag> parameterValues;

public ObservableCollection<ParameterTag> ParameterValues
 {
get { return parameterValues; }
set { parameterValues = value; }
 }
    }


#region loop through each vessel tag result
foreach (AFValues sIdObjVal in pointsValues)
 {
int i = 1;

foreach (AFValue val in sIdObjVal) // loop through all result values
 {

if (i > lstVesselTagNmes.Count)
 {
 VesselList.Add(row);
 row = new VesselData();
 i = 1;
 }

 #region Loop through the parameters for that vessel number
if (val.IsGood)
 {
double fc = 0;

 row.Timestamp = val.Timestamp;

 fc = (double)Math.Round((double)val.Value * getDecimalPointValue()) / getDecimalPointValue();
ParameterTag param = new ParameterTag();
 param.ParamName = "Parameter " + i;
 param.ParamValue = fc;
 row.ParameterValues.Add(param);
 i++;
 }

 #endregion

 }
//increment Analyzer counter as we have another group of SID for the Batch
//iAnalyzerCnt++;
 }
 #endregion

Outcomes