Skip to content

Latest commit

 

History

History
56 lines (42 loc) · 2.42 KB

Assignment.md

File metadata and controls

56 lines (42 loc) · 2.42 KB

Implementing a Controller

📔 Assignment

You are asked to write the C/C++ code that implements the system shown below.

The system represents the ensemble of a discrete controller and a continuous plant that has been discretized using the Tustin bilinear transform.

The adopted method resorts to a traditional Reference Model Control scheme, where a PI compensator is (Proportional-Integral) employed to regulate the error between the output of the reference plant and the actual plant output.

The system consisting of the controller and the plant (🔘 click on the image to enlarge)
The internal block diagram of the controller (🔘 click on the image to enlarge)

⚠ All the required parameters are illustrated in the figures.

Testing data

The goodness of your implementation can be put to test by feeding the code with the input reference contained in the file data/scope_data.tsv. This latter file also contains the expected system outputs you need to compare your outputs against.

Here's the format of the data contained in data/scope_data.tsv:

time [s] reference plant reference plant output
0 0 0 0
... ... ... ...

Plotting

You can plot data by running the script plot/plot.sh, which calls Octave underneath.

Coding

Implement the entire system comprising the controller and the discretized plant by providing the corresponding code in the module src/main.cpp.

If you want to add up further modules to the project, just drop the files in the src directory. Recognized extensions are: .cpp, .c, .cc, .h, .hpp.

  1. Build and run the code:
    cmake -S . -B build
    cmake --build build --target install
    assignment_implement-controller
  2. Compare your outputs against the testing data stored in data/scope_data.tsv.
  3. Provide a detailed report in Markdown to support and discuss the activities you carried out to achieve your results.

✨ Bonus 🏆

How can the residual oscillations in the plant response be further reduced?