⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 swing4run.m

📁 关于电机的.m程序
💻 M
字号:
%swing4run.m script file associated with swing4.mdl
%when <RUN> is double clicked, the parameters are entered,
%the model is run, and the results plotted.
%Transient stability of a single machine with a step load

clc,clear,close all
disp(date)
info= ...
        ['      TRANSIENT STABILITY OF A SYNCHHRONOUS MACHINE       '
         'A synchronous machine connected to an infinite bus is     '
         'subjected to two consecutive step loads.                  '
         'A slight further increase in the load leads to instability'
         'and loss of synchronism.                                  '
         'The bus voltage (red) and internal machine voltage (blue) '
         'are portrayed in a synchronously rotating frame.          '
         '                                                          '];   
 disp(info)
echo on
V=1;           %infinite bus voltage [pu]
E=1.03;        %internal machine voltage [pu]
Pm=0.8;        %mechanical input [pu]
H=2.76;        %inertia constant [s] 
f=60;          %base frequency [Hz]
Xline=0.4;     %transfer reactance between E and V [pu]
Pm=1.0;        %Step load [pu]
t0=.1;
%
echo off
xo=[0 1]; %IC
delta=[];wm=[];Pe=[];
figure('Position',[180 60 680  570],'Name','Swing','numbertitle','off')
  sim('swing4',7,simset('InitialState',xo));
   delta=[delta angle];
   wm=[wm speed];
   Pe=[Pe power];
warning off
      aviswing=avifile('swingmovie0.avi','compression','cinepak');
 for k=1:length(t)
   compass(E*exp(j*delta(k)));hold on
   compass(V,0,'r')
   set(findobj(gca,'Type','line'),'LineWidth',4)
   text(-1.0,1.95,'SYNCHRONOUS MACHINE','FontSize',14,'FontWeight','bold','color','blue')
   text(-1.0,1.8,'CONNECTED TO AN INFINITE BUS','FontSize',12,'FontWeight','bold','color','blue')
   hold off
   text(1,-1.67,'Step Load:','FontSize',13,'FontWeight','bold','color','k')
   %text(-1,-1.7,q)
   if k<27,text(1,-1.85,'P = 0','FontSize',12,'FontWeight','bold','color','b')
   elseif k>=27 & k<67,text(1,-1.85,'P = 1.0','FontSize',12,'FontWeight','bold','color','b') 
   elseif k>=67 & k<108,text(1,-1.85,'P = 2.3','FontSize',12,'FontWeight','bold','color','b')    
   else
    text(1,-1.85,'P = 2.5','FontSize',12,'FontWeight','bold','color','r')
   end 
   set(gca,'Xlim',[-2.0 2.0],'Ylim',[-2.0 2.0],'visible','off')
   axis equal
  % hold off
   M(k)=getframe;
    f=getframe(gca);
      aviswing=addframe(aviswing,f);
  end   
  aviaswing=close(aviswing); 
  uicontrol('Units','normalized', ...
   'Style','PushButton',...
	'BackgroundColor',[.2 .3 .8], ...
	'Callback','movie(M,1)', ...
	'FontSize',10, ...
	'FontWeight','bold', ...
	'ForegroundColor',[1 1 1], ...
	'Position',[0.34 0.05 0.09 .06], ...
	'String','Repeat', ...
    'TooltipString','Repeat');
    uicontrol('Units','normalized', ...
   'Style','PushButton',...
	'BackgroundColor',[.2 .3 .8], ...
	'Callback','close,clear,close all', ...
	'FontSize',10, ...
	'FontWeight','bold', ...
	'ForegroundColor',[1 1 1], ...
	'Position',[0.63 0.05 0.09 .06], ...
	'String','Quit', ...
    'TooltipString','Quit');

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -