making counter for partial discharge due to high voltage in solids
1 回表示 (過去 30 日間)
古いコメントを表示
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 !
0 件のコメント
採用された回答
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
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?
その他の回答 (0 件)
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!