SimPowerSystems    
power2sys

Analyze an electric circuit built with Power System Blockset

Syntax

Description

The power2sys function computes the equivalent state space model of the specified electrical model built with Power System Blockset. It evaluates the A, B, C, D standard matrices of the state space system described by the equations

where the state variables contained in the x vector are the inductor currents and capacitor voltages. Nonlinear elements are simulated by current sources driven by the voltages across the nonlinear elements.

The inputs of the system contained in the u vector are the voltage and current sources plus the current sources simulating the nonlinear elements. The following conventions are used for inputs:

The outputs of the system contained in the y vector are the voltage and current measurement plus the voltages across the nonlinear elements.

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

The fields 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

Aswitch

A matrix including closed switches
Bswitch
B matrix including closed switches
Cswitch
C matrix including closed switches
Dswitch
D matrix including closed switches
x0switch
Vector of initial values of switch currents
uss
ninput-by-nfreq steady state values of inputs
xss
nstates-by-nfreq steady state values of states
yss
noutput-by-nfreq steady state values of outputs
Hlin
nfreq-by-noutput-by-ninput transfer function of impedances
frequencies
1-by-nfreq vector of input source frequencies
LoadFlow
Load flow information for circuits with machines
OscillatoryModes
Oscillatory modes of linear part of the system

The table uses the following conventions:

states is a string matrix containing names of the state variables. Each line of states 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. Inductor current direction and capacitor voltages polarities are defined by the input and output of the block. The following conventions are used:

A suffix is added to the line for blocks containing more than two inductances or capacitors. For example, the Linear Transformer blocks produce three lines in the states matrix, one for each leakage inductance, with the suffix windingx, where x is the winding number of the transformer.

inputs is a string matrix containing names of the inputs of the system. Each line of inputs begins with a prefix U_ for voltage sources or I_ for current sources, followed by the name of the source block.

A suffix can be added to the input for blocks containing more than one source. For example, the Simplified Synchronous Machine block produces two current inputs with suffixes AB and BC.

outputs is a string matrix containing names of the outputs of the state space system (vector y). Each line of outputs begins with a prefix U_ for voltage outputs or I_ for current outputs, followed by the name of the block that produces the output. Sign conventions are indicated by the polarities of the voltage measurement and current measurement blocks.

A,B,C,D are the state space matrices of the linear part of the model.

x0 is a vector containing the initial conditions of the state variables listed in the states variable.

uss, xss, and yss are complex matrices containing the steady state values of inputs, states and outputs. If voltage and current sources all generate the same frequency, these are column vectors. If sources with different frequencies are used, each column of the matrices corresponds to a frequency contained in the frequencies vector.

frequencies is a column vector containing the input source frequencies ordered by increasing values.

Hlin is the complex transfer impedance three-dimensional array (nfreq-by-noutput-by ninput) of the linear system corresponding to the frequencies contained in the frequencies vector. For a particular frequency, Hlin is defined by

psb = power2sys('sys','sort') returns a structure array with the following fields related to the interconnection of Power System Blockset 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 circ2ss format
RlcBranchNames
List of blocks containing the state variable
SourceBranch
Source matrix in the circ2ss 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 circ2ss format

OutputMatrix

Output expression in matrix format (internal)
MeasurementBlocks
Names of the voltage and current measurement

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

If you own the Control System Toolbox, psb = power2sys('sys','ss') creates a continuous state space model of the model sys with matrices A, B, C, D. The output is a state space object.

Netlist.   When called with an extra argument, 'net', powers2sys generates a netlist stored in a file, sys.net. This file contains the node numbers automatically generated by power2sys, as well as parameter values of all linear elements. See the formats described in the circ2ss reference page.

Example

Obtain the state space matrices and steady state voltages and currents for the psbnetsim2.mdl circuit.

The command

returns the state space model in the psb structure variable.

The inductor of the 51 ohms 12 mH block and the capacitor of the 120 ohms 16 uF block are the two state variables in this circuit. The Breaker block is a nonlinear element that is represented by the first current source driven by the voltage across the breaker (the first output). Note that the current of the Breaker block is also an output of the system (third output).

See Also

circ2ss, powerinit, Powergui


  circ2ss powerinit