Lab 2 - Introduction To MATLAB Simulink and V-I Measurement PDF
Lab 2 - Introduction To MATLAB Simulink and V-I Measurement PDF
Obtained
No. Title Marks
Marks
1 Ability to Conduct Experiment 05
2 Data Analysis and Interpretation 05
Total 10
Obtained
No. Title Marks
Marks
1 Report Content/Organization/Structure 05
2 Calculations & Data Presentation 05
Total 10
Objectives:
◼ Understanding MATLAB for circuit simulation.
◼ Formation of circuits with MATLAB
◼ Analysis of the circuit using MATLAB
Resources:
Pc installed with latest version of MATLAB.
Theory:
Simulink:
Simulink is a block diagram environment for multi-domain simulation and Model-Based Design.
It supports simulation, automatic code generation, and continuous test and verification of
embedded systems.
Simulink provides a graphical editor, customizable block libraries, and solvers for modeling and
simulating dynamic systems. It is integrated with MATLAB, enabling you to incorporate
MATLAB algorithms into models and export simulation results to MATLAB for further analysis.
Procedure:
1. Opening Simulink:-
Open MATLAB 2015 on your PC and click on Simulink library as show in fig 1.1
Fig 1.1
2. Simulink Library:
The Simulink Library Browser is the library where you find all the blocks you may use in
Simulink. Simulink software includes an extensive library of functions commonly used in
modeling a system. These include:
• Continuous and discrete dynamics blocks, such as Integration, Transfer functions, Transport
Delay, etc.
Fig 1.2
3. Block Libraries:
10
Here are some common used Continuous Blocks:
11
4. Creating new model :
Click the New icon on the Toolbar in order to create a new Simulink model:
Fig 1.3
Fig 1.4
12
You may now drag the blocks you want to use from the Simulink Library Browser to the model
surface (or right-click on a block and select “Add to…”).
5. Wiring techniques:
Use the mouse to wire the inputs and outputs of the different blocks. Inputs are located on the
left side of the blocks, while outputs are located on the right side of the blocks.
Use the mouse, while holding the left button down, to drag wires from the input to the output.
Another wiring technique is to select the source block, then hold down the Ctrl key while left-
clicking on the destination block. Try the different techniques on the example above.
If wire a connection from a wire to another block, like the example below, you need to hold
down the Ctrl key while left-clicking on the wire and then to the input of the desired block.
6. Help window:
13
In order to see detailed information about the different blocks, use the built-in Help system
Fig 1.5
All standard blocks in Simulink have detailed Help. Click the Help button in the Block
Parameter window for the specific block in order to get detailed help for that block. The Help
Window then appears with detailed information about the selected block:
FIg 1.6
7. Configuration:
14
There are lots of parameters you may want to configure regarding your simulation. Select
“Configuration Parameters…” in the Simulation menu.
Fig 1.7
FIg 1.8
15
Note: Each of the controls on the Configuration Parameters dialog box corresponds to a
configuration parameter that you can set via the “sim” and “simset” commands. You will learn
more about these commands later.
Solvers are numerical integration algorithms that compute the system dynamics over time using
information contained in the model. Simulink provides solvers to support the simulation of a
broad range of systems, including continuous-time (analog), discrete-time (digital), hybrid
(mixed-signal) and multi-rate systems of any size.
8. Useful Features:
You should know about these features in Simulink in order to take full advantage of Simulink.
Flip Blocks: Normally the inputs are on the left and the outputs on the right, but in some cases it
is convenient to have the inputs on the right and output on the left side.
In order to “flip” the input and outputs right-click on the block and select “Flip Block” or Press
“CTRL + R”
16
Experiments:
Task # 01: Make the following Circuit in Simulink MATLAB and find the designated current
and voltage using scope.
Fig 1.9
NOTE : Always place the powergui block in the top-level diagram for optimal performance and
make sure that the block uses the name powergui.
While simulating a circuit in Matlab/Simulink with the help of sim power system
toolbox, we need to put the powergui block. In the powergui block we get the option of
simulating the circuit using continuous or discrete mode.
17
Procedure:
1. Open New model in Simulink and open Simulink library.
2. Write Powergui in search bar.
Fig 1.10
4. Save this file to the new folder. Now, open simulink library and go to Simscape >
SimPowerSystem>Specialized Technology>Fundamental Blocks> and choose electrical sources.
18
Select AC voltage source and add it to a new model.
5. Go to elements in the Simulink library and select series RLC branch and add it to a new model.
Fig 1.11
19
6. Connect the circuit through wires. Set the AC source to 100V peak voltage and 50 Hz
frequency.
7. Right click on RLC branch and select RL load.
8. Set the inductor value to 10mH.
Fig 1.12
9. Add current and voltage measurement blocks from Simscape >SimPowerSystems >
Specialized Technology > Fundamental blocks > Machines > Measurements.
Fig 1.13
20
10. Connect the measurement blocks as follows :
Fig 1.14
11. Double click on scope for results.
Fig 1.15
21
Fig 1.16
You can right click on the scope result screen and change style.
22
12. Now add a third scope to the model and right click on it and select configuration properties.
Set the input ports to two as follows.
Fig 1.17
23
Set the layout design of the third scope as:
By connecting a two input scope we can see result in one window as follows:
Fig 1.18
24
For titles, right click on the result window and select display and write your desired title for
convenience, such as “Output Current”.
Task#02: Make the following three phase circuit on Simulink and measure the output values.
Fig1.19
Procedure:
1. Follow the steps in Task#01 and add power-gui to the model.
2. Add three phase source and ground from Simulink library. Go to block parameters of the three
phase source and set its voltage to 400Vrms and frequency to 50 Hz. set its configuration to Yg.
(By selecting Yg an internal ground is connected to the external ground).
3. Add Three- Phase RLC branch from the Simulink library. Right click on it and select RL- load
from the drop down list.
4. Add Three- Phase V-I measurement from the Simulink library and connect it to the
corresponding phases.
5. Connect a scope to the Three- Phase V-I measurement block.Connect “a”, “b” and “c” phases
of the RL branch to each other and then to the external ground.
25
Fig1.20
6. Start the simulation and double click on scope for results.
Results:
Fig1.21
7. Add two three input scope and two Demux’ from Simulink library and connect them as show
in circuit diagram.
8. Right click on Demux and change its number of output ports as follows :
26
Fig1.22
9. Now, simulate the circuit and double click on the three input scopes for results. Results are
shown as follows:
Fig1.23
27
Fig1.24
Task#3: Make the following three phase circuit on MATLAB Simulink and measure current and
voltages at the output.
Fig 1.25
28
Procedure:
1. Follow the steps mentioned in the previous lab and add the required components to the
model.
2. Add three phase source and ground from Simulink library. Go to block parameters of the
three phase source and set its voltage to 11Kv and frequency to 50 Hz. set its configuration
to Yg. (By selecting Yg an internal ground is connected to the external ground).
3. Add Three- Phase RLC branch from the Simulink library. Right click on it and select RL-
load from the drop down list. (where R=100 Ohms, L=10mH)
4. Add two Three- Phase V-I measurement block from the Simulink library and connect it to
the corresponding phases.
5. Connect scopes to the respective Three- Phase V-I measurement blocks.
6. Connect a and c phases of the RL branch with phase b and then to the external ground.
7. Start the simulation and double click on scope for results.
Fig 1.26
(Voltages at Primary Side)
29
A close-up view of the voltages at the primary side is shown in the figure below.
(11Kv*1.414)/1.731 voltages are being supplied to the primary side.
Fig 1.27
Fig 1.28
Voltages at secondary side
We can see from the above figure that the voltages are stepped down to 400 V
30
Fig 1.29
Current at secondary side
By observing, we can see that the current magnitude has risen.
Questions:
1. Determine the purpose of using POWERGUI?
2. For 50 Hz system, Evaluate the simulation time for 3 cycles?
3. Explain the function of Demux?
4. Describe the purpose of step down transformer?
Learning outcomes:
• Able to Measure of any electrical quantity in circuit by using MATLAB.
• Able to Select different kind of elements in the Simulink Library.
31