https://mooseframework.inl.gov
Loading...
Searching...
No Matches
PIDControl.C
Go to the documentation of this file.
1//* This file is part of the MOOSE framework
2//* https://mooseframework.inl.gov
3//*
4//* All rights reserved, see COPYRIGHT for full restrictions
5//* https://github.com/idaholab/moose/blob/master/COPYRIGHT
6//*
7//* Licensed under LGPL 2.1, please see LICENSE for details
8//* https://www.gnu.org/licenses/lgpl-2.1.html
9
10#include "PIDControl.h"
11
12registerMooseObject("ThermalHydraulicsApp", PIDControl);
13
16{
18 params.addRequiredParam<std::string>("input", "The name of the control data that we read in.");
19 params.addRequiredParam<std::string>("set_point",
20 "The name of the control data with the set point.");
21 params.addRequiredParam<Real>("initial_value", "The initial value for the integral part.");
22 params.addRequiredParam<Real>("K_p", "The coefficient for the proportional term.");
23 params.addRequiredParam<Real>("K_i", "The coefficient for the integral term.");
24 params.addRequiredParam<Real>("K_d", "The coefficient for the derivative term.");
25 params.addClassDescription("Declares a control data named 'output' and uses Proportional "
26 "Integral Derivative logic on the 'value' control data to set it.");
27 return params;
28}
29
31 : THMControl(parameters),
32 _value(getControlData<Real>("input")),
33 _set_point(getControlData<Real>("set_point")),
34 _K_p(getParam<Real>("K_p")),
35 _K_i(getParam<Real>("K_i")),
36 _K_d(getParam<Real>("K_d")),
37 _output(declareComponentControlData<Real>("output")),
38 _initial_value(getParam<Real>("initial_value")),
39 _integral(declareComponentControlData<Real>("integral")),
40 _integral_old(getComponentControlDataOld<Real>("integral")),
41 _error(declareComponentControlData<Real>("error")),
42 _error_old(getComponentControlDataOld<Real>("error"))
43{
45}
46
47void
registerMooseObject("ThermalHydraulicsApp", PIDControl)
void addRequiredParam(const std::string &name, const std::string &doc_string)
void addClassDescription(const std::string &doc_string)
This block represents a proportional-integral-derivative controller (PID controller).
Definition PIDControl.h:21
PIDControl(const InputParameters &parameters)
Definition PIDControl.C:30
Real & _output
The output computed by the PID controller.
Definition PIDControl.h:39
virtual void execute()
Definition PIDControl.C:48
const Real & _K_p
The coefficient for the proportional term.
Definition PIDControl.h:33
static InputParameters validParams()
Definition PIDControl.C:15
const Real & _K_d
The coefficient for the derivative term.
Definition PIDControl.h:37
const Real & _value
input data
Definition PIDControl.h:29
const Real & _error_old
The old value of the error.
Definition PIDControl.h:49
const Real & _integral_old
The old value of _integral.
Definition PIDControl.h:45
const Real & _set_point
set point
Definition PIDControl.h:31
Real & _error
The current value of the error.
Definition PIDControl.h:47
Real & _integral
The integral value accumulated over time.
Definition PIDControl.h:43
const Real & _K_i
The coefficient for the integral term.
Definition PIDControl.h:35
const Real & _initial_value
Initial value.
Definition PIDControl.h:41
static InputParameters validParams()
Definition THMControl.C:13
Real & _dt