Tuneable Parameters changed on xPC Target host

2 views (last 30 days)
Dear all, I have a Simulink file running on a real-time machine with xPC. The model has several parameters which I like to be able to tune during run-time. So far I did that by hand when my laptop was connected to the target host with
tg = xpc;
tg.setparam(0,NewValue);
tg.setparam(1,NewValue);
...
and so on. These parameters are 'Constant' blocks in the simulink file and enter the model at various locations. I know that generally it is recommended not to update parameters dependent on other blocks since it causes computational overhead (<http://blogs.mathworks.com/seth/2011/03/08/how-do-i-change-a-block-parameter-based-on-the-output-of-another-block/ see here>). But their suggestion in using a data signal rather than a block parameter is not really what I've hoped for. That would make the whole simulink model way more complicated than it needs to be. Additionally, I don't want to change these parameters by hand by having my computer connected to the real-time machine and I want to use a serial communication from another machine setting the parameters. Since these parameters get update only seldom, once every couple minutes.
I tried to use an an Embedded Matlab Function within Simulink to do the same. The command
set_param(object,param,value)
is not supported by the code generator but can be circumvented by using
coder.extrinsic('set_param')
I couldn't test so far if that even works but I have two general questions.
- How can I make sure that this Embedded Matlab Function is only executed once it receives new data? - What would be the best way to tune these parameters online without external connection?

Answers (0)

Categories

Find more on Simulink Functions in Help Center and File Exchange

Products

Community Treasure Hunt

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

Start Hunting!