PIDChainControl

This ChainControl implements the classic PID controller, which takes as its input a value xx and the set point for that value, xˉ\bar{x}. It produces an output signal yy, which should be used as the input for some controllable device that impacts the measured quantity xx. For example, in a thermal system, xx may be the temperature of a fluid at some location, and yy may be the power sent to the heaters in the system, with the goal to heat the fluid such that the temperature at some location is xˉ\bar{x}.

"PID" stands for its three components:

  • P: Proportional

  • I: Integral

  • D: Derivative

The output signal yy at time tnt_n is computed as follows:

yn=Kpen+Kim=1nemΔtm+Kdenen1Δtn,y_n = K_p e_n + K_i \sum\limits_{m=1}^n e_m \Delta t_m + K_d \frac{e_n - e_{n-1}}{\Delta t_n} \,,

where Δtntntn1\Delta t_n \equiv t_n - t_{n-1} is the time step size and ene_n is the error:

enxˉnxn.e_n \equiv \bar{x}_n - x_n \,.
warningwarning:Execute only once per time step

The implementation assumes that the control will only be executed once per time step, so you should set "execute_on" accordingly, such as execute_on = 'INITIAL TIMESTEP_END', which is the default.

The inputs and outputs are retrieved and named as follows, respectively:

  • xx is set with "input".

  • xˉ\bar{x} is set with "set_point".

  • yy is declared with the name <control_name>:value, where <control_name> is the user-given name of the PIDChainControl.

schooltip:Tuning PID coefficients

If you are unsure on how to select the PID coefficients KpK_p, KiK_i, and KdK_d, you may try the following strategy, which involves some trial and error. First, set KiK_i and KdK_d to zero. Then, set KpK_p to some arbitrary (positive) value. Run a simulation with x0xˉx_0 \neq \bar{x} and examine the transient response of xx to the set point value xˉ\bar{x}. The goal should be to maximize KpK_p without causing an unstable response, where xx oscillates indefinitely around xˉ\bar{x}. Some initial overshoot and subsequent diminishing oscillations are acceptable. After this acceptable value of KpK_p is found, you'll likely find that xx appears to be nearly constant in time, but at the wrong value. At this point, you should start increasing KiK_i from zero until you get an acceptable response time to get the initial response (largely driven by KpK_p) to bridge the gap to xˉ\bar{x}, without introducing oscillatory behavior. Lastly, KdK_d can be used to fine-tune the response, but it is not necessary, and it risks some oscillatory behavior if the inputs have any noise, so it should only be used for relatively smooth inputs.

commentnote

To control a controllable value directly instead of using a ChainControlData, use PIDTransientControl.

Input Parameters

  • K_dCoefficient for the derivative term

    C++ Type:double

    Unit:(no unit assumed)

    Controllable:No

    Description:Coefficient for the derivative term

  • K_iCoefficient for the integral term

    C++ Type:double

    Unit:(no unit assumed)

    Controllable:No

    Description:Coefficient for the integral term

  • K_pCoefficient for the proportional term

    C++ Type:double

    Unit:(no unit assumed)

    Controllable:No

    Description:Coefficient for the proportional term

  • inputInput control data

    C++ Type:std::string

    Unit:(no unit assumed)

    Controllable:No

    Description:Input control data

  • set_pointSet point control data

    C++ Type:std::string

    Unit:(no unit assumed)

    Controllable:No

    Description:Set point control data

Required Parameters

  • depends_onThe Controls that this control relies upon (i.e. must execute before this one)

    C++ Type:std::vector<std::string>

    Unit:(no unit assumed)

    Controllable:No

    Description:The Controls that this control relies upon (i.e. must execute before this one)

  • execute_onINITIAL TIMESTEP_ENDThe list of flag(s) indicating when this object should be executed. For a description of each flag, see https://mooseframework.inl.gov/source/interfaces/SetupInterface.html.

    Default:INITIAL TIMESTEP_END

    C++ Type:ExecFlagEnum

    Unit:(no unit assumed)

    Options:NONE, INITIAL, LINEAR, NONLINEAR_CONVERGENCE, NONLINEAR, POSTCHECK, TIMESTEP_END, TIMESTEP_BEGIN, MULTIAPP_FIXED_POINT_END, MULTIAPP_FIXED_POINT_BEGIN, FINAL, CUSTOM, PRE_MULTIAPP_SETUP

    Controllable:No

    Description:The list of flag(s) indicating when this object should be executed. For a description of each flag, see https://mooseframework.inl.gov/source/interfaces/SetupInterface.html.

  • initial_integral0Initial value for the integral component

    Default:0

    C++ Type:double

    Unit:(no unit assumed)

    Controllable:No

    Description:Initial value for the integral component

Optional Parameters

  • control_tagsAdds user-defined labels for accessing object parameters via control logic.

    C++ Type:std::vector<std::string>

    Unit:(no unit assumed)

    Controllable:No

    Description:Adds user-defined labels for accessing object parameters via control logic.

  • enableTrueSet the enabled status of the MooseObject.

    Default:True

    C++ Type:bool

    Unit:(no unit assumed)

    Controllable:No

    Description:Set the enabled status of the MooseObject.

  • implicitTrueDetermines whether this object is calculated using an implicit or explicit form

    Default:True

    C++ Type:bool

    Unit:(no unit assumed)

    Controllable:No

    Description:Determines whether this object is calculated using an implicit or explicit form

Advanced Parameters