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 theModel Configuration Parameters.
See the
function
reference page for more details on how you can specify initial states for a
Simulink diagram with Simscape
Electrical Specialized Power Systems blocks.power_init
Specify Initial Electrical States with Powergui
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.Double-click the powergui block, open the Apps tab, and click Measurements and States Analyzer. The initial values of the five electrical state variables (three inductor currents and two capacitor voltages) are displayed in the Initial States tab. These initial values corresponds to the values that the software automatically sets to start the simulation in steady state.
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.
The initial value for
C2
state is set to 1.589e5 V. It corresponds to the initial capacitor voltage found in theC2
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.Click the Update button of the Powergui Measurement and Statses Analyzer app to refresh the display of initial states. The initial state of
C2
block is now set to -2e5 V.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.
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.
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.
Open the masks of the
STATE_C
andSTATE_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.
From the Initial State Tool window, select the To steady state check box under Force initial electrical states, then click Apply.
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.