Difference between revisions of "Scilab/C4/Super-Blocks-in-Xcos/English"

From Script | Spoken-Tutorial
Jump to: navigation, search
 
Line 35: Line 35:
 
<ul>
 
<ul>
 
<li><blockquote><p>'''Windows 10 OS'''</p></blockquote></li>
 
<li><blockquote><p>'''Windows 10 OS'''</p></blockquote></li>
<li><blockquote><p>'''Scilab 6.1.0 '''</p></blockquote></li></ul>
+
<li><blockquote><p>'''Scilab 6.1.0'''</p></blockquote></li></ul>
  
 
The process demonstrated in this tutorial is identical in '''Linux''' OS also.
 
The process demonstrated in this tutorial is identical in '''Linux''' OS also.
Line 84: Line 84:
  
 
<ul>
 
<ul>
<li><blockquote><p>A block that can represent a group of connected blocks</p></blockquote></li>
+
<li><blockquote><p>A block that can represent a group of connected blocks.</p></blockquote></li>
 
<li><blockquote><p>A complicated Xcos diagram can be represented with few super blocks.</p></blockquote></li>
 
<li><blockquote><p>A complicated Xcos diagram can be represented with few super blocks.</p></blockquote></li>
 
<li><blockquote><p>Super block can contain another super block providing deeper simplification.</p></blockquote></li></ul>
 
<li><blockquote><p>Super block can contain another super block providing deeper simplification.</p></blockquote></li></ul>
Line 120: Line 120:
 
In the '''menu bar,''' Click on '''File''' and then on '''Open'''.
 
In the '''menu bar,''' Click on '''File''' and then on '''Open'''.
  
Go to the '''Downloads''' folder and select the file '''Super-initial.xcos''' .
+
Go to the '''Downloads''' folder and select the file '''Super-initial.xcos'''.
  
 
I have already created this file for demonstration of '''Super blocks.'''
 
I have already created this file for demonstration of '''Super blocks.'''
Line 129: Line 129:
 
|-
 
|-
 
| Show '''palette browse'''r and '''Super-initial''' window.
 
| Show '''palette browse'''r and '''Super-initial''' window.
| Now let's look at the contents of the file..
+
| Now let's look at the contents of the file.
 
|-
 
|-
 
|
 
|
Line 146: Line 146:
 
<li><blockquote><p>A '''POWBLK_f''' block</p></blockquote></li>
 
<li><blockquote><p>A '''POWBLK_f''' block</p></blockquote></li>
 
<li><blockquote><p>An '''AFFICH_m''' block and</p></blockquote></li>
 
<li><blockquote><p>An '''AFFICH_m''' block and</p></blockquote></li>
<li><blockquote><p>A '''CLOCK_c''' block.</p></blockquote></li></ul>
+
<li><blockquote><p>A '''CLOCK_c''' block</p></blockquote></li></ul>
 
|-
 
|-
| Cursor on CONST block
+
| Cursor on '''CONST block'''.
 
| The '''CONST''' block will supply a constant value. In this file, I have given a value as 2.
 
| The '''CONST''' block will supply a constant value. In this file, I have given a value as 2.
 
|-
 
|-
| Cursor on '''POWBLK_f block'''
+
| Cursor on '''POWBLK_f block.'''
 
| The given value is then squared by the '''POWBLK_f''' block.
 
| The given value is then squared by the '''POWBLK_f''' block.
 
|-
 
|-
| Cursor on '''AFFICH_m'''
+
| Cursor on '''AFFICH_m.'''
 
| The resultant value is displayed by the '''AFFICH_m''' block.
 
| The resultant value is displayed by the '''AFFICH_m''' block.
 
|-
 
|-
| Cursor on '''CLOCK_c'''
+
| Cursor on '''CLOCK_c.'''
 
| The '''CLOCK_c block''' generates a regular and scheduled train of events.
 
| The '''CLOCK_c block''' generates a regular and scheduled train of events.
 
|-
 
|-
| Cursor on '''Scilab Multiple Values Reques'''t window
+
| Cursor on '''Scilab Multiple Values Reques'''t window.
 
|
 
|
 
Let us change the constant value to 3.
 
Let us change the constant value to 3.
Line 170: Line 170:
 
