MATLAB Answers

making counter for partial discharge due to high voltage in solids

9 views (last 30 days)
Ali
Ali on 5 Dec 2014
Edited: Ali on 6 Dec 2014
I'm writing a program to calculate the number of discharges happen in solid material the user enter applied voltage and voltage at which the breakdown occur . By calculating the voltage on void and comparing it with inception voltage if they are equal, counter must increase one and the void voltage become zero and start rising again and so on.
if true
% code
end
er =5;
d=1.2*10^-2;
promot=('enter the peak voltage');
vm=input (promot);
promot=('enter the inception voltage');
vi=input (promot);
promot=('enter void thickness ');
s=input(promot);
t= 0 :.1:3.14;
va = vm *sin(2*t);
vc=((va*s)/(s+((d-s)/er)));
for t=0 :.1:3.14
if vc==vi
vc=0;
n=n+1;
else if vc==-vi
vc=0;
n=n+1;
end
end
end
disp(n);
this is the code but i can't make counter work or makes voltage on void rise again
need help please !

Accepted Answer

Henrik
Henrik on 6 Dec 2014
I see several things that could be the issue.
Try doing
clear all
Before you run your script. Then you'll notice that n is not defined.
Secondly, vc is a vector, so when you write
if vc==vi
you are comparing a vector to a scalar.
Another thing is that vc==vi will probably never be true. What you want, I assume, is
if vc>=vi
I am not entirely sure what you want: do you want to increase vc by the amount
((va*s)/(s+((d-s)/er)))
for every time step, resetting it to zero and increase n by one when it's equal to or greater than some threshold? If so, the code below should do that.
if true
% code
end
n=0;
er =5;
d=1.2*10^-2;
promot=('enter the peak voltage\n');
vm=input (promot);
promot=('enter the inception voltage\n');
vi=input (promot);
promot=('enter void thickness\n');
s=input(promot);
vc=0;
for t=0 :.1:3.14
va = vm *sin(2*t);
vc=vc+((va*s)/(s+((d-s)/er))); %increase vc by the amount ((va*s)/(s+((d-s)/er)))
if vc>=vi
vc=0;
n=n+1;
else if vc<=-vi
vc=0;
n=n+1;
end
end
end
disp(n);
  2 Comments
Ali
Ali on 6 Dec 2014
no , it wasn't intended to depend on time , put it to adjust the shape of sinusoidal wave of applied voltage that i wanted ..and thank you for the help .

Sign in to comment.

More Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by