# Control theory basics

I'm trying to understand something very basic about Control Theory. Let's say I have the following loop:

If we'll relate this loop to a cart with a motor going in its single axis from X = 0 to X = 50, the controlled variable will be the engine speed (v), while the monitored variable will be the cart location (x).

In this case:

• The measured output should be the cart location, right? But the system output should be the engine speed, shouldn't it? If so, how does this work in the equations? (units-wise)

• What will be the Reference, System Input, System Output?

-

The control output (what you are calling the system input) and the system output are not necessarily proportional. In your example, the system is in part a integrator. This sort of thing is common. The extra pole in the system does have to be taken into account in the controller, else it can easily lead to instability.

The less directly related the control output and the system output are, the more complicated the control algorithm has to be. In the real world, you often get systems that are non-linear, partially integrate the input, etc. This is why control theory is a discipline onto itself.

-
Quote: "In your example, the system is in part a integrator". A good approximation for a dc motor (voltage in and rotating angle out) is a third-order transfer function (I-T2). – LvW Jun 27 '14 at 7:27

You need to have a goal to measure with respect to. If the goal is to simply get the cart to a certain location then you will be monitoring the location as you move along the path (like an encoder counts light ticks) and subtracting that from the total distance you intended to travel until you reach zero.

In your example it comes across to me as the system output will be the cart's location and the system input is going to be motor speed. In this way, we either slow down or speed up the motor speed to get to out destination.

The example I fall back to when thinking of control theory is a car in which the intent is to minimize the variance between a vehicle in front of you and a fixed distance behind it. The sensor is your eyes through which you observe (feedback) the change in distance and rate-of-change of distance. If you see that the variance is increasing then you may input into the system an acceleration that is proportional to the rate-of-change observed by your eyes between you and the vehicle ahead (this may either positive of negative acceleration depending on the direction the car is moving with respect to your position relative to it).

-

I think, a good example for your block diagram is the classical x-y plotter, which has two such systems (one for each direction). In this case:

• Input (reference): Voltage in V;
• Output: Location in cm;
• Controller: Control unit for correction of dynamic loop properties (V in and V out); in our example (x-yplotter): Mostly PD-T1 (lead) controller.
• System (two sections): (1) DC motor (conversion of voltage into revolutions per seconds, rps); (2) Gearbox for translation into horizontal movement (rps into cm).

• Sensor: Conversion of location (cm) back to voltage (like a potentiometr).

-

Unit-wise the solution is actually rather trivial. The parameters to your controller (for example, P, I and D) are not in fact dimensionless, but can be dimensioned (implicitly) as such that they 'convert' the error to the desired system input. For example, if your input is volts, the output amperes, your proportional action would be in ampere per volt (hence, proportional!).

Your in- and output should be carefully chosen by yourself. For example, a 'position' measured output would be much more logical than some meaningless 'voltage', but there are limits. Take for example the flow in the river with a dam: if you measure too far away from the dam, your system will have so much lag that it will become uncontrollable. In other words, you are free to choose your system borders for any subsystem, but choose them carefully.

-

The measured output should be the cart location, right? But the system output should be the engine speed, shouldn't it? If so, how does this work in the equations? (units-wise)

You will implement this either in a analog circuit, or in a discrete environment. In an analog system, the magnitudes will be in V (volts). And, in a discrete system, there will be bits and bytes. So the original units are gone. Don't worry about the units.

What will be the Reference, System Input, System Output?

Reference and input are the same things. We apply the reference as input. If you are asking these two information, then you are leaving the system design to us. There may be infinitely many solutions to this problem. The position and velocity information can be given out from some part of the system. However, the actual system output can be anything.

Example:

Reference: Angle of the gas pedal
Output: Voltage level generated by the tachometer
Sensor: Something that scales tachometer reading to the gas pedal level

You can find the position by integration the tachometer reading.

-
Would output in your example be more appropriately the increased RPM of the engine or is that not related to the control by is rather just some consequence thereof? The sensor would then be something that measures the RPM which would adjust the tach. In this way, the driver observes the tach and, through feedback, adjusts the angle of the gas pedal accordingly. – sherrellbc Jun 26 '14 at 14:17
Units are very important. Those volts represent a physical quantity, according to some units conversion. Saying "don't worry about the units" is a recipe for huge trouble. – Ben Voigt Jun 26 '14 at 18:43

For any control problem, attacking the mathematical model of the system is your first goal.

Here, we have a cart that has one degree of freedom. Let's call the position of the cart $x$. In addition, you've identified the velocity ($v = \dot{x}$) as an important variable.

The only relevant physical law here is Newton's 3rd: $F = m a = m \ddot{x}$. What forces are applied to the cart in the $x$-axis? I assume there's a motor. Disregarding things like slippage, we might model the wheels to be linear with respect to the input current $F_w = k_e i$. Assume that we care about drag, which is proportional to speed: $F_d = k_d v$, so $F = F_w - F_d$.

Model: As is usual, we try to form a linear model of the form $\dot{\mathbf{x}}=A\mathbf{x}+B\mathbf{u}$: $$a = \ddot{x} = \frac{d}{dt}\dot{x} = \frac{1}{M}F = \frac{k_e}{M} i - \frac{k_d}{M} \dot{x} \\ v = \frac{d}{dt}x = \dot{x}$$ Or, by setting our state vector to $\mathbf{x} = [\dot{x},x]^T$, we get: $$\dot{\mathbf{x}}=\frac{d}{dt}\pmatrix{\dot{x}\\x}=\pmatrix{-k_d/M & 0\\1 & 0}\pmatrix{\dot{x}\\x}+\pmatrix{k_e/M\\0}i=A\mathbf{x}+Bi$$

So, the position and the velocity is our state vector (the system output). The current $i$ is our system input (the only way we can affect the system).

Assume that we can measure the position by a voltage signal, so that 5V corresponds to 50cm, or: $v_m = \frac{x_m}{50\text{cm}}5\text{V} = (0.1\ \text{V/cm}) x_m\ = k_m x_m$. So, our measurement is $x_m = v_m / k_m$.

Finally, the control input is the difference between our measurement $x_m$ and the reference signal $x_r$.

As to your question, both position and velocity could be controlled variables. To take velocity into account, all you need is a way of measuring (or estimating) it. (We write $\mathbf{y} = D\mathbf{x}$ for that connection.) Either way, the only input to the system is the engine current, which again affects both position and velocity of the system.

To summarize:

Model: $$\dot{\mathbf{x}} = A\mathbf{x} + B\mathbf{u}$$ Measurements: $$\mathbf{y} = D\mathbf{x}$$ Error: $$\mathbf{e} = \mathbf{r} - \mathbf{y}$$ Control: $$\mathbf{u} = C\mathbf{e}$$

-

The "reference" (as in your block diagram) is, always, the desired output. Do not confuse it with the system input. Actually, the diagram should include an "input transducer" block at the start. Suppose you are controlling the speed of a motor and the desired speed is 1000rpm. You have a panel, where you set the speed by rotating a knob and set the pointer at 1000rpm. Now think what's actually happening when you set the knob at 1000rpm. By rotating the knob, you are changing the tap settings of an autotransformer( built-in inside the panel), which in turn sets a voltage proportional to the desired 1000rpm speed. This voltage (which is proportional to 1000rpm) is the actual System Input. The sensor, which may be a tacho-generator, senses the actual speed(say 950rpm) and generates a voltage proportional to the actual speed(950rpm) of the motor. This voltage, is fed back and compared, with the input signal(voltage proportional to 1000rpm), to generate the error signal.

-