Change the value of the block to 3 and click on OK.
 
Change the value of the block to 3 and click on OK.
 
|-
 
|-
| Show '''super-initial xcos window'''
+
| Show '''super-initial xcos window.'''
 
|
 
|
 
Let us now execute the '''super-initial.xcos''' file.
 
Let us now execute the '''super-initial.xcos''' file.
Line 192: Line 192:
 
Show '''palette browser.'''
 
Show '''palette browser.'''
  
'''Cursor on Palette list .'''
+
'''Cursor on Palette list.'''
  
'''User defined functions&gt;&gt;SUPER_f'''
+
'''User defined functions&gt;&gt;SUPER_f.'''
 
|
 
|
 
Go to the '''palette browser''' window.
 
Go to the '''palette browser''' window.
Line 225: Line 225:
 
Blocks connected to the input and output ports become part of the '''SUPER_f''' block.
 
Blocks connected to the input and output ports become part of the '''SUPER_f''' block.
 
|-
 
|-
| Cursor on '''SUPER_f block'''
+
| Cursor on '''SUPER_f block.'''
 
| '''SUPER_f block''' will perform the squaring operation when connected to the '''super-initial.xcos''' file.
 
| '''SUPER_f block''' will perform the squaring operation when connected to the '''super-initial.xcos''' file.
 
|-
 
|-
| Cursor on '''POWBLK_f block'''
+
| Cursor on '''POWBLK_f block.'''
 
| We will now transfer the '''POWBLK_f block''' into the '''Untitled Xcos''' window.
 
| We will now transfer the '''POWBLK_f block''' into the '''Untitled Xcos''' window.
 
|-
 
|-
Line 251: Line 251:
 
Press '''Control and V''' keys on the keyboard simultaneously.
 
Press '''Control and V''' keys on the keyboard simultaneously.
 
|-
 
|-
| Cursor on '''POWBLK_f block'''
+
| Cursor on '''POWBLK_f block.'''
 
| We can see the '''POWBLK_f block''' is transferred to the '''untitled''' '''xcos''' window.
 
| We can see the '''POWBLK_f block''' is transferred to the '''untitled''' '''xcos''' window.
 
|-
 
|-
| Show '''Untitled''' xcos window
+
| Show '''Untitled''' xcos window.
 
|
 
|
 
Position the '''POWBLK_f block''' between the input and output ports.
 
Position the '''POWBLK_f block''' between the input and output ports.
Line 266: Line 266:
 
Now we connect the '''SUPER_f block''' to the '''super-initial.xcos file.'''
 
Now we connect the '''SUPER_f block''' to the '''super-initial.xcos file.'''
  
Go to the '''super-initial.xcos''' window
+
Go to the '''super-initial.xcos''' window.
 
|-
 
|-
| Cursor on '''SUPER_f block'''
+
| Cursor on '''SUPER_f block.'''
 
| Place the '''SUPER_f''' '''block''' between the '''CONST''' and '''AFFICH_m blocks.'''
 
| Place the '''SUPER_f''' '''block''' between the '''CONST''' and '''AFFICH_m blocks.'''
 
|-
 
|-
Line 282: Line 282:
  
 
|
 
|
We have modified the '''super-initial.xcos''' file
+
We have modified the '''super-initial.xcos''' file.
  
 
The squaring operation is now represented by a super block.
 
The squaring operation is now represented by a super block.
Line 293: Line 293:
 
Cursor over the '''start''' button.
 
Cursor over the '''start''' button.
  
Cursor on '''AFFICH_m'''
+
Cursor on '''AFFICH_m.'''
 
|
 
|
 
Press '''Control''' and '''S''' keys on the keyboard to save the file.
 
Press '''Control''' and '''S''' keys on the keyboard to save the file.
Line 309: Line 309:
 
|
 
|
 
<ul>
 
<ul>
<li><blockquote><p>We can segregate operations using '''super blocks'''</p></blockquote></li>
+
<li><blockquote><p>We can segregate operations using '''super blocks.'''</p></blockquote></li>
<li><blockquote><p>In case of multiple operations, each operation can be represented by '''super blocks'''</p></blockquote></li>
+
<li><blockquote><p>In case of multiple operations, each operation can be represented by '''super blocks.'''</p></blockquote></li>
<li><blockquote><p>It will help to keep the diagram neat and understandable</p></blockquote></li></ul>
+
<li><blockquote><p>It will help to keep the diagram neat and understandable.</p></blockquote></li></ul>
 
