Single-Board-Heater-System/C2/Accessing-SBHS-through-Scilab-on-Windows/English

From Script | Spoken-Tutorial
Jump to: navigation, search

Title of script: Accessing SBHS through Scilab on windows

Author: Rupak Rokade

Keywords: Scilab, SBHS, video tutorial


Visual Cue
Narration
Show Slide Welcome to this Spoken tutorial on “Accessing SBHS through Scilab on Windows”.


SBHS stands for Single Board Heater System.

Show Slide In this spoken tutorial, we will learn:
  1. To set up serial communication between Scilab and SBHS.
  2. To perform a Step Test experiment.
Show Slide For this tutorial, I am using
  • Windows-7 Operating System and
  • Scilab 5.3.3
Show Slide


You may download Scilab from

www.scilab.org


To install Scilab, watch the Scilab spoken tutorial series on http://spoken-tutorial.org

Show Slide Before proceeding with this tutorial, you should watch-
  1. Introduction to Xcos
  2. Connecting SBHS to computer

The relevant tutorials for these, are available in this series, on the spoken tutorial website.

Show os-hardware.in To begin, we have to download the Scilab Step Test code.


So, let us open a web browser.


In the address bar, type, os-hardware.in

click on Single Board Heater System link >> Downloads link Click on the project SBHS and then on the Downloads link.
Select SBHS Local Code >> Save on Desktop Download the file available under the section SBHS Local Code.

And save this file on the Desktop.

Switch to Desktop >> Point to the zip file Notice that the downloaded file will be in zip format.
Right-click >> choose Extract here.

Point to scilab codes local

Right-click on the file and choose Extract here.


A folder named scilab codes local will be created.

We are now ready to begin our experiment.
Make sure the SBHS is connected to your computer and it is powered ON.
Right click on My Computer >> Properties First, we will check the communication port number assigned to the SBHS.


To do this, right click on My Computer and then click on Properties.

Click on Device Manager A window will open up.


In this window, click on the Device Manager.


Please note that the look and feel of Windows 7 is completely different from other Windows versions.


You may also need to vary the steps that I demonstrate here to suit your Windows version.

Point to the list displayed >> point to ports (COM & LPT) option. The device manager will show you a list of hardware devices on your computer.


Locate the ports (COM & LPT) option.


Here it is.

Double click on the Ports(COM & LPT) option Double-click on this option to open it.
Show the options under Ports(COM & LPT) If you have connected RS232 cable, then look for communications Port COM1.


Else look for USB Serial Port.


For RS232 connection, the port number mostly remains COM1.


For a USB connection, it may change to some other number.


Note down the appropriate COM number.

Click on the identified COM port number In my case it is COM14.


Sometimes the COM port number you get after connecting a USB cable, is a two-digit number.


The serial tool box which connects your board and computer, can handle only single-digit port number.


Hence, it is necessary to change your COM port number.

Double-click on the COM port Let me show you the procedure to change the COM port number.


Double-click on that particular COM port.

Click on the Port Settings tab Click on the Port Settings tab.
Click on Advanced. Then click on Advanced.
In COM port number dropdown >> choose any single-digit number. In the COM port number dropdown menu, choose the port number to any other single-digit number.


Windows may show you that all ports are currently in use.


But, in reality, this is only the old status.


Hence, you can forcibly use a particular COM port number, if there is no other USB device connected.

Click on OK Click on OK to apply these settings.
Click on OK Click on OK to close the Properties window.
Click on the close option on the Device Manager Close the Device Manager and the remaining windows.
Now, let us learn how to configure Scilab, to perform a Step Test using SBHS.
Switch to the Desktop >> Open Step test folder Open the Scilab local codes folder that we saved on the Desktop.


Open the folder Step test.

Double-click ser underscore init.sce Locate and double-click on the file ser underscore init.sce


This will launch Scilab automatically and will also open the file in Scilab editor.

Click on File >> Open a file >>

Choose ser underscore init.sce >> click on Open.

If it doesn't open the file, click on File menu, then on Open a file.


Choose the file ser underscore init.sce and click on Open.

Switch to scilab >>

Type getd space ../common_files/


Type exec space ../common_files/loader.sce

Switch to the scilab workspace and execute the following commands.


Type

get d space ../common_files/ and press Enter.


Then type


