How to initialise Goto variables used in enabled subsystems

10 次查看(过去 30 天)
How can I initialise Goto variables in an enabled or switch case action subsystem?
I use the Goto blocks to reinitialize the integration variable when one subsystem is enabled, as described here: Building a Clutch Lock-Up Model
Now I can't find a clean way to initialize the goto variables when the model is started. As there is no previously active subsystem, no value can be passed to initialize the variable.

采纳的回答

Jim Riggs
Jim Riggs 2022-11-29
You should not need to "initialize" the Goto variables. The "Goto / from" blocks are simply a way to connect a signal without showing the connecting line. The Goto block gets its value from the signal line that is the input to the block.
  4 个评论
Daniel
Daniel 2022-12-1
First of all, thank you very much for your answer and the work you put into it.
My model is a periodical one, that has three operation states where one of them is active at a time. Sorry that I didn't describe that sufficiently, but your assumption is still leading to my key problem.
My problem is based on my use of the 'Goto' and 'From' blocks. In each subsystem, a 'Goto' block is connected to the 'State' port of the integrator. This 'Goto' block is transmitting the last state of this integrator block to the one in the next subsystem active. In this new subsystem the 'From' block is providing the initialization value for the integrator block of this new subsystem. This procedure is done every time the active subsystem changes to pass on the integration value. Now the problem arised, that I had to provide a general initialization for the integration value when the simulation starts. I couldn't easily provide a initialization value, as this would have been used every time the subsystem is reactivated. I hope that is a better description of my problem.
However, I thought I am just missing the setting for this initialization somewhere. Till now I was using an external signal to solve my problem, but my implementation of this solution was problematic in some ways.
So now I'm using parts of your answer as a solution to my problem that work much better for me.
Thank you very much and sorry again for the badly described problem.

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Conditionally Executed Subsystems and Models 的更多信息

产品


版本

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by