Why the models stays in "paused after initialisation" state?

5 vues (au cours des 30 derniers jours)
Adrian
Adrian le 29 Jan 2015
Hello all, Before Matlab R2013b I did not have a problem with this... I did a model compilation programmatically like this:
eval([bdroot '([],[],[],''compile'')']);
disp(' ');disp('Model compiled!');disp(' ');
eval([bdroot '([],[],[],''term'')']);
disp(' ');disp('Model terminated!');disp(' ');
It worked just fine. Now the model remains stuck in "paused after initialization" state and does not get out of this state even using GUI. You have to forcibly close Matlab in order to modify/save/update/do anything else with the model.
Did someone else had this problem or knows a way to make sure the model is compilable without going into this kind of trouble?
Thank you!
  4 commentaires
A Jenkins
A Jenkins le 30 Jan 2015
Since I can't reproduce it, I am suspecting your compiler. I get the following:
Model opened!
Model compiled!
Model terminated!
Model closed!
Keith Rogers
Keith Rogers le 4 Mai 2015
I'm getting a similar problem. I'm trying to make use of the CompiledSampleTime property of a block, but finding that if I change the sample time then I have to compile twice to get it to work, because the first time it goes through it uses the previously compiled time. In attempting to get around this, I used the modelname([],[],[],'compile') command. Now my model window shows "Paused" in the bottom left, and if I try to do modelname([],[],[],'term') I just get the warning:
Warning: Termination of '<modelname>' deferred

Connectez-vous pour commenter.

Réponses (2)

Daniele Defilippi
Daniele Defilippi le 2 Août 2017
The issue can be solved in Matlab 2017b in the following way:
eval([bdroot '([],[],[],''compile'')']);
disp(' ');disp('Model compiled!');disp(' ');
eval([bdroot '([],[],[],''sizes'')']);
eval([bdroot '([],[],[],''term'')']);
disp(' ');disp('Model terminated!');disp(' ');
The sizes command enables model termination.

Aleksey Trubitsyn
Aleksey Trubitsyn le 8 Nov 2021
Your usage looks right to me. There are a couple of things you can check here:
1) bdroot may refer to a different model after the call to compile. This can happen if the top model contains referenced model or if there are any model callbacks which interact with another model. Or if you simply click on another model between the call to compile and terminate. I suggest using a more explicit syntax to avoid this:
>> mdl = 'myModel'
>> feval(mdl, [], [], [], 'compile')
2) if the original code snippet is more than what you've shown, this may be due to the queued behvaior of compile and terminate commands: if compile command was issued more than once on the same model, without any calls to term in between, you would need to call term the same number of times to actually termiante the compilation. You should see warnings in this case though. For example:
>> feval(‘myModel’,[],[],[],’compile’);
>> feval(‘myModel’,[],[],[],’compile’); % Warning: myModel is already compiled
>> feval(‘myModel’,[],[],[],’term’); % Warning: Termination of 'myModel' deferred
>> feval(‘myModel’,[],[],[],’term’); %no warning; model compilation is undone.
Btw, I tried this in R2022a, and i see the compiled state labeled as 'compiled' on the UI, after the compilation call.

Catégories

En savoir plus sur Simulink Environment Customization dans Help Center et File Exchange

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by