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 statespace 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 statespace system described by the
equations
$$\begin{array}{l}\dot{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 motors or machines, are simulated either by current sources driven by the voltages across the nonlinear element terminals, or by voltage sources driven by the currents through the nonlinear element terminals. The nonlinear elements produce additional current and voltage source inputs to the u vector, and additional voltage and current measurements outputs to the y vector.
For the switching devices elements, such as the breakers, diodes, and thyristors, the statespace calculations include only the resistance and capacitance elements of the snubber devices.
The Simulink^{®} blocks of the model, as well as the internal Simulink models of the Simscape Electrical Specialized Power Systems nonlinear elements, are not represented in the statespace matrices.
StateSpace 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_
, where
x
: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 phasetophase 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 

 Name of the model 






















 1by 


 Vector of initial conditions of dependent states 


 Discrete statespace A matrix. Returns an empty value when the Powergui is in continuous or in phasor mode. 
 Discrete statespace B matrix. Returns an empty value when the Powergui is in continuous or in phasor mode. 
 Discrete statespace C matrix. Returns an empty value when the Powergui is in continuous or in phasor mode. 
 Discrete statespace D matrix. Returns an empty value when the Powergui is in continuous or in phasor mode. 
 Vector of discrete initial conditions. Returns an empty value when the Powergui is in continuous or in phasor mode. 
 Sample time value used to compute discrete statespace matrices 
 A matrix taking into account the initial status of switch devices 
 B matrix taking into account the initial status of switch devices 
 C matrix taking into account the initial status of switch devices 
 D matrix taking into account the initial status of switch devices 
 Vector of initial values of switch currents 


 Display the oscillatory modes of the statespace 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]
=...
returns the statespace
calculations in separate variables.
power_analyze('sys')
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 

 Name of the model 
 Sample time for discrete systems 


 List of blocks containing the state variable 
 Source matrix in the 
 Names of the blocks defined as sources 
 Names of the inputs of the system 
 Names of the outputs of the system 
 Output expression in the

 Output expression in matrix format (internal) 
 Names of the voltage and current measurement blocks 
Output Arguments: ss
sps = power_analyze('sys','ss')
creates
a continuous statespace 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 statespace 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
statespace matrices using the command sps = power_analyze('sys','setSwitchStatus',SW)
.
The SW
structure contains the following fields.
Field  Description 

 Names of the switches of the system 
 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 statespace matrices of model sys
for the switch
status defined in SW
. Use the command
to
obtain the
SW = power_analyze('sys','getSwitchStatus')SW
structure array.
Field  Description 











Examples
Obtain the statespace matrices and steadystate voltages and currents for
the power_netsim2
model.
The command
sps = power_analyze('power_netsim2','structure');
returns the statespace 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 51ohm, 12mH block and the capacitor voltage of the 120ohm, 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).