The ThreePhaseExamples library, included in the product examples, contains simplified example models that you can use to write your own machine and transformer component files. The Synchronous Machine component in the ThreePhaseExamples library is similar to the Synchronous Machine Round Rotor block, but its equations have been simplified to omit zero-sequence dynamics. The Synchronous Machine block is therefore suitable for balanced operation only.
This example shows how you can further simplify the component file and make a custom machine block that does not account for the stator rate of change of flux.
In your working directory, create a folder called
+MyMachines. This folder will contain the source files for your customized machines.
To open the library of simplified component examples, at the MATLAB® command prompt, type:
Double-click the Synchronous Machine block.
In the block dialog box, click the Source code link.
The Simscape™ source file for this block opens in the MATLAB Editor.
Change the name of the component, the name of the block, and the block description by replacing these lines of the file:
component sm % Synchronous Machine :1.5 % Synchronous machine (SM) with a round rotor parameterized % using fundamental per-unit parameters. The defining equations are % simplified by omitting the zero-sequence dynamics: the model is suitable % for balanced operation. % The model contains effect of rate of change of magnetic flux linkages % on stator voltages, effect of speed variation on stator voltages, one % damper winding on the d-axis and two damper windings on the q-axis. % Copyright 2012-2018 The MathWorks, Inc.
component sm1 % Simplified Synchronous Machine % This synchronous machine does not include the stator d.psi/dt terms.
To remove the stator rate of change of flux terms, scroll down to the
equations section and modify the stator voltage equations from:
% Per unit stator voltage equations pu_ed == oneOverOmega*pu_psid.der - pu_psiq*pu_velocity - Ra*pu_id; pu_eq == oneOverOmega*pu_psiq.der + pu_psid*pu_velocity - Ra*pu_iq;
% Per unit stator voltage equations pu_ed == -pu_psiq*pu_velocity - Ra*pu_id; pu_eq == pu_psid*pu_velocity - Ra*pu_iq;
Save the file in the
+MyMachines folder as
sm1.ssc. The name of the Simscape file must match the component name.
To generate the custom library containing the new block, at the MATLAB command prompt, type:
This command generates the
MyMachines_lib library model in your working directory.
To open the custom library, at the MATLAB command prompt, type:
The library contains the Simplified Synchronous Machine block, which you can now use in your models.