Some tunable variables are missing in generated S-function mask

2 views (last 30 days)
Hello,
in Matlab Simulink 2013a 64bit, I generate an S-function with compilator Microsoft SDK 7.1 from a function block through Right Click > C/C++ Code > Generate S-function.
I select the parameter I want to be tunables (all of the 12) and build the S-function. But the generated S-function allows me to set only 6 of the 12 variables. On another block, all 3 variables remain tunables, and on a third block, 1 of 3 variables wished as tunable is missing in S-function mask.
All variables (present or missing) are constant values for a given simulation (like friction coefficient, gear reduction ratio, motor constant [N.m/A], detent torque, ...).
All variables have been parametrized in the mask before compilation (name instead of the value) and have an assigned value in the workspace. Missing variable names are already missing in files blockname_sf_private.h, blockname_sf.h, and blockname_sf_data.c .
Any tip or idea ? Thank you.

Answers (1)

Titus Edelhofer
Titus Edelhofer on 15 Jun 2015
Hi Benjamin,
note, that there are blocks in Simulink that don't allow the value to be tunable (all sample time related parameters for example). Which block parameters are you missing in the generated S-Function (which parameter from which block type)?
Titus
  2 Comments
Benjamin CHANEL
Benjamin CHANEL on 16 Jun 2015
Edited: Benjamin CHANEL on 16 Jun 2015
Hi Titus, thank you for your answer. My parameters are constant values during the simulation. Within the subsystem block I am compiling, they are used in subsystems and functions like
param_1*sin(param_2*u[1])
which is summed with other functions/subsystems. Neither param_1 nor param_2 are present in S-function's mask. Constant values, even in more complex subsystem blocks (derivation, integration, closed control loops, ...) do not seem to be time related. May they be ?
And of course, I do not get any warning/error message in Matlab Command window. I had a look into the multiple generated files, but I couldn't find any logs that would help me.
Titus Edelhofer
Titus Edelhofer on 17 Jun 2015
Hi Benjamin,
for the line above, do you use the MATLAB function block? This will not work, although the "Generate S-function" asks you to decide if the parameters are tunable or not. You will need to use blocks (a gain block with param_2, feed into Trigonometric function block etc). Then it should work ...
Titus

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!