Skip to content

Commit 87ee85d

Browse files
author
Steinar Elgsæter
committed
-fixes #206
1 parent b999eb9 commit 87ee85d

File tree

3 files changed

+8
-1
lines changed

3 files changed

+8
-1
lines changed

Dynamic/Identification/PidIdentifier.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -434,6 +434,7 @@ private double[] GetErrorTerm(UnitDataSet dataSet, PidFilter pidFilter)
434434
if (pidParam.Scaling.IsKpScalingOn())
435435
{
436436
yScaleFactor = 1 / pidScaling.GetKpScalingFactor();
437+
// yScaleFactor = pidScaling.GetKpScalingFactor();
437438
}
438439
if (yScaleFactor == 1)
439440
{

Dynamic/PID/PIDcontroller.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -357,6 +357,8 @@ public double Iterate(double y_process_abs, double y_set_abs, double? uTrackSign
357357
// scaling
358358
double KpScalingFactor = pidScaling.GetKpScalingFactor();
359359
double KpUnscaled = Kp / KpScalingFactor;
360+
// double KpUnscaled = Kp * KpScalingFactor;
361+
360362

361363
// it iterate PID-controller one timestep
362364
// y_process_abs is the absolute value of the process value(scalar)

Dynamic/PID/PIDscaling.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,11 +179,15 @@ public double GetUScaleFactor()
179179

180180
/// <summary>
181181
/// Get a scaling factor to convert and unscaled Kp
182+
///
183+
/// By defintion KpUnscaled = Kp / KpScalingFactor
184+
///
182185
/// </summary>
183186
/// <returns></returns>
184187
public double GetKpScalingFactor()
185188
{
186-
return GetYScaleFactor() / GetUScaleFactor();
189+
return GetUScaleFactor() / GetYScaleFactor(); // verified as correct
190+
/// return GetYScaleFactor() / GetUScaleFactor(); // does not match AIM behaviour
187191
}
188192

189193

0 commit comments

Comments
 (0)