How do I change drop - down value of a block in Simulink model for my simulation input object?

4 visualizzazioni (ultimi 30 giorni)
How do I change drop - down value of a block in a simulink model for my simulation input object? I can't use set_param as it is not supported for deployment.
I want to be able to produce a stand-alone from it.
  2 Commenti
Muhammad
Muhammad il 28 Ott 2022
It can be any block containing drop - down options. I want to switch between those options for simulation input object. See I am trying to package simulink model inside app designer app (deployable) and want to give user options to change drop - down values in my model through app.
For my case, I would like to change options of SI or Diesel engine in engine block. Another instance lies in changing drive cycles in relevant drop - down present in drive cycles source block. And probably many more!
If it helps to be more specific, for discussion, we can take a simple example of mass spring damper model shipped with simulink compiler. Command is:
openExample('simulinkcompiler/DeployingASimulationAppUsingSimulinkCompilerExample')
Now lets say we want to add option in app for user to change drop - down value ( for element - wise or matrix multiplication) in the gain block (named 'Mass') of model. How should we do it?

Accedi per commentare.

Risposta accettata

Fangjun Jiang
Fangjun Jiang il 28 Ott 2022
For changes like this, if you do it manually, meaning changing from 'Element-wise(K.*u)' to 'Matrix(K*u)', the Simulink model is changed. In other words, if you want to do it programingly, you have to use set_param('Block','Multiplication','Matrix(K*u)'). This is not something that can be done by setting up simulation input object.
  2 Commenti
Muhammad
Muhammad il 29 Ott 2022
Modificato: Muhammad il 29 Ott 2022
Dear MathWorks, This is a very strong limitation (at least, in my experience) in simulink compiler and work should be done to remove it. Regards!
Fangjun Jiang
Fangjun Jiang il 30 Ott 2022
A workaround could be developed using the variant subsystems. Use a workspace variable to control the variants, one uses the 'Element-wise(K.*u)' Gain block, the other uses the 'Matrix(K*u)' Gain block.

Accedi per commentare.

Più risposte (0)

Categorie

Scopri di più su Modeling in Help Center e File Exchange

Prodotti


Release

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by