Difference between revisions of "Scilab/C2/Xcos-Introduction/English"

From Script | Spoken-Tutorial
Jump to: navigation, search
(Created page with ''''Title of script: Introduction to Xcos''' '''Author: Shalini S''' '''Keywords: ''' {| style="border-spacing:0;" | style="background-color:#ffffff;border-top:0.0139in solid…')
 
 
(One intermediate revision by one other user not shown)
Line 1: Line 1:
'''Title of script: Introduction to Xcos'''
+
{| border=1
 +
! <center>Visual Cue </center>
 +
! <center>Narration</center>
  
'''Author: Shalini S'''
+
|-
 +
|Introduction Slide
 +
|Welcome to the spoken tutorial on''' Xcos: Scilab Connected Object Simulator.'''  
  
'''Keywords: '''
 
  
 +
'''Xcos''' is a '''Scilab package''' for modeling and simulation of dynamical systems.
  
  
{| style="border-spacing:0;"
+
It includes both '''continuous''' and '''discrete''' systems.
| style="background-color:#ffffff;border-top:0.0139in solid #000000;border-bottom:0.0139in solid #000000;border-left:0.0139in solid #000000;border-right:0.0007in solid #000000;padding-top:0in;padding-bottom:0in;padding-left:0.0375in;padding-right:0.0375in;"| '''Visual Cue'''
+
 
| style="background-color:#ffffff;border:0.0139in solid #000000;padding-top:0in;padding-bottom:0in;padding-left:0.0375in;padding-right:0.0375in;"| <center>'''Narration'''</center>
+
|-
 +
|Slide
 +
|In this tutorial you will learn
 +
 
 +
* What is '''XCOS'''.
 +
* What is '''palette'''.  
 +
* Build block diagrams in '''Xcos'''
 +
* Setup the parameters of blocks.
 +
* Setup the simulation parameters.
 +
* Simulate the constructed block diagram.
  
 
|-
 
|-
| style="background-color:#ffffff;border-top:0.0007in solid #000000;border-bottom:0.0139in solid #000000;border-left:0.0139in solid #000000;border-right:0.0007in solid #000000;padding-top:0in;padding-bottom:0in;padding-left:0.0375in;padding-right:0.0375in;"| '''Introduction Slide'''
+
| Slide  
| style="background-color:#ffffff;border-top:0.0007in solid #000000;border-bottom:0.0139in solid #000000;border-left:0.0139in solid #000000;border-right:0.0139in solid #000000;padding-top:0in;padding-bottom:0in;padding-left:0.0375in;padding-right:0.0375in;"| '''Welcome to the spoken tutorial on Xcos (Scilab Connected Object Simulator). '''
+
| To practice this tutorial, Scilab should be installed on your system.  
  
'''Xcos is a&nbsp; Scilab package&nbsp; for modeling and simulation of dynamical systems. '''
 
  
'''It includes both continuous and discrete systems.'''
+
I am using Ubuntu Linux 12.04 and Scilab version 5.3.3 for demonstration.  
  
 
|-
 
|-
| style="background-color:#ffffff;border-top:0.0007in solid #000000;border-bottom:0.0139in solid #000000;border-left:0.0139in solid #000000;border-right:0.0007in solid #000000;padding-top:0in;padding-bottom:0in;padding-left:0.0375in;padding-right:0.0375in;"| '''Slide'''
+
| Open Scilab
| style="background-color:#ffffff;border-top:0.0007in solid #000000;border-bottom:0.0139in solid #000000;border-left:0.0139in solid #000000;border-right:0.0139in solid #000000;padding-top:0in;padding-bottom:0in;padding-left:0.0375in;padding-right:0.0375in;"| '''Objective:'''
+
| Open the '''Scilab console''' window on your computer.
  
'''What is XCOS.'''
 
  
'''What is palette.'''
+
Go to applications and select '''Xcos'''
  
'''To collect the blocks from the palette and connect them to construct the block diagram.'''
+
OR
  
'''Set the parameters of different blocks.'''
+
Type “xcos” in your '''Scilab console''' window and press '''Enter'''  
  
'''To setup the simulation parameters.'''
+
|-
 +
|Palette
 +
|By doing this, two windows will open.  
  
'''Simulate the constructed block diagram.'''
+
 
 +
The two windows are
 +
# '''Palette browser''' and
 +
# '''Untitled-Xcos''' window
 +
 
 +
 
 +
In '''Palette browser''', you will find different types of blocks
 +
* '''Commonly Used Blocks'''
 +
* '''Continuous time system blocks'''
 +
* '''Discrete time systems blocks'''
 +
* and many more.  
 +
 
 +
 
 +
The other window, '''Untitled-Xcos''' is blank, with grids.
  
 
|-
 
|-
| style="background-color:#ffffff;border-top:none;border-bottom:0.0139in solid #000000;border-left:0.0139in solid #000000;border-right:0.0007in solid #000000;padding-top:0in;padding-bottom:0in;padding-left:0.0375in;padding-right:0.0375in;"| '''Slide'''
+
|Collecting the blocks from different Pallete
| style="background-color:#ffffff;border-top:none;border-bottom:0.0139in solid #000000;border-left:0.0139in solid #000000;border-right:0.0139in solid #000000;padding-top:0in;padding-bottom:0in;padding-left:0.0375in;padding-right:0.0375in;"| '''To practice this tutorial, Scilab 5.x version should be installed on your system. '''
+
|We will now simulate a '''first order system''' with a''' step input'''.
'''I am using Mac OS/X and Scilab 5.2.2 version for demonstration'''
+
 
 +
 
 +
To begin, I will select a '''transfer function block''' from the '''Continuous time systems palette'''.
  
 
|-
 
|-
| style="background-color:#ffffff;border-top:none;border-bottom:0.0139in solid #000000;border-left:0.0139in solid #000000;border-right:0.0007in solid #000000;padding-top:0in;padding-bottom:0in;padding-left:0.0375in;padding-right:0.0375in;"| '''Open Scilab'''
+
|As per narration
| style="background-color:#ffffff;border-top:none;border-bottom:0.0139in solid #000000;border-left:0.0139in solid #000000;border-right:0.0139in solid #000000;padding-top:0in;padding-bottom:0in;padding-left:0.0375in;padding-right:0.0375in;"|
+
|Drag this block to the '''Untitled-Xcos''' window.
'''Open the scilab console window, '''
+
  
'''type “xcos” in console and press enter '''
+
|-
 +
|As per narration
 +
|Select the required source in the '''Sources palette'''.
  
'''or go to the applications and select Xcos.'''
+
 
 +
I will scroll down and use the '''STEP FUNCTION block'''.
  
 
|-
 
|-
| style="background-color:#ffffff;border-top:0.0007in solid #000000;border-bottom:0.0139in solid #000000;border-left:0.0139in solid #000000;border-right:0.0007in solid #000000;padding-top:0in;padding-bottom:0in;padding-left:0.0375in;padding-right:0.0375in;"| '''Palette'''
+
|As per narration
| style="background-color:#ffffff;border-top:0.0007in solid #000000;border-bottom:0.0139in solid #000000;border-left:0.0139in solid #000000;border-right:0.0139in solid #000000;padding-top:0in;padding-bottom:0in;padding-left:0.0375in;padding-right:0.0375in;"| '''By doing this, two windows will open up'''
+
|I will drag and place it before the '''transfer function block.'''  
  
'''1 Palette browser'''
+
|-
 +
|As per narration
 +
|Similarly, the output is displayed using the '''CSCOPE block''', which is available in '''Sinks palette.'''  
  
'''2 Untitled-Xcos'''
 
  
'''In palette browser you will find different types of blocks&nbsp;'''
+
The '''CSCOPE block''' is placed after the '''transfer function block.'''  
  
* '''Commonly Used Blocks'''
+
|-
* '''Continuous time systems'''
+
|Point to the red input port.
* '''Discrete time systems'''<br/> '''And many more.'''
+
|The red input port in '''CSCOPE''' denotes that this block is an '''“event driven” block.'''  
  
'''The other window: Untitled-Xcos is blank with grids'''
+
|-
 +
|As per narration
 +
|It needs an '''event''' input for execution.
 +
 
 +
 
 +
An '''event generator block''' is available in the '''Event handling palette.'''
 +
 
 +
 
 +
The name of this block is '''Clock underscore c'''.
  
 
|-
 
|-
| style="background-color:#ffffff;border-top:0.0007in solid #000000;border-bottom:0.0139in solid #000000;border-left:0.0139in solid #000000;border-right:0.0007in solid #000000;padding-top:0in;padding-bottom:0in;padding-left:0.0375in;padding-right:0.0375in;"| '''Xcos window'''
+
|As per narration
| style="background-color:#ffffff;border-top:0.0007in solid #000000;border-bottom:0.0139in solid #000000;border-left:0.0139in solid #000000;border-right:0.0139in solid #000000;padding-top:0in;padding-bottom:0in;padding-left:0.0375in;padding-right:0.0375in;"| '''Let us start with simulating a first-order system with step input. '''
+
|Drag and place this block above the CSCOPE block.  
  
 
|-
 
|-
| style="background-color:#ffffff;border-top:0.0007in solid #000000;border-bottom:0.0139in solid #000000;border-left:0.0139in solid #000000;border-right:0.0007in solid #000000;padding-top:0in;padding-bottom:0in;padding-left:0.0375in;padding-right:0.0375in;"| '''Collecting the blocks from different Pallete'''
+
|
| style="background-color:#ffffff;border-top:0.0007in solid #000000;border-bottom:0.0139in solid #000000;border-left:0.0139in solid #000000;border-right:0.0139in solid #000000;padding-top:0in;padding-bottom:0in;padding-left:0.0375in;padding-right:0.0375in;"| '''We will now study a first order system and its step response.'''
+
|We have collected all the required blocks to do the simulation.
  
'''To begin I will select a transfer function block from the Continuous time systems palette.'''
+
|-
 +
|Connect as per narration
 +
|Let us now connect the blocks together.
  
'''Now drag the block to the Untitled-Xcos window. '''
 
  
'''Select the 'Input' available in the Sources palette.'''
+
Select the '''output port''' of '''step function block''' and connect it to the '''input port''' of the '''transfer function block.'''  
  
'''Drag and place it before the transfer function block. '''
+
|-
 +
|Point to the green input port.
 +
|Notice that the selected '''input port''' gets highlighted in green colour.
  
'''Similarly, the output is taken into the csope which is available in Sinks palette. '''
+
|-
 +
|As per narration
 +
|Similarly, connect the remaining blocks as shown.
  
'''The CSCOPE is placed after the transfer function block. '''
+
|-
 +
|Changing the parameter of step block
 +
|Now we will set the parameters of each block.  
  
'''The red input port in csope denotes that this block is a so-called “event driven” block. '''
+
|-
 +
|Double-click on step block
 +
|First, go to the '''step block''' and double-click on it.
  
'''It needs an event input for execution. '''
+
|-
 +
|Point the options in the Pop-up window
 +
|A pop up window appears, asking for the value of '''Step Time, Initial Value''' and '''Final Value'''.
  
'''Therefore, clock is needed which is available in event handling palette. '''
+
|-
 +
|Point to Step Time
 +
|'''Step Time''' is the time at which the '''step change''' will occur.
  
'''Drag and place the clock above the CSCOPE block. '''
 
  
'''Select the output port of one block and connect it to the input of the next block. '''
+
We will keep it as 1, which is the default value.
  
'''Notice that&nbsp;the selected input port gets highlighted in green colour. '''
+
|-
 +
|
 +
|'''Initial Value''' is the initial output value of the '''step function'''.
 +
 
 +
 
 +
We will keep it as 0, which is the default value.
  
 
|-
 
|-
| style="background-color:#ffffff;border-top:0.0007in solid #000000;border-bottom:0.0139in solid #000000;border-left:0.0139in solid #000000;border-right:0.0007in solid #000000;padding-top:0in;padding-bottom:0in;padding-left:0.0375in;padding-right:0.0375in;"| '''Changing the parameter of step block'''
+
|
| style="background-color:#ffffff;border-top:0.0007in solid #000000;border-bottom:0.0139in solid #000000;border-left:0.0139in solid #000000;border-right:0.0139in solid #000000;padding-top:0in;padding-bottom:0in;padding-left:0.0375in;padding-right:0.0375in;"| '''Now to set parameters of each block. '''
+
|'''Final Value''' is the output of the '''step function''', after the '''Step Time''' is lapsed.
  
'''Firstly, go to the step block and double click on it. '''
+
We will change it to 2.  
  
'''A pop up window appears asking for the following.'''
+
Click on '''OK'''.
  
'''Step time:- the time at which step will start (default 1)'''
+
|-
 +
|Changing the parameter of Transfer function block
 +
|Follow the similar procedure to configure any other block.
  
'''Initial value:- the initial value of the step function (default 0)'''
+
|-
 +
|As per narration
 +
|For '''transfer function block,''' the following configuration is required.
  
'''Final value:- the final amplitude of the step function (I am going to change it as 20).'''
 
  
'''Click on OK.'''
+
'''Numerator''' value in''' laplace domain''' has to be entered.
 +
 
 +
 
 +
We will keep it as 1, which is the default value.
  
 
|-
 
|-
| style="background-color:#ffffff;border-top:0.0007in solid #000000;border-bottom:0.0139in solid #000000;border-left:0.0139in solid #000000;border-right:0.0007in solid #000000;padding-top:0in;padding-bottom:0in;padding-left:0.0375in;padding-right:0.0375in;"| '''Changing the parameter of Transfer function block'''
+
|As per narration
| style="background-color:#ffffff;border-top:0.0007in solid #000000;border-bottom:0.0139in solid #000000;border-left:0.0139in solid #000000;border-right:0.0139in solid #000000;padding-top:0in;padding-bottom:0in;padding-left:0.0375in;padding-right:0.0375in;"| '''Follow the similar procedure to configure any other configurable block.'''
+
|'''Denominator''' value in '''laplace domain''' has to entered.
  
'''For transfer function block, the following configuration is required.'''
+
We will change it to '''2 asteric s plus 1'''.
  
'''1. numerator:- numerator of the transfer function (default is 1)'''
+
Click on '''OK'''.
  
'''2. denominator:- denominator of the transfer function (default is : 1+s)'''
+
|-
 +
|Changing the parameter of scope
 +
|Double click on '''CSCOPE block,''' to configure the following parameters.
  
'''Give some values according to your need For eg: I am going to change some values as shown.'''
+
|-
 +
|
  
'''Click on OK.'''
+
Set Ymin to 0.
 +
|The value of''' Ymin''' and '''Ymax''' should be set, depending on the range of the value, of the variable to be plotted.
 +
 
 +
Set the value of '''Ymin''' to 0.
  
 
|-
 
|-
| style="background-color:#ffffff;border-top:0.0007in solid #000000;border-bottom:0.0139in solid #000000;border-left:0.0139in solid #000000;border-right:0.0007in solid #000000;padding-top:0in;padding-bottom:0in;padding-left:0.0375in;padding-right:0.0375in;"| '''Changing the parameter of scope'''
+
|
| style="background-color:#ffffff;border-top:0.0007in solid #000000;border-bottom:0.0139in solid #000000;border-left:0.0139in solid #000000;border-right:0.0139in solid #000000;padding-top:0in;padding-bottom:0in;padding-left:0.0375in;padding-right:0.0375in;"| '''Double click on&nbsp; CSCOPE to configure for the following parameters'''
+
  
'''y min : min value of y axis'''
 
  
'''y max: max value of y axis'''
+
Set Ymax to 3.
 +
|Since I have given '''step input''' as 2, to display the output on graph, I should change the '''Ymax''' to any higher value.
  
'''Since I have given step amplitude as 20, to display it on graph I should change the y max to any higher value, for example, 25.'''
+
We will change it to 3.
  
'''Keep the other parameters unchanged.'''
+
|-
 +
|
 +
|Make a mental note of the default value of the '''refresh period'''.
  
'''Click on OK'''
+
 
 +
The default value is 30.
  
 
|-
 
|-
| style="background-color:#ffffff;border-top:0.0007in solid #000000;border-bottom:0.0139in solid #000000;border-left:0.0139in solid #000000;border-right:0.0007in solid #000000;padding-top:0in;padding-bottom:0in;padding-left:0.0375in;padding-right:0.0375in;"| '''Changing the set up parameters'''
+
|
| style="background-color:#ffffff;border-top:0.0007in solid #000000;border-bottom:0.0139in solid #000000;border-left:0.0139in solid #000000;border-right:0.0139in solid #000000;padding-top:0in;padding-bottom:0in;padding-left:0.0375in;padding-right:0.0375in;"| '''Now go to simulation in menu bar and click on setup. '''
+
|We will keep the other parameters unchanged.
  
'''A pop up window appears.'''
 
  
'''Make the following changes. '''
+
Click on '''OK'''.
  
'''final integration time:- up-to what time your simulation will run (default is 1.0E05) which means 1 times 10^5, i.e. 1,00,000 amount of time the simulation will run. '''
+
|-
 +
|Changing the set up parameters
 +
|Now go to the '''Simulation''' in menu bar and click on '''Setup'''.
  
'''Now I am going to change it to 30.'''
+
|-
 +
|Pop up window.
 +
|A pop up window appears.
 +
 
 +
|-
 +
|Point to Final integration time
 +
|We will change the value of '''Final integration time'''.
  
'''Keep the other parameters unchanged.'''
 
  
'''Click on OK.'''
+
'''Final integration time''' decides how long the simulation will run.
  
 
|-
 
|-
| style="background-color:#ffffff;border-top:0.0007in solid #000000;border-bottom:0.0139in solid #000000;border-left:0.0139in solid #000000;border-right:0.0007in solid #000000;padding-top:0in;padding-bottom:0in;padding-left:0.0375in;padding-right:0.0375in;"| '''saving the Xcos file'''
+
|
| style="background-color:#ffffff;border-top:0.0007in solid #000000;border-bottom:0.0139in solid #000000;border-left:0.0139in solid #000000;border-right:0.0139in solid #000000;padding-top:0in;padding-bottom:0in;padding-left:0.0375in;padding-right:0.0375in;"| '''Now press Ctrl+s to save the file. '''
+
|Recall the value of '''refresh period''' of the''' CSCOPE block.'''
  
'''Give a suitable name . '''
+
I will keep the value of '''Final integration time''' equal to the value of '''refresh period''' of '''CSCOPE block'''
  
'''For example, 1storder.xcos and click on Save.'''
+
So, I will change it to 30.  
  
 
|-
 
|-
| style="background-color:#ffffff;border-top:0.0007in solid #000000;border-bottom:0.0139in solid #000000;border-left:0.0139in solid #000000;border-right:0.0007in solid #000000;padding-top:0in;padding-bottom:0in;padding-left:0.0375in;padding-right:0.0375in;"| '''simulation'''
+
|
| style="background-color:#ffffff;border-top:0.0007in solid #000000;border-bottom:0.0139in solid #000000;border-left:0.0139in solid #000000;border-right:0.0139in solid #000000;padding-top:0in;padding-bottom:0in;padding-left:0.0375in;padding-right:0.0375in;"| '''To start the simulation, click on the Simulation tab of the Xcos window menu bar on the top. '''
+
|Keep the other parameters unchanged.  
  
'''A Graphic window will open showing the step response of the first order system. '''
+
Click on '''OK'''.
  
'''To save the graph click on “Export to” option in the file menu.'''
+
|-
 +
|saving the Xcos file
 +
|Now press '''Control S''' to save the file, with a suitable file name.
  
'''Give some suitable name and choose an image format. '''
 
  
'''For example, stepres.jpg'''
+
I will save it as '''firstorder.xcos'''  
  
'''This will save the graph as a JPEG-image on your computer.'''
+
|-
 +
|simulation
 +
|To start the simulation, click on the '''Start''' button, available on the menu bar of '''Xcos''' window.
  
'''There are certain parameters we chose to keep as the default value.'''
+
|-
 +
|
 +
|A Graphic window will open, showing the '''step response''' of the first order '''transfer function.'''  
  
'''These can be changed. For example '''
+
|-
 +
|
  
'''In the Clock block : period which means the sampling period and initial time.'''
+
Click on File >> Export to.
 +
|We can save this plot as an image file.
 +
 
 +
 
 +
To save the graph, go to the '''File''' menu and click on '''“Export to”''' option.
  
'''In the CSCOPE block:Output window- number, position, size,Refresh Period, buffer size , graph colour etc...'''
 
  
 
|-
 
|-
| style="background-color:#ffffff;border-top:0.0007in solid #000000;border-bottom:0.0139in solid #000000;border-left:0.0139in solid #000000;border-right:0.0007in solid #000000;padding-top:0in;padding-bottom:0in;padding-left:0.0375in;padding-right:0.0375in;"| '''Slide'''
+
|Name it firstorder.png
| style="background-color:#ffffff;border-top:0.0007in solid #000000;border-bottom:0.0139in solid #000000;border-left:0.0139in solid #000000;border-right:0.0139in solid #000000;padding-top:0in;padding-bottom:0in;padding-left:0.0375in;padding-right:0.0375in;"| '''Pause the video here and solve the exercise given with the video.'''
+
|I will name it as firstorder.png and click on '''OK'''
  
 +
|-
 +
|
 +
|There are certain parameters which we chose to keep as the default value.
 +
 +
 +
These can be changed.
 +
 +
For example
 +
 +
In the''' Clock underscore c block''', the '''period''', which means the '''sampling period''' and '''initial time''' can be set.
  
 
|-
 
|-
| style="background-color:#ffffff;border-top:0.0007in solid #000000;border-bottom:0.0139in solid #000000;border-left:0.0139in solid #000000;border-right:0.0007in solid #000000;padding-top:0in;padding-bottom:0in;padding-left:0.0375in;padding-right:0.0375in;"| '''Slide'''
+
|
| style="background-color:#ffffff;border-top:0.0007in solid #000000;border-bottom:0.0139in solid #000000;border-left:0.0139in solid #000000;border-right:0.0139in solid #000000;padding-top:0in;padding-bottom:0in;padding-left:0.0375in;padding-right:0.0375in;"| '''Exercise:'''
+
|In the '''CSCOPE block,''' the '''output window number, position, size, buffer size , graph color''' etc can also be set.
  
''' 1) Simulate a second order transfer function with damping ratio (zeta) of 0.5 and angular frequency (Wn) equal to 1. '''
+
|-
''' Try changing the color of output graph. (hint: See the block parameters of CSCOPE)'''
+
|Slide
 +
|Pause the video here and solve the exercise given with the video.
  
''' 2) Using the first exercise, plot the Step input and the output (step response) in a single plot window.'''
+
|-
''' (hint: Use CMSCOPE block)'''
+
|Slide
 +
|
 +
#Simulate a '''second order transfer function''' with '''damping ratio''' of 0.5 and '''angular frequency''' equal to 1.
 +
#Try changing the color of output graph.
 +
#Using the first exercise, plot the '''Step input''' and the '''output''' in a single plot window.
  
 
|-
 
|-
| style="background-color:#ffffff;border-top:0.0007in solid #000000;border-bottom:0.0139in solid #000000;border-left:0.0139in solid #000000;border-right:0.0007in solid #000000;padding-top:0in;padding-bottom:0in;padding-left:0.0375in;padding-right:0.0375in;"| '''Slide'''
+
|Slide  
| style="background-color:#ffffff;border-top:0.0007in solid #000000;border-bottom:0.0139in solid #000000;border-left:0.0139in solid #000000;border-right:0.0139in solid #000000;padding-top:0in;padding-bottom:0in;padding-left:0.0375in;padding-right:0.0375in;"| '''In this tutorial we have learnt :'''
+
|Now let us summarize.
  
'''Xcos is a scilab package to model and simulate dynamic systems.'''
+
In this tutorial we have learnt to:
  
'''A palette browser lists all Xcos standard blocks grouped by categories.'''
+
*Create '''Xcos simulation''' diagrams using the '''palette browser'''
 +
*Configure each block as per the simulation requirements
 +
*Setup the simulation parameters
 +
*Save the output plot.
  
'''The parameter of each block is set by double click on the particular block.'''
+
|-
 +
| Show slide
 +
|
 +
*Watch the video available at the following link
 +
* It summarizes the Spoken Tutorial project
 +
* If you do not have good bandwidth, you can download and watch it
  
'''The setup for simulation is changed by set up option in simulation available in menu bar of Xcos.'''
+
|-
 +
| Show slide
 +
| The Spoken Tutorial Project Team
 +
* Conducts workshops using spoken tutorials
 +
* Gives certificates for those who pass an online test
  
'''The output of simulation can be graphically viewed.'''
+
For more details, please write to contact at spoken hyphen tutorial dot org
  
 
|-
 
|-
| style="background-color:#ffffff;border-top:none;border-bottom:0.0139in solid #000000;border-left:0.0139in solid #000000;border-right:0.0007in solid #000000;padding-top:0in;padding-bottom:0in;padding-left:0.0375in;padding-right:0.0375in;"| '''Slide'''
+
| Show slide
| style="background-color:#ffffff;border-top:none;border-bottom:0.0139in solid #000000;border-left:0.0139in solid #000000;border-right:0.0139in solid #000000;padding-top:0in;padding-bottom:0in;padding-left:0.0375in;padding-right:0.0375in;"| '''This brings us to the end of the spoken tutorial on Introduction to XCOS. '''
+
| Spoken Tutorial Project is a part of the Talk to a Teacher project
  
* '''This spoken tutorial has been created by the Free and Open Source Software in Science and Engineering Education(FOSSEE). '''
+
* It is supported by the National Mission on Education through ICT, MHRD, Government of India
 +
* More information on this Mission is available at spoken hyphen tutorial dot org slash NMEICT hyphen Intro
 +
 
 +
|-
 +
|
 +
| Hope you found this tutorial useful.  
  
* '''More information on the FOSSEE project could beobtained from [http://fossee.in/ http://fossee.in] or [http://scilab.in/ http://scilab.in] '''
+
This is Rupak Rokade from IIT Bombay signing off.  
* '''Supported by the National Mission on Eduction through ICT, MHRD, Government of India. '''
+
* '''For more information, visit: [http://spoken-tutorial.org/NMEICT-Intro http://spoken-tutorial.org/NMEICT-Intro] '''
+
  
'''This is Anuradha Amrutkar from IIT Bombay signing off.'''
 
  
'''Thank you for joining. Goodbye. '''
+
Thank You.
  
 
|}
 
|}

Latest revision as of 11:06, 10 April 2014

Visual Cue
Narration
Introduction Slide Welcome to the spoken tutorial on Xcos: Scilab Connected Object Simulator.


Xcos is a Scilab package for modeling and simulation of dynamical systems.


It includes both continuous and discrete systems.

Slide In this tutorial you will learn
  • What is XCOS.
  • What is palette.
  • Build block diagrams in Xcos
  • Setup the parameters of blocks.
  • Setup the simulation parameters.
  • Simulate the constructed block diagram.
Slide To practice this tutorial, Scilab should be installed on your system.


I am using Ubuntu Linux 12.04 and Scilab version 5.3.3 for demonstration.

Open Scilab Open the Scilab console window on your computer.


Go to applications and select Xcos

OR

Type “xcos” in your Scilab console window and press Enter

Palette By doing this, two windows will open.


The two windows are

  1. Palette browser and
  2. Untitled-Xcos window


In Palette browser, you will find different types of blocks

  • Commonly Used Blocks
  • Continuous time system blocks
  • Discrete time systems blocks
  • and many more.


The other window, Untitled-Xcos is blank, with grids.

Collecting the blocks from different Pallete We will now simulate a first order system with a step input.


To begin, I will select a transfer function block from the Continuous time systems palette.

As per narration Drag this block to the Untitled-Xcos window.
As per narration Select the required source in the Sources palette.


I will scroll down and use the STEP FUNCTION block.

As per narration I will drag and place it before the transfer function block.
As per narration Similarly, the output is displayed using the CSCOPE block, which is available in Sinks palette.


The CSCOPE block is placed after the transfer function block.

Point to the red input port. The red input port in CSCOPE denotes that this block is an “event driven” block.
As per narration It needs an event input for execution.


An event generator block is available in the Event handling palette.


The name of this block is Clock underscore c.

As per narration Drag and place this block above the CSCOPE block.
We have collected all the required blocks to do the simulation.
Connect as per narration Let us now connect the blocks together.


Select the output port of step function block and connect it to the input port of the transfer function block.

Point to the green input port. Notice that the selected input port gets highlighted in green colour.
As per narration Similarly, connect the remaining blocks as shown.
Changing the parameter of step block Now we will set the parameters of each block.
Double-click on step block First, go to the step block and double-click on it.
Point the options in the Pop-up window A pop up window appears, asking for the value of Step Time, Initial Value and Final Value.
Point to Step Time Step Time is the time at which the step change will occur.


We will keep it as 1, which is the default value.

Initial Value is the initial output value of the step function.


We will keep it as 0, which is the default value.

Final Value is the output of the step function, after the Step Time is lapsed.

We will change it to 2.

Click on OK.

Changing the parameter of Transfer function block Follow the similar procedure to configure any other block.
As per narration For transfer function block, the following configuration is required.


Numerator value in laplace domain has to be entered.


We will keep it as 1, which is the default value.

As per narration Denominator value in laplace domain has to entered.

We will change it to 2 asteric s plus 1.

Click on OK.

Changing the parameter of scope Double click on CSCOPE block, to configure the following parameters.

Set Ymin to 0.

The value of Ymin and Ymax should be set, depending on the range of the value, of the variable to be plotted.

Set the value of Ymin to 0.


Set Ymax to 3.

Since I have given step input as 2, to display the output on graph, I should change the Ymax to any higher value.

We will change it to 3.

Make a mental note of the default value of the refresh period.


The default value is 30.

We will keep the other parameters unchanged.


Click on OK.

Changing the set up parameters Now go to the Simulation in menu bar and click on Setup.
Pop up window. A pop up window appears.
Point to Final integration time We will change the value of Final integration time.


Final integration time decides how long the simulation will run.

Recall the value of refresh period of the CSCOPE block.

I will keep the value of Final integration time equal to the value of refresh period of CSCOPE block

So, I will change it to 30.

Keep the other parameters unchanged.

Click on OK.

saving the Xcos file Now press Control S to save the file, with a suitable file name.


I will save it as firstorder.xcos

simulation To start the simulation, click on the Start button, available on the menu bar of Xcos window.
A Graphic window will open, showing the step response of the first order transfer function.

Click on File >> Export to.

We can save this plot as an image file.


To save the graph, go to the File menu and click on “Export to” option.


Name it firstorder.png I will name it as firstorder.png and click on OK
There are certain parameters which we chose to keep as the default value.


These can be changed.

For example

In the Clock underscore c block, the period, which means the sampling period and initial time can be set.

In the CSCOPE block, the output window number, position, size, buffer size , graph color etc can also be set.
Slide Pause the video here and solve the exercise given with the video.
Slide
  1. Simulate a second order transfer function with damping ratio of 0.5 and angular frequency equal to 1.
  2. Try changing the color of output graph.
  3. Using the first exercise, plot the Step input and the output in a single plot window.
Slide Now let us summarize.

In this tutorial we have learnt to:

  • Create Xcos simulation diagrams using the palette browser
  • Configure each block as per the simulation requirements
  • Setup the simulation parameters
  • Save the output plot.
Show slide
  • Watch the video available at the following link
  • It summarizes the Spoken Tutorial project
  • If you do not have good bandwidth, you can download and watch it
Show slide The Spoken Tutorial Project Team
  • Conducts workshops using spoken tutorials
  • Gives certificates for those who pass an online test

For more details, please write to contact at spoken hyphen tutorial dot org

Show slide Spoken Tutorial Project is a part of the Talk to a Teacher project
  • It is supported by the National Mission on Education through ICT, MHRD, Government of India
  • More information on this Mission is available at spoken hyphen tutorial dot org slash NMEICT hyphen Intro
Hope you found this tutorial useful.

This is Rupak Rokade from IIT Bombay signing off.


Thank You.

Contributors and Content Editors

Nancyvarkey, Pravin1389, Rupakrokade