0% found this document useful (0 votes)
63 views14 pages

Simulink Model Description

This document provides instructions for learning Simulink through tutorials on various control systems applications. It lists 7 tutorials covering topics like temperature and flow rate control, modeling a falling ball, modeling a solar cell, and interactions between Simulink and MATLAB. Key steps covered include building models with inputs, outputs, controllers, and other blocks, extracting simulation data, and plotting results. The document also provides code examples for modeling and analyzing solar cell performance data from a Simulink simulation in MATLAB.

Uploaded by

kazi ahad
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
63 views14 pages

Simulink Model Description

This document provides instructions for learning Simulink through tutorials on various control systems applications. It lists 7 tutorials covering topics like temperature and flow rate control, modeling a falling ball, modeling a solar cell, and interactions between Simulink and MATLAB. Key steps covered include building models with inputs, outputs, controllers, and other blocks, extracting simulation data, and plotting results. The document also provides code examples for modeling and analyzing solar cell performance data from a Simulink simulation in MATLAB.

Uploaded by

kazi ahad
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 14

LEARNING SIMULINK

SL. No. Tutorials Learning Things Pages


01 Control of  Full procedure in words 01-07
temperature  Use of In1, In2, Out1, Out2 for input and outputs
and flow rate  Atomic subsystem (built in) is included for PI controller.
 Saturation block is used
 Outputs are Temperature, T and Flow rate, F
 Once Run the program, variable T and F are available in
MATLAB, but they are printable or controllable.
 Get curve from workspace ---- See Tips.
02 Dynamic  Matlab subfunction is called inside the Simulink model- VVI 09
behavior of ball  Nice formulation of the dynamic model ÿ=−g . The ball is
drppin from 20 m height. The ball radius is 1.5 m
 Here output goes to oscilloscope.
 Procedure of getting control on figure by giving two commands
in command window
set(0,’ShowHiddenHandles’,’on’); and
Set(gcf,’menubar’,’figure’);
03 P-V solar cell  Callback function is used to give the values of initial parameters
Draw I-V and P-  Right Click .>> Properties>> call back
V curve from  Five equations are used and then make five subsystems.
Equation  During drawing P-V and I-V curve Min and Max limit of P,V and I
must be given to get only positive Values.
04 Matlab-Simulink  How to send data to Simulink model from Matlab? From
interaction workspace
 How to extract data from Simulink to Matlab? 3 ways. Among
them To workspace and out1 are better.
05 MGR_solar1m.m Plot I-V and P-V curve from equations
06 Modeling of Single cell is modeled and output current and voltages are displayed.
solar cell using
built in block.
07 P-V array We can group some cells and make subsystem. That will be PV module.
making
MATLAB Program: MGR_solar1m.m
% to get plot of I-V an dP-P-V curve of the output shown in the
% simulink model " MGR_solar1", we have to execute
% the following commands.
% Remeber both simulink file .xls and matlab file .m must be in
same
% folder location.
clear
close all
clc
open('MGR_solar1') % optional
sim('MGR_solar1') % Run the simulink model from MATLAB
%
% % % Extract data generated by the Output port
xSignal = yout.getElement('x'); % In the model “x” is signalname
t = xSignal.Values.Time;
I = xSignal.Values.Data(:,1);
V = xSignal.Values.Data(:,2);
P = xSignal.Values.Data(:,3);
% plot of I-V characterisics
% plot(V,P,'LineWidth',2,'Color','k')
%
% axis([0 35 0 220])
% xlabel('Volatge of Solar cell','FontSize',18)
% ylabel('Power of solar cell','FontSize',18)
% title('P-V Characterisics of Solar Panel','FontSize',22)

% figure(2)
% plot(V,I,'LineWidth',2,'Color','k')
% axis([0 35 0 10])
% xlabel('Volatge of Solar cell','FontSize',18)
% ylabel('Current of solar cell','FontSize',18)
% title('I-V Characterisics of Solar Panel','FontSize',22)

figure(1)
% [ax,h1,h2] = plotyy(V,I,V,P);
% % Good choice with old version command
% set(ax(1),'YLim',[0 210])
% set(ax(2),'YLim',[0 10])
% set(ax(1),'YTick',[0:10:210])
% set(ax(2),'YTick',[0:0.5:10])
% grid on
%%%%%%%%%%%%%%%%%%%%%%%%%%%
% or wirh new version
yyaxis left
plot(V,I,'LineWidth',2,'Color','b') % Plot into left axes
ylim([0 10]);
yticks([0:0.5:10]);
xlabel('Volatge of Solar cell','FontSize',18)
ylabel('Current of solar cell','FontSize',18)
title('Characterisics of Solar Panel','FontSize',22)

