Scilab/C4/Super-Blocks-in-Xcos/English
Title of script: Super Blocks in Xcos
Author: Rupak Rokade and Anandajith
Keywords: Xcos, scilab, super blocks
Visual Cue | Narration |
---|---|
Show Slide: Title Slide |
Hello and welcome to the Spoken Tutorial on “Super Blocks in Xcos”. |
Show Slide: Learning Objectives |
In this tutorial, we will learn how to:
|
Show Slide: System Requirements |
To record this tutorial, I am using:
The process demonstrated in this tutorial is identical in Linux OS also. |
Show Slide: Pre-requisites |
Before practising this tutorial, a learner should have:
|
Show slide: Code Files |
|
First we will see why we need to use super blocks. | |
Show slide: Use of Super Blocks |
|
Show slide: What is a super block? |
What is a super block?
|
We will now demonstrate a super block using an example. | |
Show scilab console. Type xcos>>press Enter. |
Open the scilab console. Type xcos and press Enter. We can see two windows named Untitled Xcos and Palette browser opens. |
Cursor on the Palette browser window and Untitled-Xcos window. |
Notice the Palette browser window is located on the left side. The Untitled - Xcos window is on the right side. |
File>>Open. Downloads>>super-initial.xcos . >>Open. |
Go to the Untitled Xcos window. In the menu bar, Click on File and then on Open. Go to the Downloads folder and select the file Super-initial.xcos . I have already created this file for demonstration of Super blocks. Click on the Open button. The file super-initial.xcos opens in the Xcos window. |
Show palette browser and Super-initial window. Cursor on CONST block. Cursor on POWBLK_f block. Cursor on AFFICH_m block. Cursor on CLOCK_c block. Cursor on CONST block Cursor on POWBLK_f block Cursor on AFFICH_m Cursor on CLOCK_c |
Now let's look at the contents of the file.. We see that the file contains four blocks
The CONST block will supply a constant value. In this file, I have given a value as 2. The given value is then squared by the POWBLK_f block. The resultant value is displayed by the AFFICH_m block. The CLOCK_c block generates a regular and scheduled train of events. |
Cursor on Scilab Multiple Values Request |
Let us change the constant value to 3. Double click on the CONST block. The Scilab Multiple Values Request window opens. Change the value of the block to 3 and click on OK. |
Show super-initial xcos window |
Let us now execute the super-initial.xcos file. First we save the file by pressing Control and s keys simultaneously. Then execute the file using the start button on the toolbar. Here we can see the value is displayed as 9.0 in the AFFICH_ m block . |
Now we will demonstrate Super blocks using this example. We will represent the squaring operation using a super block. First we will import the Super block into the super-initial.xcos window. | |
Show palette browser. Cursor on Palette list . User defined functions>>SUPER_f |
Go to the palette browser window. Here we can see a list of palettes on the left side. Click on the User defined functions palette. In the right panel, select the SUPER _ f block which is the super block. Now, drag and drop it in the super-initial.xcos window. |
Show super-initial xcos window. Hover cursor over POWBLK_f Block. |
Here the POWBLK_f block is the operation block. We will use the SUPER_f to represent the POWBLK _ f block. |
Show untitled xcos window. Cursor on SUPER_f block Cursor on POWBLK_f block |
Double click on the SUPER _ f block. We see another untitled xcos window open instead of parameters. This Untitled Xcos window will have one input and output port by default. Blocks connected to the input and output ports become part of the SUPER_f block. SUPER_f block will perform the squaring operation when connected to the super-initial.xcos file. We will now transfer the POWBLK_f block into the Untitled Xcos window. |
Cursor on super-initial xcos window. Press Ctrl+X. |
Click on the POWBLK_f block. Press Control and X keys on the keyboard simultaneously. This will cut the block from the file. |
Cursor on Untitled xcos window. Press Ctrl+V. Cursor on POWBLK_f block |
Go to the untitled xcos window. Press Control and V keys on the keyboard simultaneously. We can see the POWBLK_f block is transferred to the untitled xcos window. Position the POWBLK_f block between the input and output ports. Connect the black input port to the input port of the POWBLK_f block. Connect the black output port of the POWBLK_f block to the output port. |
Cursor on super-initial xcos window. Cursor on SUPER_f block |
Now we connect the SUPER_f block to the super-initial.xcos file. Go to the super-initial.xcos window Place the SUPER_f block between the CONST and AFFICH_m blocks. Connect the black output port of CONST block to the input port of SUPER_f block. Connect the black output port of SUPER_f block to the input port of AFFICH_m block. All the necessary connections have been made. We have modified the super-initial.xcos file The squaring operation is now represented by a super block. Now let us save and execute the super-initial.xcos file. |
Cursor on super initial xcos window. Cursor over the start button. Cursor on AFFICH_m |
Press Control and S keys on the keyboard to save the file. Execute the file using the start button on the toolbar. We can see that the file runs without error and displays the result as 9.0. We got the desired result when we executed the file with the superblock as well. |
Show slide Advantages of Super blocks |
|
Show Slide: Summary |
This brings us to the end of this tutorial. Let us summarise. In this tutorial, we have learnt to:
|
Show Slide: Assignment |
For assignment activity, please do the following.
|
Show Slide: Assignment |
Hint: Use the GAIN_f block to multiply the output by three. |
Show Slide: About Spoken Tutorial Project |
The video at the following link summarises the Spoken Tutorial project. Please download and watch it. |
Show Slide: Spoken Tutorial Workshops |
We conduct workshops using Spoken Tutorials and give certificates. Please contact us. |
Show Slide: Answers for THIS Spoken Tutorial |
Please post your timed queries in this forum. |
Show Slide: FOSSEE Forum | Please post your general and technical queries on Scilab in this forum. |
Show Slide: Textbook Companion project. |
The FOSSEE team coordinates the Textbook Companion project. We give Certificates and Honorarium to the contributors. For more details, please visit this site. |
Show Slide: Lab Migration |
The FOSSEE team coordinates the Lab Migration project. For more details, please visit this site. |
Show Slide: Acknowledgement | Spoken Tutorial and FOSSEE projects are funded by MoE, Government of India. |
Show Slide: Thank you |
This is Anandajith TS, FOSSEE intern 2021, IIT Bombay signing off. Thanks for joining. |