# Open loop vs. closed loop control systems (with Xcos simulations)

The intention of this tutorial is to explain what an open or closed loop control system means. Also we are going to explain the differences between a feedback and a feedforward control system. The fist part of the tutorial explains the theoretical concepts of the systems, giving also real world application examples. In the second part, using Xcos modeling and simulation capabilities, the same example are explained in depth for a better understanding.

In engineering, control systems are classified as open loop or closed loop. The closed loop control system is also know as a feedback control system.

There are also feedforward control systems, which are open loop control systems but with an adjustment of the control input function of disturbances.

### Open loop control systems

In an open loop control system the input (control action) doesn’t depend on the output of the system. Regardless of how the system behaves, the input signal is independent of the system’s response.

Image: Open loop control system

The input is the control action applied to the system. The output is the system’s reaction for a given input. The output can be affected also by some disturbances which interact with the system.

An example of an open loop control system is a toaster. In this case, the system contains the electrical resistances of the toaster, the input is the level (time) of toasting and the output is the toasted bread. For the same input (time/level) the output can be more or less “toasted” depending on several disturbances: consistency of the bread, geometry of the slice, outside temperature, etc. The system is open loop because the input is not adjusted function of the output.

Another example of open loop control systems is a vehicle driving on a road. In this case we’ll consider that the input is the engine torque, the system is the vehicle itself and the output is the vehicle speed. The driver is adjusting the engine torque (input) by pressing the accelerator pedal.

Image: Example of open loop control system (vehicle driving)

Let’s analyze what is happening with our system for different conditions of input and disturbance.

Zone A

For a given position of the accelerator pedal, the engine will generate a certain amount of torque which will be applied to the wheels. If the road is straight (no gradient) the vehicle speed will stabilize at a constant value.

Zone B

The road has a positive gradient which acts as a disturbance on the system. The driver doesn’t change the position of the accelerator pedal so the input torque will be the same. Due to the road gradient, an additional opposing force will act on the vehicle, which will cause a slowdown. In this case, the driver didn’t adjust the engine torque (input) function of vehicle speed drop (output), or road gradient (disturbance).

Zone C

To road gradient decreases at zero (flat road). The engine torque being the same, the vehicle will accelerate to the same vehicle speed as in zone A. This happens because the additional opposing force, due to road gradient, becomes null and the engine torque is enough to accelerate back the vehicle.

Due to the fact that the input (engine toque) wasn’t adjusted function of the vehicle speed or road gradient, the system’s response was affected. This can be seen as an open loop, where the driver didn’t adjusted the accelerator position in order to keep a constant vehicle speed. The control loop is open because there is no dependency between the input and the output.

### Closed loop (feedback) system

In a closed loop control system, the input is adjusted function of the output of the system. This means that any disturbances affecting the system will be compensated by the input.

It’s called a feedback control system because the output is fed back to the input, which uses it in such a way that the desired system’s behavior is maintained.

Image: Close loop (with feedback) control system

Let’s look at the same vehicle example. In this scenario the vehicle will be in cruise control mode. This means that the vehicle speed is no longer controlled by the driver, through the accelerator pedal position, but by the engine control module. The cruise control function keeps a predefined vehicle speed (set by the driver) regardless of the road conditions, by adjusting the engine torque.

Image: Example of closed loop control system (vehicle cruise control)

Zone A

The vehicle speed is kept constant by the cruise control function. The engine torque is set to a constant value which will maintain the desired set speed.

Zone B

The positive road gradient causes an additional opposing force on the vehicle which should cause vehicle slowdown. The cruise control function reads the current vehicle speed and increases the engine torque in order to compensate for the road gradient. This way the vehicle speed is kept constant regardless of the disturbance.

Zone C

The road gradient goes back to zero. Therefore the opposing forces will decrease. In order to prevent the vehicle to accelerate to a higher speed than the set one, the engine torque will be decreased. This way the output vehicle speed will be kept a the same constant value.

### Open loop (feedforward) control system

We can have an open loop control system which can adjust it’s input based on known disturbances. This control systems are called feedforward control systems. Knowing or measuring the amplitude and type of disturbance, the input signal can be modified in such a way that it compensate for the changing output.

Image: Open loop (with feedforward) control system

For our vehicle example, the feedforward can be performed by the driver. Imagine that, while driving, the driver observes a hill coming up in front. Based on experience the driver knows that the vehicle will decelerate. To prepare (compensate) for the additional opposing force, at the beginning of the hill, the driver will press more the accelerator pedal which will increase the torque of the engine (input). This way the vehicle will keep constant speed throughout the hill.

Feedforward control system rely on the calibration of the feedforward part. This is usually done after some test or measurements have been performed with the system subject to disturbances.

### System (plant) modeling – Xcos

In order to simulate an open loop and a closed loop control system and to analyze the behavior of the vehicle for a given input and disturbance, we’ll need to model it mathematically.

Instead of engine torque as an input we are going to use the traction force. This is a valid approach since the traction force applied at the wheel is directly proportional with the engine torque.

First we’ll describe the forces acting on the vehicle driving on a road with gradient.