yyaxis right
plot(V,P,'LineWidth',2,'Color','r') % Plot into right axes
ylim([0 210]);
yticks([0:10:210]);
ylabel('Power of solar cell','FontSize',18)
legend('I-V curve','P-V curve','Location','northwest')
grid on
hold on
% Do analysis using Matlab on the data
[P_Max indexMax]=max(P);
vMax=V(indexMax);
plot(vMax,P_Max,'rx','LineWidth',2,'MarkerSize',14)
xx=[vMax vMax];
yy=[P_Max 0];
line(xx,yy,'Color','blue','LineStyle','--');
text(vMax+1,P_Max,'MPP', 'FontSize', 20)
legend('I-V curve','P-V curve','Location','northwest')

Simulink file Name: MGR_solar1.slx - Final view

Here it is seen that two X-Y graphs are used to get plot of I-V and P-V curve. In both cases, voltage, V is placed at
x-axis , which is on top of two inputs to X-Y graphs. The result are fully graphically controlled to make them
printable format.

% % % Extract data generated from the Output port


xSignal = yout.getElement('x'); % In the model “x” is signalname
t = xSignal.Values.Time;
I = xSignal.Values.Data(:,1);
V = xSignal.Values.Data(:,2);
P = xSignal.Values.Data(:,3);

Also there is a control on final figure output shown below.

Characterisics of Solar Panel


10 210
9.5
9
I-V curve MPP 200
190
P-V curve
8.5 180
170
Current of solar cell
8

Power of solar cell


7.5 160
7 150
6.5 140
6 130
120
5.5
110
5
100
4.5
90
4 80
3.5 70
3 60
2.5 50
2 40
1.5 30
1 20
0.5 10
0 0
0 5 10 15 20 25 30 35

Volatge of Solar cell

However, from the X-Y graph, we can also get X-Y plots. But they cannot be used in research paper.

The underneath of PV module is shown below: Total 5 subsystems for 5 currents.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

Matlab –simulink interaction program


Here, From Workspace and To Workspace both are used
E:\Simulink_files\
Simulink model name:

Matlab_Simulink_interaction1.slx

Program:

% This is a script to illustrate how interact with a Simulink


model from a
% Matlab script.
clear
clc
close all
% Define model parameters
g=10;
m=1;
c=0.5;
L=1;
tFinal=45;
tStepMax=0.05;

Theta0=-0*pi/180;
ThetaDot0=0;
% Create an input called 'simT' which will be used as input of
simlink
% model
t_in = linspace(0, tFinal, 100)';
T_in=zeros(size(t_in));

for k = 1:length(t_in)
if(t_in(k)<10)
T_in(k)=t_in(k);
else
T_in(k)=sin(t_in(k));
end
end

simT = [t_in T_in];


% To open the simulink model
open('Matlab_Simulink_interaction1') % Purely optional

% run the simulink model using the "sim' command


sim('Matlab_Simulink_interaction1')
% % Extract data generated by the Output port1
% xSignal = yout.getElement('x');
% t = xSignal.Values.Time;
% Theta = xSignal.Values.Data(:,1);
% ThetaDot = xSignal.Values.Data(:,2);

%%%%%%%% The number "2" displayed in simulink model by click


"Display, then
%%%%%%%% signal and ports and then "signal dimensions" . After
doing all
%%%%%%%% these things "2" displayes as there are two signals
available.

