NWH Common
Search Results for

    Show / Hide Table of Contents

    Class PIDController

    Proportional-Integral-Derivative controller for smooth value regulation. Used for automated control systems like cruise control, stability systems, and steering assistance.

    Inheritance
    object
    PIDController
    Namespace: NWH.Common.Utility
    Assembly: NWH.Common.dll
    Syntax
    public class PIDController
    Remarks

    PID controllers combine three control strategies:

    • Proportional: Reacts to current error
    • Integral: Eliminates accumulated error over time
    • Derivative: Anticipates future error based on rate of change Tune the three gain values to achieve desired response characteristics.

    Constructors

    | Edit this page View Source

    PIDController(float, float, float, float, float)

    Creates a new PID controller with specified gains and output limits.

    Declaration
    public PIDController(float gainProportional, float gainIntegral, float gainDerivative, float outputMin, float outputMax)
    Parameters
    Type Name Description
    float gainProportional

    Proportional gain (Kp). Higher values increase response to current error.

    float gainIntegral

    Integral gain (Ki). Higher values eliminate steady-state error faster.

    float gainDerivative

    Derivative gain (Kd). Higher values dampen oscillations.

    float outputMin

    Minimum output value.

    float outputMax

    Maximum output value.

    Fields

    | Edit this page View Source

    maxValue

    Maximum output value. Output will be clamped to this value.

    Declaration
    public float maxValue
    Field Value
    Type Description
    float
    | Edit this page View Source

    minValue

    Minimum output value. Output will be clamped to this value.

    Declaration
    public float minValue
    Field Value
    Type Description
    float

    Properties

    | Edit this page View Source

    GainDerivative

    The derivative term is proportional to the rate of change of the error

    Declaration
    public float GainDerivative { get; set; }
    Property Value
    Type Description
    float
    | Edit this page View Source

    GainIntegral

    The integral term is proportional to both the magnitude of the error and the duration of the error

    Declaration
    public float GainIntegral { get; set; }
    Property Value
    Type Description
    float
    | Edit this page View Source

    GainProportional

    The proportional term produces an output value that is proportional to the current error value

    Declaration
    public float GainProportional { get; set; }
    Property Value
    Type Description
    float
    Remarks

    Tuning theory and industrial practice indicate that the proportional term should contribute the bulk of the output change.

    | Edit this page View Source

    IntegralTerm

    Adjustment made by considering the accumulated error over time

    Declaration
    public float IntegralTerm { get; }
    Property Value
    Type Description
    float
    Remarks

    An alternative formulation of the integral action, is the proportional-summation-difference used in discrete-time systems

    | Edit this page View Source

    ProcessVariable

    The current value

    Declaration
    public float ProcessVariable { get; set; }
    Property Value
    Type Description
    float
    | Edit this page View Source

    ProcessVariableLast

    The last reported value (used to calculate the rate of change)

    Declaration
    public float ProcessVariableLast { get; }
    Property Value
    Type Description
    float
    | Edit this page View Source

    SetPoint

    The desired value

    Declaration
    public float SetPoint { get; set; }
    Property Value
    Type Description
    float

    Methods

    | Edit this page View Source

    ControlVariable(float)

    The controller output

    Declaration
    public float ControlVariable(float timeSinceLastUpdate)
    Parameters
    Type Name Description
    float timeSinceLastUpdate

    timespan of the elapsed time since the previous time that ControlVariable was called

    Returns
    Type Description
    float

    Value of the variable that needs to be controlled

    • Edit this page
    • View Source
    In this article
    Back to top Copyright © NWH - Vehicle Physics, Aerodynamics, Dynamic Water Physics