Scilab/C2/Xcos-Introduction/English
Title of script: Introduction to Xcos
Author: Shalini S
Keywords:
Visual Cue | |
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 | Objective:
What is XCOS. What is palette. To collect the blocks from the palette and connect them to construct the block diagram. Set the parameters of different blocks. To setup the simulation parameters. Simulate the constructed block diagram. |
Slide | To practice this tutorial, Scilab 5.x version should be installed on your system.
I am using Mac OS/X and Scilab 5.2.2 version for demonstration |
Open Scilab |
Open the scilab console window, type “xcos” in console and press enter or go to the applications and select Xcos. |
Palette | By doing this, two windows will open up
1 Palette browser 2 Untitled-Xcos In palette browser you will find different types of blocks
The other window: Untitled-Xcos is blank with grids |
Xcos window | Let us start with simulating a first-order system with step input. |
Collecting the blocks from different Pallete | We will now study a first order system and its step response.
To begin I will select a transfer function block from the Continuous time systems palette. Now drag the block to the Untitled-Xcos window. Select the 'Input' available in the Sources palette. Drag and place it before the transfer function block. Similarly, the output is taken into the csope which is available in Sinks palette. The CSCOPE is placed after the transfer function block. The red input port in csope denotes that this block is a so-called “event driven” block. It needs an event input for execution. Therefore, clock is needed which is available in event handling palette. 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. Notice that the selected input port gets highlighted in green colour. |
Changing the parameter of step block | Now to set parameters of each block.
Firstly, go to the step block and double click on it. A pop up window appears asking for the following. Step time:- the time at which step will start (default 1) Initial value:- the initial value of the step function (default 0) Final value:- the final amplitude of the step function (I am going to change it as 20). Click on OK. |
Changing the parameter of Transfer function block | Follow the similar procedure to configure any other configurable block.
For transfer function block, the following configuration is required. 1. numerator:- numerator of the transfer function (default is 1) 2. denominator:- denominator of the transfer function (default is : 1+s) Give some values according to your need For eg: I am going to change some values as shown. Click on OK. |
Changing the parameter of scope | Double click on CSCOPE to configure for the following parameters
y min : min value of y axis y max: max value of y axis 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. Keep the other parameters unchanged. Click on OK |
Changing the set up parameters | Now go to simulation in menu bar and click on setup.
A pop up window appears. Make the following changes. 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. Now I am going to change it to 30. Keep the other parameters unchanged. Click on OK. |
saving the Xcos file | Now press Ctrl+s to save the file.
Give a suitable name . For example, 1storder.xcos and click on Save. |
simulation | To start the simulation, click on the Simulation tab of the Xcos window menu bar on the top.
A Graphic window will open showing the step response of the first order system. To save the graph click on “Export to” option in the file menu. Give some suitable name and choose an image format. For example, stepres.jpg This will save the graph as a JPEG-image on your computer. There are certain parameters we chose to keep as the default value. These can be changed. For example In the Clock block : period which means the sampling period and initial time. In the CSCOPE block:Output window- number, position, size,Refresh Period, buffer size , graph colour etc... |
Slide | Pause the video here and solve the exercise given with the video.
|
Slide | Exercise:
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) 2) Using the first exercise, plot the Step input and the output (step response) in a single plot window. (hint: Use CMSCOPE block) |
Slide | In this tutorial we have learnt :
Xcos is a scilab package to model and simulate dynamic systems. A palette browser lists all Xcos standard blocks grouped by categories. The parameter of each block is set by double click on the particular block. The setup for simulation is changed by set up option in simulation available in menu bar of Xcos. The output of simulation can be graphically viewed. |
Slide | This brings us to the end of the spoken tutorial on Introduction to XCOS.
This is Anuradha Amrutkar from IIT Bombay signing off. Thank you for joining. Goodbye. |