Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

ELEC313 Lab#3

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 10

Qatar University

Department of Electrical Engineering

ELEC 313 Electric Machines Lab

Experiment 3: Introduction to Matlab/Simulink

1. Objective
The objective of this session is to introduce Matlab/Simulink and Specialized Power
Systems toolbox in Simscape library to the students.

2. Background Information
Simulink is a toolbox extension of Matlab program which gives an environment for multi-
domain simulation and Model-Based Design for dynamic and embedded systems. It provides
an interactive graphical environment and customizable set of block libraries that let you
design, simulate, implement and test a variety of time varying systems, including power
systems, machines, communications, controls and signal processing.

Simulink enables the user to move beyond idealized linear models to more realistic non-
linear models. It allows to create our own blocks if the available ones in the toolboxes and
libraries don’t meet our needs. The GUI simplifies the modeling process, eliminating the
need to formulate differential and difference equations in a program. Models are
hierarchical, so it can be built both top-down and bottom-up approaches.

After the model is defined, its dynamic behavior can be simulated using a choice of
mathematical integration methods, either from Simulink menus or by entering commands in
the Matlab command window. Using scopes and other display blocks, the results can be seen
throughout the simulation.

Because Matlab and Simulink are strongly integrated, the models can be simulated, analyzed
and revised in either environment at any point.

2.1 Key Features


 Extensive and expandable libraries of predefined blocks
 Interactive graphical designer for assembling and managing intuitive block diagrams.
 Ability to manage complex designs by segmenting models into hierarchies of design
components
 Model explorer to navigate, create, configure and search all signals, parameters,
properties and generated code associated with the model
 Application programming interfaces that let you connect with other simulation programs
and incorporate hand written codes
 Matlab function blocks for bringing Matlab algorithms into Simulink and embedded
system implementations
 Various simulation modes (normal, accelerator, rapid accelerator) for running
simulations interpretively or at compiled C-code speeds using fixed or variable step
solvers.

1
 Graphical debugger and profiler to examine simulation results and then diagnose
performance and unexpected behavior in the design
 Full access to Matlab for analyzing and visualizing results, customizing the modeling
environment and defining signal, parameter and test data
 Model analysis and diagnostic tools to ensure model consistency and identify modeling
errors

2.2 Model Based Design


Model-based Design is a process that enables faster, more cost-effective development of
dynamic systems. It allows you to improve efficiency by:
 Using a common design environment across project teams
 Linking designs directly to requirements
 Integrating testing with design continuously and identify and correct errors
 Refining algorithms through multi domain simulation
 Automatically generating embedded software code
 Developing and reusing test suites
 Automatically generating documentation
 Reusing designs to deploy systems across multiple processors and hardware targets

There are six steps to modeling any system

1. Defining the System: The system should be envisaged as a whole and be divided
into sub components. After building each of them a complete model can be
integrated.
2. Identifying System Components: There are three types of components in defining a
system
 Parameters:- System values that remain constant unless you change them
 States:- Variables in a system that change over time
 Signals:- Input and output values that change dynamically during a simulation
3. Modeling the System with Equations: Each subsystem within the system should be
described mathematically using algebraic, logical, differential or difference equations
or a combination of them.
4. Building the Simulink Block Diagram: Using the mathematical model, the blocks
can be created.
5. Running the Simulation: Select proper solver for the simulation to be run. Some of
the available ODE solvers are:
 ode45:- Based on Dormand-prince and always select as the “first try” method
 ode23:- Based on Bogacki-Shampine, more efficient when tolerances are wide
 ode113:- Based on Adams-Bashforth-Moulton solver which is multi step and
variable order. Recommended when the function evaluation is time consuming
and tolerances are tight.
 ode15s:- A multistep, variable order solver based on backward differentiation
 ode23s:- One step solver based on Rosenbrock formula.

The following parameters should also be specified for the solver selected

 tolerance:- Used to control the amount of relative error at each step. When the
tolerance is small, the routine takes smaller steps consuming more run time and
vice versa. Most of the simulations in machines need an error tolerance ranging
from 1e-3 to 1e-6. Always start with something conservative in terms of accuracy

