MATLAB Examples

Three-Phase Synchronous Machine Governor Control Design

This example script shows how you can linearize a Simscape™ Electrical™ model to support control system stability analysis and design. It uses example model pe_sm_governor_control_design.

An alternative and recommended way to linearize Simulink® and Simscape models is to use Simulink Control Design™. Simulink Control Design linearizes your model at operating points you specify. It also returns a state-space model object with state names. If you have Simulink Control Design available, open the model pe_sm_governor_control_design and from the toolbar select Analysis->Control Design->Linear Analysis. Then select Linearize At... from the Operating Point menu and set the simulation snapshot time to 4 seconds. Finally click the Bode icon on the toolstrip.


Open Model

Open the model.


Trim Model

Trim the model by running closed-loop and selecting the state at 4 seconds when generator is in steady-state.

assignin('base','ClosedLoop',1); % Close the speed-control feedback loop
[t,x,y] = sim('pe_sm_governor_control_design');
idx = find(t>4,1);
X = x(idx,:); U = y(idx);

Linearize Speed-Control Feedback Loop

Open the speed-control feedback loop, linearize the model, and close the speed-control feedback loop.

assignin('base','ClosedLoop',0); % Open the speed-control feedback loop
assignin('base','ClosedLoop',1); % Close the speed-control feedback loop

Bode Diagram

Plot the Bode diagram.

c = -c; d = -d; % Negative feedback convention
npts = 100; w = logspace(-3,5,npts); G = zeros(1,npts);
for i=1:npts
    G(i) = c*(1i*w(i)*eye(size(a))-a)^-1*b +d;
ax1 = subplot(2,1,1);
grid on
ylabel('Magnitude (dB)')
title('Bode diagram: speed-control feedback loop')
ax2 = subplot(2,1,2);
ylabel('Phase (degrees)')
xlabel('Frequency (rad/s)')
xlim(w([1 end]))
grid on