#5025 closed defect (fixed)
Issue with delay() in the NF
Reported by: | Francesco Casella | Owned by: | Per Östlund |
---|---|---|---|
Priority: | high | Milestone: | 2.0.0 |
Component: | New Instantiation | Version: | |
Keywords: | Cc: |
Description
Please run this test model with the NF
model TestDelay Real x(start = 0, fixed = true); Real y; equation der(x) = 1 - x; y = delay(x,1); annotation(experiment(StopTime=5)); end TestDelay;
The result is y = 0
, which is wrong.
The model flattened with the old FE gives
y = delay(x, 1.0, 1.0);
while the new FE returns
y = delay(x, 1.0);
Apparently the back-end expects that delayMax
is computed by the NF in the case it is not supplied and delayTime
is a parameter expression.
Please provide this also with the NF.
Change History (4)
comment:1 by , 6 years ago
follow-up: 3 comment:2 by , 6 years ago
Indeed it works, now ScalableTestSuite.Electrical.TransmissionLine.Verification.TransmissionLineCheck passes verification, see report.
As a final remark, when delay(expr,delayTime)
is used, you should check that delayTime is a constant or a parameter expression, otherwise you should issue an error, since the backend (following the specification) expects delayMax
to be a parameter expression.
comment:3 by , 6 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Replying to casella:
As a final remark, when
delay(expr,delayTime)
is used, you should check that delayTime is a constant or a parameter expression, otherwise you should issue an error, since the backend (following the specification) expectsdelayMax
to be a parameter expression.
This already seems to be the case, due to delayTime
being declared as parameter in the definition of delay
with two arguments. The error message that's generated could be better, but at least it works.
Should be fixed in 3729dd6. I just changed the definition in ModelicaBuiltin so that
delay(expr, delayTime)
=delay(expr, delayTime, delayTime)
.