In this lab session, we will be using the language Julia in something called a notebook. This is an interactive way of presenting code, and in it, we will explore the topic of gain scheduling and optimization-based PID controller tuning. If you wish, you could go though the notebook beforehand. You could even install the notebook and try to run parts of it. However, the only prerequisite for the lab is that you have read Chapter 9 in "Adaptive Control" by K.J. Astrom. As an alternative, if you do not have this book, we recommend that you read chapter 9 in the book "The electrical engineering handbook" av C. J. Bett, which is available here: https://www.sciencedirect.com/science/article/pii/B9780121709600500864 If you wish to test the notebook yourselves, then you will need to install Julia. If you are using the Lab computers, they will be preinstalled with Julia 1.1 and you can simply proceed from point [1]. If you would like to run the lab on your own computer you will need to install Julia 1.1 and then follow the steps from point [2] below. [1] In the terminal, execute the following. ``` cd && git clone https://github.com/JuliaControl/ControlExamples.jl cd ControlExamples.jl mkdir /var/tmp/$USER export JULIA_DEPOT_PATH=/var/tmp/$USER ``` [2] Open a Julia REPL, and make sure that you are using Julia 1.1. ``` julia ``` [3] In the Julia REPL, we will now enter the package manager by typing ] (instead of "julia>" you should now be seeing "(v1.1) pkg>", indicating that you are in the package manager). Proceed to adding and building the necessary packages by executing the commands below. ``` dev ControlSystems GR OrdinaryDiffEq Plots ForwardDiff NLopt Roots add WebIO@0.6.2 add Interact build Interact add IJulia build IJulia ``` [4] Return to the regular REPL by typing backspace. Finally, launch the notebook with the lab by running. ``` using IJulia notebook() ``` Now, in the notebook interface, open ControlExamples.jl and then open gain_scheduling.ipynb. You are now ready to do the lab! To execute a line of code, simply press it then click "Run" in the toolbar. While the code is being executed, you will see "In [*]" at the top left of the code snippet that you are running, which will be replaced by "[X]" once the code has been run, where X is a number.