2
and gradually loosen it to reduce the run time until you have a compromise
between both.
 minimum step size:- This parameter is used to start the integration at the
beginning of simulation and to restart once a discontinuity occurs.
 maximum step size:- This limit the step length to achieve a smooth appearance
in the plot of the output.

6. Validating the Simulation Results: Using linearization and trimming tools the
results can be analyzed and validated.

3. Simulink Software basics

3.1 Starting Simulink Software


Start Matlab and in the command window, enter

<<simulink

The Simulink library browser opens as shown below.

Simulink can also be opened by clicking the Simulink icon on the Matlab toolbar.

3
To create a new Simulink model, click on the New icon and select the Simulink Model as
follows:

The file can be saved using the Save icon.

3.2 Simulink Library Browser


The Simulink library browser displays the block libraries installed on your computer. To get
information on the selected block, right click and choose the option. A specific block can be
searched using Search icon.

Simulink library browser includes 16 standard block libraries as given in the following table.

4
3.3 Simulink Editor Window
The Simulink editor window contains the block diagram. The model can be built by
dragging blocks from the Simulink libraries, arranging them logically, connecting the blocks
with signal lines, and then setting the parameters for each block. It also allows to:

5
 Set configuration parameters such as start and stop time, type of solver and data
import/export settings
 Start and stop the simulation
 Save the model
 Print the block diagram

4. Lab Work-Creating a Simple Model


Here we learn the basic techniques through creating a simple model. The same techniques
are used even the model is complex.

To create the simple model as shown below, we need 4 blocks:


 Sine Wave: Generates the input signal
 Integrator: Processes the input signal
 Mux: Combines the input signal and output signal into one signal.
 Scope: Visualize both signals.

After connecting the blocks, the model integrates a sine wave signal and displays the result
along with the original signal.

4.1 Stepwise Instructions


1. Open a new model and save with an appropriate name as mentioned earlier.
2. Open the Sources library in Simulink Library Browser and it displays in the right
pane, all the sources available. Select the Sine Wave block.

6
3. Click and drag it to the empty window.
4. Add the following blocks to your model by the same steps as per the table below.

5. Any block in the model can be clicked and dragged to another place as shown below.

7
6. Place the cursor on the output port of sine wave block as it changes to cross hairs (+)
shape. The input and output ports for any block can be identified as below.

7. Click and drag a line from the output port to the input port of the integrator. Release
the mouse button as it approaches the input port, the line would automatically snap
in. Complete the model with the same procedure. You can automatically draw a
line between two blocks by selecting the first and then selecting the second while
holding down the Ctrl key.
8. To simulate the model, we have to set the configuration parameters as shown. Start
the simulation by clicking on and stop simulation by clicking on . Now click
on the scope and you can find the simulation results.

8
9. Using Parameters button from the scope toolbar and then the style tab, the
appearance of the scope can be changed as shown.

9
10.Lab Assignment (60% Weight)
A single phase 10kVA, 2200/220 V, 50 Hz transformer with the following parameters (in
per unit basis) is given.

Rc(pu) = 100 Xm(pu) = 18.47


R1(pu) = 0.02066 R2(pu) = 8.2645×10-4
X1(pu) = 0.032335 X2(pu) = 0.032335

Using Simulink:

Perform the Open Circuit and Short Circuit tests on the default single phase transformer
transformer and complete the table below. Please note that both tests are done on the HV
side of the given transformer. Make sure that you included powergui block in your model for
the successful simulation using Specialized Power Systems Library under Electrical Library
in Simscape.

Meter Readings Open Circuit Test Short Circuit Test


(on HV side) (LV side open) (LV side shorted)
Voltmeter 2200V
Ammeter 4.55 A
Wattmeter

Please show the simulation diagrams and snapshots of meter readings for each test.

11.References
1. Simulink: Getting Started Guide by Mathworks
http://www.mathworks.com/help/pdf_doc/simulink/sl_gs.pdf
2. Dynamic Simulations of Electric Machinery using Matlab/Simulink, Chee-Mun
Ong

10

You might also like