Why Matlab can't load initial states of a demo model after i copy it in my own model?

39 views (last 30 days)
Hi i want to use Wind Farm - DFIG Detailed Model inside my simulation. this is what i do: first i type power_wind_dfig_det in the command window, after i press enter the model appears. then i copy the entire and paste it inside my own model. i know that it needs initial states so i put the initial states file power_wind_dfig_det_xinitial in the working folder and set the Initial state=xInitial (all files can be found here: C:\Program Files\MATLAB\R2013a\toolbox\physmod\powersys\DR\DRdemo ) but after i run the simulink i get this error: Error loading the initial state for model 'MyModel'. Unable to find a matching block state corresponding to element 1 of signals structure array.
So the question is why Matlab can't load the initial states while it is available and loaded correctly into the workspace?

Answers (2)

Adrian Jacov
Adrian Jacov on 26 Aug 2016
Hi, here, the answer, by mathworks;
1) In the Simulation/Configuration Parameters/Data Import/Export Parameters menu, uncheck the "Initial state" parameter.
ALL:
  1 Comment
Loubna Saleh
Loubna Saleh on 10 Mar 2017
Hi , I have the same problem and I followed all the instructions written but still have this error {Error loading the initial state for model 'power_wind_dfig_det'. Initial state must be a structure containing a signals structure array. The signals structure should have the following fields: 'values', 'label', and 'blockName'}
I choose 'Scope' parameters/Save data to workspace/Variable name:xFinal /Format: structure with time , but xFinal after simulation is 1x1struct with 3 fields while xInitial that was initially set was 1x1stuct with 2 fields .So do you know how to fix this data setting please ? thnx

Sign in to comment.


SINGARAVELAN S
SINGARAVELAN S on 6 Oct 2017
Go to Simulation/Configuration Parameters/Data Import/Export menu and remove the tick in the initial state and run it. other wise follow this you modify this model, or change parameter values of power components, the initial conditions stored in the "xInitial" variable will no longer be valid and Simulink® will issue an error message. To regenerate the initial conditions for your modified model, follow the steps listed below:
In the Simulation/Configuration Parameters/Data Import/Export Parameters menu, uncheck the "Initial state" parameter.
Double click on the Step block labeled "Wind Speed (m/s)" and temporarily disable the change of wind speed by multiplying the Step time by 100.
Double click on the Breaker block and make sure that no fault is applied (Phase A, B and C checkboxes not selected).
Double click on the 120 kV voltage source block and make sure that the "Time variation of" parameter is set to "None".
Start simulation. When Simulation is completed, verify that steady state has been reached by looking at waveforms displayed on the scopes. The final states which have been saved in the "xFinal" array can be used as initial states for future simulations. Executing the next two commands copies these final conditions in "xInitial" and saves this variable in a new file (myModel_init.mat). * >> xInitial=xFinal; * >> save myModel_init xInitial
In the File/Model Properties/Callbacks/InitFcn window, replace the first line of initialization commands with "load myModel_init". Next time you open this model, the variable xInitial saved in the myModel_init.mat file will be loaded in your workspace.
In the Simulation/Configuration Parameters menu, check "Initial state".
Start simulation and verify that your model starts in steady-state.
Double click on the Step block labeled "Wind Speed (m/s)" and re-enable the change of wind speed at t=5 s (remove the 100 multiplication factor).
Save your Model.

Categories

Find more on Variable Initialization in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!