Why does my SimulationInput not update the model variables when it runs in Simulink Compiler or Rapid Accelerator?

6 views (last 30 days)
I have a model I am running from within an app using the 'sim' command. To do this, I have made a "SimulationInput" object in the same way that is shown in the documentation here:
The issue is that sometimes when I run my model with the 'sim' command, the variables that I have included in the SimulationInput don't seem to affect the results.
I have been through the debugger and verified that the values being set for this input object are indeed correct.
Furthermore, I can get it to work when my app is in base MATLAB, but when I deploy it to a web app the input values are ignored.
What could be the issue here?

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 28 May 2021
There are a couple reasons for the model to not use the SimulationInput values:
1) Make sure there are no Model Workspace variables that could be overriding the SimulationInput. You can find this under the Modeling Tab -> Model Explorer -> (Name of my Model) -> Model Workspace
 
2) If you are tuning Simscape components while running in Simulink Compiler or in Rapid Accelerator mode with RapidAcceleratorUpToDateCheck off, it is likely the Simscape parameters are set as "Compile-Time" parameters.
I.e. if a Voltage Source uses the value of the variable, 'volts', then the value of volts at compile time will be used during simulation even when the SimulationInput is being used.
To let these components use the run-time value instead of the compile-time, please follow the instructions on the following page to switch the variable to be "run-time" tunable parameters:

More Answers (0)

Categories

Find more on Electrical Sensors in Help Center and File Exchange

Products


Release

R2021a

Community Treasure Hunt

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

Start Hunting!