Hello,
I have a problem with simulating a simple if-clause, so the system comes into chattering or sth. like an endless loop I think.
The model has an input 'u' and an output 'y'. The value comming into the element over the input 'u' shall be reached by the output using a linear function with a constant slope=150.
The algorithm part should determine if the slope is positive or negative and then the equation part shall reckon 'y'.
CODE
algorithm
if y < u then
sign :=1;
elseif y > u then
sign :=-1;
else
sign :=0;
end if;
equation
der(y) = sign*150;
if y < u then
sign :=1;
elseif y > u then
sign :=-1;
else
sign :=0;
end if;
equation
der(y) = sign*150;
I suppose that my access to the Matter is lightly wrong, but I simply do not get what could be wrong...