-
Notifications
You must be signed in to change notification settings - Fork 62
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Do calculations as float and not as int for plotting points. #288
base: master
Are you sure you want to change the base?
Conversation
This fixes a problem where points some times seemed too close to each other. Signed-off-by: Tzachi Dar <[email protected]>
Isn't the whole point of @mgranberry, as far as I remember you introduced this? Like it would be after a merge of this pr: This behaviour would not be in, but there would be a lot of legacy code around it :/ Wouldn't it also introduce timings with the precision of milliseconds? In case we want to keep the fuzzer in but weaken the effect we could set it to minutes (or less)? How do we make them equidistant on the chart - without too much calculation costs? |
Will look for @mgranberry answer, but in the meantime... if the readings are a few seconds apart, than I don't think it has an Today, the code breaks them in parts of 2.5 minutes, but this 2.5 minutes This can be fixed, probably by going over the points once, looking for Adrian, can you explain more about the legacy code issues that you see? Thanks On Thu, Mar 3, 2016 at 10:55 AM, AdrianLxM [email protected] wrote:
|
If we would get rid of the fuzzer behaviour alltogether, I would have eliminated the fuzzer... but I've just seen, that PointValue just accepts float values, so we have to make the timestamps (long) float anyways. |
Personally, I've never been a fan of fuzzer. Until I figured out what it did, it made debugging what was going on with xBridge2 difficult. I had to remove it in a branch to get around it. ---- AdrianLxM wrote ----
|
Well, It seems the fuzzer was added around the date 22.3.2015. The way I understand this, there is no problem with the fuzzer, but with the fact that it does not work well. 0, 150, 300, 450, 600, 750, 900. So, first (but not really related) I believe that before doing the calculations, we should add 75 to the value before doing the division. This actually means that we should use the function round() and not flour()... Next step is go over all the packets and find the relative offset. Here is the way that I suggest to do the calculations of the offset: and the point will be set to Here is an example of how this will look with some numbers. Basicly, this are the points with offset == 20 and one point (1199) has shifted. It should have been 1220. So, applying the formula, (point.time + 75 - offset) on this points will yeld (offset == 20): This points when divided by 150, will give us good values (in the middle of the buckets). I hope I was clear, let me know if not, and please let me know if this sounds like a good plan. Obviously, all this was written with the assumption that calculation the offset will be fast. I'll measure that tomorrow, and see how long it will take. (two points about this, (1) I believe that we can calculate the offset based on smaller number of points (for example 20). (2) we can also cache this value all together). All input is welcomed. |
round versus floor: the timeframe/buckets: the offset:
this would basically make the offset the average time (divided by 150, already floored?). Also I think there is a simpler solution without the need to loop over all values twice: I have never seen a case where one value was off more than 30 seconds (xBridge doesn't send it in such a case e.g.). So even in a worstcase scenario it would still make for a good offset that defines the centres of the buckets/timeframes. In short: I would simply take the time of the first value as offset. |
The fuzzer was Stephen's addition. I only cleaned it up a little when fixing something for the Share2. I never really liked it because it seems unwise to throw away any information from the devices. |
This fixes a problem where points some times seemed too close to each other.
Signed-off-by: Tzachi Dar [email protected]
The current code moves from seconds to units of 2.5 minutes.
As a result, since due to measuring errors two points are not guaranteed to be in 5 minutes apart, they might end much closer than they should be.
I'll upload pictures tomorrow for the change.