Specialized course Process Control at Norwegian University of Life Sciences (NMBU), Spring 2018


Compulsory exercise to lessons in Lecture 3

This exercise is about programming of a simulated control system from scratch in Matlab, i.e. with native Matlab code, and about programming a simulated time-delay. Although there are effective premade functions to implement such simulators in Matlab and/or Simulink, it is my experience that it useful in practical projects to be able to implement simulators with controllers and measurement filters using native code. With such skills, you can also use any programming tool or language for implementation.

1.      Simulator of averaging level control system: Implement with native Matlab code a simulated averaging level control system similar to this SimView simulator. Include in your simulator the Skogestad PI tuning formula used there to tune the PI controller. Include random level measurement noise, and a level measurement time-constant filter. You can define the simulation case yourself. Define parameters or settings yourself that are not defined in the SimView simulator. Finally, run some illustrative simulations, e.g. step change of setpoint and step change of inflow (you may compare some of your simulations with simulations with the SimView simulator).
Tips: For-loop; Order of implementation within the loop: Controller update; Process update; Filter update; Use arrays only to store arrays of data for plotting (arrays are updated during loop running): These arrays should be predefined with respect to their length before the for-loop starts, to save computational time.

2.      Simulator of a time-delay. Many physical processes exhibits an (apparent) time-delay. Implement a simulator of a pure time-delay. Run a simulation that hopefully demonstrates that it works correctly (plot the input and the output signal of the time-delay in the same plot).
Tips: Use an array to represent the time-delay.


Updated 2 February 2018 by Finn Aakre Haugen, course teacher.