Tuning parameters via C API

I have created tunable parameters in my Simulink model and have compiled it using the grt. Now I would like to change the value of these parameters via an external interface. What is the function call to do this? How do I hook into the dll?

Respuestas (1)

Kaustubha Govind
Kaustubha Govind el 19 de Oct. de 2011

0 votos

You should find a parameter structure declared as "extern" in the modelname.h file. It typically has a type named something like Parameters_modelname and a variable named modelname_P, and is defined in the modelname_data.c file. You can eliminate this definition and create your own. Since this is a global variable, you can access in from anywhere in code and modify it.
You can also customize what the tunable parameter data structure looks like by choosing a different Tunable Parameter Storage Class.
This page explains how you can create your parameter as a Simulink.Parameter object and choose a storage class.

1 comentario

vcmorini
vcmorini el 17 de Jul. de 2017
Hello Kaustubha Govind, could you provide an example about changing parameters values with C API ?
It works for Simscape and Simulink?
C API is the only way to change tunable parameters values after code generation? Because I was looking at Generating Code Multibody and does not says anything about C API.
Thank you

Iniciar sesión para comentar.

Categorías

Productos

Preguntada:

el 19 de Oct. de 2011

Comentada:

el 17 de Jul. de 2017

Community Treasure Hunt

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

Start Hunting!

Translated by