﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc
5041	assert on parameters are not called in the right order	Francesco Casella	Lennart Ochel	"Please consider the following test case
{{{
model TestInitialAssert
  parameter Real p = 0;
  parameter Real q = 1/p;
initial equation
  assert(p > 0, ""p must be positive"");
end TestInitialAssert;
}}}
OMEdit fails with
{{{
assert | debug | division by zero at time 0, (a=1) / (b=0), where divisor b expression is: p
}}}
In fact, the model contains an assertion on {{{p}}} that could convey more useful information to the end user, but which is not triggered because the expression {{{1/p}}} is evaluated first and causes the initialization to fail, which is precisely the reason why the assertion was put there in the first place.

Recommendation: assertions should be evaluated as early as possible in the BLT, i.e. as soon as the variables/parameters they depend on have been computed.

In this case, the assertion on {{{p}}} should be computed right after the binding equation {{{p = 1}}} has been evaluated, also in the case the assertion is put in the {{{equation}}} section."	defect	new	critical		Backend				
