Exemple #1
0
        private new void Capture(object state)
        {
            m_RpmValues = new List <DatedValue>();
            m_KphValues = new List <DatedValue>();
            OBDParameterValue value;
            DatedValue        d_value;

            while (m_Capture)
            {
                value = m_obdInterface.getValue("SAE.RPM", true);
                if (!value.ErrorDetected)
                {
                    d_value      = new DatedValue(value.DoubleValue);
                    d_value.Date = DateTime.Now;
                    if (Convert.ToDecimal(d_value.Value) >= numFromRPM.Value &&
                        Convert.ToDecimal(d_value.Value) <= numToRPM.Value)
                    {
                        m_RpmValues.Add(d_value);
                        value = m_obdInterface.getValue("SAE.VSS", false);
                        if (!value.ErrorDetected)
                        {
                            d_value      = new DatedValue(value.DoubleValue * (double)m_obdInterface.ActiveProfile.SpeedCalibrationFactor);
                            d_value.Date = DateTime.Now;
                            m_KphValues.Add(d_value);
                        }
                        m_Capture = false;
                    }
                }
            }
            Calculate();
            btnOpen.Enabled = true;
        }
Exemple #2
0
        private new void Capture(object state)
        {
            m_arrRpmValues = new ArrayList();
            m_arrKphValues = new ArrayList();
            bool flag = false;

            if (m_bCapture)
            {
                do
                {
                    OBDParameterValue obdParameterValue1 = m_obdInterface.getValue("SAE.RPM", true);
                    if (!obdParameterValue1.ErrorDetected)
                    {
                        DatedValue datedValue1 = new DatedValue(obdParameterValue1.DoubleValue);
                        DateTime   now1        = DateTime.Now;
                        datedValue1.Date = now1;
                        Decimal num1 = numFromRPM.Value;
                        Decimal num2 = new Decimal();
                        num2 = new Decimal(datedValue1.Value);
                        if (num2 >= num1)
                        {
                            Decimal num3 = numToRPM.Value;
                            Decimal num4 = new Decimal();
                            num4 = new Decimal(datedValue1.Value);
                            if (num4 <= num3)
                            {
                                m_arrRpmValues.Add((object)datedValue1);
                                OBDParameterValue obdParameterValue2 = m_obdInterface.getValue("SAE.VSS", false);

                                if (!obdParameterValue2.ErrorDetected)
                                {
                                    float      num5        = m_obdInterface.GetActiveProfile().SpeedCalibrationFactor;
                                    DatedValue datedValue2 = new DatedValue(obdParameterValue2.DoubleValue * (double)num5);
                                    DateTime   now2        = DateTime.Now;
                                    datedValue2.Date = now2;
                                    m_arrKphValues.Add((object)datedValue2);
                                }
                                flag = true;
                                goto label_9;
                            }
                        }
                        if (flag)
                        {
                            m_bCapture = false;
                        }
                    }
                    label_9 :;
                }while (m_bCapture);
            }
            Calculate();
            btnOpen.Enabled = true;
        }
Exemple #3
0
        private void CalculateTimeslip()
        {
            double num1 = 0.0;
            double num2 = 0.0;
            bool   flag = false;

            timeslip         = new Timeslip();
            timeslip.Vehicle = m_obdInterface.ActiveProfile.Name;
            if (m_KphValues == null || m_KphValues.Count == 0)
            {
                return;
            }
            timeslip.Vehicle = m_obdInterface.ActiveProfile.Name;
            timeslip.Date    = m_KphValues[0].Date;
            if (m_KphValues.Count <= 1)
            {
                return;
            }

            int index = 1;

            do
            {
                DatedValue datedValue1  = m_KphValues[index - 1];
                DatedValue datedValue2  = m_KphValues[index];
                double     num3         = (datedValue2.Value + datedValue1.Value) * 0.5 * (5.0 / 18.0);
                DateTime   dateTime     = datedValue1.Date;
                double     totalSeconds = datedValue2.Date.Subtract(dateTime).TotalSeconds;
                num1 += totalSeconds;
                double num4 = totalSeconds * num3;
                num2 += num4;
                if (num2 >= 18.288 && timeslip.SixtyFootTime == 0.0)
                {
                    timeslip.SixtyFootTime = num1 - (num2 - 18.288) / num3;
                    flag = true;
                }
                if (datedValue2.Value >= 96.56064 && timeslip.SixtyMphTime == 0.0)
                {
                    timeslip.SixtyMphTime = num1 - (datedValue2.Value - 96.56064) / ((datedValue2.Value - datedValue1.Value) / totalSeconds);
                    flag = true;
                }
                if (num2 >= 201.168 && timeslip.EighthMileTime == 0.0)
                {
                    double num5 = num2 - 201.168;
                    timeslip.EighthMileTime  = num1 - num5 / num3;
                    timeslip.EighthMileSpeed = ((datedValue2.Value - datedValue1.Value) * ((num4 - num5) / num4) + datedValue1.Value) * 0.621371192;
                    flag = true;
                }
                if (num2 >= 304.8 && timeslip.ThousandFootTime == 0.0)
                {
                    timeslip.ThousandFootTime = num1 - (num2 - 304.8) / num3;
                    flag = true;
                }
                if (num2 >= 402.336 && timeslip.QuarterMileTime == 0.0)
                {
                    double num5 = num2 - 402.336;
                    timeslip.QuarterMileTime  = num1 - num5 / num3;
                    timeslip.QuarterMileSpeed = ((datedValue2.Value - datedValue1.Value) * ((num4 - num5) / num4) + datedValue1.Value) * 0.621371192;
                    flag       = true;
                    m_bCapture = false;
                }
                ++index;
            }while (index < m_KphValues.Count);
            if (!flag)
            {
                return;
            }
            UpdateTimeslip();
        }