Xcos tutorial – Simple demo – x-engineer.org (2024)

Home
General Engineering
Xcos

Xcos tutorial – Simple demo

This is the first tutorial in a series, explaining some of the Xcos demonstration models. One of the main disadvantages of Scilab/Xcos, which is also a characteristic of open source software, is the low detail and quality of the documentation. With this series of articles we’ll go through the Xcos demonstrations block diagram models and explain the content.

To access Xcos demo models you have 3 possibilities:

  • click on the Scilab Demonstrations icon in the toolbar
  • click Help (?) and then Scilab Demonstrations
  • run the demo_gui() function in the Scilab console

Image: Scilab – Xcos Demonstrations window

From the Demonstrations window, in the left panel, click on Xcos. In the right panel select Standard demos. A third panel will open with all the Xcos Standard demo models. Select Simple Demo and the Xcos block diagram model will open.

The purpose of this Xcos demo model is to teach the user how to:

  • generate an event signal with a specified time step
  • modify an event signal
  • generate a periodic square wave
  • generate a sine wave

Image: Events (discrete or continuous) can be used to activate part of the diagram

Observation: There are two main types of signals associated with Xcos blocks: event signals and data signals.

The properties of the event signals are the following:

  • the ports are colored in red
  • they can not be saved in the workspace
  • the blocks which handle event signals are in the Event handling library (see Palette browser)
  • they can be seen as function calls or triggers (as in Matlab Simulink)

The properties of data signals are the following:

  • the ports are colored in black
  • they can be saved in the workspace
  • they represent numerical values (scalars or vectors)

The Clock block generates an event signal (time signal) with the following parameters:

  • Period: 0.1
  • Init time: 0.0

The Period is the time step, which can be viewed also as the refresh or update rate. The Init time parameter specifies the start of the event. The unit for both Period and Init time is seconds. The output can be used to trigger a Scope block or a signal generator block.

Since the period of out event signal is Tclock = 0.1 s, the frequency will be:

\[f_{clock} = \frac{1}{T_{clock}}=10 \text{ Hz}\]

The Frequency division block has an input event port and an output event port. The parameters of the block are:

  • Phase (0 to division factor -1): 0
  • Division factor: 30

The Division factor is used to change the frequency of the input event. The period of the output event Toutwill be calculated function of the period of the input event Tin and the division factor DF:

\[T_{out}=T_{in} \cdot DF\]

This gives the period of the output event equal to:

\[T_{out}=30 \cdot 0.1 = 3 \text{ s}\]

The Square wave generatorblock has an event input port and a parameter defining the amplitude A of the signal. The output signal will switch between A and -A every time a new event is occurring. In our case the square signal will switch from 1 to -1 every 3 seconds.

Image: Square wave signal plot

The Sine wave generator doesn’t have an input event port. Instead, the output signal is defined by three parameters:

  • Magnitude: 1
  • Frequency (rad/s): 1
  • Phase (rad): 0

The Magnitude is actually the amplitude of the signal. Since it’s in rad/s, the Frequency is actually the angular speed ω. In order to calculate the frequency of the signal, we can use the formula:

\[f_{sine}=\frac{\omega}{2 \pi}=\frac{1}{2 \pi}=0.1591549 \text{ Hz}\]

To find the period of the sine wave we divide 1 to the frequency:

\[T_{sine}=\frac{1}{f_{sine}}=\frac{1}{0.1591549}=6.2831853 \text{ s}\]

Image: Sine wave signal plot

For a better understanding of the demo model, let’s make the following changes of the block parameters and analyze the output.

Block Parameter Value
Clock Period 0.01
Frequency division Division factor 50
Square wave generator Amplitude 0.5
Sine wave generator Frequency (rad/s) 5

With this parameter setting, the square signal should switch between 0.5 and -0.5 every 0.5 seconds. The sine wave will have its frequency increased five times.

Image: Square wave (high frequency) signal plot

Image: Sine wave (high frequency) signal plot

Let’s recap what we’ve done during the tutorial:

  • generated an event signal with the Clock block
  • modify the event signal with the Frequency division block
  • generate a periodic square signal with the Square wave generator block
  • generate a sine signal with the Sine wave generator block

For any questions, observations and queries regarding this article, use the comment form below.

Don’t forget to Like, Share and Subscribe!

Prev Article

Next Article

Xcos tutorial – Simple demo – x-engineer.org (2024)
Top Articles
Workday Login Ahn
Giant Glimmer Fish Wow
Express Pay Cspire
The Largest Banks - ​​How to Transfer Money With Only Card Number and CVV (2024)
Genesis Parsippany
Jazmen Jafar Linkedin
Blanchard St Denis Funeral Home Obituaries
Readyset Ochsner.org
Cad Calls Meriden Ct
Southside Grill Schuylkill Haven Pa
Caroline Cps.powerschool.com
Zachary Zulock Linkedin
Zoebaby222
Mlb Ballpark Pal
Babyrainbow Private
Vcuapi
Aberration Surface Entrances
Swgoh Turn Meter Reduction Teams
Invert Clipping Mask Illustrator
Inter-Tech IM-2 Expander/SAMA IM01 Pro
Stardew Expanded Wiki
Silive Obituary
Bible Gateway passage: Revelation 3 - New Living Translation
Ppm Claims Amynta
Ups Drop Off Newton Ks
Shreveport City Warrants Lookup
Filthy Rich Boys (Rich Boys Of Burberry Prep #1) - C.M. Stunich [PDF] | Online Book Share
Boxer Puppies For Sale In Amish Country Ohio
D2L Brightspace Clc
A Christmas Horse - Alison Senxation
Co10 Unr
Darknet Opsec Bible 2022
Reli Stocktwits
Ljw Obits
Edict Of Force Poe
National Insider Threat Awareness Month - 2024 DCSA Conference For Insider Threat Virtual Registration Still Available
Skip The Games Grand Rapids Mi
Kerry Cassidy Portal
What Is A K 56 Pink Pill?
Wunderground Orlando
Bob And Jeff's Monticello Fl
Tricare Dermatologists Near Me
Pain Out Maxx Kratom
Noh Buddy
Hanco*ck County Ms Busted Newspaper
Ssc South Carolina
My Gsu Portal
Keci News
Underground Weather Tropical
18443168434
De Donde Es El Area +63
Palmyra Authentic Mediterranean Cuisine مطعم أبو سمرة
Latest Posts
Article information

Author: Frankie Dare

Last Updated:

Views: 6571

Rating: 4.2 / 5 (73 voted)

Reviews: 80% of readers found this page helpful

Author information

Name: Frankie Dare

Birthday: 2000-01-27

Address: Suite 313 45115 Caridad Freeway, Port Barabaraville, MS 66713

Phone: +3769542039359

Job: Sales Manager

Hobby: Baton twirling, Stand-up comedy, Leather crafting, Rugby, tabletop games, Jigsaw puzzles, Air sports

Introduction: My name is Frankie Dare, I am a funny, beautiful, proud, fair, pleasant, cheerful, enthusiastic person who loves writing and wants to share my knowledge and understanding with you.