 If we are interested in more general tips for tuning PI regulators, here are a couple of slides available. So there exist many different methods for the proper tuning. Let's start with the manual one. This requires a step change in the required quantity, let it be speed, load or the current, and measurement of the regulated quantity response. So on this picture is an example of the change of the required speed as a step from 2000 RPM to 4000 RPM and the response is the real speed over time in the violet color. You can see oscillations, you can see overshoot. So we saw a damped oscillation response, which is usually unwanted behavior. So we have some rules of thumb that can be applied. Well, if there is an overshoot, we have to change the ratio Kp divided by Ki to avoid it. If the shape is exponentially nearing to the required value, we can keep the Kp-Ki ratio, but we proportionally change both Kp and Ki to decrease or increase the slope. And one recommendation, we shall try this at different speeds and loads and choose conservative values for the Kp and Ki to avoid undamped oscillations at any part of the load curve. The tuning of the speed can be simplified by using the plotter window in the monitor mode. Otherwise, we can use the DAX and the oscilloscope. The optimum reaction of the speed tuning is when the overshoot is not exhibited at all and the target speed is closing to the required one very quickly without unnecessary delay. Further, when we look at the speed regulation over the different speed and load changes, we can see that the coefficients for the proper PI tuning at different speeds can differ. Which means that for proper tuning we need to change these coefficients over time, typically depending on the speed that we get as a feedback from our motor system. In such case, we shall measure the Kp and Ki parameters at different speeds and make an interpolation between these measurements. This needs to be implemented by user, but it's very easy to achieve. So now let's look at the tuning of the PI regulator a little bit more analytically. Let's create the speed step and let's measure the speed response. So we need to determine the stabilized speed at the infinity time called y on a torque step u. We have to determine the process dead time lambda that tells us what is the reaction delay of the whole system. Then we have to determine the time constant tau when speed crosses the threshold of the 63% of the speed step. This threshold is measured between the initial stabilized value and the final stabilized value. And finally we need to know the PI process frequency, fs that's set in the motor controller bench and it's typically 2 kHz. Now we will assume that the motor with the load works as a first order system with a simple exponential response. And in the case of previously measured values we can calculate the process gain as a delta speed divided by delta torque. And you can see that the values have the digits of digits per PWM and the change in the compare register of the motor control timer. Further we can consider the PI regulator of a depicted form. Then putting the calculated values into these terms for different types of regulators in our motor control bench we use the PI regulator. We can calculate the Kp, tau i and tau d parameters according to the central line. This set of coefficients comes from the method of Ziegler-Nichols and it's a little bit aggressive and generates overshoots. If we want a more conservative or moderate reaction and tuning of the PI regulators we can use a different calculation of these coefficients based on the Kohan-Kuhn method. And when we get the coefficients we can calculate the Kp, Ki and possibly Kd if you use the PId regulators with the equations on this page. These values shall be expressed as a ratio K divided by 2 power N and put in the motor control workbench where the value of the Kx parameter is in the 16-bit range. Finally when calculating the PI coefficients we still need to tune the system to the final point. The equations on the previous slides are valid in the range of the lambda divided by T 0.1 to 1 otherwise we need to use the other types of the tuning. The next method that we can use for tuning the Kp and Ki works in a time domain with an a priori knowledge of the motor and load inertia and mechanical resistance. These are equivalent of the electrical inductance and electrical resistance and by substitution of these ratios in the control loop we can calculate the Kp and Ki like on this slide. If our system exhibits a second order or more complex or even interlinked system with combined exponential behaviors the measurement of the responses and calculation is too complex and it's discussed in the control theory literature. For example a zero pole mapping regulators. Such example will use a PI regulator with derivative component or more complex polynomial regulators. It's beneficial if we use a small filter with a tau equal of 10% of the main tau time constant for the error component to be introduced before the PI regulator. If you are interested in some literature where you can learn more about tuning the PI regulators we have attached some links to the different literature that can give you better understanding and more precise equations. We can as well use tools like MATLAB and the Berica workbench for the tuning.