power_analyze

Analyze electric circuit

Syntax

sps = power_analyze('sys','structure')
[A,B,C,D,x0,states,inputs,outputs,uss,xss,yss,frequencies,Hlin] =...
power_analyze('sys')
sps = power_analyze('sys','sort')
sps = power_analyze('sys','ss')
power_analyze('sys','net')
SW = power_analyze('sys','getSwitchStatus')
sps = power_analyze('sys','setSwitchStatus',SW)

Description

The power_analyze command computes the equivalent state-space model of the specified electrical model built with Simscape™ Electrical™ Specialized Power Systems software. It evaluates the A, B, C, D standard matrices of the state-space system described by the equations

$\begin{array}{l}\stackrel{˙}{x}=Ax+Bu\\ y=Cx+Du\end{array}$

where the state vector x represents the inductor currents and capacitor voltages, the input vector u represents the voltage and current sources, and the output vector y represents the voltage and current measurements of the model.

Nonlinear elements, such as the switch devices, motors and machines, are simulated by current sources driven by the voltages across the nonlinear element terminals. The nonlinear elements produces additional current source inputs to the u vector, and additional voltage measurements outputs to the y vector.

The Simulink® blocks of the model, as well as internal Simulink models of the Simscape Electrical Specialized Power Systems nonlinear elements are not represented in the state-space matrices.

State-Space Matrices

The A, B, C, D matrices are computed for the particular circuit topology where all the switch devices, if any, are considered to be open status (that is, with infinite impedance).

power_analyze also computes the Aswitch, Bswitch, Cswitch, and Dswitch matrices for the circuit topology that take into account the initial state (open/closed) of the Breaker and Ideal Switch blocks present in the model. The initial state of power electronic devices (Diodes, Thyristors, and so on) is considered to be open, unless a nonzero initial current value is specified in the mask of the device when Lon parameter is different from zero.

For a circuit that contains no switches, the Aswitch, Bswitch, Cswitch, and Dswitch matrices have exactly the same values as the A, B, C, D matrices.

States

In Simscape Electrical Specialized Power Systems software, each state variable name begins with a prefix Uc_ for capacitor voltages or Il_ for inductor currents, followed by the name of the block in which the element (C or L) is found.

A character vector is added to this prefix for blocks containing more than one inductance or capacitor. For example, the Linear Transformer block is represented with four state variables, one for each of the three leakage inductances, defined with the prefixes Il_winding_x:, where x is the winding number of the transformer, and one state for the magnetization inductance defined with the prefix Il_Lm:.

Inputs

Each input state variable name begins with a prefix U_ for voltage sources or I_ for current sources, followed by the name of the source block. Text can be added to the prefix for blocks containing more than one source. For example, the Synchronous Machine block produces two current inputs with prefixes I_A: and I_B: (phase A and phase B machine currents).

Outputs

Each output state variable name begins with a prefix U_ for voltage outputs or I_ for current outputs, followed by the name of the block that produces the output. Text can be added to the prefix for blocks containing more than one output. For example, the Synchronous Machine block produces two voltage outputs with prefixes U_AB: and U_BC: (two machine phase-to-phase voltages).

Sign Conventions

The following conventions are used for inputs:

• Source current flowing in the arrow direction is positive.

• Positive source voltage is indicated by a + sign on the icon.

The sign conventions used for voltages and currents of state variables and measurement outputs are described in Measuring Voltages and Currents.

Output Arguments: Structure

sps = power_analyze('sys','structure') creates a structure array sps with fields and values describing the model sys.

The fields of the structure array are defined in the following order.

Field

Description

circuit

Name of the model

states

char array of state variable names

inputs

char array of system input names

outputs

char array of system output names

A

nstates-by-nstates state-space A matrix

B

nstates-by-ninput state-space B matrix

C

noutput-by-nstates state-space C matrix

D

noutput-by-ninput state-space D matrix

x0

nstates-by-1 vector of initial conditions of the state variables listed in states

xss

nstates-by-nfreq steady-state values of states. A set of values is computed for every frequency specified in the frequencies vector.

uss

ninput-by-nfreq steady-state values of inputs. A set of values is computed for every frequency specified in the frequencies vector.

yss

noutput-by-nfreq steady-state values of outputs. A set of values is computed for every frequency specified in the frequencies vector.

frequencies

1-by-nfreq vector of input source frequencies ordered by increasing values

DependentStates

char array of dependent state variable names. The dependent states are not included in the state-space equations.

x0DependentStates

Vector of initial conditions of dependent states

xssDependentStates

nstates-by-nfreq steady-state values of dependent states

