Main Content

Analyze a Simple Circuit

Introduction

In this section, you

  • Obtain the state-space representation of your model with thepower_analyzecommand

  • Compute the steady-state voltages and currents using the graphical user interface of thePowerguiblock

  • Analyze an electrical circuit in the frequency domain

Electrical State Variables

The electrical state variables are the Simulink®states of your diagram associated to the capacitor and inductor devices of theSimscape™ Electrical™Specialized Power Systems blocks. Inductors and capacitors elements are found in the RLC-branch type blocks such as theSeries RLC Branchblock,Three-Phase Parallel RLC Loadblock, in the transformer models, in thePI Section Lineblock, in the snubber devices of the power electronic devices, etc.

The electrical state variables consist of the inductor currents and the capacitor voltages. Variable names forSimscape ElectricalSpecialized Power Systems electrical states contain the name of the block where the inductor or capacitor is found, preceded by theIl_prefix for inductor currents or theUc_prefix for capacitor voltages.

State-Space Representation Using power_analyze

You compute the state-space representation of a model with thepower_analyzecommand. Enter the following command at the MATLAB®prompt.

[A,B,C,D,x0,electrical_states,inputs,outputs]=power_analyze('power_gui')

Thepower_analyzecommand returns the state-space model ofpower_guiexample model in the four matrices A, B, C, and D. x0 is the vector of initial conditions of the electrical states of your circuit. The names of the electrical state variables, inputs, and outputs are returned in three matrices.

See thepower_analyzereference page for more details on how to use this function.

Steady-State Analysis

Open the power_gui example model by typingpower_guiat the command line. Then open thePowergui Steady-State Voltages and Currents Toolto display the steady-state phasors voltages measured by the voltage measurement and current measurement blocks of the model.

每一个测量输出被生产er vector corresponding to the measurement block name. The magnitudes of the phasors correspond to the peak value of the sinusoidal voltages.

You can also display the steady-state values of the source voltage or the steady-state values of the inductor currents and capacitor voltages by selecting either theSourcesor theStatescheck box.

Refer to the sectionMeasuring Voltages and Currentsfor more details on the sign conventions used for the voltages and currents of sources and electrical state variables listed in theSteady-State Toolwindow.

Frequency Analysis

TheSimscape>Electrical>Specialized Power Systems>Sensors and Measurementslibrary contains anImpedance Measurementblock that measures the impedance between any two nodes of a circuit. In the following two sections, you measure the impedance in thepower_guimodel by using two methods:

Obtaining the Impedance vs. Frequency Relation from theImpedance MeasurementandPowerguiBlocks

The process to measure a circuit impedance from the state-space model (which is described in detail in the next section,Obtaining the Impedance vs. Frequency Relation from the State-Space Model) has been automated in aSimscape ElectricalSpecialized Power Systems block. In thepower_guiexample model, twoImpedance Measurementblocks of powerlib measure impedance at two points in the model. Delete the Impedance B3 block and reconnect the Impedance B1 as shown.

Measuring Impedance vs. Frequency with theImpedance MeasurementBlock

In the150 km Lineblock, setNumber of pi sectionsto 1, and clickOK. Open the Powergui dialog. In theToolstab, selectImpedance Measurement. A new window opens, showing the list ofImpedance Measurementblocks available in the circuit.

Fill in the frequency range by entering0:2:5000(zero to 5000 Hz by steps of 2 Hz). Select the logarithmic scale to display Z magnitude.

When the calculation is finished, the window displays the magnitude and phase as functions of frequency. In the150 km Lineblock dialog box, set theNumber of pi sections到10。在Powergui Impedance vs Frequency Measurement tool, click theUpdatebutton. The block dialog box displays the frequency response for the new circuit.

Obtaining the Impedance vs. Frequency Relation from the State-Space Model

Note

The following section assumes that you have Control System Toolbox™ software installed.

To measure the impedance versus frequency at the same node where theimpedance measurementblock is connected, you need a current source providing a second input to the state-space model. Add theAC Current Sourceblock from theSimscape>Electrical>Specialized Power Systems>Sourceslibrary to your model. Connect this source, as shown below. Set the current source magnitude to zero and keep its frequency at60 Hz.

AC Current Source at the B2 Node

Now compute the state-space representation of the model with thepower_analyzecommand. Enter the following command at the MATLAB prompt.

sys1 = power_analyze('power_gui','ss')

This command returns a state-space model representing the continuous-time state-space model of your electrical circuit.

In the Laplace domain, the impedance is defined as the transfer function between the current injected by theAC current Sourceblock and the voltage measured by the U2Voltage Measurementblock.

Z 2 ( s ) = U 2 ( s ) I 2 ( s )

You obtain the names of the inputs and outputs of this state-space model as follows.

sys1.InputName ans = 'U_Vs (60Hz)' 'I_AC Current Source' sys1.OutputName ans = 'U_Ub2' 'U_Ub1'

The impedance at the measured node then corresponds to the transfer function between output 1 and input 2 of this state-space model. For the 0–5000 Hz range, it can be calculated and displayed as follows.

freq=0:5000; w=2*pi*freq; bode(sys1(1,2),w);

Repeat the same process to get the frequency response with a 10 section line model. Open thePI Section Linedialog box and change the number of sections from1to10. To calculate the new frequency response and superimpose it upon the one obtained with a single line section, enter the following commands.

sys10 = power_analyze('power_gui','ss'); bode(sys1(1,2),sys10(1,2),w);

Open the property editor of the Bode plot and select units for Frequency in Hz using linear scale and Magnitude in absolute using log scale. The resulting plot is shown below.

Impedance at the Measured Node as Function of Frequency

This graph indicates that the frequency range represented by the single line section model is limited and the 10 line section model gives a better approximation for higher frequencies.