making counter for partial discharge due to high voltage in solids

조회 수: 4 (최근 30일)
Ali
Ali 2014년 12월 5일
편집: Ali 2014년 12월 6일
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 !

채택된 답변

Henrik
Henrik 2014년 12월 6일
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
Henrik
Henrik 2014년 12월 6일
One issue I see with your calculations is that they depend on the time-step, I don't think that's intended?
Ali
Ali 2014년 12월 6일
편집: Ali 2014년 12월 6일
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 .

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 MATLAB에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by