Documentation

### This is machine translation

Translated by
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

## Specify Initial Conditions

### Introduction

In this section, you

• Learn what are the state variables of a Simulink® diagram containing Simscape™ Electrical™ Specialized Power Systems blocks

• Specify initial conditions for the electrical state variables

### State Variables

The state variables of a Simulink diagram containing Simscape Electrical Specialized Power Systems blocks consist of

• The electrical states associated to RLC branch-type Simscape Electrical Specialized Power Systems blocks. They are defined by the state-space representation of your model. See Electrical State Variables for more details about the electrical states.

• The Simulink states of the Simscape Electrical Specialized Power Systems electrical models such as the Synchronous Machine block, the Saturable Transformer block, or the Three-Phase Dynamic Load block.

• The Simulink states of the other Simulink blocks of your model (controls, user-defined blocks, and other blocksets).

The following picture provides an example that contains the three types of state variables:

### Initial States

Initial conditions, which are applied to the entire system at the start of the simulation, are generally set in the blocks. Most of the Simulink blocks allow you to specify initial conditions. For the case of the electrical states, the Simscape Electrical Specialized Power Systems software automatically sets the initial values of the electrical states to start the simulation in steady state.

However, you can specify the initial conditions for the capacitor voltage and inductor currents in the mask of these blocks:

• the Series and Parallel RLC Branch blocks

• the Series and Parallel RLC Load blocks

The initial values entered in the mask of these blocks overwrites the default steady-state parameters calculated by the Simscape Electrical Specialized Power Systems software. In the same sense, you can overwrite initial conditions of the overall blocks by specifying them in the States area of the Model Configuration Parameters dialog box.

See the `power_init` function reference page for more details on how you can specify initial states for a Simulink diagram with Simscape Electrical Specialized Power Systems blocks.

### Specify Initial Electrical States with Powergui

1. Open the Transient Analysis of a Linear Circuit example by typing `power_transient` at the command line. Rename the RLC Branch blocks as shown in the next figure.

2. From the Tools tab of the Powergui block, select . The initial values of the five electrical state variables (three inductor currents and two capacitor voltages) are displayed. These initial values corresponds to the values that the software automatically sets to start the simulation in steady state.

3. Open the Scope block and start the simulation. As the electrical state variables are automatically initialized, the system starts in steady state and sinusoidal waveforms are observed.

4. The initial value for `STATE_D` state is set to 1.589e5 V. It corresponds to the initial capacitor voltage found in the `STATE_D` block. Open this block, select the Set the initial capacitor voltage parameter, then specify a capacitor initial voltage of -2e5 V. Click the OK button.

5. Click the From diagram button of the Powergui Initial States Tool to refresh the display of initial states. The initial state of `STATE_D` block is now set to -2e5 V.

6. Start the simulation. In the second trace of the Scope block, zoom around the transient at the beginning of the simulation. As expected, the model does not start in steady state, but the initial value for the capacitor voltage measured by the Voltage Measurement block is -2e5 V.

7. Select the `STATE_A` state variable in the Initial States Tool list. In the Set selected electrical state field, set the initial inductor current to 50 A, and click Apply. Open the mask of the `STATE_A` block, and note that the Set the initial inductor current parameter is selected and the initial inductor current is set to 50 A.

Run the simulation and observe the new transient caused by this new setting.

#### Forcing Initial States to Zero

Now suppose that you want to reset all the initial electrical states to zero without losing the settings you have done in the previous steps.

1. From the Initial State Tool window, select the To zero check box under Force initial electrical states, then click Apply. Restart the simulation and observe the transient when all the initial conditions start from zero.

2. Open the masks of the `STATE_C` and `STATE_A` blocks and note that even if initial conditions are still specified in these blocks, the setting for the initial states is forced to zero by the Powergui block.

A message is displayed at the command line to remind you every time you start the simulation that the electrical initial states of your model are forced to zero by the Powergui block, which overwrites the block settings in your model.

#### Forcing Initial States to Steady State

Similarly, you can set all the initial states to steady without losing the settings you have done in the previous steps.

1. From the Initial State Tool window, select the To steady state check box under Force initial electrical states, then click Apply.

2. Restart the simulation and observe that the simulation starts in steady state.

A message is displayed at the command line to remind you every time you start the simulation that the electrical initial states of your model are forced to steady state by the Powergui block.

#### Returning to Block Settings

To return to the block settings, clear both check boxes under Force initial electrical states, then click Apply.

#### 10 Ways to Speed Up Power Conversion Control Design with Simulink

Download white paper