Single-Board-Heater-System/C2/Implementing-Proportional-Controller-on-SBHS-remotely/English-timed
From Script | Spoken-Tutorial
Revision as of 17:34, 17 December 2016 by Sandhya.np14 (Talk | contribs)
|
|
00:01 | Welcome to the spoken tutorial on Implementing proportional controller on SBHS remotely. |
00:09 | In this tutorial, we will learn to: * Use Ziegler-Nichols tuning method to calculate proportional controller gain |
00:18 | * Modify step test code to design a proportional controller |
00:22 | * Implement this proportional controller on SBHS. |
00:26 | Ensure that Scilab is installed on your computer. |
00:30 | Also, ensure that you have internet connectivity before you begin with this tutorial. |
00:36 | I am recording this tutorial on a Windows 7, 32-bit Operating System. |
00:41 | As a pre-requisite, watch the tutorial on Using SBHS Virtual labs on Windows OS. |
00:48 | This tutorial is available on the Spoken Tutorial website. |
00:53 | It will teach you how to do a basic step test experiment on SBHS, remotely. |
01:00 | You also need to have basic knowledge of PID tuning. |
01:05 | You should have the step test experiment code folder available with you. |
01:10 | You should also have the step test experiment data file with you. |
01:15 | If not, then it is recommended that you re-do the step test experiment and generate a new data file. |
01:23 | In my machine, the data file is within the Scilab_codes_windows folder >> step test folder >> logs folder. |
01:35 | Here is a folder with my username and here is my data file. |
01:41 | Let us now download the Analysis code from the website. |
01:46 | Open a web browser and go to the web site: sbhs dot os hyphen hardware dot in. |
01:55 | On the left hand side, click on Downloads. |
02:00 | Download the file SBHS Analysis Code and save it on the Desktop. |
02:09 | Here it is! The file downloaded will be in a zip format. |
02:14 | Right-click and extract the contents of the zip file. |
02:19 | A folder named Scilab codes analysis will be created. |
02:25 | Open this folder. |
02:27 | Locate and open the folder Step Analysis. |
02:32 | The Step Analysis folder will have few more folders. |
02:36 | Copy-paste the data file generated earlier inside the Kp tau order1 folder. |
02:50 | Double-click on the Scilab file firstorder. |
02:55 | This will launch Scilab automatically and will also open the file in Scilab editor. |
03:02 | If it doesn't open the file, click on the File menu and then on Open a file. |
03:09 | Choose the file firstorder and click on Open. |
03:18 | Locate the variable filename and change its value to the filename of your data file. |
03:27 | I will copy-paste the filename to avoid spelling mistakes. |
03:34 | Keep the ".txt" extension. |
03:37 | Save and execute this Scilab code. |
03:42 | If the data file is not corrupted and there are no errors, a plot window will open. |
03:48 | This plot window will show two graphs, the SBHS temperature plot which has noise and output of the SBHS first order model which is a smooth curve. |
04:05 | This code basically does the job of fitting a first order transfer function using the data file. |
04:12 | The values of time constant tau and gain Kp are displayed on the top. |
04:19 | In this tutorial, we will not use the first order transfer function. |
04:23 | We will only use the plot of the SBHS output. |
04:26 | Switch to the Scilab editor. |
04:29 | Locate the line plot2d of t comma y underscore prediction. |
04:37 | We don't want the prediction output to appear on the plot. |
04:41 | Comment out this line by putting two forward slashes at the beginning of the line. |
04:48 | Save and execute the Scilab code. |
04:52 | Switch to the plot window. |
04:54 | Notice that the plot window now has only the SBHS temperature plot. |
05:00 | To save this image, click on the File menu. |
05:04 | Then choose Export to option. |
05:07 | Give a name to the image file. I will type sbhsplot. |
05:14 | Click on the drop-down menu for Files of type and choose PNG. |
05:22 | Choose the directory where you want to save this file. |
05:27 | I will choose Desktop and click on Save. |
05:31 | Let us open and see if the image file is created on the Desktop. |
05:36 | Here it is! |
05:39 | Close this image window. |
05:42 | Let me now switch to the slides. |
05:45 | Let us calculate the value of proportional gain using Ziegler-Nichols tuning method. |
05:52 | There are two tuning rules given by Ziegler-Nichols to calculate the PID parameters. These are Reaction curve method and Instability method. |
06:03 | We will see the Reaction curve method. |
06:06 | In this method, a step input is given to the system and its output is observed over a period of time. |
06:13 | Any practical system would respond exponentially to a step input. |
06:18 | A tangent is drawn at the point of inflection |
06:22 | that is, when the curve changes from convex to concave. |
06:27 | The dead time and time constant are calculated from the time axis. |
06:33 | This is illustrated in this figure. This is the tangent line drawn at the point of inflection . |
06:41 | 'K' is the gain of the system, |
06:45 | 'L' is the dead time and |
06:48 | 'T' is the time constant. |
06:50 | Replicate this on the SBHS output figure which is saved on the Desktop. |
06:56 | I have already done this. |
06:58 | Let me open this file. |
07:01 | I have used paint brush which is a default image editing tool on Windows. |
07:08 | I have got the values of gain equal to 2.7, dead time equal to 1 second and time constant equal to 50 seconds. |
07:18 | Note that these are all approximate values. |
07:22 | The values depend on the accuracy with which you draw the tangent line at the inflection point. |
07:30 | After you get the required values, refer to the table given by Ziegler-Nichols to calculate the value of proportional gain. |
07:39 | For a proportional controller, we need to calculate only the value of proportional gain. |
07:44 | In my case, the value of proportional gain comes out to be 18. |
07:50 | Now, let us see how to implement the proportional controller on SBHS. |
07:56 | We would modify the step test code for this. |
07:59 | Switch to the folder where you have the step test code. |
08:03 | Here it is. Make a copy of this folder. |
08:08 | Rename this folder as proportional and open it. |
08:14 | Rename the stepc file to proportional. |
08:19 | Rename the steptest dot sci file to proportional. |
08:24 | Rename the steptest dot xcos file to proportional. |
08:29 | Close Scilab, if already running. |
08:33 | Double-click on the proportional dot sce file. |
08:38 | This should launch Scilab automatically and also open the file in Scilab editor. |
08:43 | If it doesn't open the file, click on the File menu, and then on Open a file. |
08:50 | Choose the file proportional and click on Open. |
08:56 | Change the exec command to execute proportional.sci file, instead of steptest.sci file. |
09:06 | Change the xcos command to execute the proportional.xcos file, instead of steptest.xcos file. |
09:16 | Save this file. |
09:18 | Click on the File menu and choose Open. |
09:22 | Select the file proportional.sci and click on Open. |
09:28 | Change the function name from steptest to proportional. |
09:33 | Delete the input variable heat from the proportional function input and type setpoint. |
09:42 | In the next line, type global, leave a space and then type temp and press Enter. |
09:51 | In the next line, type: err equal to setpoint minus temp. |
10:00 | Add semicolon at the end and press Enter. |
10:05 | In the next line, type: heat equal to 18 multiplied by err. Add a semicolon at the end. |
10:17 | Here, 18 is the value of the proportional gain for my SBHS. |
10:22 | You may change it according to what you would have calculated for your SBHS. |
10:28 | Add setpoint in the input variable of the plotting function , inside its function call. |
10:36 | To do so, add a space after temp and type setpoint. |
10:43 | Save this file. |
10:45 | Switch to the Scilab console. Type xcos and press Enter. |
10:52 | xcos window will open. |
10:55 | Close the palette window. |
10:58 | On the xcos untitled window, click on File menu and choose Open. |
11:05 | Browse to the proportional directory. |
11:08 | Select proportional.xcos and click on Open. |
11:13 | Xcos file will open. |
11:15 | Double-click on the label Heat input in percentage. |
11:20 | Delete it and type setpoint. |
11:24 | Click once anywhere on the xcos window to save the label. |
11:29 | Double-click on the step input block to open its Properties window. |
11:34 | Change the Initial Value to 30 and Final Value to 40. |
11:40 | Keep Step time as 300. Click on Ok. |
11:45 | Double-click on the function block. A window will appear. Click on OK. |
11:53 | Another window will appear. |
11:55 | Here, there is an option to enter the function name to be called by this xcos block. |
12:02 | Change the function name from step test to proportional. Click on Ok. |
12:09 | Another window will open. |
12:11 | Keep clicking on Ok three times to finish the configuration of function block. |
12:18 | Save the 'xcos' diagram and close it. |
12:22 | Close the xcos untitled window as well. |
12:25 | Switch to the web browser. |
12:27 | On the left hand side, click on Virtual labs. |
12:32 | Login with your registered username and password. Book a slot. |
12:42 | Switch to the proportional folder. Double-click on the file run. |
12:48 | This will open the SBHS client application. |
12:53 | Login with your username and password. Make sure you are logging in at the booked slot time. |
13:02 | Expect the message "Ready to execute Scilab code". |
13:06 | Switch to the Scilab console. |
13:08 | Type: get d space dot dot slash common files. Press Enter. |
13:17 | Switch to the Scilab editor. Execute the file proportional.sce. |
13:25 | If the network is fine, then it will automatically open the xcos window with a proportional controller xcos diagram. |
13:34 | Execute this xcos diagram and expect a plot window. |
13:41 | The plot window will have three plots heat, fan, temperature. |
13:47 | Setpoint will also be plotted in the temperature graph. |
13:52 | Observe that the proportional controller computes the value of heat in order to achieve the setpoint value of temperature. |
14:02 | Run this experiment long enough to observe what happens after a step change in setpoint occurs. |
14:10 | I will now pause this recording until the experiment is executed for sufficient time. |
14:16 | You can see that the proportional controller has responded to the change in the setpoint. |
14:23 | You can observe that the proportional controller inherently has the property of offset. |
14:29 | A proportional controller will always have an offset between the setpoint value and the actual value. |
14:36 | Now, let us summarize. In this tutorial, we learnt to- * Use Ziegler-Nichols tuning method to calculate proportional controller gain for SBHS |
14:47 | * Modify step test code to design a proportional controller |
14:51 | * Implement the designed proportional controller on SBHS. |
14:56 | Watch the video available at the following link. It summarises the Spoken Tutorial project. |
15:02 | If you do not have good bandwidth, you can download and watch it. |
15:06 | The Spoken Tutorial project team: * Conducts workshops using spoken tutorials. |
15:10 | * Gives certificates to those who pass an online test. |
15:14 | For more details, please write to: contact at spoken-tutorial.org |
15:21 | Spoken Tutorial project is a part of the Talk to a Teacher project. |
15:25 | It is supported by the National Mission on Education through ICT, MHRD, Government of India. |
15:31 | More information on this mission is available at: |
15:42 | Thanks for joining. This is Rupak Rokade from IIT Bombay, signing off. Thank You. |