I am not able to debug my script as follows

33 visualizzazioni (ultimi 30 giorni)
William
William il 2 Nov 2024 alle 2:44
Risposto: Walter Roberson il 2 Nov 2024 alle 6:01
%%Prefault System;
Pb=25e3;
%Transfer Reactance
X=1i*0.3+(1i*0.2/2);
%Defining Values;
E=1.03;
V=1.0;
%Max Power
Pmax=(abs(E)*abs(V))/abs(X);
%Electrical Power;
deliveredP=20e3;
Pele = deliveredP/Pb;
%Initial Load Angle;
Delta0=asin(Pele/Pmax);
Delta0deg=rad2deg(Delta0);
%%System under fault
%Finding delta of fault.
X2=1i*0.3+1i*0.2+((1i*0.4*1i*0.2)/1i*0.1);
DelFault=asin(Pele*X2/E*V);
%%Post Fault System
%Finding transfer reactance
XT=1i*0.3+1i*0.2;
%Finding the delta post fault.
DelPFault=asin(Pele*XT/E*V);
%Calculation of the swing curve
%Kineitic Energy
H=2.56;
freq=60;
M=H/(150*freq);
%Interval time
IT=0.1;
%defining the constant
C=(IT^2)/M;
%Delta of the swing bus
DeltaSW=0;
radDeltaSW=deg2rad(DeltaSW);
%%Calculating the swing curve
%Accelerating power at the beginning of the time interval
Pa1=0;
Pa2=Pmax-0.935*sin(DelFault);
%Aver accelerating power
PaAVE1=(Pa1+Pa2)/2;
%calculating change in the load angle in the time interval;
cPaAVE1=C*PaAVE;
Unrecognized function or variable 'PaAVE'.
changeDel1=radDeltaSW+cPaAVE;
%Delta and acc power at the beginning(0.1)
Delta1=Delta0+changeDel1;
Pa3=Pmax-0.935*sin(Delta1);
PaAVE2=(Pa2+Pa3)/2;
cPaAVE1=C*cPaAVE;
changeDel2=changeDel1+cPaAVE1;
%0.2sec
Delta2=Delta0+changeDel2;
Pa4=Pmax-0.935*sin(Delta2);
PaAVE3=(Pa3+Pa4)/2;
cPaAVE2=C*cPaAVE1;
changeDel3=changeDel2+cPaAVE2;
%0.3sec
Delta3=Delta1+changeDel3;
Pa5=Pmax-0.935*sin(Delta3);
PaAVE4=(Pa3+Pa4)/2;
cPaAVE4=C*cPaAVE2;
changeDel4=changeDel3+cPaAVE3;
%0.4sec
Delta4=Delta3+changeDel4;
Pa1=Pmax-0.935*sin(Delta4);
Pa2=Pmax-2.06*sin(Delta4);
PaAVE5=(Pa1+Pa2)/2;
cPaAVE5=C*PaAVE5;
changeDel5=changeDel4+cPaAVE4;
%0.5sec
Delta5=Delta4+changeDel5;
Pa5=Pmax-2.06*sin(Delta5);
PaAVE6=(Pa4+Pa5)/2;
cPaAVE5=C*PaAVE5;
changeDel6=changeDel5+cPaAVE5;
%0.6sec
Delta6=Delta4+changeDel5;
Pa6=Pmax-2.06*sin(Delta4);
PaAVE6=(Pa5+Pa6)/2;
cPaAVE6=C*PaAVE6;
changeDel6=changeDel5+cPaAVE5;
%0.7sec
Delta7=Delta5+changeDel6;
Pa7=Pmax-2.06*sin(Delta7);
PaAVE7=(Pa6+Pa7)/2;
cPaAVE7=C*PaAVE6;
changeDel7=changeDel6+cPaAVE7;
%0.8sec
Delta8=Delta5+changeDel6;
Pa8=Pmax-2.06*sin(Delta8);
PaAVE8=(Pa7+Pa8)/2;
cPaAVE8=C*PaAVE8;
changeDel8=changeDel7+cPaAVE7;
%0.9sec
Delta9=Delta6+changeDel7;
Pa9=Pmax-2.06*sin(Delta9);
PaAVE9=(Pa8+Pa9)/2;
cPaAVE9=C*PaAVE9;
changeDel9=changeDel8+cPaAVE8;
%1.0sec
Delta10=Delta7+changeDel8;

Risposta accettata

Walter Roberson
Walter Roberson il 2 Nov 2024 alle 6:01
PaAVE1=(Pa1+Pa2)/2;
You assign to PaAVE1 but you do not use PaAVE1 afterwards
cPaAVE1=C*PaAVE;
No variable PaAVE is defined.
You do not use cPaAVE1 before it is overwritten.
changeDel1=radDeltaSW+cPaAVE;
No variable cPaAVE is defined.
PaAVE2=(Pa2+Pa3)/2;
cPaAVE1=C*cPaAVE;
You overwrite cPaAVE1. My guess is that you want to write to cPaAVE2 and use that variable in the following code.

Più risposte (0)

Tag

Prodotti


Release

R2024b

Community Treasure Hunt

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

Start Hunting!

Translated by