Skip to content
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

fix for incorrect decimal shift? #3446

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open

fix for incorrect decimal shift? #3446

wants to merge 8 commits into from

Conversation

SybexX
Copy link
Collaborator

@SybexX SybexX commented Dec 21, 2024

could be a fix for the following problems:
#3439 (reply in thread)
#3445

The error occurs when the following conditions exist:

  • CNNType = DoubleHyprid10 or Digit100
  • Transition from 9 to 0 or a NaN of the last digital digit
  • Extendedresolution disabled

One solution (if you only have digital digits) was/is to activate the Extendedresolution.

Unfortunately, it is impossible to fix the problem correctly, since a number of the last digit greater than 9.994999 is a correctly recognized number for some user/condition and a NaN for others user/condition?
With this fix, a number greater than 9.994999 is always classified as a NaN and the correction is made in the further steps (findDelimiterPos() / checkDigitIncreaseConsistency()).

#3445

Read: 43643.610 - Pre: 4363.904 - Rate: 39279.706,3.8,3.0,6.0,4.0,3.0,7.0,10.0

should be "Read: 4364,369"

#3439 (reply in thread)

[0d00h09m23s] 2024-12-15T14:28:15 <DBG> [CNN] getReadout _analog=0, _extendedResolution=0, prev=-1
[0d00h09m23s] 2024-12-15T14:28:15 <DBG> [CNN] PointerEvalHybridNew - No predecessor - Result = 10 number: 9.996094 number_of_predecessors = -1.000000 eval_predecessors = -1 Digital_Uncertainty = 0.200000
[0d00h09m23s] 2024-12-15T14:28:15 <DBG> [CNN] getReadout(dig100) prev=10
[0d00h09m23s] 2024-12-15T14:28:15 <DBG> [CNN] PointerEvalHybridNew - O analogue predecessor, >= 9.5 --> no zero crossing yet = 4 number: 4.863281 number_of_predecessors = 9.996094 eval_predecessors = 10 Digital_Uncertainty = 0.200000 result_after_decimal_point = 8
[0d00h09m23s] 2024-12-15T14:28:15 <DBG> [CNN] getReadout#PointerEvalHybridNew()= 4
[0d00h09m23s] 2024-12-15T14:28:15 <DBG> [CNN] getReadout#result= 410
[0d00h09m23s] 2024-12-15T14:28:15 <DBG> [CNN] PointerEvalHybridNew - NO analogue predecessor, no change of digits, as pre-decimal point far enough away = 5 number: 4.796875 number_of_predecessors = 4.863281 eval_predecessors = 4 Digital_Uncertainty = 0.200000
[0d00h09m23s] 2024-12-15T14:28:15 <DBG> [CNN] getReadout#PointerEvalHybridNew()= 5
[0d00h09m23s] 2024-12-15T14:28:15 <DBG> [CNN] getReadout#result= 5410
[0d00h09m23s] 2024-12-15T14:28:15 <DBG> [CNN] PointerEvalHybridNew - NO analogue predecessor, no change of digits, as pre-decimal point far enough away = 2 number: 2.000000 number_of_predecessors = 4.796875 eval_predecessors = 5 Digital_Uncertainty = 0.200000
[0d00h09m23s] 2024-12-15T14:28:15 <DBG> [CNN] getReadout#PointerEvalHybridNew()= 2
[0d00h09m23s] 2024-12-15T14:28:15 <DBG> [CNN] getReadout#result= 25410
[0d00h09m23s] 2024-12-15T14:28:15 <DBG> [CNN] PointerEvalHybridNew - NO analogue predecessor, no change of digits, as pre-decimal point far enough away = 7 number: 6.984375 number_of_predecessors = 2.000000 eval_predecessors = 2 Digital_Uncertainty = 0.200000
[0d00h09m23s] 2024-12-15T14:28:15 <DBG> [CNN] getReadout#PointerEvalHybridNew()= 7
[0d00h09m23s] 2024-12-15T14:28:15 <DBG> [CNN] getReadout#result= 725410
[0d00h09m23s] 2024-12-15T14:28:15 <DBG> [CNN] PointerEvalHybridNew - NO analogue predecessor, no change of digits, as pre-decimal point far enough away = 3 number: 3.000000 number_of_predecessors = 6.984375 eval_predecessors = 7 Digital_Uncertainty = 0.200000
[0d00h09m23s] 2024-12-15T14:28:15 <DBG> [CNN] getReadout#PointerEvalHybridNew()= 3
[0d00h09m23s] 2024-12-15T14:28:15 <DBG> [CNN] getReadout#result= 3725410
[0d00h09m23s] 2024-12-15T14:28:15 <DBG> [POSTPROC] handleAllowNegativeRate for device: Gas
[0d00h09m23s] 2024-12-15T14:28:15 <ERR> [POSTPROC] Gas: Raw: 37254.10, Value: , Status: Rate too high - Read: 37254.10 - Pre: 3725.48 - Rate: 33528.62

should be "Read: 3725.49"

@caco3
Copy link
Collaborator

caco3 commented Dec 22, 2024

@SybexX can you please add a description to the pull request?

I think this solution is better than the initial proposal with (int) ((int) trunc(round((number+10 % 10)*1000)) ) / 1000;. Because if I understand it right, that one would again be an issue if somebody would have 5 digits behind the decimal point.

I added some minor changes to the comments.
I will load it onto my devices and let it run for a while to check for regressions.

@caco3
Copy link
Collaborator

caco3 commented Dec 23, 2024

Thanks for the detailed description and the fix of my faulty comment. I must have ben sleepy already 😴

@caco3
Copy link
Collaborator

caco3 commented Dec 25, 2024

@SybexX Since I test this branch I again saw several errors with Neg. Rate - Read: - Raw: 0731.13571 - Pre: 731.13574 "! Differenz (Raw - Pre): -3.000000003794412e-05. I am not sure if this is a coincidence. Before I have not seen them for a longer time.

Notes:

  • Rate Threshold is enabled and set to 2
  • Extended Resolution is enabled.

I am now going to increase it to 5 to work around this.

@SybexX
Copy link
Collaborator Author

SybexX commented Dec 25, 2024

This change only affects the last digital digit or do you not have analog digits?

@caco3
Copy link
Collaborator

caco3 commented Dec 25, 2024

Yes, I have 3 digits + 4 pointers. That's why I also thought it might be a coincidence.

@caco3 caco3 linked an issue Dec 25, 2024 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ROI Recognition as 10.0
2 participants