aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/lib/transport/pid_controller.h
diff options
context:
space:
mode:
authorGravatar Craig Tiller <ctiller@google.com>2017-02-07 10:30:58 -0800
committerGravatar Craig Tiller <ctiller@google.com>2017-02-07 10:30:58 -0800
commitd52b76de441a32912daf0b00a2c09ebd1ff66629 (patch)
treed1849be228d2cd71c6ef13cb0b7166501ecd2e71 /src/core/lib/transport/pid_controller.h
parent6911d08388a7958e159d96481770caf8e7bb8a9e (diff)
parent923e054da4141beaca0f8e4da24652b78b091582 (diff)
Merge github.com:grpc/grpc into bm_perf
Diffstat (limited to 'src/core/lib/transport/pid_controller.h')
-rw-r--r--src/core/lib/transport/pid_controller.h17
1 files changed, 15 insertions, 2 deletions
diff --git a/src/core/lib/transport/pid_controller.h b/src/core/lib/transport/pid_controller.h
index 83c82d6471..0a86521e90 100644
--- a/src/core/lib/transport/pid_controller.h
+++ b/src/core/lib/transport/pid_controller.h
@@ -45,20 +45,33 @@ typedef struct {
double gain_p;
double gain_i;
double gain_d;
+ double initial_control_value;
+ double min_control_value;
+ double max_control_value;
+ double integral_range;
+} grpc_pid_controller_args;
+
+typedef struct {
double last_error;
double error_integral;
+ double last_control_value;
+ double last_dc_dt;
+ grpc_pid_controller_args args;
} grpc_pid_controller;
/** Initialize the controller */
void grpc_pid_controller_init(grpc_pid_controller *pid_controller,
- double gain_p, double gain_i, double gain_d);
+ grpc_pid_controller_args args);
/** Reset the controller: useful when things have changed significantly */
void grpc_pid_controller_reset(grpc_pid_controller *pid_controller);
/** Update the controller: given a current error estimate, and the time since
- the last update, returns a delta to the control value */
+ the last update, returns a new control value */
double grpc_pid_controller_update(grpc_pid_controller *pid_controller,
double error, double dt);
+/** Returns the last control value calculated */
+double grpc_pid_controller_last(grpc_pid_controller *pid_controller);
+
#endif /* GRPC_CORE_LIB_TRANSPORT_PID_CONTROLLER_H */