Opened 6 years ago

Closed 6 years ago

Last modified 6 years ago

#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 Per Östlund, 6 years ago

Should be fixed in 3729dd6. I just changed the definition in ModelicaBuiltin so that delay(expr, delayTime) = delay(expr, delayTime, delayTime).

comment:2 by Francesco Casella, 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.

Last edited 6 years ago by Francesco Casella (previous) (diff)

in reply to:  2 comment:3 by Per Östlund, 6 years ago

Resolution: fixed
Status: newclosed

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) expects delayMax 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.

comment:4 by Francesco Casella, 6 years ago

Ok, very good!

Note: See TracTickets for help on using tickets.