public void UpdateBestSetValue(EncoderCurve curve)
    {
        BestSetValueEnum b          = BestSetValueEnum.AUTOMATIC_FEEDBACK;
        string           encoderVar = GetMainVariable;

        if (encoderAutomaticHigher || encoderAutomaticLower)
        {
            if (encoderVar == Constants.MeanSpeed)
            {
                UpdateBestSetValue(b, curve.MeanSpeedD);
            }
            else if (encoderVar == Constants.MaxSpeed)
            {
                UpdateBestSetValue(b, curve.MaxSpeedD);
            }
            else if (encoderVar == Constants.MeanPower)
            {
                UpdateBestSetValue(b, curve.MeanPowerD);
            }
            else if (encoderVar == Constants.PeakPower)
            {
                UpdateBestSetValue(b, curve.PeakPowerD);
            }
            else if (encoderVar == Constants.MeanForce)
            {
                UpdateBestSetValue(b, curve.MeanForceD);
            }
            else if (encoderVar == Constants.MaxForce)
            {
                UpdateBestSetValue(b, curve.MaxForceD);
            }
        }
    }
    //called from gui/encoderTreeviews.cs
    public string AssignColorAutomatic(BestSetValueEnum b, EncoderCurve curve, string variable)
    {
        if (GetMainVariable != variable)
        {
            return(UtilGtk.ColorNothing);
        }

        double currentValue = curve.GetParameter(variable);

        return(AssignColorAutomatic(b, currentValue));
    }
 public void ResetBestSetValue(BestSetValueEnum b)
 {
     if (b == BestSetValueEnum.AUTOMATIC_FEEDBACK)
     {
         bestSetValueAutomaticFeedback = 0;
     }
     else            // b == BestSetValueEnum.CAPTURE_MAIN_VARIABLE
     {
         bestSetValueCaptureMainVariable = 0;
     }
 }
 private double getBestSetValue(BestSetValueEnum b)
 {
     if (b == BestSetValueEnum.AUTOMATIC_FEEDBACK)
     {
         return(bestSetValueAutomaticFeedback);
     }
     else            // b == BestSetValueEnum.CAPTURE_MAIN_VARIABLE
     {
         return(bestSetValueCaptureMainVariable);
     }
 }
    //called from previous function, gui/encoder.cs plotCurvesGraphDoPlot
    public string AssignColorAutomatic(BestSetValueEnum b, double currentValue)
    {
        if (encoderAutomaticHigher && currentValue > getBestSetValue(b) * encoderAutomaticHigherValue / 100)
        {
            return(UtilGtk.ColorGood);
        }
        else if (encoderAutomaticLower && currentValue < getBestSetValue(b) * encoderAutomaticLowerValue / 100)
        {
            return(UtilGtk.ColorBad);
        }

        return(UtilGtk.ColorNothing);
    }
 public void UpdateBestSetValue(BestSetValueEnum b, double d)
 {
     if (b == BestSetValueEnum.AUTOMATIC_FEEDBACK)
     {
         if (d > bestSetValueAutomaticFeedback)
         {
             bestSetValueAutomaticFeedback = d;
         }
     }
     else
     {               // b == BestSetValueEnum.CAPTURE_MAIN_VARIABLE
         if (d > bestSetValueCaptureMainVariable)
         {
             bestSetValueCaptureMainVariable = d;
         }
     }
 }