Exemplo n.º 1
0
 private void PlotTotalDelta(Dictionary <string, Series> series, int start, int end)
 {
     for (int index_l = start; index_l < end; index_l++)
     {
         DSLOGEntry en = LogEntries.ElementAt(index_l);
         //Adds points to first and last x values
         double entryTime = en.Time.ToOADate();
         if (index_l == 0 || index_l == end - 1)
         {
             foreach (var kv in IdToPDPGroup)
             {
                 if (kv.Key.StartsWith(DSAttConstants.TotalPrefix))
                 {
                     series[kv.Key].Points.AddXY(entryTime, en.GetGroupPDPTotal(kv.Value) / (TotalPDPScale / 10.0));
                 }
                 else
                 {
                     series[kv.Key].Points.AddXY(entryTime, en.GetGroupPDPSd(kv.Value) / (TotalPDPScale / 10.0));
                 }
             }
         }
         else
         {
             foreach (var kv in IdToPDPGroup)
             {
                 var lastEn = LogEntries.ElementAt(index_l - 1);
                 var nextEn = LogEntries.ElementAt(index_l + 1);
                 if (kv.Key.StartsWith(DSAttConstants.TotalPrefix))
                 {
                     if (lastEn.GetGroupPDPTotal(kv.Value) != en.GetGroupPDPTotal(kv.Value) || nextEn.GetGroupPDPTotal(kv.Value) != en.GetGroupPDPTotal(kv.Value))
                     {
                         series[kv.Key].Points.AddXY(entryTime, en.GetGroupPDPTotal(kv.Value) / (TotalPDPScale / 10.0));
                     }
                 }
                 else
                 {
                     if (lastEn.GetGroupPDPSd(kv.Value) != en.GetGroupPDPSd(kv.Value) || nextEn.GetGroupPDPSd(kv.Value) != en.GetGroupPDPSd(kv.Value))
                     {
                         series[kv.Key].Points.AddXY(entryTime, en.GetGroupPDPSd(kv.Value));
                     }
                 }
             }
         }
     }
 }
Exemplo n.º 2
0
        public static string EntryAttToUnit(this DSLOGEntry en, string name, Dictionary <string, int[]> idTOpdp, bool units = true)
        {
            if (name == DSAttConstants.TripTime)
            {
                return(en.TripTime + ((units) ? "ms":""));
            }
            else if (name == DSAttConstants.LostPackets)
            {
                return((en.LostPackets * 100).ToString("0.##") + ((units) ? "%" : ""));
            }
            else if (name == DSAttConstants.Voltage)
            {
                return(en.Voltage.ToString("0.##") + ((units) ? "V" : ""));
            }
            else if (name == DSAttConstants.RoboRIOCPU)
            {
                return((en.RoboRioCPU * 100).ToString("0.##") + ((units) ? "%" : ""));
            }
            else if (name == DSAttConstants.CANUtil)
            {
                return((en.CANUtil * 100).ToString("0.##") + ((units) ? "%" : ""));
            }
            else if (name.StartsWith(DSAttConstants.PDPPrefix))
            {
                return(en.GetPDPChannel(int.Parse(name.Substring(3))).ToString("0.##") + ((units) ? "A" : ""));
            }
            else if (name == DSAttConstants.DSDisabled)
            {
                return(en.DSDisabled.ToString());
            }
            else if (name == DSAttConstants.DSAuto)
            {
                return(en.DSAuto.ToString());
            }
            else if (name == DSAttConstants.DSTele)
            {
                return(en.DSTele.ToString());
            }
            else if (name == DSAttConstants.RobotDisabled)
            {
                return(en.RobotDisabled.ToString());
            }
            else if (name == DSAttConstants.RobotAuto)
            {
                return(en.RobotAuto.ToString());
            }
            else if (name == DSAttConstants.RobotTele)
            {
                return(en.RobotTele.ToString());
            }

            else if (name == DSAttConstants.Brownout)
            {
                return(en.Brownout.ToString());
            }
            else if (name == DSAttConstants.Watchdog)
            {
                return(en.Watchdog.ToString());
            }
            else if (name == DSAttConstants.TotalPDP)
            {
                return(en.GetDPDTotal().ToString("0.##") + ((units) ? "A" : ""));
            }
            else if (name.StartsWith(DSAttConstants.TotalPrefix))
            {
                return(en.GetGroupPDPTotal(idTOpdp[name]).ToString("0.##") + ((units) ? "A" : ""));
            }
            else if (name.StartsWith(DSAttConstants.DeltaPrefix))
            {
                return(en.GetGroupPDPSd(idTOpdp[name]).ToString("0.##") + ((units) ? "A" : ""));
            }
            return("");
        }