分析代码，检测是否到达目标力的逻辑有问题吗bool isIncreasing = i < numPoints / 2; // 判断是增加还是减少 forceInt
                    int delay = 13 * 1000; // 延迟时间
                    //double upperResolution1, lowerResolution1;
                    //float displacement;
                    //int stiffness = j;
                    //int force;

                    while ((isIncreasing && forceInt < force) || (!isIncreasing && forceInt > force))
                    {

                        // 计算 forceInt 和 force 之间的差值
                        int difference = Math.Abs(force - forceInt);

                        // 定义最小步进值，防止步进值过小导致无限循环
                        int minStep = 1;

                        // 计算步进值，步进值可以是差值的一半，或者其他合适的比例
                        int step = Math.Max(difference / 2, minStep);

                        // 根据 isIncreasing 增加或减少 forceInt
                        forceInt += isIncreasing ? step : -step;

                        // 确保 forceInt 不小于 forceValue
                        if (forceInt < forceValue)
                        {
                            int randomNumber = rand.Next(1, 21);
                            forceInt = forceValue + randomNumber;
                        }
                            

                        Force_Set(forceInt); // 设置力值
                        await Task.Delay(delay); // 延迟

                        List<double> list = new List<double> { };
                        double[] data = rawSignalUp.ToArray();
                        if (isbandstopFirst)
                        {
                            for (int k = 0; k < 100; k++)
                            {
                                bandstop.bandStop(data[k]);
                            }
                            isbandstopFirst = false;
                        }


                        for (int k = 0; k < 200; k++)
                        {
                            list.Add(bandstop.bandStop(data[k]));
                        }

                        List<double> list1 = new List<double> { };
                        double[] data1 = rawSignalDown.ToArray();

                        for (int k = 0; k < 200; k++)
                        {
                            list1.Add(bandstop.bandStop(data1[k]));
                        }


                        // 读取分辨率值
                        upperResolution1 = Math.Round(list.Average(), 3);

                        lowerResolution1 = Math.Round(list1.Average(), 3);

                        // 计算位移
                        displacement = (float)((upperResolution - upperResolution1) + (lowerResolution - lowerResolution1));

                        // 计算力值
                        force = (int)(displacement * stiffness) + forceValue;
                    }

                 
                    Console.WriteLine("加电压到" + sineWave[i] * 25 + "V, 后....位移: " + Math.Round(displacement, 2) + "阻挡力：" + textBox5.Text);
                    //检查力是否到位，如果不到位记录一下。
                    int maxChecks = 100;
                    int interval = 200; // milliseconds
                   int tolerance = 10; // tolerance range
                   int currentValue;
                   for (int k = 0; k < maxChecks; k++)
                   {
                       // Wait for the specified interval
                       await Task.Delay(interval);
                       if (int.TryParse(textBox5.Text, out currentValue))
                       {
                           // Check if the value is within the tolerance range
                           if (Math.Abs(currentValue - (force - forceValue)) <= tolerance)
                           {
                               break;
                           }
                       }
                       if (k == maxChecks - 1)
                       {
                           Console.WriteLine("没有到达目标力");
                       }
                       
                   }