Reputation: 41
I have a probably rather small problem! I want to sample a signal in Modelica and as we know, it provides a built-in function for that called "sample".
So when I try to use an algorithm like the following, a fault pops up which says 'Attempting to call non-function sample as function'.
Did I miss something or did I do something wrong over here?
algorithm
if sample(0,1) then
x := y;
end if;
Upvotes: 1
Views: 135
Reputation: 4231
You can only use sample inside when equation for the conditional expressions. Sample is not a function is a builtin operator:
when sample(0,1) then
x := y; // maybe reinit(x, y); is needed here.
end if;
Upvotes: 2