Discrete state-space A matrix. Returns an empty value when the Powergui is in continuous or in phasor mode.

Bdiscrete

Discrete state-space B matrix. Returns an empty value when the Powergui is in continuous or in phasor mode.

Cdiscrete

Discrete state-space C matrix. Returns an empty value when the Powergui is in continuous or in phasor mode.

Ddiscrete

Discrete state-space D matrix. Returns an empty value when the Powergui is in continuous or in phasor mode.

x0discrete

Vector of discrete initial conditions. Returns an empty value when the Powergui is in continuous or in phasor mode.

SampleTime

Sample time value used to compute discrete state-space matrices

Aswitch

A matrix taking into account the initial status of switch devices

Bswitch

B matrix taking into account the initial status of switch devices

Cswitch

C matrix taking into account the initial status of switch devices

Dswitch

D matrix taking into account the initial status of switch devices

x0switch

Vector of initial values of switch currents

Hlin

noutput-by-ninput-by-nfreq complex transfer function of impedances of the linear system corresponding to the frequencies contained in the frequencies vector. For a particular frequency, Hlin is defined by

yss(:,i) = Hlin(:,:,i) * uss(:,i)

OscillatoryModes

Display the oscillatory modes of the state-space system

The table uses the following conventions:

• nstates is the number of states.

• ninput is the number of inputs.

• noutput is the number of outputs.

• nfreq is the number of input source frequencies.

[A,B,C,D,x0,states,inputs,outputs,uss,xss,yss,frequencies,Hlin] =...
power_analyze('sys')
returns the state-space calculations in separate variables.

Output Arguments: Sort

sps = power_analyze('sys','sort') returns a structure array sps with the following fields related to the interconnection of Simscape Electrical Specialized Power Systems blocks in a model. The fields are defined in the following order.

Field

Description

circuit

Name of the model

SampleTime

Sample time for discrete systems

RlcBranch

rlc matrix in the power_statespace format

RlcBranchNames

List of blocks containing the state variable

SourceBranch

Source matrix in the power_statespace format

SourceBranchNames

Names of the blocks defined as sources

InputNames

Names of the inputs of the system

OutputNames

Names of the outputs of the system

OutputExpressions

Output expression in the power_statespace format

OutputMatrix

Output expression in matrix format (internal)

MeasurementBlocks

Names of the voltage and current measurement blocks

Output Arguments: ss

sps = power_analyze('sys','ss') creates a continuous state-space model of the model sys with matrices A, B, C, D. You must have Control System Toolbox™ software installed for this option. The output is a state-space object.

Output Arguments: Net

power_analyze('sys','net') generates a netlist stored in a file, sys.net. The file contains the node numbers automatically generated by power_analyze, as well as parameter values of all linear elements. See the formats described in the power_statespace reference page.

Output Arguments: getSwitchStatus

SW = power_analyze('sys','getSwitchStatus') returns a structure array with switch names and their initial status. You can use the SW structure to specify switch statuses for a particular circuit topology and to compute the corresponding state-space matrices using the command sps = power_analyze('sys','setSwitchStatus',SW). The SW structure contains the following fields.

Field

Description

SwitchNames

Names of the switches of the system

SwitchStatus

Vector of initial states of switches

Output Arguments: setSwitchStatus

sps = power_analyze('sys','setSwitchStatus',SW) creates a structure array sps with fields and values describing the state-space matrices of model sys for the switch status defined in SW. Use the command
SW = power_analyze('sys','getSwitchStatus')
to obtain the SW structure array.

Field

Description

A

nstates-by-nstates state-space A matrix

B

nstates-by-ninput state-space B matrix

C

noutput-by-nstates state-space C matrix

D

noutput-by-ninput state-space D matrix

x0

nstates-by-1 vector of initial conditions of the state variables listed in states

Examples

Obtain the state-space matrices and steady-state voltages and currents for the power_netsim2 circuit.

The command

sps = power_analyze('power_netsim2','structure');

returns the state-space model in the sps structure variable.

sps.A =
1.0e+04 *
0    			6.2500
-0.0083			-1.4250

sps.uss =
0
1000
sps.xss =
1.0e+02 *
4.8392 - 5.1314i
0.0310 + 0.0292i

sps.yss =
1.0e+02 *
8.5535 - 1.6287i
0

sps.inputs =
I_Breaker
U_Source

sps.outputs =
U_Breaker
I_Current Measurement

The inductor current of the 51-ohm, 12-mH block and the capacitor voltage of the 120-ohm, 16-µF block are the two state variables in this circuit. The Breaker block is a nonlinear element that is represented by a current source (the first input) driven by the voltage across its terminals (the first output).