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.
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 |
... | ... | ... | ... |
You can plot data by running the script plot/plot.sh
, which calls Octave underneath.
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
.
- Build and run the code:
cmake -S . -B build cmake --build build --target install assignment_implement-controller
- Compare your outputs against the testing data stored in
data/scope_data.tsv
. - Provide a detailed report in Markdown to support and discuss the activities you carried out to achieve your results.
How can the residual oscillations in the plant response be further reduced?