Power System Blockset
  Go to block:
    Search    Help Desk 
Circ2ss    Examples   See Also

Compute the state-space model of a linear electrical circuit

Synopsis

You must call circ2ss with a minimum of seven input arguments.

You can also specify additional arguments. To use options, the number of input arguments must be 12, 13, 14 or 16.

Description

Computes the state-space model of a linear electrical circuit expressed as

  

where x is the vector of state-space variables (inductor currents and capacitor voltages), u is the vector of voltage and current inputs, and y is the vector of voltage and current outputs.

When you build a circuit from the Power System Block set icons of the powerlib library, circ2ss is automatically called by power2sys. circ2ss has also been made available as a stand-alone function for expert users. This allows you to generate state-space models without using the Power System Blockset graphical interface and to access options that are not available through powerlib. For example, you can specify transformers and mutual inductances with more than three windings.

The linear circuit can contain any combination of voltage and current sources, RLC branches, multi-winding transformers, mutually coupled inductances, and switches. The state variables are inductor currents and capacitor voltages.

The State-Space block containing A,B,C,D and x0 matrices computed by circ2ss can then be used in a Simulink system to perform simulation of the electrical circuit. Nonlinear elements (such as mechanical or electronic switches, transformer saturation, machines, and distributed parameter lines) can be connected to the linear circuit. These Simulink models are interfaced with the linear circuit through voltage outputs and current inputs of the state-space model. You can find the models of the nonlinear elements provided with the Power System Blockset in the powerlib_models library.

Input Arguments

The number of input arguments must be 7, 12, 13, 14, or 16. Arguments 8 to 16 are optional. The first seven arguments that must be specified are (see format following):

The following arguments are optional. Some of them are used to pass arguments from the power2sys function. Hereafter, we describe only the arguments to be specified when circ2ss is used as a stand-alone function.

Output Arguments

The last lines of the states matrix, which are followed by an asterisk, indicate inductor currents and capacitor voltages which are not considered as state variables. This situation arises when inductor currents or capacitor voltages are not independent (inductors in series or capacitors forming a loop). The currents and voltages followed by an asterisk can be expressed as a linear combination of the other state variables:

Format of the RLC Input Matrix

Two formats are allowed:

Each line of the RLC matrix must be specified according to the following format:

[node1, node2, type, R, L, C, Nobr] for RLC or line branch
[node1, node2, type, R, L, C, Nobr] for transformer magnetizing branch
[node1, node2, type, R, L, U, Nobr] for transformer winding
[node1, node2, type, R, L, U, Nobr] for mutual inductances

For a mutual inductor or a transformer having N windings, N+1 consecutive lines must be specified in rlc matrix:

   1.
N lines with type=2 or type=3; (one line per winding). Each line specifies R/L/U or R/Xl/Xc, where [R/L, R/Xl] = winding resistance and leakage reactance for a transformer or winding resistance and self reactance for mutually coupled windings. U is the nominal voltage of transformer winding (specify 0 if type =3).
   2.
One extra line with type=1 for the magnetizing branch of a transformer (parallel Rm/Lm or Rm/Xm) or one line with type=0 for a mutual impedance (series Rm/Lm or Rm/Xm).
For a transformer magnetizing branch or a mutual impedance, the first node number is an internal node located behind the leakage reactance of the first winding. The second node number must be same as the second node number of the first winding.

