MATLAB Projects
Hello friends, hope you all are fine and having fun with your lives. Today, I am going to combine all of my MATLAB Projects in this post. I have posted quite a lot of projects on MATLAB but they are not well arranged that's why are not easily accessible. So, today I finally thought to combine all my MATLAB Projects and post their links in this post so that you guys can easily access all of them in one place just like Arduino , PIC Microcontroller Projects. All these MATLAB Projects and tutorials are designed and written by our team and we have done quite a lot of work in compiling these projects as you all know MATLAB is the most difficult and vast educational tool.
Most of these MATLAB Projects are free to use and users can easily download their codes from the respective project but few of them are not free but we have placed quite small amount on them so that engineering students can buy them easily. If you got problem in any of these tutorials, then ask in comments of that respective project and I will try my best to resolve your problems as soon as possible. Moreover, I am also gonna add more MATLAB Projects in future so I will keep on adding their links in this post so that we have complete record in one place. :) As I always say, other bloggers are welcome to copy these codes but do mention our blog link in your posts and help us grow. :) So, let's get started with MATLAB Projects:
Basics of MATLAB
These are basic tutorials on MATLAB and are essential for beginner to must read them once and then move on to next tutorials. In these tutorials, I have just shown some tricks of using MATLAB, so must read them once.
MATLAB Projects - Coding
These are coding based MATLAB Projects. In these projects, I have designed algorithms in m file of MATLAB software. If you have problem in any of these projects then ask in comments and I will resolve them.
Embedded MATLAB Projects
Simulink Projects
Below are given MATLAB Projects designed in Simulink. Simulink is an awesome simulation tool available in MATLAB and is used for designing complex projects. Till now, I haven't posted much simulations but I have plans to post more simulations in near future:
Inverters Simulation
Image Processing
Image Processing is one of the best tool of MATLAB software. We can perform any kind of image processing in MATLAB. Below are given image processing projects in MATLAB software.
Speech Recognition in MATLAB using Correlation
Hello friends, hope you all are fine and having fun with your lives. Today, I am going to share a tutorial on Speech Recognition in MATLAB using Correlation. Speech recognition is used in almost every security project where you need to speak and tell your password to a computer and is also used for automation. For example, I want to turn my AC on or off using voice commands then I have to use Speech Recognition. I have to make the system recognize that whether I am saying ON or OFF. In short, speech recognition plays a vital role in voice control projects. In today's post, I am gonna show you How to do Speech Recognition in Matlab and the technique I have used in this project is known as cross correlation. You should also have a look at Eye Ball Detection in MATLAB.
Correlation is normally used in signal processing, where you need to compare two signals and need to find the similarity between them. It is also known as the dot product of those two signals. Correlation has many uses and you can read more about it on its Wiki Page. Correlation is also used for pattern recognition like you want to find some pattern in the signal then you can use Correlation. Anyways, in our project, we are using correlation to find similarities between our stored signals and the testing signal. So, let's get started with Speech Recognition in MATLAB using Correlation.
Speech Recognition in MATLAB using Correlation
- First of all, download this complete project by clicking the below button:
- Now in this package, you will find nine audio wav files.
- Five of them are the recorded sounds that are already feed in MATLAB.
- Two are test files that will be recognized by the code.
- The remaining two are success and failure files which will run if you got the recognition or not.
- Let me explain the code a bit. First of all, what we need to do is to upload the first five training audio files in the software so and then we need to test these fives files with the test files and we need to check which one is a maximum match.
- Here's the complete code:
function speechrecognition(filename)
voice=wavread(filename);
x=voice;
x=x';
x=x(1,:);
x=x';
y1=wavread('one.wav');
y1=y1';
y1=y1(1,:);
y1=y1';
z1=xcorr(x,y1);
m1=max(z1);
l1=length(z1);
t1=-((l1-1)/2):1:((l1-1)/2);
t1=t1';
%subplot(3,2,1);
plot(t1,z1);
y2=wavread('two.wav');
y2=y2';
y2=y2(1,:);
y2=y2';
z2=xcorr(x,y2);
m2=max(z2);
l2=length(z2);
t2=-((l2-1)/2):1:((l2-1)/2);
t2=t2';
%subplot(3,2,2);
figure
plot(t2,z2);
y3=wavread('three.wav');
y3=y3';
y3=y3(1,:);
y3=y3';
z3=xcorr(x,y3);
m3=max(z3);
l3=length(z3);
t3=-((l3-1)/2):1:((l3-1)/2);
t3=t3';
%subplot(3,2,3);
figure
plot(t3,z3);
y4=wavread('four.wav');
y4=y4';
y4=y4(1,:);
y4=y4';
z4=xcorr(x,y4);
m4=max(z4);
l4=length(z4);
t4=-((l4-1)/2):1:((l4-1)/2);
t4=t4';
%subplot(3,2,4);
figure
plot(t4,z4);
y5=wavread('five.wav');
y5=y5';
y5=y5(1,:);
y5=y5';
z5=xcorr(x,y5);
m5=max(z5);
l5=length(z5);
t5=-((l5-1)/2):1:((l5-1)/2);
t5=t5';
%subplot(3,2,5);
figure
plot(t5,z5);
m6=300;
a=[m1 m2 m3 m4 m5 m6];
m=max(a);
h=wavread('allow.wav');
if m<=m1
soundsc(wavread('one.wav'),50000)
soundsc(h,50000)
elseif m<=m2
soundsc(wavread('two.wav'),50000)
soundsc(h,50000)
elseif m<=m3
soundsc(wavread('three.wav'),50000)
soundsc(h,50000)
elseif m<=m4
soundsc(wavread('four.wav'),50000)
soundsc(h,50000)
elseif m<m5
soundsc(wavread('five.wav'),50000)
soundsc(h,50000)
else
{soundsc(wavread('denied.wav'),50000)}
end
- Now if you read the code from start then you can see, first of all, I uploaded the test file which I want to compare with my samples.
- After that, I uploaded all 5 samples and also get their correlation with the test sample.
- Finally, in the end, I compared the results and on the basis of it I figured out which one is the correct speech file.
- You will also get spectrum graphs of your sound files as shown in the below figure:
- It was quite an easy project and I have done it within half an hour and I hope you guys will understand.
- If you got any problems then ask in the comments and I will resolve them.
- Here's the complete video demonstration for this project and I hope it's going to help you out in understanding it.
That's all for today, and I think you have understood How to do Speech Recognition in MATLAB using Correlation. Will meet you guys in the next tutorial soon. Till then take care !!! :)
Image Zooming with Bilinear Interpolation in MATLAB
Hello friends, hope you all are fine and having fun with your lives. Today, I am going to share a simple tutorial on Image zooming with bilinear Interpolation in MATLAB. We have seen many software in which there's an option of zooming an image. For example, if you have used paint or photoshop then you have seen that you can zoom your image quite easily by clicking a button. Today's we are gonna do the same thing but in MATLAB and we will have a look at the code behind this feature.
Now, when we are zooming some image then in fact we are increasing the pixels of that image and in order to do that we have to fill those extra pixels with the color of their neighbor pixel. This thing is know as interpolation. There are many different techniques for interpolation and the one we are gonna use for this tutorial is known as Bilinear Interpolation. Bilinear interpolation is simple type of linear interpolation in which we simply apply interpolation formula on both the x and y axis. So, let's have a brief overview of Bilinear Interpolation first and then we will move on to MATLAB implementation.
What is Bilinear Interpolation ?
- As I explained earlier, Bilinear Interpolation is a simple interpolation technique in which we fill the gaps between pixels using the neighbor pixels.
- For example, we have an unknown pixel in between four pixels, and let's say the unknown pixel is f(x,y) and it is surrounded by four pixels which are:
- Q11 = (x1, y1).
- Q12 = (x1, y2).
- Q21 = (x2, y1).
- Q22 = (x2, y2).
- All these four neighbor pixels are known , now by using Bilinear Interpolation we can find the values of this unknown pixel.
- Now, first of all, we will move in the x direction only.
- The formula used for Bilinear Interpolation for x factor is:
- Now after calculating these x formulas, now we will move in y direction and the formulas are:
- Now using these formulas we can quite easily find our unknown pixel f(x,y) using Bilinear interpolation. These formulas are taken from Wiki Page of Bilinear Interpolation and you can read more details about it there.
- Now we have seen the Bilinear Interpolation so now let's move and see How to do Image Zooming using this Bilinear interpolation in MATLAB.
Image Zooming with Bilinear Interpolation in MATLAB
- You can download the complete code by clicking the below button but also read the post, as I have explained this code in this remaining post.
Download MATLAB Code for Image Zooming
- In order to do image zooming with Bilinear Interpolation in MATLAB, first of all, what you need to do is to read an image file, which I have done using this simple formula:
im0=imread('TEP.jpg');
im=cast(im0,'int16');
imshow(cast(im,'uint8'));
[h,v,d]=size(im);
- So, in this above code, what we did is , we simply read the image file which I have named as TEP.jpg
- After that I have converted this image file into int16 and then to uint8 and finally I get the size of this image file using size command.
- After that I have applied a simple algorithm and have zoomed my image using below code:
for i=1:h
for j=1:v
im1(1+(i-1)*fac,1+(j-1)*fac,:)=im(i,j,:);
end
imshow(cast(im1,'uint8'));
end
- Now in the above loop what we have done is we simply enhanced our image and named it as im1, I have used a variable fac, which is factor, its user defined like if you want to zoom image by 2 then factor will be 2.
- Now we have enhanced our image, next thing we need to do is to apply the bilinear Interpolation on this complete image and we will get the result.
- Here's the complete code for Image Zooming with Bilinear Interpolation in MATLAB.
function bilinear_zoom(fac)
im0=imread('TEP.jpg');
im=cast(im0,'int16');
imshow(cast(im,'uint8'));
[h,v,d]=size(im);
for i=1:h
for j=1:v
im1(1+(i-1)*fac,1+(j-1)*fac,:)=im(i,j,:);
end
imshow(cast(im1,'uint8'));
end
%bilinear interpolation
for i=1:1+(h-2)*fac %row number
for j=1:1+(v-2)*fac %column number
if ((rem(i-1,fac)==0) && (rem(j-1,fac)==0))
else
h00=im1( ceil(i/fac)*fac-fac+1,ceil(j/fac)*fac-fac+1,:);
h10=im1( ceil(i/fac)*fac-fac+1+fac,ceil(j/fac)*fac-fac+1,:);
h01=im1( ceil(i/fac)*fac-fac+1,ceil(j/fac)*fac-fac+1+fac,:);
h11=im1( ceil(i/fac)*fac-fac+1+fac,ceil(j/fac)*fac-fac+1+fac,:);
x=rem(i-1,fac); %coordinates of calculating pixel.
y=rem(j-1,fac);
dx=x/fac; %localizeing the pixel being calculated to the nearest four know pixels.
dy=y/fac;
b1=h00; %constants of bilinear interpolation.
b2=h10-h00;
b3=h01-h00;
b4=h00-h10-h01+h11;
im1(i,j,:)=b1+b2*dx+b3*dy+b4*dx*dy; %equation of bilinear interpolation.
end
end
imshow(cast(im1,'uint8'));
end
imshow(cast(im1,'uint8'));
imwrite(cast(im1,'uint8'),'zoomed_pic.jpg');
- Now if you check in the Bilinear Interpolation code, we have applied the same equations which we have discussed in the above section.
- The Image I have used for this code is as follows:
- Now in MATLAB window, I have given this command bilinear_zoom(2) , where fac = 2, so I am increasing my image by factor 2. So it will be zoomed by 2 times.
- Its the image from my 555 Timer post but as I have posted it recently so this image was on my desktop thats why I used it. :P
- The result obtained is as follows:
- Now you can see the image has been zoomed and is now looking big and because of Bilinear Interpolation in MATLAB we haven't lost the in between pixels.
- Here's a video for this tutorial, which will give you better idea of How to do Image Zooming with Bilinear Interpolation in MATLAB.
That's all for today, I hope you have enjoyed this post. Will meet you guys in the next tutorials soon. Till then take care. :)
Color Detection in Images using MATLAB
Hello friends, hope you all are fine and having fun with your lives. In today's tutorial, we are gonna see Color Detection in Images using MATLAB. In the previous tutorial, I have posted about How to Detect Circles in Images using MATLAB in which we have detected objects based on their geometrical figure means either they are circle or not but today we are gonna distinguish objects based on their color i.e. whether they are red colored or green colored etc. Its a quite simple tutorial and comes in the basic category. We will first detect the color and then will create a boundary around that object and will also show its XY coordinates as well.
Image processing is an important tool of MATLAB. We can quite easily do the image processing in it using Image Processing toolbox so you need to make sure that your MATLAB must have Image processing toolbox before running this code. You should also have a look at these MATLAB Image Processing Projects. So, let's start with the project.
Color Detection in Images using MATLAB
- In order to do the Color Detection in Images using MATLAB, first thing we are gonna need is the image itself. :P
- So, I designed an image in paint which has different shapes in different colors as shown in below figure:
- As you can see in the above figure, there are different shapes in different colors so now we are gonna detect these objects on the basis of their color.
- Now use the below code and add it in your MATLAB m file, if you are new to m File then have a look at How to Create m File in MATLAB.
- If you wanna protect your code in m File then you should read How to Protect code in m File.
data = imread('TEP.jpg');
diff_im = imsubtract(data(:,:,2), rgb2gray(data));
%Use a median filter to filter out noise
diff_im = medfilt2(diff_im, [3 3]);
diff_im = im2bw(diff_im,0.18);
diff_im = bwareaopen(diff_im,300);
bw = bwlabel(diff_im, 8);
stats = regionprops(bw, 'BoundingBox', 'Centroid');
% Display the image
imshow(data)
hold on
for object = 1:length(stats)
bb = stats(object).BoundingBox;
bc = stats(object).Centroid;
rectangle('Position',bb,'EdgeColor','r','LineWidth',2)
plot(bc(1),bc(2), '-m+')
a=text(bc(1)+15,bc(2), strcat('X: ', num2str(round(bc(1))), ' Y: ', num2str(round(bc(2)))));
set(a, 'FontName', 'Arial', 'FontWeight', 'bold', 'FontSize', 12, 'Color', 'black');
end
hold of
- Now, run your m file and if everything goes fine then you will get an image as shown in below figure:
- You can see in the above figure, we have only detected the shapes with green color.
- The + sign indicates the center of each detected shape.
- X and Y are the x,y coordinates of the center point of each shape which are shown in black for each detected shape.
- Now, let's detect the red color in above figure, so in order to do so what I need to do is to simply change the third value in imsubtract function from 2 to 1.
- The complete code for red color detection in MATLAB is shown below:
data = imread('TEP.jpg');
diff_im = imsubtract(data(:,:,1), rgb2gray(data));
%Use a median filter to filter out noise
diff_im = medfilt2(diff_im, [3 3]);
diff_im = im2bw(diff_im,0.18);
diff_im = bwareaopen(diff_im,300);
bw = bwlabel(diff_im, 8);
stats = regionprops(bw, 'BoundingBox', 'Centroid');
% Display the image
imshow(data)
hold on
for object = 1:length(stats)
bb = stats(object).BoundingBox;
bc = stats(object).Centroid;
rectangle('Position',bb,'EdgeColor','r','LineWidth',2)
plot(bc(1),bc(2), '-m+')
a=text(bc(1)+15,bc(2), strcat('X: ', num2str(round(bc(1))), ' Y: ', num2str(round(bc(2)))));
set(a, 'FontName', 'Arial', 'FontWeight', 'bold', 'FontSize', 12, 'Color', 'black');
end
hold off
- Now, when you run this code in MATLAB, you will get the output as shown in below figure:
- Now instead of detecting the green shapes, it has now detected the red shapes in MATLAB.
- And have also shown their x,y coordinates in black color.
- Now, finally let's detect the blue color, in order to do, you now just need to change the third parameter to 3 and it will detect the blue color as shown in below figure:
- That's all for today, and I think its quite an easy one as I mentioned earlier this one is quite basic tutorials. Thanks for reading and I hope it will help you in some ways. :)
Detect Circles in Images Using MATLAB
Hello friends, hope you all are fine and having fun with your lives. In today's post we are gonna see How to detect Circles in Images using MATLAB. It's quite a simple and basic tutorial but quite helpful as today I was working on a project in which I need to do so but all the codes available online were for detection and tracking of circles in live images. So, I thought to share this one on our site. I have also posted another tutorial Color Detection in Images using MATLAB, so I think its better if you check that one as well.
We all know about MATLAB, which is a great tool for image processing and quite easy as it has a strong Help section. I haven't posted much tutorials on MATLAB in my blog so from now on I am gonna post tutorial on MATLAB as I get many requests about it. If you have any requests then use our Contact form and send them to us and I will try my best to postrelated tutorials. I personally prefer OpenCV over MATLAB, when it comes to image processing but in OpenCV there's not much flexibility as in MATLAB. Anyways, let's start our tutorial which is How to Detect Circles in Images using MATLAB.
Detect Circles in Images Using MATLAB
- First of all, you are gonna need an Image, in which you are gonna find circles so I used this image of a bike.
- As we can see there are two circles in the above image, which are two tyres, so we are gonna detect them now.
- So, copy the below code and paste it in your MATLAB m file.
ImagePath='TEP.jpg'; %Give Path of your file here
Img=imread(ImagePath);
Img=im2bw(Img(:,:,3));
Rmin=70;
Rmax=100;
[centersDark, radiiDark] = imfindcircles(Img, [Rmin Rmax], ...
'ObjectPolarity','bright','sensitivity',0.90)
imagesc(Img);
hold on
viscircles(centersDark, radiiDark,'LineStyle','--');
hold off
- Now, when you run this code you will get something as shown in below figure:
- As you can see in the above figure, both the circles are now detected and are marked with red and white line.
- The command, I have used for detecting these circles is imfindcircles , where Rmin and Rmax are the minimum and maximum radius of the circles.
- It will detect only those circles which will lie in this range and other circles will be ignored.
- Moreover, the last parameter is for setting the sensitivity of circle detection, which I have given is 0.90.
- It will also give the center of these circles along with their radii in the command window as shown in below figure:
- As, we have detected two circles so the command window is showing the X, Y coordinates of both these circles along with their radii.
- Now test it and also change the minimum and maximum ranges and you will see you are gonna detect more circles.
It was quite easy but if you have problem in it then ask in comments and I will try my best to solve them. That's all for today, will meet in next tutorial. Till then take care !!! :)
3 Level Cascaded H Bridge Inverter
Buy This Project
Hello Friends, i hope you all are fine and enjoying. Today i am going to share my new project tutorial which is 3 level cascaded H bridge Inverter. I also have explained inverters in detail in one of my previous tutorial which was Introduction to Multilevel Inverters. In this tutorial i am going t o explain a new application of cascaded H-bridge inverters and we will design a 3-level cascaded H bridge Inverter through it.
Before going to that, first of all lets recall some basics of Inverters from our previous posts. Inverters or commonly known as power inverters and A dc-to-ac converter whose output is of desired output voltage and frequency is called an inverter. Inverters are also called as counter devices of rectifiers. Rectifiers are those devices which are used to convert Alternating current (AC) into Direct Current (DC). Based on the type of operation, inverters can be divided into 2 major classes named as:
- Voltage Source Inverter (VSI)
- Current Source Inverter (CSI)
A voltage controlled inverter or VSI is one in which independent controlled ac output is a Voltage waveform. On the other hand, a current source inverter or CSI is one in which independent controlled ac output is Current waveform. Since my today's tutorial title is 3-level cascaded H-bridge inverter, A three level inverter is better than a two level inverter and the reason is that in 3 level inverter, we are dealing with three output voltage or current levels and the beauty of these type of inverters is that, they give better output and current sinusoidal waveforms and Threshold values are much better. Now i am done with the introduction and basics of inverters, now lets move towards the actual working of my project tutorial. You can also buy the complete simulation of this project and we have kept very small price for it which is only $10, only to meet our design costs.
3 level Cascaded H-Bridge Inverter
- We have designed the 3 level cascaded H-bridge inverter in MATLAB Simulink and the complete diagram of the circuit is shown in the image given below:
- The above figure seem like a complex one but it is very simple to understand and has a large no of applications. So lets explain each and every parameter one by one.
- In the first stage, signal comes to a common junction and in MATLAB it is known as 'Bus Selector'. It can accept no of inputs and outputs simultaneously. It has 1 input signal and 2 output signals.
- The output from this junction is going to 2 blocks named as 'A9' and 'A10'.
- In order to explore these blocks, you can simply double click on the and a new window will open. That window is shown in the image given below:
- Every block is infact a H-bridge( it contains 4 small blocks which are arranged in H form). It needs a DC supply to operate and at input and output we have apply scopes to monitor its input and output waveforms.
- Now if you want to explore it more then simply go to any small box, double click on it and a new window will open, which is shown in the image below:
- When you will double click on that small box then a new and very informative window will open which will represent, what is fabricated in that small box.
- If you carefully read the top lines then it reads that a gto transistor is fabricated in parallel with a series RC circuit. GTO means a Gate Turn Off transistor.
- GTO is a special type of transistor and a high power semi conductor device. The difference between a GTO and any other type of transistor is that the other transistors need a Gate pulse to turn ON and when you will remove the Gate pulse they will still remain in ON state.
- To turn it OFF you have to apply some alternate means like apply reverse voltage and when transistor tends to go into other direction we remove these reverse voltages.
- Unlike any other type of transistor, the beauty of GTO is that it can be turned ON & OFF only through gate control, which makes it a very important electrical component to implement.
- In ON state, GTO has some particular values of Resistance and Inductance.
- In OFF state, it has infinite internal impedance and no current passes through it in OFF state.
- Now in the circuit we have arranged 6 blocks. We have 3 sets of blocks and each set contains 2 thyristor blocks arranged in parallel with each other.
- In input supply from source is coming to every block in 3 sets. The output from each block goes to a ideal voltage measurement block representing as VC.
- When you will run the simulation, and to monitor the output voltage results, you will double click on this block and it will be giving complex values.
- After these voltage measurement blocks, we have Fourier analyzer block. This block Fourier analyzes the input signal over a running window of one cycle of fundamental frequency component.
- First and second output returns the Magnitude and Phase angle of the signals under consideration respectively. Here we are dealing with fundamental harmonic component so, i have kept its value 1.
- All this can be seen in the image shown below:
- If you have connected all the blocks in their exact positions and all the connections are OK then, when you will run the simulation and the waveforms on the scope will like:
OUTPUT WAVEFORMS
- The output results of scope#1 are shown in the image given below:
- You can see that in the above image, we have output square waves of three different colors which are green, yellow and pink.
- As i explained earlier that we are designing a 3 level inverter and we will be dealing with 3 output waveforms, which verifies our conclusion.
- The output graph of scope#3 is shown in the image given below:
- If you look closely then, the output graph of scope#1 is similar to that of scope#3 but the output curves of scope#3 are bit contracted.
- The output graph of the scope#2 is shown in the image given below:
- The output of scope#2 represents sinusoidal square waves and bu taking the mean of every part of square wave, we can generate a AC curve.
- The output of scope#5 is similar to that of scope#2 and it is also shown in the image given below:
- The output of scope#5 is s bit purified and much similar to sinusoidal AC signal.
Alright friends, that's all from my today's post. It was a bit lengthy but very technical and easy to understand. I hope you have learned something new today. If you have any questions regarding this, then don't feel shy to ask and i will try my best to make you understand the problem. Stay tuned for more project tutorials. Until next tutorial Take Care !! :)
11-Level 3-Phase Capacitor Clamped Inverter
Buy This Project
Hello friends, hope you all are fine and enjoying. Today i am going a new project tutorial which is 11-level 3-phase Capacitor Clamped Inverter. In my previous post 11 Level 3-phase Cascaded H-Bridge Inverter, we have designed the simulation of 3 phase 11 level inverter but the only difference was the method used in that project was cascaded H Bridge but today we are gonna see How to design an 11 level 3 phase inverter using clamped capacitors.
Now i am going to share a new and advanced bulk of knowledge about inverters with you people. Since we are going to design a 3-phase capacitor clamped inverter so, we need to design some algorithm which should be able to invert DC into AC at some High voltages and after inverting these DC voltages into AC, we will create a phase sequence and most importantly phase polarity between these three phases so they should be able to feed the load and must supply load current. It is a very interesting but a bit complicated project and now-a-days it has got a large no of industrial applications. The study about inverters and their implementation is the back bone of Modern Renewable Energy and it is the future of Power Generation. It is a MATLAB simulation based project so, any kind of hardware is not included in this tutorial. So what actually we are going to do is to design the complete simulation of the project and we will discuss every component and also each sub-component which will be used in Simulink MATLAB. So let's get started with 11 Level 3 Phase Capacitor Clamped Inverter:
11-level 3-Phase Capacitor Clamped Inverter
- Capacitor Clamped inverters are commonly known as Flying Capacitor Technology and they were first purposed by Meynard and Foch.
- Flying Capacitor includes no of series combination of Capacitor Clamped Inverter Switching Cells and these capacitors are used to get high voltages.
- The general concept related to flying capacitor is that it can charge up to one-half of the DC voltages and then within the circuit they can automatically increase or decrease the voltages, according to our requirement.
- The block diagram of the complete simulation of capacitor clamped inverter in MATLAB is given in the image below:
- The complete block diagram of the Capacitor 3-phase clamped inverter is shown above. In this image, you can notice that we have 30 input pulses numbered as no.1 to no.30 .
- So we can say that we have 30 DC input pins and these DC voltages will be inverted to get High Voltage AC.
- If you double click on any input pulse then, a new window will open and it will be showing that source from which we are gaining input DC voltages.
- We are gaining DC voltages from DC generators and a no of generators are connected in parallel to get HIGH voltage DC.
- The block to which all the inputs are connected is in fact a Capacitor Clamped Bank.
- In this bank, no. of capacitors are connected in series. Since a charged capacitor behaves as a voltage source and these capacitors are connected in series and their voltages adds up and in this way we get, HIGH voltages.
- To look inside the block then double click on the block and a new window will open and it will be showing all the components which are fabricated in that block.
- The internal structure of the block for capacitor clamped inverter is shown below in image:
- In the above shown image, you can see that within the block, we have a no. of sub-blocks which are connected with each other.
- To see what is in that small box, double click on that and a new window will open, which will be showing the internal structure of the each small box.
- The internal structure of sub-block is shown in the image given below:
- In the above given figure you can see that, in every block we have a MOSFETS which are connected with antiparallel diodes for capacitor clamped inverter.
- Ideal IGBT or GTO transistors can also be used but as I explained the properties of MOSFET in the beginning, that we give pulse to its base and it becomes operational.
- Once MOSFET has been triggered it keep conducting and in order to stop it, we will have to provide reverse voltage on its base to bring it to rest state.
- Since we are going to generate High Voltages 3-phase AC, so we have applied 3 big blocks and from each block, only one phase will be generated.
- After each big block, we have a summing junction on which voltages arrives and then we have applied two different types of voltage measuring devices.
- One device measures the phase voltages of inverted AC voltages. It can also be seen from the above given block diagram that the meter on the above side, measures phase voltages of all the three phases appearing on the summing junction.
- Now if you look closely then, you will observe that only one wire from each summing junction is coming to the meter and we also know that in order to measure phase voltages, we also need a neutral wire.
- We can get neutral wire from common ground of the system and the voltage difference between a phase and a neutral wire will give us Phase voltages.
- The below meter measures line voltages. Line voltages means the voltage difference between 2 phases. In our system we have three phases which are A, B and C respectively.
- To measure line voltages, this meter measures potential difference between phases and NO neutral wire is included in it.
- The line voltages will be AB, BC and CA.
- The Phase voltages and Line voltages have much difference between them and each have their own applications.
- For example to run the single phase House-Hold load we need phase voltages (voltage difference between a phase and a neutral wire).
- Whereas in industries, we need Line voltages to run the 3-phase load.
- Now run the simulation of this capacitor clamped inverter, and after completion now click on the scope for Line Voltages and you will get the below results:
- Now for Phase voltages of capacitor clamped inverter, click on the scope for phase voltages and you will get the below results:
APPLICATIONS
All type of Inverters have a large no of applications and now a days they are focus of Research and modern studies. Inverters have also made us able to get power from Renewable energy sources like solar panels, wind mills etc. Some industrial based applications of inverters are given below:
- The biggest advantage of inverters are that they give good power quality.
- Due to good power quality motors can reach at High speed at High voltages without producing any harmonics.
- They are used in power supply circuits.
- Now-a-days inverter Air Conditioners are also available in market and due to their High Efficiency and low power rating their demand is much High.
- ECU( electrical control unit) which carries out in-vehicle control also carries inverted circuits and it's demand is also accelerating these days.
Alright friends, that was all from today post. I hope you have learned something new today. If you have any question then don't hesitate to ask in comments. Stay tuned for more beneficial project tutorials. Until next tutorial Take Care !!! :)
11 Level 3-phase Cascaded H Bridge Inverter
Buy This Project
Hello friends, i hope you all are fine and enjoying. In this post i am going to share a new project tutorial, in which we will see how to design an 11 Level Cascaded H Bridge Inverter. If you recall my previous tutorial, in which we saw the design and working applications of 11 Level 3-phase Capacitor Clamped Inverter, then you can see its exactly the same project but only we are having a different approch in it, instead of using Capacitor clamped we are using cascaded H bridge Inverter in this project.
In this project we again are going to design an inverter but the only difference is The Implementation Technique. In that project we used Capacitor Clamped technique to get High Voltages inverted AC and now in this project, we will use Cascaded H-Bridge technique to design an Inverter. We have designed this Cascaded H bridge Inverter project in Simulink MATLAB. So i will explain this project tutorial in steps. First of all we will discuss the block diagram of the project, which we have made in Simulink. Then we will discuss the internal structure and the components which are implemented in the block diagram. And in the end we will see the applications of the cascaded H-Bridge inverters. I think this was enough for introduction and Now let's get practical and without wasting any time i think we should move towards the designing of the cascaded H Bridge 3-phase inverter.
11 Level 3-Phase Cascaded H Bridge Inverter
- A cascade H Bridge Inverter is a power electronic device, built to synthesize a desired AC voltage from several level of DC voltages.
- Cascaded H Bridge inverter can be implemented by using only a single DC source or capacitors or multiple DC sources.
- A standard cascade multilevel inverter requires 'n' DC sources to produce '2n+1' levels.
- The beauty of this system is that it can allow us to gain the desired levels of AC without using any type of Transformer.
- It allows us to simultaneously maintain the DC voltage level of the DC source and choose a fundamental frequency switching pattern to produce a nearly sinusoidal AC output.
- The block diagram of the Cascaded H Bridge Inverter designed in Simulink MATLAB is shown in the image given below:
- From above figure, you can see that we have on the extreme left side we have inputs of the systems and they are numbered as 'pulse'.
- Since we are going to design a multilevel inverter, which is a 11 Level inverter and to get that much levels, we also need multiple DC inputs.
- In this system, we have 30 DC inputs and they are numbered as 'pulse1-pulse30'.
- From the title of the project, you can understand that we are going to design a 3-phase inverter and for that we must have 3 control units to get three phase voltages.
- All the inputs are going to three big blocks which are named as ' Cascaded H-Bridge Inverter'. If you double click on that block then, a new window will open which will show the internal mechanism of this big block.
- This window is shown in the image given below:
- The above figure is very important and it is showing what actually is happening in that block. Since the components encrypted in each block are large so the above figure is showing half of the components.
- 10 inputs are connected to each block and in the above shown block we have 5 inputs.
- Every input is connected to a H shape bridge. In every H-shaped bridge, we have 4 sub-blocks. In order to under the mask of the sub-blocks, Double click on them and a new window will open, which will be representing the internal structure of sub-block.
- That small window is shown in the image given below:
- Now from the above figure, you can see that every sub-block contains an ideal IGBT, Gto or MOSFET and antiparallel diodes.
- In these H-bridges we have implemented MOSFET transistor for switching. Reason is that they have mush fast response and are capable to perform switching at high speed.
- Below are some parameters of transistors, which are fabricated in sub-blocks.
- An important thing to note here is that for MOSFET 'Snubber Resistance (Cs)' is infinite in OFF state. This is because in OFF state it doesn't allow the current to pass through it.
- Once MOSFET is triggered then it will keep on conducting and after that we will have to stop it manually.
- Now if you again focus the first block diagram then, you will observe that each block is giving only value of phase voltages at its output.
- From three blocks, we get three phase voltages and then to measure these voltages, we have 2 types of measuring devices.
- First type of voltmeter will measure the phase voltages and you can see that all the three phases are connected to that instrument.
- Phase voltage is the potential difference between a single phase and neutral wire. Since no neutral wire is connected to this instrument and the meter will take the system's neutral wire to measure the voltages.
- The other meter measures the Line voltages. Line voltages are the potential difference between any two phases. At our meters input we have Line Voltages like AB, BC and CA.
RESULTS
- We have connected two different types of voltmeters in our system. One will give the graphical representation of phase voltages and the other will give the graph of Line voltages.
- The graph of phase voltages is given below in the image:
- The above graph is representing the phase voltages of all the three phases, which we have generated in our system.
- You can see that all the three phases are at an angle of 120 degrees to each other.
- The graph of line voltages is shown in the image given below:
- The above graph is showing the 3-phase line AC voltages.
- You can see that some cornered square wave is obtained at output. Corners are appearing in output wave due to switching of MOSFET transister, we have used in our project.
- A proper filter circuit can eliminate this flaw and a fine AC can been obtained at output.
Alright friends, that was all from today's post. I hope you guys have enjoyed this H Bridge Inverter. If you have any question then ask in comments and i will try my best to resolve the issue. For more tutorials stay tuned. Till next tutorial Take Care !!! :)
Analysis of Sinusoidal Pulse Width Modulation of AC Signal
Hello friends, hope you all are fine and enjoying. Today I am going to share a very interesting tutorial which is Analysis of Sinusoidal Pulse Width Modulation of AC signal. I will try to explain this tutorial in parts. I will explain the code step by step and at every step we will see that what are the purpose of commands, which are written in that particular code. Before doing that first of all let me explain what is meant by Pulse Width Modulation.
Pulse Width Modulation or PWM is a technique which is used for getting Analog Results with digital means. We can say that some Digital Control or some Electronics algorithm is used to generate square waves. Square wave is in fact a signal which is generated through switching between ON & OFF states. There are no of ways to generate PWM. For example in modern electronics projects PWM is generated through some type of micro controllers or 555 Timers. If you recall my previous project tutorials, in which I have generated PWM through 555 timer. Since in this tutorial we are working with-in MATLAB premises so we will only discuss CODE and no hardware design involved in this tutorial. Now without wasting any time, I think we should move towards the CODE of the project. Stay tuned and believe me you will learn something new from this project.
You should also read:
Analysis of Sinusoidal Pulse Width Modulation of an AC Signal
-
First of all open your MATLAB software and a command window will appear. Now first thing to do is to clear the command window and remove all the previous variables or functions from MATLAB.
-
This is done through MATLAB language and we have commands to do this. The commands are given below:
clc
clear all
disp('Sinusoidal Pulse Width Modulation of AC Signal')
disp(' ')
- 'clc' and 'clear all' command will clear the command window and remove all the variables already existing.
- Then the next command is 'disp(' ')' , and this command is used to display anything in command window. In dispaly command i have written the title of my project, which is "Sinusoidal Pulse Width Modulation of AC Signal" .
- Now coming towards part 2, which is to enter some information from user side. Since we are analyzing the PWM of AC signal and we need to enter the data of that particular signal, which we are going to analyze.
- The code to do all this is given below:
Vrin=1;
f=input('The frequency of the input supply voltage, f = ');
Z=1;
ma=input('the modulation index,ma, (0<ma<1), ma = ');
phi=input('the phase angle of the load in degrees = ');
Q=input('The number of pulses per half period = ');
- The first command is 'Vrin' which is RMS value of the supply voltage in Per Unit. As you know that the maximum value of Per Unit is one, so i have kept its value equals to 1.
- In the next steps, you can see that i have given the 'input' command. This command is used at that place if we need data from external source, which means if user will enter that data according to the input signal.
- As you can see in the above code that Firstly it is asking frequency then comes the variable 'Z', which is load impedence in per-unit and we have kept its value 1.
- 'ma' is the modulation index and its value varies from 0 to 1.
- 'phi' is the phase angle of load in degrees.
- 'Q' is the no. of pulses per half period of the given cycle. MATLAB code will ask these values from user to enter them manually according to the that signal, which is under consideration.
- Coming towards the Third part of the CODE, which is to calculate load parameters. The parameters of the load signal which we have entered in the above commands (part 2).
- MATLAB Commands to calculate phase angle, Resistance and Inductance of the the load are given below:
phi=phi*pi/180;
R=Z*cos(phi);
L=(Z*sin(phi))/(2*pi*f);
- 'phi' is the load phase angle in degrees. while the other 'pi' is a built-in MATLAB function. In MATHEMATICS pi has a constatnt value which is '2.14' .
- Next 2 formulas the used to calculate Resistance(R) and Inductance(L) of the load respectively.
- Up till now we have entered the known values of the signal under examination. No in the next part of the tutorial, we are going to calculate the no of pulses per period of the sine wave or AC Signal under consideration.
- MATLAB command to calculate the period of an AC signal is given below:
N=2*Q;
- This is a simple product formula. 'Q' is the no of pulses per half period and when we will multiply it with 2, we get no of pulses in full period, which is 'N'.
- Period of an AC cycle can be defined as the time taken by the AC voltage to complete its one cycle. Period is reciprocal of Frequency. Frequency can be defined as the no of waves passing through a particular point in one second. Both these terms are necessary to explain AC signal.
- In the next part of the code, we are going to develop a function to generate a saw-tooth voltage from the given input parameters of the signal.
- In each period of the sawtooth, there is one increasing and decreasing part of the sawtooth, thus the period of the input supply is divided into into 2N sub-periods. The function to develop this sawtooth voltage is given below:
for k=1:2*N
for j=1:50
i=j+(k-1)*50;
wt(i)=i*pi/(N*50);
Vin(i)=sqrt(2)*Vrin*sin(wt(i));
ma1(i)=ma*abs(sin(wt(i)));
if rem(k,2)==0
Vt(i)=0.02*j;
if abs(Vt(i)-ma*abs(sin(wt(i))))<=0.011
m=j;
beta(fix(k/2)+1)=3.6*((k-1)*50+m)/N;
else
j=j;
end
else
Vt(i)=1-0.02*j;
if abs(Vt(i)-ma*abs(sin(wt(i))))ma*abs(sin(wt(i)))
Vout(i)=0;
else
Vout(i)=Vin(i);
end
end
end
beta(1)=[];
- The above part code seems to be bit lengthy but it is not that difficult to understand. Since in the previous part we have generated a saw-tooth voltage and we need to calculate its period.
- To calculate period, we have introduced some counters in our code named i,j and k. 'i' is the generalized counter.
- 'k' is the counter, used to count sub-periods and 'j' is the counter inside these sub-periods. From the beginning of the above part, we have defined a generalized counter, then we have calculated supply voltages through modulation of index.
Few MATLAB Projects:
- Then i have written a conditional loop consisting of 'if' and 'else' and we have generated a saw-tooth waveform from it.
- In the end, the final value of this saw-tooth voltage is saved in variable named 'beta'.
- Up-til now we have generated a saw-tooth voltage and we have calculated the beginning value (alpha) ,ending value (beta) and the period (width) of this saw-tooth voltage.
- Now in the next part we will write the command to display all these values of the saw-tooth voltage curve. Part of CODE is given below:
disp(' ')
disp('......................................................................')
disp('alpha beta width')
[alpha' beta' (beta-alpha)']
- In this step, we will simply display the values of the saw-tooth voltage, which we have generated in the above code.
- Now we will write a CODE to plot the graphs of the the voltage curve, we have generated above:
a=0;
subplot(3,1,1)
plot(wt,Vin,wt,a)
axis([0,2*pi,-2,2])
title('Generation Of The Output Voltage Pulses ')
ylabel('Vin(pu)');
subplot(3,1,2)
plot(wt,Vt,wt,ma1,wt,a)
axis([0,2*pi,-2,2])
ylabel('Vt, m(pu)');
subplot(3,1,3)
plot(wt,Vout,wt,a)
axis([0,2*pi,-2,2])
ylabel('Vo(pu)');
xlabel('Radian');
- The title of this graph is generation of output voltage pulses and it will plot the graphs.
- In next step, we will examine the output voltage curve. Its RMS value. HARMONIC components present in it and THRESHOLD value. CODE to examine all this is:
Vo =sqrt(1/(length(Vout))*sum(Vout.^2));
disp('The rms Value of the Output Voltage ')
Vo
y=fft(Vout);
y(1)=[];
x=abs(y);
x=(sqrt(2)/(length(Vout)))*x;
disp('The rms Value of the output voltage fundamental component = ')
x(1)
THDVo = sqrt(Vo^2 -x(1)^2)/x(1);
- The formulas to calculate all these parameters of output voltage curve are given in the above code.
- Uptil now, we have calculated all the parameters of output voltage curve and now i am going to calculate the current parameters of the output curve. The algorithm to calculate the output current wave-form is given below:
m=R/(2*pi*f*L);
DT=pi/(N*50);
C(1)=-10;
i=100*N+1:2000*N;
Vout(i)=Vout(i-100*N*fix(i/(100*N))+1);
for i=2:2000*N;
C(i)=C(i-1)*exp(-m*DT)+Vout(i-1)/R*(1-exp(-m*DT));
end
- Now we are going to calculate all the parameters of the current waveform, which we previously explained for the output voltage waveform. Now we are going to calculate the RMS value, Harmonic component and Threshold value of the output current. CODE to do all this is given below:
for j4=1:100*N
CO(j4)=C(j4+1900*N);
CO2= fft(CO);
CO2(1)=[];
COX=abs(CO2);
COX=(sqrt(2)/(100*N))*COX;
end
CORMS = sqrt(sum(CO.^2)/(length(CO)));
disp(' The RMS value of the load current is')
CORMS
THDIo = sqrt(CORMS^2-COX(1)^2)/COX(1);
- All the above data and results were to monitor output parameters.
- Now we are going to calculate the current parameters of input supply voltages.
- first of all, i will find the input supply current and then i will analyze this supply current. Find its RMS value, Find its Fourier series, its displacement factor and Threshold value of the input supply current. The CODE to perform all this work simultaneously is given below:
for j2=1900*N+1:2000*N
if Vout(j2)~=0
CS(j2)=C(j2);
else
CS(j2)=0;
end
end
for j3=1:100*N
CS1(j3)=CS(j3+1900*N);
end
CSRMS= sqrt(sum(CS1.^2)/(length(CS1)));
disp('The RMS value of the supply current is')
CSRMS
CS2= fft(CS1);
CS2(1)=[];
CSX=abs(CS2);
CSX=(sqrt(2)/(100*N))*CSX;
THDIS = sqrt(CSRMS^2-CSX(1)^2)/CSX(1);
phi1 = atan(real(CS2(1))/imag(CS2(1)))-pi/2;
PF=cos(phi1)*CSX(1)/CSRMS;
- Up till now we have calculated all the parameters and now we are going to draw a table in MATLAB and it will show all the results simultaneously.
- The combined code to display all the parameters on the output window is given below:
disp(' Performance parameters are')
THDVo
THDIo
THDIS
PF
a=0;
figure(2)
subplot(3,2,1)
plot(wt,Vout(1:100*N),wt,a);
title('');
axis([0,2*pi,-1.5,1.5]);
ylabel('Vo(pu)');
%
subplot(3,2,2)
plot(x(1:100))
title('');
axis([0,100,0,0.8]);
ylabel('Von(pu)');
subplot(3,2,3)
plot(wt,C(1900*N+1:2000*N),wt,a);
title('');
axis([0,2*pi,-1.5,1.5]);
ylabel('Io(pu)');
subplot(3,2,4)
plot(COX(1:100))
title('');
axis([0,100,0,0.8]);
ylabel('Ion(pu)');
subplot(3,2,5)
plot(wt,CS(1900*N+1:2000*N),wt,a);
axis([0,2*pi,-1.5,1.5]);
ylabel('Is(pu)');
xlabel('Radian');
subplot(3,2,6)
plot(CSX(1:100))
title('');
axis([0,100,0,0.8]);
ylabel('Isn(pu)');
xlabel('Harmonic Order');
- In the above code 2 commands are used in excess. First one is 'plot', which is used to plot any particular function in MATLAB and the second command is 'subplot' which is used to draw multiple plots like 2 or 3 plots in the same window.
- When you will write all this CODE and you will run it then, graphs will appear according to the data you entered to examine that particular signal.
RESULTS
- The graphical results of all the above tutorial will be displayed in this section. First of all, when you will run the M-file then command window will appear and it will ask you give some input values of the supply voltages.
- Such command window is shown in the image below:
- After inputing these values, the above given algorithm will start plotting the graphs, the firsst graph is shown in the below figure:
- Next plot is shown below, the graphs are labelled that's why I am not explaining them much.
- It will also give some other values in the MATLAB's command window, a screenshot of these values is as follows:
- Here's the complete programming code for this project:
clc
clear all
disp('Sinusoidal Pulse Width Modulation of AC Signal')
disp(' ')
Vrin=1;
f=input('The frequency of the input supply voltage, f = ');
Z=1;
ma=input('the modulation index,ma, (0<ma<1), ma = ');
phi=input('the phase angle of the load in degrees = ');
Q=input('The number of pulses per half period = ');
phi=phi*pi/180;
R=Z*cos(phi);
L=(Z*sin(phi))/(2*pi*f);
N=2*Q;
for k=1:2*N
for j=1:50
i=j+(k-1)*50;
wt(i)=i*pi/(N*50);
Vin(i)=sqrt(2)*Vrin*sin(wt(i));
ma1(i)=ma*abs(sin(wt(i)));
if rem(k,2)==0
Vt(i)=0.02*j;
if abs(Vt(i)-ma*abs(sin(wt(i))))<=0.011
m=j;
beta(fix(k/2)+1)=3.6*((k-1)*50+m)/N;
else
j=j;
end
else
Vt(i)=1-0.02*j;
if abs(Vt(i)-ma*abs(sin(wt(i))))<0.011
l=j;
alpha(fix(k/2)+1)=3.6*((k-1)*50+l)/N;
else
j=j;
end
end
if Vt(i)>ma*abs(sin(wt(i)))
Vout(i)=0;
else
Vout(i)=Vin(i);
end
end
end
beta(1)=[];
disp(' ')
disp('..........................................')
disp('alpha beta width')
[alpha' beta' (beta-alpha)']
a=0;
subplot(3,1,1)
plot(wt,Vin,wt,a)
axis([0,2*pi,-2,2])
title('Generation Of The Output Voltage Pulses ')
ylabel('Vin(pu)');
subplot(3,1,2)
plot(wt,Vt,wt,ma1,wt,a)
axis([0,2*pi,-2,2])
ylabel('Vt, m(pu)');
subplot(3,1,3)
plot(wt,Vout,wt,a)
axis([0,2*pi,-2,2])
ylabel('Vo(pu)');
xlabel('Radian');
Vo =sqrt(1/(length(Vout))*sum(Vout.^2));
disp('The rms Value of the Output Voltage ')
Vo
y=fft(Vout);
y(1)=[];
x=abs(y);
x=(sqrt(2)/(length(Vout)))*x;
disp('The rms Value of the output voltage fundamental component = ')
x(1)
THDVo = sqrt(Vo^2 -x(1)^2)/x(1);
m=R/(2*pi*f*L);
DT=pi/(N*50);
C(1)=-10;
i=100*N+1:2000*N;
Vout(i)=Vout(i-100*N*fix(i/(100*N))+1);
for i=2:2000*N;
C(i)=C(i-1)*exp(-m*DT)+Vout(i-1)/R*(1-exp(-m*DT));
end
for j4=1:100*N
CO(j4)=C(j4+1900*N);
CO2= fft(CO);
CO2(1)=[];
COX=abs(CO2);
COX=(sqrt(2)/(100*N))*COX;
end
CORMS = sqrt(sum(CO.^2)/(length(CO)));
disp(' The RMS value of the load current is')
CORMS
THDIo = sqrt(CORMS^2-COX(1)^2)/COX(1);
for j2=1900*N+1:2000*N
if Vout(j2)~=0
CS(j2)=C(j2);
else
CS(j2)=0;
end
end
for j3=1:100*N
CS1(j3)=CS(j3+1900*N);
end
CSRMS= sqrt(sum(CS1.^2)/(length(CS1)));
disp('The RMS value of the supply current is')
CSRMS
CS2= fft(CS1);
CS2(1)=[];
CSX=abs(CS2);
CSX=(sqrt(2)/(100*N))*CSX;
THDIS = sqrt(CSRMS^2-CSX(1)^2)/CSX(1);
phi1 = atan(real(CS2(1))/imag(CS2(1)))-pi/2;
PF=cos(phi1)*CSX(1)/CSRMS;
disp(' Performance parameters are')
THDVo
THDIo
THDIS
PF
a=0;
figure(2)
subplot(3,2,1)
plot(wt,Vout(1:100*N),wt,a);
title('');
axis([0,2*pi,-1.5,1.5]);
ylabel('Vo(pu)');
%
subplot(3,2,2)
plot(x(1:100))
title('');
axis([0,100,0,0.8]);
ylabel('Von(pu)');
subplot(3,2,3)
plot(wt,C(1900*N+1:2000*N),wt,a);
title('');
axis([0,2*pi,-1.5,1.5]);
ylabel('Io(pu)');
subplot(3,2,4)
plot(COX(1:100))
title('');
axis([0,100,0,0.8]);
ylabel('Ion(pu)');
subplot(3,2,5)
plot(wt,CS(1900*N+1:2000*N),wt,a);
axis([0,2*pi,-1.5,1.5]);
ylabel('Is(pu)');
xlabel('Radian');
subplot(3,2,6)
plot(CSX(1:100))
title('');
axis([0,100,0,0.8]);
ylabel('Isn(pu)');
xlabel('Harmonic Order');
That's all for today. I have tried my best to explain it in detail but still if you get into some trouble then ask in comments.
Fault Detection of Gas Turbine in MATLAB
Buy This Project
Hello friends, I hope you all are fine and enjoying. Today i am going to share a new project which is Fault Detection of Gas Turbine in MATLAB. In this project, i will try to elaborate that, What is a Gas Turbine? What are the operating parameters of a Gas Turbine? Mostly what type of Faults and Vibrations comes in Gas Turbine system during its operation? Gas Turbine is also called a Combustion Turbine. It has Four Basic components which includes Compressor, Combustion Chamber, Turbine and Alternator.
Generally compressor is installed upstream and the Rotating turbine is connected downstream and the Combustion Chamber is connected in between both of them and at the end of line we have Alternator which is also connected on the same shaft.Gas Turbine operates on "Brayton Cycle". Gas Turbine can be divided into 2 main sections, COLD Section and HOT Section, as shown in the above feature image. COLD Section includes Compressor and the HOT Section includes Turbine and and Exhaust portion. First of all, Compressor in-takes the Fresh atmospheric air and after compression it gets to high pressure, next comes the Combustion Chamber in which fuel is sprayed continuously and ignites the air so that combustion generates a High-Temperature Flow. In the next stage, this high temperature and high pressure gas enters into turbine and it releases its energy to turbine blades and the Turbine starts to rotate. A synchronous generator is also connected on the same shaft of the Turbine and when turbine gets to its rated rpm, then synchronous generator starts to generate electricity. Gas Turbines are of different Sizes and Ratings. The operation of Gas Turbine includes to monitor a large no of parameters. For example During the operation of Gas Turbine, a large no. of equipments are operating simultaneously and there are always chances of some fault occurrence and some abnormal vibrations. Although we also have a large no of primary and secondary protection equipments installed but we still need very careful monitoring of the system for its safe operation. Gas turbines are widely used in aircraft engines, trains, ships and coupled with electrical generators to generate electricity.
It was quite a tough job of design the Model of Gas Turbine in Simulink and it includes a lot of our team efforts, so we haven't made it a open source and we have placed a very small amount for this which is, 10$ only. You can click on the above button to purchase the complete control model of Gas Turbine in Simulink. Above was a small introduction about the basic components of Gas Turbine and their operation. Now lets move towards the designing of the Fault Detection of Gas Turbine in MATLAB.
You may also like to read:
Fault Detection of Gas Turbine in MATLAB
- In order to observe the Fault Detection of Gas Turbine in MATLAB, we are gonna use Simulink which is available in MATLAB.
- The complete Simulink model of Gas Turbine is shown in the image given below:
- First of all fresh air from atmosphere is entered into the system and and next to that we have a 'Reference Filter', which removes dust particles from air.
- Next to that, we have a Mu- Law compressor and to see the other properties of this compressor you will select that icon and then right click on it, a window will open and then you will click on option 'look under mask' .
- When you will click that option, a new window will open in Simulink and it will be representing the actual parameters of Mu-Law compressor.
- You can see that in the figure given below:
- The output of Mu-Law compressor comes to a summing junction and at this junction, we also have another input which is of Combustor Heat.
- The output of the summing junction goes to the combustor delay and exhaust delay.
- The output of combustor delay and the exhaust delay is connected to a scope.
- The purpose of scope is to see the actual output graphical parameters of the of the combustion delay and exhaust delay and we can also check some abnormalities through it.
- The output of combustor relay goes to Gas Turbine Dynamics. It is Gas Turbine built in function and it is used to observe the dynamic behavior of Gas Turbine. The Gas Turbines Dynamics control are shown in the image below:
- The output of Gas Turbine goes to 'Throttle and Manifold' control. This control is observing the air intake dynamics of the gas turbine.
- If you double click on it, then a new window will open which will be showing the embedded close loop system of 'Throttle and Manifold ' control, which can be easily seen in the image given below:
- First comes the throttle angle control of gas turbine. It has three inputs.
- First input is the Throttle angle 'Theta' and this angle is measured in 'degrees'.
- Second input is of the atmospheric pressure which is measured in 'bar', as you can see in the above image.
- Third input is of the 'Manifold Pressure' and it is also measured in bar.
- Manifold is actually the output of second control system which is also embedded in the same system.
- From above image, we see that on the next stage, output of 'Throttle Control' is actually the the input of 'Manifold Control' system and second input of manifold system is Engine Speed which is actually the speed of Gas Turbine and it is measured in rad/sec.
- The whole output of all the system is Air Charge. As i described earlier that when fresh atmospheric air is burned in the combustion chamber then High Temp and High Pressure Air charge is produced.
- Now this High Temp and High Pressure Air charge goes to the next control system which is 'Induction to power stroke Delay'. In order to observe the properties of this system, you simply double click on the function and a new window will open, which is shown in the image given below:
- As you can see in the above image, we have 2 inputs to this system. First one is Air charge and second one is running speed of the turbine.
- If you closely observe the image then, you will notice that we have place 2 inputs to control model named as 'Divide1'. It is actually a comparator and it is continuously comparing the actual running speed of the turbine and the constant reference value.
- Whenever speed will deviate from its reference value then error will be generated.
- Both these inputs goes to the next control box which is, 'variable time delay'. It continuously monitors the ratio of air charge flowing into the system and the corresponding turbine speed. For example, whenever the pressure or temp of the inlet steam will vary then, turbine speed will vary and this control model will generate an error, which will tell us that some abnormalities are going on in the system.
- Next comes the 'Engine Torque Control' . It has 2 inputs. First input is of the Air Charge and the second input is the speed of the Turbine. If you double click on this control model then, a new window will open representing its properties. That window is shown in the image below:
- Engine Torque is defined by 4 input parameters. First is Air charge and you can see that Air Charge input also goes to the Stoichiometric Fuel burning mechanism of combustion chamber. This is because the combustion chamber burns the fuel according to already existing temp and pressure of the charged air.
- If the temp of the air entering the combustion chamber is much low then, it will have to burn more fuel to get the proper temp and pressure of the air.
- Third input is of the 'Spark Advance'. It monitors that either spark plug is igniting the fuel with proper timing or not. If the spark plug doesn't ignite the fuel on exact time then, unburnt fuel particles will comes through exhaust hole. and engine will not run smoothly.
- Fourth input is of the speed of the turbine. Engine Torque control also monitors the existing speed of the turbine. and turbine is not running with the proper speed then, it will decide either it has to open more fuel to get it to proper speed or there is some issue going with spark ignition system.
- All these parameters define the Engine's torque and if there is any problem with any of the input then output torque will also vary accordingly.
- All these system's output goes to the Function Block Parameters and this block converts angular velocity to rpm. It is in fact a techogenerator.
- Techogenerator is in fact a sensor, which is mounted in the shaft of any rotating mechanism and it records the angular speed of the shaft and generates a electrical signal in form of RPMs. It continuously monitors the angular speed of the turbine and then it converts it to RPM.
- In the next stage, output of techogenerator goes to the summing junction. This junction has 2 inputs. First input is from techogenerator and the second input is from external disturbance.
- External Disturbance has a very important role in defining the safe operation of any system. It not only disturbs the system but in severe conditions, it can also collapse the system.
- In the next and final stage, we have a Gear Box model of the Gas turbine. If we double click on it then a new window will open, which will be representing its internal parameters. The internal detail of this control model is shown in the image given below:
- It is the most important control model of Gas Turbine. It has only one input which is rpm of turbine and this input is coming from techogenerator.
- As you can see in the above given image that, it monitors RPM, Vibrations, Over Vibrations, Dangerous Vibrations and Bearing factor errors.
- Now if you note from the above given image then you will see that RPM, we have connected a scope and the factors which needs continuous monitoring are over vibrations and Bearing Factor error.
- When we will run the simulation, the the system will monitor it completely from first stage to final stage (which is from inlet fresh air to RPM of Gas Turbine) . If any problem comes in the system then turbine speed will vary.
- Dear friends, the beauty of any project's simulation is that we can put abnormalities in our system and then, we can monitor the system's behaviour under these abnormalities. This thing helps in improvising new technology and also lead us to a better design of the system.
- Now in the above figure, we hava a control model named 'variation of the system'. when you will double click on that then, a third small window will open, which is shown in the image given below:
- If you look closely the option named "Constant value" then here we can change the vibrations inserted in the system. Here we change the value according to our own choice and we will start from 1 and then go to maximum value (12) and observe the behaviour of Gas Turbine.
- Now i am going to create some abnormalities on the above system's and we will see their results and then we will conclude either they are dangerous or not.
RESULTS
- We have seen the detailed explanation of "Fault Detection of Gas turbine in MATLAB" and I hope till now you got much familiar with how its operating. So now lets have a look at the results of this simulation.
- First of all, i am going to keep vibrations of the system at 1 then i will play the simulation then the Gear Box will generate the following results, as shown in the image below:
- Now we can see that as we have set the vibration value to 1 so there's no errors gennerated by the simulation. In other words, our gas turbine is running smoothly and is not generating any erros.
- Now i am going to increase the vibrations of the system and i am going to keep its value 10.Then the generated results are given as:
- From above figure, you have seen that System is generating over speeding error and Bearing Factor error but they are not Dangerous yet and system can also run under these conditions.
- In the next stage, i am going to increase the vibrations of systems a little more and i will make its value 12. Now we will observe the output of the system from the below figure:
- From above figure, we can easily see that i have increase the vibrations of the turbine upto that extend that it has generated the Dangerous alarm. Now we must immediately stop the system and if we didn't do that, then the system will collapse.
- Now i am going to share the graphs of the no. of Scopes we have added in our system.
- Output graph of "Scope # 1" is given in the figure below:
- Above graph is of scope#1 and it is representing the curves of 'Combustor Delay' and 'Exhaust Delay'.
- The output graph of the next scope, added in the system is given in the image below:
- The above figure is showing the curves of 2 different functions. First is Thermocouple Transfer Function and the next is of Temperature Reference.
- The output graph of the scope#2 is shown in the image below:
- In the above graph, we have 3 curves. Straight curve is of HEAT. Since turbine is running at normal temp and no over heating is produced in it.
- The green curve is of Combustion delay and Exhaust Delay. This is a very abrupt curve. To make it smooth,we have added another control model named as "Transfer Function 1". That's why the yellow curve is the final curve and it is rather smooth than the other two.
- Now in the end, i am going to share the output curve of scope#5, which is shown as below:
- The above graph is of the RPM of the turbine. As we can see that in the begining, when the simulation was OFF then, curve was at zero. Then we started the simulation and the infact turbine started and it started to accelerate and it gained it max speed which is 10,000 rpm within 10 seconds. which can be verified from above image.
Alright Friends, the above tutorial was a little bit lengthy but it was very interesting and have a large no of industrial applications. If you have any questions regarding above tutorial then, don't hesitate to ask and i will try my best to satisfy you. Follow us to get the whole simulations straight in your inbox. Till next tutorial Take Care !! :)