%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % synphas.m - plots phasors for a synchronous generator and % equivalent grid prior to synchronization to % assess voltage across contactors to be closed. % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% clear; fdiff=input(' Frequency difference small?( Y or N ) ','s'); mdiff=input(' Voltage magnitude different?( Y or N ) ','s'); pdiff=input(' Phase sequence different?( Y or N ) ','s'); if fdiff == 'Y'; n=100; else; n=15; end; % Set angle increment if mdiff == 'Y'; m=0.5; else; m=1; end % Set magnitudes if pdiff == 'Y'; k=-1; else; k=1; end % Set phase sequence % 123. - Grid, abc* - oncoming alternator theta=linspace(0,2*pi,n);A1=0; A2=-2*pi/3; A3=2*pi/3; for i=1:n; pause(0.0001) Aa=theta(i); Ab=Aa-k*2*pi/3; Ac=Aa+k*2*pi/3; polar(0,1.25); hold on % Configurable phasors of the alternator - asterisks at the tip polar([0 Aa],[0 m],'r'); polar(Aa,m,'*'); % Red polar([0 Ab],[0 m],'y-.'); polar(Ab,m,'*'); % Yellow polar([0 Ac],[0 m],'b--'); polar(Ac,m,'*'); % Blue % Fixed phasors of the grid - dots at the tip polar([0 A1],[0 1],'r'); polar(A1,1,'.'); % Red polar([0 A2],[0 1],'y-.'); polar(A2,1,'.'); % Yellow polar([0 A3],[0 1],'b--'); polar(A3,1,'.'); % Blue % Contactor voltages indicated by dotted green lines polar([A1 Aa],[1 m],'g:'); polar([A2 Ab],[1 m],'g:'); polar([A3 Ac],[1 m],'g:'); hold off end text(1.1,0.1,'V1'); text(-0.7,-1,'V2'); text(-0.7,1,'V3'); name=['Phasor diagrams for synchronizing alternator'; ' '; ' ']; title(name);