Ejemplo n.º 1
0
        private void PlotPDP(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)
                {
                    for (int i = 0; i < 24; i++)
                    {
                        series[DSAttConstants.PDPPrefix + i].Points.AddXY(entryTime, en.GetPDPChannel(i));
                    }
                }
                else
                {
                    var lastEn = LogEntries.ElementAt(index_l - 1);
                    var nextEn = LogEntries.ElementAt(index_l + 1);
                    //Checks if value is differnt around it so we don't plot everypoint

                    for (int i = 0; i < 24; i++)
                    {
                        if (lastEn.GetPDPChannel(i) != en.GetPDPChannel(i) || nextEn.GetPDPChannel(i) != en.GetPDPChannel(i))
                        {
                            series[DSAttConstants.PDPPrefix + i].Points.AddXY(entryTime, en.GetPDPChannel(i));
                        }
                    }
                }
            }
        }
Ejemplo 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("");
        }