Modifying parameters for S-function in a model which is compiled / run in rapid accelerator mode
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
I have a model which includes an S-function block. The model has all the necessary parameter on the model workspace. A function calls the model and runs it with different parameter sets, which works just fine in normal simulation mode, the parameters influence the initial state of the S-function .
However I want to create an exe from the model, so I'm using configureForDeployment before running the simulation. The problem is that in this case the initial state of my S-function is always the same, which refers to the values of the parameters available on the model workspace during building the rapid accelerator target. Same thing happens when I use mcc. Parameters for other blocks get updated normally.
My code is similar to (inside a for cycle):
in = Simulink.SimulationInput('MyModel');
in = in.setVariable('MyParam', MyParam, 'Workspace', in.ModelName);
in = simulink.compiler.configureForDeployment(in);
simRes = sim( in );
How can I modify the S-function parameters between simulation runs in a compiled model / in rapid accelerator mode? Thanks for the help!
0 Kommentare
Antworten (1)
Fangjun Jiang
am 11 Sep. 2020
Before the configureForDeployment line, use set_param('S_Function_Block','Param_Name','Param_Value') to change the parameter for the S-function block. This might make the model dirty (the model has been modified) so you might also have to save the model before you can run configureForDeployment.
3 Kommentare
Fangjun Jiang
am 14 Sep. 2020
- It depends on the parameter data type to use 'Param_Value' or MySFunParameterValues
- The model needs to be re-build after setting the S-Function parameters, which is said in your original question. Why did you comment above that "the model is already built"?
- You might also need to run the callback functions of the S-function after you change the S-function parameters. It depends on your S-function.
Siehe auch
Kategorien
Mehr zu Deploy Standalone Applications finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!