Lab 4 and 5
Lab 4 and 5
LAB SESSION 04
OBJECT: Mathematical modeling of Electrical System
Theory:
o e is applied Potential.
o i is the mesh current.
The differential equations for the given figure.
According to Mesh Analysis:
e(t)=V L +V C +V R
e(t)=LD i +
The state equations for the given figure.
This circuit contains two energy-storage elements,
Inductor and capacitor.
STATE EQUATION:
PROCEDURE:
1. create a MATLAB-function RLC.m
function dXdt=RLC(t,X)
e=60; % (V)
R=10; % (Ohm)
L=1; % (H)
C=10; % (F)
%dX/dt
dXdt(1,1)=(1/C)*X(2);
Lab No 04 Instrumentation and Control(EL-305)
NED University of Engineering and Technology Department of Electronic Engineering
dXdt(2,1)=(-1/L)*X(1)-(R/L)*X(2)+(1/L)*e;
clear
close
Clc
X0=[0 0];
[t,X]=ode45('RLC',[0 500],X0);
subplot(2,1,1);
plot(t,X(:,1));
legend('Vc');
grid on;
title('Vc');
subplot(2,1,2);
plot(t,X(:,2),'r');
legend('i');
grid on;
title('i');
Graph:
Time constant = RC = 10*10= 100 sec
For first time constant :
Vc=63.2% * e = 0.632*60 =37.92 V
Lab No 04 Instrumentation and Control(EL-305)
NED University of Engineering and Technology Department of Electronic Engineering
OBSERVATIONS:
Parameter Behavior of system
Voltage
source(e)
Resistance(R)
Inductance(L)
Capacitance(C)
CONCLUSION:
EXERCISE:
Write the function and program of the following circuit diagram. Also explain the plots
of the respective state variables.
Criteria Poor (25%) Fair (50%) Good (75%) Excellent (100%)
Set up • Setup of equipment is not accurate • Setup of equipment is generally • Setup of equipment is generally • All equipment accurately placed
equipment • Help is required with several major workable with several details that accurate with 1 or 2 small details that • All necessary supplies on hand
and care details. need refinement need refinement • Very neat and organized
(20 points) • Many necessary supplies must be • Some necessary supplies must be • All necessary supplies on hand
found during lab (mid-lab) or after searched out after start of
start of experiment experiment
Following • Lacks the appropriate knowledge of • Demonstrates general knowledge of • Demonstrates good knowledge of the • Demonstrates very good knowledge
procedure the lab procedures lab procedures lab procedures of lab procedures
(30 points) • Often requires help from the • Requires help from teacher with • Will ask peers for help with problems • Gladly helps other students to follow
instructor to complete even basic some steps in procedures in lab procedures procedures
procedures • Works to follow each step before • Thoroughly and carefully follows
moving on to the next step each step before thoughtfully moving
on to the next step
Data • Measurements are incomplete, • Measurements are somewhat • Measurements are mostly accurate • Measurements are both accurate
collection inaccurate and imprecise inaccurate and very imprecise • Observations are generally complete and precise
(20 points) • Observations are incomplete or not • Observations are incomplete or • Work is organized • Observations are very thorough and
included recorded in a confusing way • Only 2 or 3 minor errors using may recognize possible errors in data
• Symbols, units and significant figures • There are 3 or more minor errors symbols, units and significant digits. collection
are not included using symbols, units and significant • Work is neat and organized
digits or 2 major errors • Includes appropriate symbols, units
and significant digits
Safety • Proper safety precautions are • Proper safety precautions are often • Proper safety precautions are • Proper safety precautions are
(10 points) consistently missed missed generally used consistently used
• Needs to be reminded often during • Needs to be reminded more than • May need to be reminded once • Consistently thinks ahead to ensure
the lab once during the lab during the lab safety
• Will often help other students to
conduct labs safely
Reporting • Many observations are not reported • Some significant observations are • Few relevant observations are missed • All relevant observations are
the results • Results are not discussed missed but report covers overall • Results are discussed reported and results are thoroughly
(20 objective of the lab session assessed
points) • Results are briefly discussed
Penalties 1. Late for more than 10 minutes without strong justification • -25 points of total score
2. Not wearing proper attire in the lab or wearing metallic jewelry which poses a safety hazard
3. Not obeying technician/demonstrator’s instructions
4. Eating/drinking in the lab
Lab No 05 Instrumentation and Control(EL-305)
NED University of Engineering and Technology Department of Electronic Engineering
LAB SESSION 05
OBJECT: Mathematical modeling of Electrical System by Simulink
THEORY:
To use graphical user interface diagrams to model the physical systems for the purpose of
design and analysis of control systems. We will learn how MATLAB/SIMULINK helps
in solving such models. This lab introduces powerful graphical user interface (GUI),
Simulink of MATLAB.
This software is used for solving the modeling equations and obtaining the response of a
system to different inputs. Both linear and nonlinear differential equations can be solved
numerically with high precision and speed, allowing system responses to be calculated
and displayed for many input functions.
SIMULINK
Simulink provides access to an extensive set of blocks that accomplish a wide range of
functions useful for the simulation and analysis of dynamic systems. The blocks are
grouped into libraries, by general classes of functions.
o Mathematical functions such as summers and gains are in the Math library.
o Integrators are in the Continuous library.
o Constants, common input functions, and clock can all be found in the Sources
library.
o Scope, To Workspace blocks can be found in the Sinks library.
o Simulink uses blocks to write a program.
o Blocks are arranged in various libraries according to their functions.
o Properties of the blocks and the values can be changed in the associated dialog
boxes.
Some of the blocks are given below.
SUM (Math library)
The sum block can be represented in two ways in Simulink, by a circle or by a rectangle.
The block for an integrator as shown below looks unusual. The quantity 1/s
comes from the Laplace transform expression for integration.
The Scope normally chooses its scales automatically to best display the data.
In the Simulink diagram, the appearance of a block can be changed by changing the
foreground or background colors, or by drop shadow or other options available in the
format drop down menu. The available options can be reached in the Simulink window
by highlighting the block, then clicking the right mouse button. The Show Drop Shadow
option is on the format drop-down menu.
• Interconnect the blocks by dragging the cursor from the output of one block to the
input of another block. Interconnecting branches can be made by right-clicking on
an existing branch.
• Double-click on any block having parameters that must be established, and set
these parameters. For example, the gain of all Gain blocks must be set. The
number and signs of the inputs to a Sum block must be established. The
parameters of any source blocks should also be set in this way.
• It is necessary to specify a stop time for the solution. This is done by clicking on
the Simulation > Parameters entry on the Simulink toolbar.
Mass-Spring System Model
Consider the Mass-Spring system used in the previous exercise as shown in the
figure.
Where;
Fs(x) is the spring force.
Ff(t) is the friction coefficient
x(t) is the displacement
Fa(t) is the applied force
The differential equation for the above Mass-Spring system can then be written as
follows
PROCEDURE:
Modeling of a second order system
Construct a Simulink diagram to calculate the response of the Mass-Spring
system.
The input force increases from 0 to 8 N at t = 1 s.
The parameter values are M = 2 kg, K= 16 N/m, and B =4 N.s/m.
Draw the free body diagram.
Write the modeling equation from the free body diagram
Solve the equations for the highest derivative of the output.
Draw a block diagram to represent this equation.
Draw the corresponding Simulink diagram.
Use Step block to provide the input fa(t).
In the Step block, set the initial and final values and the time at which the step
occurs.
Use the “To Workspace” blocks for t, fa(t), x, and v in order to allow MATLAB
to plot the desired responses. Set the save format to array in block parameters.
Select the duration of the simulation to be 10 seconds from the Simulation >
Parameters entry on the toolbar
Lab No 05 Instrumentation and Control(EL-305)
NED University of Engineering and Technology Department of Electronic Engineering
Simulink file
CONCLUSION:
Criteria Poor (25%) Fair (50%) Good (75%) Excellent (100%)
Set up • Setup of equipment is not accurate • Setup of equipment is generally • Setup of equipment is generally • All equipment accurately placed
equipment • Help is required with several major workable with several details that accurate with 1 or 2 small details that • All necessary supplies on hand
and care details. need refinement need refinement • Very neat and organized
(20 points) • Many necessary supplies must be • Some necessary supplies must be • All necessary supplies on hand
found during lab (mid-lab) or after searched out after start of
start of experiment experiment
Following • Lacks the appropriate knowledge of • Demonstrates general knowledge of • Demonstrates good knowledge of the • Demonstrates very good knowledge
procedure the lab procedures lab procedures lab procedures of lab procedures
(30 points) • Often requires help from the • Requires help from teacher with • Will ask peers for help with problems • Gladly helps other students to follow
instructor to complete even basic some steps in procedures in lab procedures procedures
procedures • Works to follow each step before • Thoroughly and carefully follows
moving on to the next step each step before thoughtfully moving
on to the next step
Data • Measurements are incomplete, • Measurements are somewhat • Measurements are mostly accurate • Measurements are both accurate
collection inaccurate and imprecise inaccurate and very imprecise • Observations are generally complete and precise
(20 points) • Observations are incomplete or not • Observations are incomplete or • Work is organized • Observations are very thorough and
included recorded in a confusing way • Only 2 or 3 minor errors using may recognize possible errors in data
• Symbols, units and significant figures • There are 3 or more minor errors symbols, units and significant digits. collection
are not included using symbols, units and significant • Work is neat and organized
digits or 2 major errors • Includes appropriate symbols, units
and significant digits
Safety • Proper safety precautions are • Proper safety precautions are often • Proper safety precautions are • Proper safety precautions are
(10 points) consistently missed missed generally used consistently used
• Needs to be reminded often during • Needs to be reminded more than • May need to be reminded once • Consistently thinks ahead to ensure
the lab once during the lab during the lab safety
• Will often help other students to
conduct labs safely
Reporting • Many observations are not reported • Some significant observations are • Few relevant observations are missed • All relevant observations are
the results • Results are not discussed missed but report covers overall • Results are discussed reported and results are thoroughly
(20 objective of the lab session assessed
points) • Results are briefly discussed
Penalties 1. Late for more than 10 minutes without strong justification • -25 points of total score
2. Not wearing proper attire in the lab or wearing metallic jewelry which poses a safety hazard
3. Not obeying technician/demonstrator’s instructions
4. Eating/drinking in the lab