making counter for partial discharge due to high voltage in solids
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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 commentaires
Réponse acceptée
Henrik
le 6 Déc 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 commentaires
Henrik
le 6 Déc 2014
One issue I see with your calculations is that they depend on the time-step, I don't think that's intended?
Plus de réponses (0)
Voir également
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!