現在この質問をフォロー中です
- フォローしているコンテンツ フィードに更新が表示されます。
- コミュニケーション基本設定に応じて電子メールを受け取ることができます。
Undefined function 'ShortLine' for input arguments of type 'double'.
1 回表示 (過去 30 日間)
古いコメントを表示
%***- - - - - Main Program
function test()
TransmissionLineData;
[ZSeries,YShunt] = ShortLine(nphc,ngw,nb,bsep,resis,rdext,gmr,x,y,f, sigmag,vbase,sbase)
[Z012,Y012] = SequenceImpedance(ZSeries,YShunt);
%End main Program
function [Z012,Y012] = SequenceImpedance(ZSeries,YShunt)
TS(1,1) = 1;
TS(1,2) = 1;
TS(1,3) = 1;
TS(2,1) = 1;
TS(2,2) = -0.5-sqrt(3)*0.5*i;
TS(2,3) = -0.5+sqrt(3)*0.5*i;
TS(3,1) = 1;
TS(3,2) = -0.5+sqrt(3)*0.5*i;
TS(3,3) = -0.5-sqrt(3)*0.5*i;
ST = inv(TS);
Z012 = ST*ZSeries*TS;
Y012 = ST*YShunt*TS;
12 件のコメント
Geoff Hayes
2017 年 12 月 15 日
Mohd - is ShortLine a function that you have written or have downloaded from somewhere? The error suggests that MATLAB can't find that function or you are not providing the correct input parameters.
In the command window type
which ShortLine
The above will return the full path for the function if it can be found. If it can't be found, then try adding it (or rather the folder that it is in) to your MATLAB search path. See https://www.mathworks.com/help/matlab/matlab_env/what-is-the-matlab-search-path.html for details.
Adam
2017 年 12 月 15 日
Please format your code, it is almost impossible to work out what is on each line and what is in a comment.
MOHD ABDUL MUQEEM
2017 年 12 月 15 日
編集済み: Walter Roberson
2017 年 12 月 15 日
%transmission line.
%
%nphc = number of phase conductors
%ngw = number of ground wires
%
nphc = 3 ; ngw = 0 ;
%
%Individual Conductors Data
%resis = resistance in ohms per meter
%rdext = external radius in meters
%gmr = geometrical mean radius in meters
%nb = number of bundle conductors per phase -1 to 4
%bsep = separation between conductors in the bundle in meters
%x,y = conductor’s co-ordinates in the tower in meters
%
resis(1) = 0.1379/1000 ; rdext(1) = 1.049/100 ; gmr(1) = 0.817/100 ;
nb(1) = 4 ; bsep(1) = 0.46 ; x(1) = 12.65 ; y(1) = 27.50 ;
resis(2) = 0.1379/1000 ; rdext(2) = 1.049/100 ; gmr(2) = 0.817/100 ;
nb(2) = 4 ; bsep(2) = 0.46 ; x(2) = 0 ; y(2) = 27.50 ;
resis(3) = 0.1379/1000 ; rdext(3) = 1.049/100 ; gmr(3) = 0.817/100 ;
nb(3) = 4 ; bsep(3) = 0.46 ; x(3) = -12.65 ; y(3) = 27.50 ;
%
%General Data
%f = frequency
%sigmag = ground’s conductivity
%vbase = base voltage
%sbase = base power
%
f = 50 ; sigmag = 0.01 ; vbase = 500 ; sbase = 100 ;
%
%End of function TransmissionLineData
MOHD ABDUL MUQEEM
2017 年 12 月 15 日
編集済み: Walter Roberson
2017 年 12 月 15 日
%transmission line of Example 1, to include long-line effects and passive
%shunt and series compensation. The line is 500 km long and contains no
%compensation.
%
%Transmission Line Data
%
%nsections = number of sections in the transmission line
%length = total length of transmission line
%
nsections = 1 ;
length(1) = 500 ;
%
%Compensating Plant Data
%
ZSe(:,:,1) = [ 0 0 0 ; 0 0 0 ; 0 0 0 ] ;
YSh(:,:,1) = [ 0 0 0 ; 0 0 0 ; 0 0 0 ] ;
%
%End of function LongLineData
MOHD ABDUL MUQEEM
2017 年 12 月 15 日
編集済み: Walter Roberson
2017 年 12 月 15 日
%***- - - - - Main Program
function test()
TransmissionLineData;
[ZSeries,YShunt] = ShortLine(nphc,ngw,nb,bsep,resis,rdext,gmr,...
x,y,f, sigmag,vbase,sbase)
%End main Program
function [ZSeries,YShunt] = ShortLine(nphc,ngw,nb,bsep,...
resis,rdext,gmr,x, y,f,sigmag,vbase,sbase)
[RAD,GMR,RES] = BundleReduction(nphc,ngw,nb,bsep,rdext,gmr,resis);
[YShunt] = PotCoeff(nphc,RAD,x,y,f);
[ZSeries] = Dubanton(nphc,ngw,GMR,RES,x,y,f,sigmag);
[ZSeries] = GroundWireReduction(nphc,ngw,ZSeries);
[ZSeries,YShunt] = PerUnit(nphc,ZSeries,YShunt,vbase,sbase);
function [RAD,GMR,RES] = BundleReduction(nphc,ngw,nb,bsep,rdext,...
gmr,resis);
for ii = 1: nphc + ngw
if nb(ii) == 1
RAD(ii) = rdext(ii);
GMR(ii) = gmr(ii);
elseif nb(ii) == 2
RAD(ii) = sqrt(rdext(ii)*bsep(ii));
GMR(ii) = sqrt(gmr(ii)*bsep(ii));
elseif nb(ii) == 3
RAD(ii) = exp(log(rdext(ii)*bsep(ii)*bsep(ii))/3);
GMR(ii) = exp(log(gmr(ii)*bsep(ii)*bsep(ii))/3);
elseif nb(ii) == 4
RAD(ii) = sqrt(sqrt(rdext(ii)*bsep(ii)*bsep(ii)*bsep(ii)...
*sqrt (2)));
GMR(ii) = sqrt(sqrt(gmr(ii)*bsep(ii)*bsep(ii)*bsep(ii)*sqrt(2)));
end
RES(ii) = resis(ii)/nb(ii);
end
function [YShunt] = PotCoeff(nphc,RAD,x,y,f);
[YShunt] = zeros(nphc,nphc);
omega = 2*pi*f;
eps = 8.854*1e-9;
for ii = 1: nphc
for jj = 1: nphc
if ( ii == jj )
YShunt(ii,ii)=log(2*y(ii)/RAD(ii));
else
YShunt(ii,jj) = log( sqrt ( ( x(ii) - x(jj) )^2 + ...
( y(ii) + y(jj) )^2 ) / sqrt ( ( x(ii) - x(jj) )^2 + ...
( y(ii)-y(jj) )^2 ) );
end
end
end
YShunt = i*2*pi*omega*eps*inv(YShunt);
function [ZSeries] = Dubanton(nphc,ngw,GMR,RES,x,y,f,sigmag)
[ZSeries] = zeros(nphc+ngw,nphc+ngw);
mnu = 4*pi*1e-7;
omega = (0+(2*pi*f)*i);
pe = 1/sqrt(omega*mnu*sigmag);
for ii = 1: nphc + ngw
for jj = 1: nphc + ngw
if( ii == jj )
ZSeries(ii,ii) = 1000*( RES(ii) + omega*mnu*...
log((y(ii)+y(jj)+2*pe)/GMR(ii))/(2*pi) );
else
ZSeries(ii,jj) = 1000*omega*mnu*...
log( sqrt((x(ii)-x(jj))^2+(y(ii)+y(jj)+2*pe)^2) /...
sqrt((x(ii)-x(jj))^2+(y(ii)-y(jj))^2 ) )/(2*pi);
end
end
end
function [ZSeries] = GroundWireReduction(nphc,ngw,ZSeries)
for ii = nphc + 1: nphc + ngw
ZSeries(ii,ii) = 1/ZSeries(ii,ii);
for jj = 1: nphc + ngw
if( ii ~= jj )
ZSeries(jj,ii) = ZSeries(jj,ii)*ZSeries(ii,ii);
for kk = 1: nphc + ngw
if( kk ~= ii )
ZSeries(jj,kk) = ZSeries(jj,kk) -ZSeries(jj,ii)*...
ZSeries(ii,kk);
if ( jj == nphc + ngw)
ZSeries(ii,kk) = -ZSeries(ii,ii)*ZSeries(ii,kk);
end
end
end
end
end
end
if ngw > 0
for jj = 1: nphc + ngw -1
ZSeries(nphc+ngw,jj) = -ZSeries(nphc+ngw,nphc+ngw)*...
ZSeries(nphc+ngw,jj)
end
ZSeries = ZSeries(1:nphc,1:nphc);
end
function [ZSeries,YShunt] = PerUnit(nphc,ZSeries,YShunt,vbase,sbase)
zbase = vbase*vbase/sbase;
for ii = 1: nphc
for jj = 1: nphc
ZSeries(ii,jj) = ZSeries(ii,jj)/zbase;
YShunt(ii,jj) = YShunt(ii,jj)*zbase;
end
end
MOHD ABDUL MUQEEM
2017 年 12 月 15 日
編集済み: Walter Roberson
2017 年 12 月 15 日
%***- - - - - Main Program
function test()
TransmissionLineData;
[ZSeries,YShunt] = ShortLine(nphc,ngw,nb,bsep,resis,rdext,gmr,...
x,y,f, sigmag,vbase,sbase)
[Z012,Y012] = SequenceImpedance(ZSeries,YShunt);
%End main Program
function [Z012,Y012] = SequenceImpedance(ZSeries,YShunt)
TS(1,1) = 1;
TS(1,2) = 1;
TS(1,3) = 1;
TS(2,1) = 1;
TS(2,2) = -0.5-sqrt(3)*0.5*i;
TS(2,3) = -0.5+sqrt(3)*0.5*i;
TS(3,1) = 1;
TS(3,2) = -0.5+sqrt(3)*0.5*i;
TS(3,3) = -0.5-sqrt(3)*0.5*i;
ST = inv(TS);
Z012 = ST*ZSeries*TS;
Y012 = ST*YShunt*TS;
MOHD ABDUL MUQEEM
2017 年 12 月 15 日
編集済み: Walter Roberson
2017 年 12 月 15 日
%***- - - - - Main Program
function test()
TransmissionLineData;
LongLineData;
[ZSeries,YShunt,Z012,Y012] = ShortLine(nphc,ngw,nb,bsep,resis,...
rdext,gmr,x,y,f,sigmag,vbase,sbase);
[ZPhase,YPhase] = LongLine(nphc,nsections,length,ZSeries,YShunt,...
ZSe,Ysh);
%End main Program
function [ZPhase,YPhase] = LongLine(nphc,nsect,length,ZSeries,...
YShunt,ZSe,YSh)
AUX = eye(nphc*2);
[TV,ZY] = eig(ZSeries*YShunt);
[TI,YZ] = eig(YShunt*ZSeries);
ZModal = inv(TV)*ZSeries*TI;
YModal = inv(TI)*YShunt*TV;
kk = 1;
for ll = 1: nsect
if ( length(ll) > 0 )
[ABCD] = ABCDLine(ll,nphc,length,ZModal,YModal,TV,TI);
else
[ABCD] = ABCDComp(kk,nphc,ZSe,YSh);
kk = kk + 1;
end
AUX = AUX*ABCD;
end
ABCD = AUX;
A = ABCD(1:nphc,1:nphc);
B = ABCD(1:nphc,nphc+1:nphc*2);
C = ABCD(nphc+1:nphc*2,1:nphc);
D = ABCD(nphc+1:nphc*2,nphc+1:nphc*2);
ZPhase(1:nphc,1:nphc) = A*inv(C);
ZPhase(1:nphc,nphc+1:nphc*2) = -B + A*inv(C)*D;
ZPhase(nphc+1:nphc*2,1:nphc) = inv(C);
ZPhase(nphc+1:nphc*2,nphc+1:nphc*2) = inv(C)*D;
YPhase = inv(ZPhase);
%End LongLine function
function [ABCD] = ABCDLine(ll,nphc,length,ZModal,YModal,TV,TI);
Modal = zeros(nphc,nphc);
for ii = 1: nphc
gamma = sqrt(ZModal(ii,ii)*YModal(ii,ii));
gammar = real(gamma*length(ll));
gammai = imag(gamma*length(ll));
fact1 = sinh(gammar);
fact2 = cosh(gammar);
fact3 = sin(gammai);
fact4 = cos(gammai);
Modal(ii,ii) = ((fact2*fact4)+(fact1*fact3)*i);
end
ABCD(1:nphc,1:nphc) = TV*Modal*inv(TV);
for ii = 1: nphc
gamma = sqrt(ZModal(ii,ii)*YModal(ii,ii));
gammar = real(gamma*length(ll));
gammai = imag(gamma*length(ll));
fact1 = sinh(gammar);
fact2 = cosh(gammar);
fact3 = sin(gammai);
fact4 = cos(gammai);
Modal(ii,ii) = sqrt(ZModal(ii,ii)/YModal(ii,ii))*...
(fact1*fact4+fact2*fact3*i);
end
ABCD(1:nphc,nphc+1:nphc*2) = TV*Modal*inv(TI);
for ii = 1: nphc
gamma = sqrt(ZModal(ii,ii)*YModal(ii,ii));
gammar = real(gamma*length(ll));
gammai = imag(gamma*length(ll));
fact1 = sinh(gammar);
fact2 = cosh(gammar);
fact3 = sin(gammai);
fact4 = cos(gammai);
Modal(ii,ii) = sqrt(YModal(ii,ii)/ZModal(ii,ii))*...
(fact1*fact4+fact2*fact3*i);
end
ABCD(nphc+1:nphc*2,1:nphc) = TI*Modal*inv(TV);
for ii = 1: nphc
gamma = sqrt(ZModal(ii,ii)*YModal(ii,ii));
gammar = real(gamma*length(ll));
gammai = imag(gamma*length(ll));
fact1 = sinh(gammar);
fact2 = cosh(gammar);
fact3 = sin(gammai);
fact4 = cos(gammai);
Modal(ii,ii) = (fact2*fact4+fact1*fact3*i);
end
ABCD(nphc+1:nphc*2,nphc+1:nphc*2) = TI*Modal*inv(TI);
%End ABCDLine function
function [ABCD] = ABCDComp(kk,nphc,ZSe,YSh)
One = eye(nphc) ;
ABCD(1:nphc,1:nphc) = One ;
ABCD(1:nphc,nphc+1:nphc*2) = ZSe(:,:,kk) ;
ABCD(nphc+1:nphc*2,1:nphc) = YSh(:,:,kk) ;
ABCD(nphc+1:nphc*2,nphc+1:nphc*2) = YSh(:,:,kk)*ZSe(:,:,kk) + One ;
%End ABCDComp function
Walter Roberson
2017 年 12 月 15 日
I am confused. You have posted several different function test(), only one of which defines function ShortLine . I do not know which one is the correct version.
If you define a function inside a .m but not as the first function in the file, then that second function cannot be called from outside the .m (unless you pass out a handle to it.)
回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Tables についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!エラーが発生しました
ページに変更が加えられたため、アクションを完了できません。ページを再度読み込み、更新された状態を確認してください。
Web サイトの選択
Web サイトを選択すると、翻訳されたコンテンツにアクセスし、地域のイベントやサービスを確認できます。現在の位置情報に基づき、次のサイトの選択を推奨します:
また、以下のリストから Web サイトを選択することもできます。
最適なサイトパフォーマンスの取得方法
中国のサイト (中国語または英語) を選択することで、最適なサイトパフォーマンスが得られます。その他の国の MathWorks のサイトは、お客様の地域からのアクセスが最適化されていません。
南北アメリカ
- América Latina (Español)
- Canada (English)
- United States (English)
ヨーロッパ
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
アジア太平洋地域
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)