exec space ../common_files/loader.sce and press Enter.

Point to message You can see that it gives a message that it has loaded the serial port toolbox.
Switch to scilab >> locate variable port2 Switch to the scilab editor.


In the ser underscore init.sce file, locate the line which asks for value of variable port2.


Value of port2 variable needs to be replaced with the identified COM port number.

Change the port number Change the port number to the one you identified just a few minutes back.
Point accordingly Make sure this is in single quotes.
Save the file Do not make any other changes to the content of this file.


Now, save the file.

Click on Execute On the menu bar, click on the Execute button to execute this file.
Point to the message On the Scilab workspace you will get a message COM Port Opened


However, it is also possible that you get an error message.


Let me explain using slides, how do you handle a typical error.


Let me switch to slides.

Show Slide In case a TCL/TK related error is displayed,
  • Reconnect the USB cable connected to the SBHS and execute this file again.
  • Check once if the COM port number has changed.
  • If it still doesn't work, restart Scilab and repeat the process.
In Scilab >>

Type

exec space step_test.sci

>>

Type


xcos space step_test.xcos

In the Scilab workspace, execute the following commands -

Type exec space step_test.sci and press Enter.


Then type

xcos space step_test.xcos and press Enter.

This will launch the xcos interface made for step test experiment.
Double click on the Heater Input block You can change the block parameters by double-clicking on the blocks.


It is recommended that you keep the parameters unchanged for the first time.

click on the simulation tab In the menubar of the Xcos window, click on the Simulation option.
Click on the Start option Now select the Start option
Point at the first plot After we have executed the Xcos file successfully, a plot window with three graphs will be displayed.


The first graph is of Heater in percentage.

Point at the second plot The second graph is of Fan in percentage.
Point at the third plot The third graph is of Temperature in degree Celsius.
Show Slide There are some things to be noted.


Let me switch to the slides.


The Fan, Heater and Temperature are displayed on the SBHS display as shown in the image.

Show Slide Please note that the values shown in the graph should be the same as displayed on the SBHS display.


If this is not the case, then it means that Scilab is not communicating with SBHS.

Show Slide You can also check if the communication LEDs are flashing periodically.


You will find these LEDs next to the USB connector on the SBHS, as shown in this image

This is a real experiment and will take some time to produce results.


I will now pause the recording for some time.

Point at the plots After running the experiment for sufficient time, the final graphs will be as shown here.


We can see that the temperature has responded to the step change in the heat value.

<PAUSE>
Switch to the step test folder. Most of the process that we went through, can be completed by just executing one file.


Let me show you this file.


Switch to the step test folder.


The steps after launching of scilab till opening xcos can be executed using start.sce file.

Show slides Let me switch to slides.


Usage of start.sce file is recommended only after you get a firm understanding of the process.


This file assumes that the port number provided in the ser underscore init.sce file is correct.

Click on the Stop option To stop the experiment, click on the Stop option available in the menu bar of the Xcos window.


After completing the experiment, let us reset the SBHS.


Let me switch to the slides again to illustrate this.

Show the Slide A reset push button is provided on the SBHS, as shown in the picture.


To reset, press the Reset button for 1 or 2 seconds and then release it.


The reset operation makes Heat 0% and Fan 100%.


However 0 is displayed for both on the LCD.

Go to the Step test folder and point to the file The data file for this experiment is saved in the Step test folder.

Let me show you this file.

The name of the data file is in the format of a time stamp.


Read the data file name as Year Month Date Hours Minutes Seconds dot txt.

Click and open the file. Let me open and show you the content of the data file.


It has values of heat, fan and temperature for every sample.


Hence, this file can be used for analysis purpose.

Show slide Now, let us summarise.


In this tutorial, we learnt to-

  1. Set up serial communication between the Scilab and SBHS
  2. Perform a Step Test experiment.
Show slide The video available at the following link summarises the Spoken Tutorial project.


Please download and watch it.

Show slide The Spoken Tutorial Project Team conducts workshops and gives certificates to those who pass online tests.


For more details, write to us.

Show slide Spoken Tutorial Project is funded by NMEICT, MHRD, Government of India.


More information on this Mission is available at the link shown here.


Thanks for joining; this is Rupak Rokade from IIT Bombay signing off.

Contributors and Content Editors

Nancyvarkey, Rupakrokade