Opened 6 years ago
Closed 5 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)
follow-up: 2 comment:1 by , 6 years ago
comment:2 by , 6 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
sheetNameto be discrete here since it's aStringvariable with no variability prefix.sheetNameshould probably be considered to have the same variability as the argument it represents though, in this caseconstant, 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:4 by , 5 years ago
| Milestone: | 1.17.0 → 1.18.0 |
|---|
Retargeted to 1.18.0 because of 1.17.0 timed release.
comment:6 by , 5 years ago
| Resolution: | → fixed |
|---|---|
| Status: | new → closed |

Replying to casella:
I'm guessing it's caused by line 106 in the same file, in the definition of
computeColSum:Since this argument isn't given by the call this default argument is used instead, and the NF probably considers the variability of
sheetNameto be discrete here since it's aStringvariable with no variability prefix.sheetNameshould probably be considered to have the same variability as the argument it represents though, in this caseconstant, but it's not really specified.