% Extract the data generated by the 'To Workspace' block (using


a
% timeseries in save format
% t = simX.Time;
% Theta = simX.Data(:,1);
% ThetaDot = simX.Data(:,2);

% Extract the data generated by the 'To Workspace' block (using


a
% structure with time in save format (set this)
% t = simX.time;
% Theta = simX.signals.values(:,1);
% ThetaDot = simX.signals.values(:,2);

% % Extract data generated by the signal logging technique


xSignal = logsout.getElement('x');
t = xSignal.Values.Time;
Theta = xSignal.Values.Data(:,1);
ThetaDot = xSignal.Values.Data(:,2);

% Do analysis using Matlab on the data


[ThetaMax indexMax]=max(Theta);
tMax=t(indexMax);

figure
subplot(2,1,1)
hold on
plot(t,Theta)
plot(tMax,ThetaMax,'rx','LineWidth',2,'MarkerSize',14)
xlabel('t (seeconds)')
ylabel('\theta(rad)')
grid on
title('Data generated by the simulink model')
legend('\theta','Max(\theta)')

subplot(2,1,2)
plot(t,ThetaDot)
xlabel('t (seeconds)')
ylabel('d\theta/dt(rad/s)')
grid on

Data generated by the simulink model


1

(rad) 0.5 Max( )

-0.5

-1
0 5 10 15 20 25 30 35 40 45
t (seeconds)

1
d /dt(rad/s)

-1

-2

0 5 10 15 20 25 30 35 40 45
t (seeconds)

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

Modeling of Solar Cell using built in function


 Open MATLAB and go to the Simulink
 Search Solar cell, add the block into the model.
 Double click on it.
 You will see, Short circuit current I SC , Open circuit voltage VOC , kind of irradiance at 1000watts/m 2 we are
getting these values. Others are quality factor and series resistance.
 Similarly we can change the model. By any means.
 Now we need converter from simscape name: PS-Simulink converter. It converts physical signal to
Simulink signal. The light signal is physical signal. So we need to convert to Simulink signal.
 Now we need PS constant . Get it.
 We need current sensor and voltage sensor Simulink model Name :
 We need PS constant block as well.
MGR_solar2_built.slx
Connection:

1. First we connect irradiance (PS constant) to solar cell.


2. Connect current sensor (Ammeter) and Voltage sensor (voltmeter). These meters are used for physical
signals only. From physical signal . Because Solar cell uses physical signals. After converting these voltage
and current signals to Simulink ones, they go to displays.

Simulation Procedure:

 First of all, simulate without having resistance as it is given open circuit voltage V OC and short circuit
current, ISC .
 Simulate 1 sec as well.
 The display shows VOC = 0.6 V
 Now get short circuit current.
 Short ground to upper point. And simulate for 1 sec
 ISC displays 7.34A.
 Now give normal connection through resistanec Rsh =1 ohm. This is load resistance.
 V = 0.5967 volt and I = 0.5967A
 Increase R =1000 ohms, V =0.6 and I = 0.0006 A

This is how we simulate solar cell in Simulink.

Now we wll talk about PV arrays.

PV Array:
As we have seen solar cell takes very small amount of current. So we need a combination of them in order
to get higher value. P-V array is nothing but series or parallel combination of solar cells. Depending on the
voltage and current requirements, we connect solar cells either in series or parallel.

For example: one solar cell has V OC = 0.6 volt and I SC = 6 A(set it). If we connect 3 cells in series, at the
output terminals, VOC = 3*0.6 = 1.8 V and the short circuit current, I SC will remain same. Now it becomes a P-
V mosule. It is an example of one P-V module of 0.6V and 6A.
One module picuture.

We can have

1. Series combination
2. Parallel combination
3. Series parallel combination.
Depending on the requirement.

In MGR_solar3_PV_Array.slx Simulink model, we have connected 3 cells in series to get our


desired output. The model runs and the current and voltage are displayed.

 At first change the cell Isc = 6A from 7.34 A default.


 Now test for VOC and ISC . They are 1.8V and 6A respectively.
 VOC = 1.8 V and ISC = 6 A. for each subsystem module.
 Total VOC = 3 X1.8 = 5.4 volts. I is also increased. 3 times as supply voltage has been increased by 3
times.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

I-V AND P-V CURVE OF A SINGLE CELL


Matlab Program: MGR_solar4m.m

% to get plot of I-V and P-V curve for a single cell


% simulink model " MGR_solar4", we have to execute
% the following commands.
% Remeber both simulink file .slx and matlab file .m must be in
same
% folder location.
clear
close all
clc
open('MGR_solar4') % optional
sim('MGR_solar4') % Run the simulink model from MATLAB

% Extract the data generated by the 'To Workspace' block (using


a
% timeseries in save format
t = simI.Time;
I = simI.Data(:,1);
V = simV.Data(:,1);
P = simP.Data(:,1);

% plot of I-V characterisics

yyaxis left
plot(V,I,'LineWidth',2,'Color','b') % Plot into left axes
ylim([0 8]);
yticks([0:0.5:8]);
xlabel('Volatge of single Solar cell','FontSize',18)
ylabel('Current of single solar cell','FontSize',18)
title('Characterisics of single Solar Cell','FontSize',22)

% plot of P-V characterisics


yyaxis right
plot(V,P,'LineWidth',2,'Color','r') % Plot into right axes
ylim([0 3.5]);
yticks([0:0.5:3.5]);
ylabel('Power of single solar cell','FontSize',18)
legend('I-V curve','P-V curve','Location','southeast')
grid on

Simulink model MGR_solar4.slx


Characterisics of single Solar Cell
8 3.5
7.5
Current of single solar cell

Power of single solar cell


7 3
6.5
6
2.5
5.5
5
4.5 2
4
3.5 1.5
3
2.5
1
2
1.5
1 0.5
I-V curve
0.5 P-V curve
0 0
0 0.1 0.2 0.3 0.4 0.5 0.6

Volatge of single Solar cell

I-V AND P-V CURVE OF A 6 CELL IN SERIES


Matlab Program: MGR_solar5m.m
Simulink model: MGR_solar5.slx
Characterisics solar array (6 cell)
10 25
9.5 24
Current of solar array (6cell)

I-V curve

Power of solar array (6cell)


9 23
P-V curve 22
8.5 21
8 20
7.5 19
7 18
17
6.5 16
6 15
5.5 14
5 13
12
4.5 11
4 10
3.5 9
3 8
7
2.5 6
2 5
1.5 4
1 3
2
0.5 1
0 0
0 0.5 1 1.5 2 2.5 3 3.5 4

Volatge of solar array(6cell)

You might also like