To model a saturable transformer you must use a nonlinear inductance instead of the linear inductance simulating the reactive losses. Set the Lm/Xm value to zero (no linear inductance) and use the transfosat block with proper flux-current characteristic. This block can be found in the powerlib_models library. This block must be connected to the State-Space block between a voltage output (voltage across the magnetizing branch and a current input (current source injected into the transformer internal node). See the example given at the end of the Circ2ss documentation.

If type is a negative value: length (km) of a transmission line simulated by a PI section.
For a transmission line, the R,L,C or R/Xl/Xc values must be specified in ohm/km or ohm, mH, µF /km.

The following restrictions apply for transformer and mutually coupled winding R-L values: Null values are not allowed for winding resistances. Specify a very low value (e.g., 1e-6 pu, based on rated voltage and power) to simulate a quasi ideal transformer. The leakage reactances can be set to zero. The resistive part of the magnetizing branch Rm of a transformer must have a finite value. Specify a very high value (low losses, e.g, Rm=1e4 pu or 0.01% current based on rating) to simulate a quasi ideal transformer. The inductive part of the magnetizing branch can be set to infinite (No reactive losses; specify Xm=0). A null value is not allowed for the mutual inductance of coupled windings. The resistive part of series mutual branch can be set to zero.

Format of the SOURCE Input Matrix

Three formats are allowed:

Each line of the Source matrix must be specified according to the following format:

Format of the SWITCHES Input Matrix

Switches are nonlinear elements simulating mechanical or electronic devices such as circuit breakers diodes or thyristors. As for other nonlinear elements, they are simulated by current sources driven by the voltage appearing across their terminals. Therefore, they cannot have a perfectly zero impedance. They are simulated as ideal switches in series with a series R-L circuit. Various models of switches (circuit breaker, ideal switch, and power electronic devices) are available in the powerlib_models library. They must be interconnected to the State-Space block through appropriate voltage outputs and current inputs.

The switch parameters must be specified in a line of the Switches matrix in seven different columns according to the following format:

Note: For these last two fields, the same units as specified for the rlc matrix must be used. Null inductance values are not allowed. However, the resistance can be set to zero.

The next two fields specify the current input number and the voltage output number to be used for interconnecting the switch model to the state-space block.

Format of the LINE_DIST Matrix

The distributed parameter line model contains two parts:

   1.
A linear part containing current sources and resistances that are connected at the line sending and receiving buses together with the linear circuit.
   2.
A nonlinear part available in the dist_line block of the powerlib_models library. This block performs the phase to mode transformations of voltage and currents and simulates the transmission delays for each mode. The dist_line block must be connected to appropriate voltage outputs and current inputs of the State-Space block. The line parameters have to be specified in the line_dist matrix and also in the dist_line block.
Each row of the line_dist matrix is used to specify a distributed parameter transmission line. The number of columns of line_dist depends on the number of phases of the transmission line.

For an nphase line, the first (4+3*nphase+nphase^2) columns are used. For example, for a three-phase line, 22 columns are used.

Format of the YOUT Matrix

The desired outputs are specified by a string matrix yout. Each line of the yout matrix must be an algebraic expression containing a linear combination of states and state derivatives specified according the following format:

To form a valid MATLAB expression, each output expression is built from voltage and current variable names defined above, their derivatives, constants, other variable names, parenthesis and operators (+-*/^). For example:

If variable names are used (as R1 and L2 in the above example), their names and values must be specified by the two input arguments vary_name and vary_val.

Sign Conventions for Voltages And Currents

I_bn Il_bn, In: Branch current, inductor current of branch #n or current of source #n is oriented from node1 to node2.

I_bn_nx: Current at one end (node x) of a pi transmission line. If x = node1, the current is entering the line. If x = node2, the current is going out of the line.

Uc_bn, Un: Voltage across capacitor or source voltage (Unode1 - Unode2)

U_nx1_x2: Voltage between nodes x1 and x2 = Ux1 - Ux2. Voltage of node x1 with respect to node x2.

Example

The following circuit consists of two sources (one voltage source and one current source), two series RLC branches (R1-L1 and C6), two parallel RLC branches (R5-C5 and L7-C7), one saturable transformer and two switches (Sw1 and Sw2). Sw1 is initially closed whereas Sw2 is initially open. Three measurement outputs are specified (I1,V2 and V3). This circuit has seven nodes numbered 0, 1, 2, 2.1, 10, 11 and 12. Node 0 is used for the ground. Node 2.1 is the internal node of the transformer where the magnetization branch is connected.

You can use the circ2ss function to find the state-space model of the linear part of the circuit. The nonlinear elements Sw1,Sw2 and Lsat must be modeled separately by means of current sources driven by the voltage appearing across their terminals. Therefore you must foresee three additional currents sources and three additional voltage outputs for interfacing the nonlinear elements to the linear circuit.

You will obtain the state-space model of the circuit by entering the following commands in a .m executable file, available in the psbcirc2ss.m file.

While circ2ss is executing, the following messages are displayed:

The names of the state variables are returned in the states string matrix:

Although this circuit contains six inductors and capacitors, there are only four state variables. The names of the state variables are given by the first four lines of the states matrix. The last two lines are followed by an asterisk indicating that these two variables are a linear combination of the state variables:

The A,B,C,D matrices contain the state-space model of the circuit without nonlinear elements (sw1 switch open). The x0 vector contains the initial state values considering the switch sw1 closed. The Asw, Bsw, Csw, Dsw matrices contain the state-space model of the circuit considering the closed switch sw1. In our example, the system contains an extra state corresponding to the current flowing into the Sw1 inductor. The xosw vector contains the initial current in the closed switch.

The system source frequencies are returned in the freq vector:

The corresponding steady-state complex outputs are returned in the (6x3) y matrix where each column corresponds to a different source frequency.

For example, you can obtain the magnitude of the six voltage and current outputs at 60Hz as follows:

The initial values of the four state variables are returned in the x0 vector. You must use this vector in the State-Space block to start the simulation in steady-state.

The initial values of switch currents are returned in x0sw. To start the simulation in steady-state, you must use these values as initial currents for the nonlinear model simulating the switches.

The Simulink model of the circuit is shown in the following figure. If you had used the powerlib library to build your circuit, the same Simulink system would have been generated automatically by the power2sys function. The corresponding version of this circuit built with the Power System Blockset is available in the psbcirc2ss_slk.mdl file.

The linear part of the circuit is simulated by the State-Space block. Appropriate inputs and outputs are used to connect the switch and saturable reactance models to the linear system. You can find the breaker and transfosat blocks in the powerlib_models library containing all the nonlinear models used by the Blockset. As the breaker model is vectorized, a single block is used to simulate the two switches Sw1 and Sw2.

See Also

power2sys

[ Previous | Help Desk | Next ]