attempted PID controller with Kepler

I wanted to check out the Kepler scientific workflow system (, and decided to build a PID controller model with it. Here I report on my results.

The following schematic, taken from the Wikipedia entry, shows the basic configuration of a PID controller. PID stands for “proportional integral derivative”, reflecting the fact that the value of the error between a set point r(t) and “plant” (process) output y(t) is subjected to a proportional multiplier (gain P), an integration of the error times a gain (gain I), and the derivative of the error times a gain (gain D). These results are then added together and used as input u(t) to the plant. As the plant output y(t) approaches the set point, the error decreases and therefore the modulation of plant input u(t) by the proportion, integral, and derivative components decreases. When the gains are tuned correctly, such a controller causes the plant output value to track the set point.


My resulting Kepler model implementing a PID controller for a simulated plant looks like:


The process to be controlled is a sine wave plus input u(t), where u(t) is modulated by the control system. The set point is 10. Note the “Sensor Lag” objects which are time delays necessary to prevent causality loop errors.

Simulating the system with naïve gains gives us:


Here the system oscillates around the value five, sometimes nearing 10 in values. I ran out of time allotted for this project before I could tune the gain parameters to produce a more satisfactory tracking of the set point. I believe the spikes at the discontinuous points are the derivative step trying to deal with theoretically infinite slopes, or they are artifacts of the underlying Runge-Kutta simulation procedure (or both). In either case the size of the spikes builds over simulation time, causing the simulation to eventually fail due to production of infinite values.

It may be that my choice of a sine wave plus u(t) for the plant is a poor one for PID control. If I come up with a more appropriate plant I’ll try this again.

Post Author: badassdatascience

2 thoughts on “attempted PID controller with Kepler

Leave a Reply

Your email address will not be published.