I need to assert that a variable (a in the MWE below) is bigger than another (b).
I noticed that an assertion a>b inside an imported model behaved like a>=b.
I tried to work around that problem to assert for a>(b+Constants.small) instead.
Changing the assertion, even when asserting for a>(b+someBiggerNumber) still doesn' works as expected for a=b. If a!=b the assertion works as expected.
Is this a bug or am I doing something wrong? If it"s a bug, is there a workaround?
MWE:
model MWE
model SomeModel
parameter Real a(start=1);
parameter Real b(start=1);
protected
Real c=5/(a-b);
equation
assert(a > b, "a has to be bigger than b. However, a (=" + String(a) +") < b (=" + String(b) + ")");
//assert(a > (b + 1), "a has to be bigger than b+1. However, a (=" + String(a) +") < b (=" + String(b) + ")");
end SomeModel;
SomeModel sm(a = 5, b = 5);
Real var;
equation
var = sm.c;
end MWE;
// assert a > b
// a=5, b=4 no fail, as expected, same for b<4
// a=5, b=5 no fail
// a=5, b=6 fail, as expected, same for b>3
// assert a > (b + 1)
// a=5, b=3 no fail, as expected, same for b<3
// a=5, b=4 fail, as expected
// a=5, b=5 no fail
// a=5, b=6 fail, as expected, same for b>3