|
@@ -123,12 +123,11 @@ public class PidLambdaContainer {
|
|
|
conversion=Double.parseDouble(cols[1]);
|
|
|
cpa=Double.parseDouble(cols[2]);
|
|
|
realCost=Double.parseDouble(cols[3]);
|
|
|
- Double lambdaNew=1d;
|
|
|
if(conversion<5d){
|
|
|
conversion=1d;
|
|
|
}
|
|
|
latestRealCPA=realCost/conversion;
|
|
|
- lambdaNew =cacheItem.calculate(kp,ki,kd,cpa,latestRealCPA);
|
|
|
+ Double lambdaNew =cacheItem.calculate(kp,ki,kd,cpa,latestRealCPA);
|
|
|
|
|
|
cacheItem.lambda=lambdaNew;
|
|
|
cacheItem.latestRealCpa=latestRealCPA;
|
|
@@ -214,9 +213,9 @@ public class PidLambdaContainer {
|
|
|
|
|
|
public double latestRealCpa=0d;
|
|
|
|
|
|
- private double processVariable; // 处理变量
|
|
|
- private double integral; // 积分项
|
|
|
- private double lastError; // 上一个误差
|
|
|
+ private double processVariable=0d; // 处理变量
|
|
|
+ private double integral=0d; // 积分项
|
|
|
+ private double lastError=0d; // 上一个误差
|
|
|
|
|
|
public double calculate(double kp, double ki, double kd, double setPoint,double currentValue) {
|
|
|
processVariable = currentValue;
|