modelica-tools / csv-compare

Tool to compare curves from one csv files with curves from other csv files using an adjustable tolerance
https://www.modelica.org
BSD 3-Clause "New" or "Revised" License
25 stars 15 forks source link

Index out of bound exception #16

Closed ghost closed 8 years ago

ghost commented 9 years ago

We're getting "Exception during run: Index was outside the bounds of the array." Command used is:

Compare.exe -o -m csvFileCompare -r . -t 0.001 --inline res.csv base.csv

And the files can be found here

Exact error message is:

2015-05-27Z10:58:36 [ Warning ] The resolution of the base x-axis is smaller than the compare x-axis. The better the base resolution is, the better the validation result will be! 2015-05-27Z10:58:36 [ Warning ] a is invalid! 219 errors have been found during validation. 2015-05-27Z10:58:36 [ Error ] Exception during run: Index was outside thebounds of the array.

The two warnings are rather strange, the two result files has different resolution during different time (due to events). It would also be rather interesting to know why "a" is invalid...

Version of CSV Compare:

CSV File Comparison Tool v2.0.0-rel

ghost commented 9 years ago

I've investigated this issue to find a workaround since this a blocker for us. I think I have found the cause for the crash. The crash only seems to happen when, in the actual result, is two result points from the same time, e.g. there was an event at that time point. Additionally one of the points must be within the bound and the other isn't, i.e. the line segment startes within the bound and ends outside.

The following illustrates the problem: actual.csv:

time;a 0;0 1;2 1;1 2;2

expected.csv

time;a 0;0 1;1 2;2

Command:

Compare.exe -o -m csvFileCompare -r . -t 0.001 --inline actual.csv expected.csv

The workaround that I've found is to add a small epsilon to the second point so that the points aren't located on exactly the same time point. E.g.:

time;a 0;0 1;2 1.00000000001;1 2;2

Still, this is a workaround and should really addressed and fixed in CSV-Compare