Fuel calcualtion and formula size

Ubaid 2 years ago

I have used the following expression and it worked

io270 < 28 ? 0:
(io270 >=  1 && io270 < 28 )? (0.888888888888889 * io270)+-0.888888888888886:
(io270 >=  28 && io270 < 68 )? (0.25 * io270)+17:
(io270 >=  68 && io270 < 114 )? (0.217391304347826 * io270)+19.2173913043478:
(io270 >=  114 && io270 < 158 )? (0.227272727272727 * io270)+18.0909090909091:
(io270 >=  158 && io270 < 203 )? (0.222222222222222 * io270)+18.8888888888889:
(io270 >=  203 && io270 < 247 )? (0.227272727272727 * io270)+17.8636363636364:
(io270 >=  247 && io270 < 289 )? (0.238095238095238 * io270)+15.1904761904762:
(io270 >=  289 && io270 < 331 )? (0.238095238095238 * io270)+15.1904761904762:
(io270 >=  331 && io270 < 375 )? (0.227272727272727 * io270)+18.7727272727273:
(io270 >=  375 && io270 < 462 )? (0.229885057471264 * io270)+17.7931034482759:
(io270 >=  462 && io270 < 505 )? (0.232558139534884 * io270)+16.5581395348837:
(io270 >=  505 && io270 < 549 )? (0.227272727272727 * io270)+19.2272727272727:
(io270 >=  549 && io270 < 591 )? (0.238095238095238 * io270)+13.2857142857143:
(io270 >=  591 && io270 < 634 )? (0.232558139534884 * io270)+16.5581395348837:
(io270 >=  634 && io270 < 677 )? (0.232558139534884 * io270)+16.5581395348837:
(io270 >=  677 && io270 < 720 )? (0.232558139534884 * io270)+16.5581395348837:
(io270 >=  720 && io270 < 804 )? (0.238095238095238 * io270)+12.5714285714286:
(io270 >=  804 && io270 < 844 )? (0.25 * io270)+3:
(io270 >=  844 && io270 < 889 )? (0.222222222222222 * io270)+26.4444444444445:
(io270 >=  889 && io270 < 934 )? (0.222222222222222 * io270)+26.4444444444445:
(io270 >=  934 && io270 < 983 )? (0.204081632653061 * io270)+43.3877551020408:
(io270 >=  983 && io270 < 1023 )? (0.175 * io270)+71.975:8000

Thanks for instant response & support.

Rishi 20 days ago

Hi,

In the above discussions, it seems each device must have its own calibration values based on tank size and sensor output.
If we have multiple devices with different tank capacities and different calibration curves, what is the global solution for handling fuel calibration in Traccar?

Is there a way to avoid manually setting computed attributes per device, and instead use a scalable approach that automatically adjusts calibration based on device-specific tank parameters, without hardcoding logic for each device?

Anton Tananaev 20 days ago

You can store some attribute in the device and then use those variables.