power_initstates

Compute and modify initial values of voltages and currents of model

Syntax

power_initstates('sys')
sps = power_initstates('sys')

Description

power_initstates('sys') opens the Initial States Setting Tool dialog box that lets you display the initial values of the electrical state variables (inductor currents and capacitor voltages) of a model, as well as modify the initial electrical states in order to start the simulation from any initial conditions. This tool can also be activated from the Powergui block dialog box by selecting Initial States Setting.

sps = power_initstates('sys') returns a structure with the fields:

FieldDescription
circuitThe name of the model
StatesThe names of the electrical state variables
x0The current initial states vector used for the simulation of the model
x0_steadyThe computed initial states that ensure a steady-state simulation
x0_blocksDefault initial states values, defined in blocks
DependentStatesThe names of the dependent states, if any
x0DependentStatesInitial state values of dependent states
UseInitialStatesFrom

The initial state for the simulation, expressed as a character vector ('block', 'steady', 'zero').

If set to 'block', the default initial states are used. If set to 'steady', the computed initial states that ensure a steady-state simulation are used. If set to 'zero', the initial states are forced to 0.

Dialog Box

Initial state values for simulation

Display names of model state variables and their initial values.

Set selected state

Enter a value here to set the initial value of the variable selected in the Initial state values for simulation list.

Force initial electrical states

If To Steady State is selected, force all initial electrical state values to steady-state values. When this option is selected, the Set selected state option is disabled, because all states are forced to steady-state values.

If To Zero is selected, force all initial electrical state values to zero. When this option is selected, the Set selected state option is disabled, because all states are forced to zero. If you want to set all states to zero, and then set one or several states to something else, do this by using the Set selected state option: first, select all states, enter 0, and click Apply; then select the states that you want to set to something else and modify their values individually.

If neither To Steady State nor To Zero is selected, initial state values defined in blocks are used for the simulation.

Reload states

If From File is selected, allows you to choose a previously saved file storing the model's states. If From Diagram is selected, sets all initial state values to their current values (either steady state values or last modified values).

Format

In the pull-down menu, choose the format in which you want your measurements displayed. The floating point option is displayed in mantissa-exponent form with five significant figures. The best of option displays with four significant figures and uses mantissa-exponent form only for numbers larger than 9999. The final option is displayed in plain numbers with two figures to the right of the decimal point. The default is floating point.

Sort values by

Select order of displayed initial state values. Selecting Default order displays the value by block order in the diagram. Selecting State number displays the values according to the states' ordering in the state-space model. Selecting Type displays the values grouped by capacitors and inductors. The default is Default order.

Save Initial States

Save the model's initial state settings in a file.

Sign Conventions for Voltages and Currents

Unlike Simulink® signal lines and input and output ports, the Physical Modeling connection lines and terminal ports lack intrinsic directionality. The voltage and current polarities are determined, not by line direction, but instead by block orientation. To find out a block orientation, first click on the block to select it. Then enter the following command:

get_param(gcb,'Orientation')

The following table indicates the polarities of the currents and voltages for single-phase and three-phase RLC elements (branches or loads), surge arresters, and single-phase and three-phase breakers. The table also indicates the polarities of their state variables (inductor currents and capacitor voltages).

Block
Orientation

Positive Current
Direction

Measured
Voltage

right

left —> right

Vleft – Vright

left

right —> left

Vright – Vleft

down

top —> bottom

Vtop – Vbottom

up

bottom —> top

Vbottom – Vtop

The natural orientation of the blocks (that is, their orientation in the Element library) is right for horizontal blocks and down for vertical blocks.

For single-phase transformers (linear or saturable), with the winding connectors appearing on the left and right sides, the winding voltages are the voltages of the top connector with respect to the bottom connector whatever the block orientation (right or left). The winding currents are the currents entering the top connector. For three-phase transformers, the voltage polarities and positive current directions are indicated by the signal labels used in the Multimeter block.