|-
 
|-
 
|
 
|
Line 333: Line 333:
  
 
<ul>
 
<ul>
<li><blockquote><p>Open the '''super-initial.xcos''' file</p></blockquote></li>
+
<li><blockquote><p>Open the '''super-initial.xcos''' file.</p></blockquote></li>
 
<li><blockquote><p>Add an operation to multiply the output of the '''POWBLK_f''' block by 3.</p></blockquote></li></ul>
 
<li><blockquote><p>Add an operation to multiply the output of the '''POWBLK_f''' block by 3.</p></blockquote></li></ul>
 
|-
 
|-

Latest revision as of 02:56, 8 September 2021

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:

  • Use super block in Xcos.

Show Slide:

System Requirements

To record this tutorial, I am using:

  • Windows 10 OS

  • Scilab 6.1.0

The process demonstrated in this tutorial is identical in Linux OS also.

Show Slide:

Pre-requisites

https://www.spoken-tutorial.org

Before practising this tutorial, a learner should have:

  • Basic knowledge of Scilab and Xcos.

  • If not, for relevant tutorials please visit this website.

Show slide:

Code Files

  • The files used in this tutorial are provided in the Code files link.

  • Please download and extract the files.

  • Make a copy and then use them while practising.

First we will see why we need to use super blocks.

Show slide:

Use of Super Blocks

  • Xcos diagrams can grow with increasing complexity.

  • Larger more complicated Xcos diagrams are difficult to manage.

  • Super blocks help to organize the complicated Xcos diagrams.

Show slide:

What is a super block?

What is a super block?

  • A block that can represent a group of connected blocks.

  • A complicated Xcos diagram can be represented with few super blocks.

  • Super block can contain another super block providing deeper simplification.

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. Now let's look at the contents of the file.

Cursor on CONST block.

Cursor on POWBLK_f block.

Cursor on AFFICH_m block.

Cursor on CLOCK_c block.

We see that the file contains four blocks

  • A CONST block

  • A POWBLK_f block

  • An AFFICH_m block and

  • A CLOCK_c block

Cursor on CONST block. The CONST block will supply a constant value. In this file, I have given a value as 2.
Cursor on POWBLK_f block. The given value is then squared by the POWBLK_f block.
Cursor on AFFICH_m. The resultant value is displayed by the AFFICH_m block.
Cursor on CLOCK_c. The CLOCK_c block generates a regular and scheduled train of events.
Cursor on Scilab Multiple Values Request window.

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.

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.

Cursor on SUPER_f block. SUPER_f block will perform the squaring operation when connected to the super-initial.xcos file.
Cursor on POWBLK_f block. We will now transfer the POWBLK_f block into the Untitled Xcos window.

Show 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.

Show Untitled xcos window.

Press Ctrl+V.

Go to the untitled xcos window.

Press Control and V keys on the keyboard simultaneously.

Cursor on POWBLK_f block. We can see the POWBLK_f block is transferred to the untitled xcos window.
Show 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.

Show super-initial xcos window.

Now we connect the SUPER_f block to the super-initial.xcos file.

Go to the super-initial.xcos window.

Cursor on SUPER_f block. Place the SUPER_f block between the CONST and AFFICH_m blocks.
Show super-initial xcos window.

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.

Show 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

  • We can segregate operations using super blocks.

  • In case of multiple operations, each operation can be represented by super blocks.

  • It will help to keep the diagram neat and understandable.

Show Slide:

Summary

This brings us to the end of this tutorial. Let us summarise.

In this tutorial, we have learnt to:

  • Use super blocks in Xcos.

Show Slide:

Assignment

For assignment activity, please do the following.

  • Open the super-initial.xcos file.

  • Add an operation to multiply the output of the POWBLK_f block by 3.

Show Slide:

Assignment

  • Transfer the squaring and multiplications operations inside the SUPER_f block.

  • Save and execute the super-initial.xcos file.

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.

Contributors and Content Editors

Anandajitht