I have built a generic discrete transfer function in a C-script.
This is the code:
#define u Input(0)
#define y Output(0)
#define a ParamRealData(0,0)
#define b ParamRealData(1,0)
#define c ParamRealData(2,0)
#define alpha ParamRealData(3,0)
#define beta ParamRealData(4,0)
#define gamma ParamRealData(5,0)
#define K ParamRealData(6,0)
#define reset_value ParamRealData(7,0)
#define UL Input(1)
#define LL Input(2)
#define reset Input(3)
if (y_unsat < LL)
y = LL;
else if (y_unsat > UL)
y = UL;
Basically, it converts a 2nd order discrete transfer function in a Linear difference equation.
I write the parameters in the block mask and the C-script has a discrete sample time. (500e-6s)
I would like to change the gain K during simulation but I noticed that it doesn't change at all!
Is it possible? How can I solve ?
Thank you everyone!