- To set startup parameters for a simulation, use setVariable on the SimulationInput object or Simulation object:
- To change parameters while the simulation is running, use simulink.compiler.modifyParameter inside a runtime callback like postStepFcn:
How do I tune parameters in my model with Simulink Compiler?
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
MathWorks Support Team
am 31 Okt. 2024
Beantwortet: MathWorks Support Team
am 31 Okt. 2024
I am trying to tune parameters in my model with Simulink Compiler but I am unable to do so. What could be the problem.
Akzeptierte Antwort
MathWorks Support Team
am 31 Okt. 2024
There are two approaches to tuning parameters in a Simulink Compiler standalone application:
Here is an example that shows parameter tuning with an App Designer app and Simulink compiler:
Some common problems and solutions are described below.
Problem:
Simscape parameters do not seem to change after being tuned with setVariable.
Solution:
For Simscape parameters, we need to mark them as runtime tunable
Problem:
I get the following error when using simulink.compiler.modifyParameter
Error using simulink.sim.internal.modifyParameters
simulink.compiler.modifyParameter can be used only while the simulation is running.
Solution:
simulink.compiler.modifyParameter should only be used in one of the Simulink Compiler runtime callbacks such as the postStepFcn or externalInputFcn or externalOutputFcn. If you want to tune parameters before or between runs, use setVariable on the SimulationInput object instead.
Problem:
setVariable does not tune the value of a model workspace parameter.
Solution:
You need to set the workspace argument to the model name when using setVariable.
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Deploy Standalone Applications finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!