Opened 5 years ago

Closed 4 years ago

#5728 closed defect (fixed)

Wrong variability reported by NF

Reported by: Francesco Casella Owned by: Per Östlund
Priority: high Milestone: 1.18.0
Component: New Instantiation Version:
Keywords: Cc:

Description

Please check ExternData/files/ExternData_ExternData.Examples.XLSTest. The NF reports:

[ExternData 2.5.0/Examples/package.mo:99:5-99:78:writable]
Error: Component sumB of variability parameter has binding 
'ExternData.Examples.XLSTest.computeColSum(xlsfile, "B")' of higher 
variability discrete.

Looking at the source code, I don't understand why this should be the case. The function is called with an inner parameter xslfile and with a literal constant.

Why should its variability be discrete?

Change History (6)

in reply to:  description ; comment:1 by Per Östlund, 5 years ago

Replying to casella:

Why should its variability be discrete?

I'm guessing it's caused by line 106 in the same file, in the definition of computeColSum:

input Integer endRow = ExternData.Functions.XLS.getArrayRows2D(sheetName=sheetName, xls=xlsfile.xls) "End row";

Since this argument isn't given by the call this default argument is used instead, and the NF probably considers the variability of sheetName to be discrete here since it's a String variable with no variability prefix. sheetName should probably be considered to have the same variability as the argument it represents though, in this case constant, but it's not really specified.

in reply to:  1 comment:2 by Francesco Casella, 5 years ago

Replying to perost:

Replying to casella:

Why should its variability be discrete?

I'm guessing it's caused by line 106 in the same file, in the definition of computeColSum:

input Integer endRow = ExternData.Functions.XLS.getArrayRows2D(sheetName=sheetName, xls=xlsfile.xls) "End row";

Since this argument isn't given by the call this default argument is used instead, and the NF probably considers the variability of sheetName to be discrete here since it's a String variable with no variability prefix. sheetName should probably be considered to have the same variability as the argument it represents though, in this case constant, but it's not really specified.

I don't think there are many models that use String variables as discrete variables, normally they are just used for constant filenames.

I would go for any solution that makes endRow constant or parameter variability.

Thanks!

comment:3 by Francesco Casella, 4 years ago

Milestone: 1.16.01.17.0

Retargeted to 1.17.0 after 1.16.0 release

comment:4 by Francesco Casella, 4 years ago

Milestone: 1.17.01.18.0

Retargeted to 1.18.0 because of 1.17.0 timed release.

comment:5 by Per Östlund, 4 years ago

Fixed in f450566.

comment:6 by Per Östlund, 4 years ago

Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.