Image: Vehicle system – longitudinal dynamics

where:

Ft [N] – traction force (proportional with the engine torque)
Faero [N] – aerodynamic force
Froll [N] – rolling force

The traction force is moving the vehicle forward while the opposing forces (aerodynamic, gradient and rolling) are trying to slow down the vehicle. The opposing forces are calculated as:

$\begin{split} F_{\text{aero}} &= \frac{1}{2} \rho C_x A v^2\\ F_{\text{grad}} &= G sin(\alpha)\\ F_{\text{roll}} &= f G cos(\alpha) \end{split}$

where:

ρ [kg/m3] – air density at standard pressure and temperature
Cx [-] – aerodynamic coefficient
A [m2] – frontal area of the vehicle
v [m/s] – vehicle speed
G [N] – vehicle weight
f [-] – coefficient of rolling resistance

The vehicle weight is the product between the vehicle mass m [kg] and the gravitational acceleration g [m/s2]:

$G = mg$

Before designing the Xcos block diagram we’ll load the above parameters in the Scilab console.

g = 9.81;
m = 2100;
Cx = 0.3;
A = 0.75;
ro = 1.202;
f = 0.013;
G = m*g;

The vehicle speed is determined by integrating the differential equation of the vehicle’s longitudinal dynamics:

$\bbox[#FFFF9D]{\frac{dv}{dt}=\frac{1}{m} \left (F_{\text{t}} – f G cos(\alpha) – G sin(\alpha) – \frac{1}{2} \rho C_x A v^2 \right )}$

The Xcos vehicle model (also called the plant) is constructed as a subsystem (user function) with two signal inputs and one signal output. The signal inputs are the actual input of the system, the traction force (controlled by the driver or cruise control function) and the road gradient (disturbance). The output of the system is the vehicle speed.

Image: System model – vehicle Xcos block diagram

### Open loop control systems (Xcos simulation)

The input traction force is kept constant for the whole duration of the simulation. For a given traction force of 300 N, the vehicle will cruise at a constant speed of 55 kph. In order to achieve a constant vehicle output speed, the initial condition of the integrator block is set at 15.28 m/s (55 kph).

Image: Open loop control system Xcos block diagram

The simulation is run for 100 s. The road gradient is set to rise at 20 s up to a value of 2 ° and ramped down back to zero at 40 s. The input, disturbance and output are saved in the Scilab workspace and plotted using Scilab instructions.

Image: Open loop system response

As you can see, when the road gradient increases, the vehicle can not maintain the same speed and it’s decelerating. After the road gradient return to zero, the vehicle starts to pick up speed, at a slow rate due to inertia.

In this scenario, the control loop is open because the input (traction force) was not adjusted to compensate for the road gradient disturbance.

### Closed loop control systems (Xcos simulation)

For the closed loop scenario we set a target vehicle speed (setpoint) of 55 kph. This means that the vehicle will have to maintain this speed setpoint regardless of the road conditions (disturbances). The traction force will be maintained by the cruise control function which is represented by a PID controller. Function of the speed error the PID controller will adjust the traction force in order to maintain the set speed.

Image: Closed loop feedback control system – Xcos block diagram

The input of the system (plant) will be the combined action of the PID controller and the nominal 300 N traction force. We do this because we know that in order to have a constant vehicle speed of 55 kph we need a traction force of 300 N. The PID controller will only compensate for the deviations of the measured vehicles speed.

As you can see the output vehicle speed is fed back to the difference block, which calculates the speed error (delta between setpoint and actual). The speed error is then fed as an input signal to the PID controller.

Running the simulation for 100 s gives the following results.

Image: Closed loop feedback system response

When the vehicle is not driving at the set speed (55 kph) there will be an speed difference error. This will be used by the PID controller and adjust the traction force. The adjustment is done by increasing or decreasing the traction force in such a way that the error is minimized (zero).

By feeding the output vehicle speed back to the input calculation, we are closing the loop of the control system.

### Open loop (feedforward) control system

For a feedforward control system we need to map the adjustment of the input signal function of the known disturbances. To do this we’ll create a look-up table which will output a traction force function of the road gradient.

Image: Feedforward force input

For example, if the road gradient is 5 ° we’ll give an additional 1500 N to the wheel in order to compensate for the disturbance.

The setup of the map is done as a result of several measurements (for several gradient) or by trial and error. We can give an initial estimation of the feedforward traction force, simulate, evaluate the results and adjust accordingly.

Image: Open loop feedforward control system – Xcos block diagram

The feedforward traction force is added with the nominal 300 N force. The value of the feedforward force is interpolated between 0 and 10 °.

Running the simulation for 100 s gives the following results.

Image: Open loop feedforward system response

As you can see, the total input traction force is adjusted function of the road gradient. The feedforward component manages to compensate partially the road gradient change but not completely. Because of this, the vehicle speed drops down to 53 kph. After the road gradient return to zero, the feedforward force becomes 0 and the total traction force is returning to nominal value, 300 N.

For any questions, observations and queries regarding this article, use the comment form below.

Don’t forget to Like, Share and Subscribe!