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

Detailed documentation #42

Closed JayHuLBL closed 6 years ago

JayHuLBL commented 6 years ago

@svenruetz Is there any detailed document on the CSV-compare tool? It would be great to help us to understand purpose of each function.

JayHuLBL commented 6 years ago

@tbeu

tbeu commented 6 years ago

I am afraid, I do not know any other documentation than the information you find in this repository.

JayHuLBL commented 6 years ago

Thanks!

antic-eye commented 6 years ago

Hi @JayHuLBL, sorry for the late reply, as I am not really part of this project anymore the answering took awhile. There is indeed no detailed documentation for the open source code available, sorry. Feel free to ask if you need to understand specific functions. The answers might take a while though ;)

JayHuLBL commented 6 years ago

@antic-eye In the function CurveCompare/TubeSize.cs, I am not quite sure if I am right on understanding the way to calculate baseX and baseY.

  1. baseX = reference.X.Max() - reference.X.Min(), so if the data set is a time series (X is from 0 second to 200,000 seconds, and Y is fluctuate between 0 and 1), will it be the case baseX = 200,000 - 0 = 200,000, baseY = 1, so that ratio = 1/200,000? If I make the setting like this relativity = true, value = 0.02, axes = X, then the rectangle will be x = 0.02*200000 = 4000, y = 4000*1/200,000 = 0.02 --- the tube will be very narrow?

  2. following item 1, if my understanding is correct, then when the time series data set becomes larger (0~400,000), although we use the same input setting relativity = true, value = 0.02, axes = X, will the tube suppose to be different?

svenruetz commented 6 years ago

Hello @JayHuLBL , I checked with the developer of the algorithm and this was his answer:

The idea of the curve compare is the automatically compare like in a quadratic result window. Hence we use base = reference.Max() - reference.Min() and in case of relativity == Relativity.Relative value is the relative error. If Y fluctuates between 0 and 1 value * (1 - 0) is the error in the y-direction. This is independent of the error in the x-direction. If you change the values of the x-direction (from 0 second - 200 000 seconds to 0 second - 400 000 seconds) the tube-size in the x-direction changes, but not in the y-direction.

Hence, you understand the calculation of baseX and baseY correctly. But I'm not sure if I understand your question correctly: If your reference data is from example y = 0.5 * (sin(time) + 1) then all data with values between 0 and 1 are accepted. I'm not sure if this is what you want. In this case you can also make the value smaller und use minY = 0.02.

I hope this is the answer of your question.

I hope this helps.

Best regards,

Sven

JayHuLBL commented 6 years ago

@antic-eye Thanks for your reply. It's helpful. One follow-up question is, what are the default settings in the tool (public void Calculate(double value, Axes axes, Relativity relativity))? Are they like:

svenruetz commented 6 years ago

@JayHuLBL yes tehy should be: https://github.com/modelica-tools/csv-compare/blob/d335141d8b1abafb6a73f5ba2f575fa08d094a43/Modelica_ResultCompare/CsvFile.cs#L20