0

Consider that I have built an electrical circuit or any other system at Simulink and to do simulations, Simulink should work in the sense that it builds a state space model of the system, right? If that is the case, is it possible to set an initial condition of this model? And more, is it possible to know what are the state variables of the model built by Simulink?

gustavoreche
  • 205
  • 4
  • 12

1 Answers1

2

The Simulink.BlockDiagram.getinitialState method can be used to interrogate the model, and return an appropriate structure giving the current initial value of the states.

The values in the structure can then be changed and the (new) values used with the model configuration parameters to start at a different initial state. See the doc for a usage example.

Phil Goddard
  • 10,571
  • 1
  • 16
  • 28
  • I typed `x0 = Simulink.BlockDiagram.getInitialState('Sist_2_areas_ST1A_KUNDUR')` but I can see some states as row vectors! But all states it's supposed to be scalars, right? My system is a electrical power system if that helps. – gustavoreche Apr 06 '16 at 04:14
  • 1
    No. A state-space block for instance would have a vector of initial states. And many power system models will use state-space blocks. – Phil Goddard Apr 06 '16 at 04:17
  • Last question, so the order of my model should be equal to the sum of all dimensions shown in `x0.signals`? – gustavoreche Apr 06 '16 at 04:28
  • I would expect that to be the case. – Phil Goddard Apr 06 '16 at 04:30