From fd6db7f8fe1baeca51d05b5d1569a62a7088280c Mon Sep 17 00:00:00 2001 From: Shubham gupta Ggps <24877361+gptshubham595@users.noreply.github.com> Date: Fri, 7 Jul 2023 01:44:36 +0530 Subject: [PATCH 01/10] Update model-distance-calculations.json --- .../model-distance-calculations.json | 66 ++++++++++++++++++- 1 file changed, 63 insertions(+), 3 deletions(-) diff --git a/lib/src/main/resources/model-distance-calculations.json b/lib/src/main/resources/model-distance-calculations.json index 2bda2d1fd..395d2030c 100644 --- a/lib/src/main/resources/model-distance-calculations.json +++ b/lib/src/main/resources/model-distance-calculations.json @@ -31,14 +31,74 @@ "default": false }, { - "coefficient1": 0.1862616782, - "coefficient2": 8.235367435, - "coefficient3": -0.45324519, + "coefficient1": 1.60433254, + "coefficient2": 5.33443408, + "coefficient3": 0, "version":"6.0", "build_number":"MPE24.49-18", "model":"XT1092", "manufacturer":"Motorola", "default": false + }, + { + "coefficient1": 2.65, + "coefficient2": 3.91, + "coefficient3": 1.61, + "version":"12.0", + "build_number":"SP1A.210812.016", + "model":"CPH2401", + "manufacturer":"Oneplus", + "default": false + }, + { + "coefficient1": 0.000475, + "coefficient2": 25.65, + "coefficient3": 5.86, + "version":"6.0", + "build_number":"", + "model":"", + "manufacturer":"Google", + "default": false + }, + { + "coefficient1": 0.102139, + "coefficient2": 13.18, + "coefficient3": 2.38, + "version":"6.0", + "build_number":"", + "model":"", + "manufacturer":"Oppo", + "default": false + }, + { + "coefficient1":1.660582 , + "coefficient2": 6.05, + "coefficient3": 0.67, + "version":"6.0", + "build_number":"", + "model":"", + "manufacturer":"Redmi", + "default": false + }, + { + "coefficient1": 1.35070638 , + "coefficient2": 7.31428284, + "coefficient3": 0, + "version":"6.0", + "build_number":"", + "model":"", + "manufacturer":"samsung", + "default": false + }, + { + "coefficient1": 1.9504739, + "coefficient2": 5.42879314, + "coefficient3": 0, + "version":"6.0", + "build_number":"", + "model":"", + "manufacturer":"Vivo", + "default": false } ] } From f057ea02c3001dde56f3f6963984a082d792aaf0 Mon Sep 17 00:00:00 2001 From: Shubham gupta Ggps <24877361+gptshubham595@users.noreply.github.com> Date: Fri, 7 Jul 2023 19:49:13 +0530 Subject: [PATCH 02/10] Create Proximity iBeacon Script Power Regression.py --- Proximity iBeacon Script Power Regression.py | 129 +++++++++++++++++++ 1 file changed, 129 insertions(+) create mode 100644 Proximity iBeacon Script Power Regression.py diff --git a/Proximity iBeacon Script Power Regression.py b/Proximity iBeacon Script Power Regression.py new file mode 100644 index 000000000..6de8a9dfd --- /dev/null +++ b/Proximity iBeacon Script Power Regression.py @@ -0,0 +1,129 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- +""" +Created on Mon Dec 26 15:23:54 2022 + +@author: shubham.gupta7 +""" + +# fit a line to the economic data +import numpy, scipy, matplotlib +import matplotlib.pyplot as plt +from scipy.optimize import curve_fit +from scipy.optimize import differential_evolution +import warnings +import math +import numpy as np + +vector = np.vectorize(np.int_) + +yData = numpy.array([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 18, 20, 27, 34, 41]) + +xData=[1.176470588, 1.215686275, 1.352941176, 1.176470588, 1.254901961, 1.431372549, 1.254901961, 1.31372549, 1.274509804, 1.784313725, 1.490196078, 1.411764706, 1.529411765, 1.588235294, 1.549019608, 1.568627451, 1.450980392, 1.68627451, 1.62745098, 1.62745098] + +def func2(x, a, b, c): # from the zunzun.com "function finder" + return (a * (x**b) + c) + +def func(x, a, b): # from the zunzun.com "function finder" + return (a * (x**b)) + +def func3(x, a, b, c, d, e): # from the zunzun.com "function finder" + y=[] + for i in range(len(x)): + y.append((a * math.exp(b*x[i]) + c * (x[i]**d) + e)) + return y + +# function for genetic algorithm to minimize (sum of squared error) +def sumOfSquaredError(parameterTuple): + warnings.filterwarnings("ignore") # do not print warnings by genetic algorithm + val = func(xData, *parameterTuple) + return numpy.sum((yData - val) ** 2.0) + + +def generate_Initial_Parameters(i): + # min and max used for bounds + maxX = max(xData) + minX = min(xData) + maxY = max(yData) + minY = min(yData) + + minData = min(minX, minY) + maxData = max(maxX, maxY) + + parameterBounds = [] + parameterBounds.append([0, maxData]) # search bounds for a + parameterBounds.append([0, maxData]) # search bounds for b + if(i==1): + parameterBounds.append([0, maxData]) # search bounds for c + if(i==2): + parameterBounds.append([0, maxData]) # search bounds for d + parameterBounds.append([0, maxData]) # search bounds for e + + # "seed" the numpy random number generator for repeatable results + result = differential_evolution(sumOfSquaredError, parameterBounds, seed=5) + return result.x + + +# by default, differential_evolution completes by calling curve_fit() using parameter bounds +geneticParameters = generate_Initial_Parameters(0) + +# now call curve_fit without passing bounds from the genetic algorithm, +# just in case the best fit parameters are aoutside those bounds +#fittedParameters, pcov = curve_fit(func, xData, yData, geneticParameters, maxfev=3000) +bestfit = [] +bestRSq = 1000 + + +#for i in range(3): +fittedParameters, pcov = curve_fit(func, xData, yData, geneticParameters, maxfev=8000) + +print('Fitted parameters:', fittedParameters) +print() + +modelPredictions = func(xData, *fittedParameters) + +absError = modelPredictions - yData +SE = numpy.square(absError) # squared errors +MSE = numpy.mean(SE) # mean squared errors +RMSE = numpy.sqrt(MSE) # Root Mean Squared Error, RMSE + +Rsquared = 1.0 - (numpy.var(absError) / numpy.var(yData)) +if(bestRSq>Rsquared): + bestRSq = Rsquared + bestfit = fittedParameters +print() +print('RMSE:', RMSE) +print('R-squared:', Rsquared) + +print() + +print(bestRSq) +print(bestfit) + + +########################################################## +# graphics output section +def ModelAndScatterPlot(graphWidth, graphHeight): + f = plt.figure(figsize=(graphWidth/100.0, graphHeight/100.0), dpi=100) + axes = f.add_subplot(111) + + # first the raw data as a scatter plot + axes.plot(xData, yData, 'D') + + # create data for the fitted equation plot + xModel = numpy.linspace(min(xData), max(xData)) + yModel = func(xModel, *fittedParameters) #change it to fun or fun2 + + # now the model as a line plot + axes.plot(xModel, yModel) + + axes.set_xlabel('X Data') # X axis data label + axes.set_ylabel('Y Data') # Y axis data label + + plt.show() + plt.close('all') # clean up after using pyplot + + +graphWidth = 800 +graphHeight = 600 +ModelAndScatterPlot(graphWidth, graphHeight) From 1f80baed7a5441b1fcaaf7a750ab01d3f8955617 Mon Sep 17 00:00:00 2001 From: Shubham gupta Ggps <24877361+gptshubham595@users.noreply.github.com> Date: Sat, 8 Jul 2023 04:37:46 +0530 Subject: [PATCH 03/10] Create python_script_to_get_coefficients.py --- .../python_script_to_get_coefficients.py | 129 ++++++++++++++++++ 1 file changed, 129 insertions(+) create mode 100644 lib/scripts/python_script_to_get_coefficients.py diff --git a/lib/scripts/python_script_to_get_coefficients.py b/lib/scripts/python_script_to_get_coefficients.py new file mode 100644 index 000000000..6de8a9dfd --- /dev/null +++ b/lib/scripts/python_script_to_get_coefficients.py @@ -0,0 +1,129 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- +""" +Created on Mon Dec 26 15:23:54 2022 + +@author: shubham.gupta7 +""" + +# fit a line to the economic data +import numpy, scipy, matplotlib +import matplotlib.pyplot as plt +from scipy.optimize import curve_fit +from scipy.optimize import differential_evolution +import warnings +import math +import numpy as np + +vector = np.vectorize(np.int_) + +yData = numpy.array([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 18, 20, 27, 34, 41]) + +xData=[1.176470588, 1.215686275, 1.352941176, 1.176470588, 1.254901961, 1.431372549, 1.254901961, 1.31372549, 1.274509804, 1.784313725, 1.490196078, 1.411764706, 1.529411765, 1.588235294, 1.549019608, 1.568627451, 1.450980392, 1.68627451, 1.62745098, 1.62745098] + +def func2(x, a, b, c): # from the zunzun.com "function finder" + return (a * (x**b) + c) + +def func(x, a, b): # from the zunzun.com "function finder" + return (a * (x**b)) + +def func3(x, a, b, c, d, e): # from the zunzun.com "function finder" + y=[] + for i in range(len(x)): + y.append((a * math.exp(b*x[i]) + c * (x[i]**d) + e)) + return y + +# function for genetic algorithm to minimize (sum of squared error) +def sumOfSquaredError(parameterTuple): + warnings.filterwarnings("ignore") # do not print warnings by genetic algorithm + val = func(xData, *parameterTuple) + return numpy.sum((yData - val) ** 2.0) + + +def generate_Initial_Parameters(i): + # min and max used for bounds + maxX = max(xData) + minX = min(xData) + maxY = max(yData) + minY = min(yData) + + minData = min(minX, minY) + maxData = max(maxX, maxY) + + parameterBounds = [] + parameterBounds.append([0, maxData]) # search bounds for a + parameterBounds.append([0, maxData]) # search bounds for b + if(i==1): + parameterBounds.append([0, maxData]) # search bounds for c + if(i==2): + parameterBounds.append([0, maxData]) # search bounds for d + parameterBounds.append([0, maxData]) # search bounds for e + + # "seed" the numpy random number generator for repeatable results + result = differential_evolution(sumOfSquaredError, parameterBounds, seed=5) + return result.x + + +# by default, differential_evolution completes by calling curve_fit() using parameter bounds +geneticParameters = generate_Initial_Parameters(0) + +# now call curve_fit without passing bounds from the genetic algorithm, +# just in case the best fit parameters are aoutside those bounds +#fittedParameters, pcov = curve_fit(func, xData, yData, geneticParameters, maxfev=3000) +bestfit = [] +bestRSq = 1000 + + +#for i in range(3): +fittedParameters, pcov = curve_fit(func, xData, yData, geneticParameters, maxfev=8000) + +print('Fitted parameters:', fittedParameters) +print() + +modelPredictions = func(xData, *fittedParameters) + +absError = modelPredictions - yData +SE = numpy.square(absError) # squared errors +MSE = numpy.mean(SE) # mean squared errors +RMSE = numpy.sqrt(MSE) # Root Mean Squared Error, RMSE + +Rsquared = 1.0 - (numpy.var(absError) / numpy.var(yData)) +if(bestRSq>Rsquared): + bestRSq = Rsquared + bestfit = fittedParameters +print() +print('RMSE:', RMSE) +print('R-squared:', Rsquared) + +print() + +print(bestRSq) +print(bestfit) + + +########################################################## +# graphics output section +def ModelAndScatterPlot(graphWidth, graphHeight): + f = plt.figure(figsize=(graphWidth/100.0, graphHeight/100.0), dpi=100) + axes = f.add_subplot(111) + + # first the raw data as a scatter plot + axes.plot(xData, yData, 'D') + + # create data for the fitted equation plot + xModel = numpy.linspace(min(xData), max(xData)) + yModel = func(xModel, *fittedParameters) #change it to fun or fun2 + + # now the model as a line plot + axes.plot(xModel, yModel) + + axes.set_xlabel('X Data') # X axis data label + axes.set_ylabel('Y Data') # Y axis data label + + plt.show() + plt.close('all') # clean up after using pyplot + + +graphWidth = 800 +graphHeight = 600 +ModelAndScatterPlot(graphWidth, graphHeight) From 1c18740d076b54ff54c46bbeb710d069374827bd Mon Sep 17 00:00:00 2001 From: Shubham gupta Ggps <24877361+gptshubham595@users.noreply.github.com> Date: Sat, 8 Jul 2023 04:39:34 +0530 Subject: [PATCH 04/10] Delete Proximity iBeacon Script Power Regression.py --- Proximity iBeacon Script Power Regression.py | 129 ------------------- 1 file changed, 129 deletions(-) delete mode 100644 Proximity iBeacon Script Power Regression.py diff --git a/Proximity iBeacon Script Power Regression.py b/Proximity iBeacon Script Power Regression.py deleted file mode 100644 index 6de8a9dfd..000000000 --- a/Proximity iBeacon Script Power Regression.py +++ /dev/null @@ -1,129 +0,0 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- -""" -Created on Mon Dec 26 15:23:54 2022 - -@author: shubham.gupta7 -""" - -# fit a line to the economic data -import numpy, scipy, matplotlib -import matplotlib.pyplot as plt -from scipy.optimize import curve_fit -from scipy.optimize import differential_evolution -import warnings -import math -import numpy as np - -vector = np.vectorize(np.int_) - -yData = numpy.array([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 18, 20, 27, 34, 41]) - -xData=[1.176470588, 1.215686275, 1.352941176, 1.176470588, 1.254901961, 1.431372549, 1.254901961, 1.31372549, 1.274509804, 1.784313725, 1.490196078, 1.411764706, 1.529411765, 1.588235294, 1.549019608, 1.568627451, 1.450980392, 1.68627451, 1.62745098, 1.62745098] - -def func2(x, a, b, c): # from the zunzun.com "function finder" - return (a * (x**b) + c) - -def func(x, a, b): # from the zunzun.com "function finder" - return (a * (x**b)) - -def func3(x, a, b, c, d, e): # from the zunzun.com "function finder" - y=[] - for i in range(len(x)): - y.append((a * math.exp(b*x[i]) + c * (x[i]**d) + e)) - return y - -# function for genetic algorithm to minimize (sum of squared error) -def sumOfSquaredError(parameterTuple): - warnings.filterwarnings("ignore") # do not print warnings by genetic algorithm - val = func(xData, *parameterTuple) - return numpy.sum((yData - val) ** 2.0) - - -def generate_Initial_Parameters(i): - # min and max used for bounds - maxX = max(xData) - minX = min(xData) - maxY = max(yData) - minY = min(yData) - - minData = min(minX, minY) - maxData = max(maxX, maxY) - - parameterBounds = [] - parameterBounds.append([0, maxData]) # search bounds for a - parameterBounds.append([0, maxData]) # search bounds for b - if(i==1): - parameterBounds.append([0, maxData]) # search bounds for c - if(i==2): - parameterBounds.append([0, maxData]) # search bounds for d - parameterBounds.append([0, maxData]) # search bounds for e - - # "seed" the numpy random number generator for repeatable results - result = differential_evolution(sumOfSquaredError, parameterBounds, seed=5) - return result.x - - -# by default, differential_evolution completes by calling curve_fit() using parameter bounds -geneticParameters = generate_Initial_Parameters(0) - -# now call curve_fit without passing bounds from the genetic algorithm, -# just in case the best fit parameters are aoutside those bounds -#fittedParameters, pcov = curve_fit(func, xData, yData, geneticParameters, maxfev=3000) -bestfit = [] -bestRSq = 1000 - - -#for i in range(3): -fittedParameters, pcov = curve_fit(func, xData, yData, geneticParameters, maxfev=8000) - -print('Fitted parameters:', fittedParameters) -print() - -modelPredictions = func(xData, *fittedParameters) - -absError = modelPredictions - yData -SE = numpy.square(absError) # squared errors -MSE = numpy.mean(SE) # mean squared errors -RMSE = numpy.sqrt(MSE) # Root Mean Squared Error, RMSE - -Rsquared = 1.0 - (numpy.var(absError) / numpy.var(yData)) -if(bestRSq>Rsquared): - bestRSq = Rsquared - bestfit = fittedParameters -print() -print('RMSE:', RMSE) -print('R-squared:', Rsquared) - -print() - -print(bestRSq) -print(bestfit) - - -########################################################## -# graphics output section -def ModelAndScatterPlot(graphWidth, graphHeight): - f = plt.figure(figsize=(graphWidth/100.0, graphHeight/100.0), dpi=100) - axes = f.add_subplot(111) - - # first the raw data as a scatter plot - axes.plot(xData, yData, 'D') - - # create data for the fitted equation plot - xModel = numpy.linspace(min(xData), max(xData)) - yModel = func(xModel, *fittedParameters) #change it to fun or fun2 - - # now the model as a line plot - axes.plot(xModel, yModel) - - axes.set_xlabel('X Data') # X axis data label - axes.set_ylabel('Y Data') # Y axis data label - - plt.show() - plt.close('all') # clean up after using pyplot - - -graphWidth = 800 -graphHeight = 600 -ModelAndScatterPlot(graphWidth, graphHeight) From 8f268b44840072ba173dcf1d62103ae44caf37f9 Mon Sep 17 00:00:00 2001 From: Shubham gupta Ggps <24877361+gptshubham595@users.noreply.github.com> Date: Tue, 11 Jul 2023 11:54:45 +0530 Subject: [PATCH 05/10] Update python_script_to_get_coefficients.py --- lib/scripts/python_script_to_get_coefficients.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/scripts/python_script_to_get_coefficients.py b/lib/scripts/python_script_to_get_coefficients.py index 6de8a9dfd..fa0915ce6 100644 --- a/lib/scripts/python_script_to_get_coefficients.py +++ b/lib/scripts/python_script_to_get_coefficients.py @@ -3,7 +3,7 @@ """ Created on Mon Dec 26 15:23:54 2022 -@author: shubham.gupta7 +@author: gptshubham595 """ # fit a line to the economic data From 01ab2889c009c8390098c73f1daf30b58fac4177 Mon Sep 17 00:00:00 2001 From: Shubham gupta Ggps <24877361+gptshubham595@users.noreply.github.com> Date: Tue, 11 Jul 2023 11:58:02 +0530 Subject: [PATCH 06/10] Script Readme.md --- lib/scripts/Readme.md | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 lib/scripts/Readme.md diff --git a/lib/scripts/Readme.md b/lib/scripts/Readme.md new file mode 100644 index 000000000..9f2fc3a8c --- /dev/null +++ b/lib/scripts/Readme.md @@ -0,0 +1,26 @@ +## INSTRUCTION TO USE THR POWER REGRESSION PYTHON SCRIPT + +In the given scenario, we have two variables, namely `xData` and `yData`. The xData variable represents a list of ratios of RSSI (Received Signal Strength Indication) values between your phone and the iPhone at a distance of 1 meter. On the other hand, the yData variable represents the corresponding distances in meters. + +To approximate the distance based on the RSSI values, a function called `fun()` is defined. This function follows the form of `Ax^B`, where A and B are coefficients. However, it is possible to modify the equation and find a better approach by using a different form, such as `Ax^B+C`. + +By utilizing this equation and the coefficients obtained, it becomes possible to estimate the approximate or much closer distance value compared to the actual distance. This estimation is achieved by applying the modified equation to the RSSI ratios from xData. The resulting values will correspond to the distances in yData. + + +## About the script + + - The given code snippet performs a curve fitting analysis on a set of economic data using the `scipy.optimize.curve_fit` function. The goal is to find the best-fit curve that approximates the relationship between two variables, xData and yData. + + - The code begins by importing the necessary libraries, such as `numpy`, `scipy`, and `matplotlib`, and defining the required functions and variables. It defines three functions: `func, func2, and func3`, each representing a different mathematical equation form for the curve fitting. + + - Next, the `sumOfSquaredError` function is defined, which calculates the sum of squared errors between the observed `yData` and the values predicted by the curve fitting function. This function will be used by the genetic algorithm implemented in the `differential_evolution `method to minimize the error and find optimal parameter values. + + - The `generate_Initial_Parameters` function sets the search bounds for the parameters (a, b, c, d, and e) used in the curve fitting process. It then calls the differential_evolution function to find the initial parameter values that minimize the sum of squared errors. + + - The code then proceeds to fit the curve using the curve_fit function, passing the `func`, `xData`, `yData`, and the initial parameter values obtained from the genetic algorithm. The resulting `fittedParameters` represent the best-fit parameters for the curve. + + - After fitting the curve, the code calculates various evaluation metrics, such as the root mean squared error (RMSE) and the coefficient of determination (R-squared), to assess the quality of the fit. It also keeps track of the best-fit parameters and the corresponding R-squared value. + + - Finally, the code generates a scatter plot of the raw data points (`xData` and `yData`) and overlays the fitted curve based on the `fittedParameters`. The plot is displayed using `matplotlib.pyplot` and then closed. + + - Overall, this code performs a curve-fitting analysis on economic data, finds the best-fit curve using a genetic algorithm and curve_fit, and visualizes the results through a scatter plot. From bd84059751aafdf6e47b692877d6567ce7b66b15 Mon Sep 17 00:00:00 2001 From: Shubham gupta Ggps <24877361+gptshubham595@users.noreply.github.com> Date: Tue, 11 Jul 2023 12:00:52 +0530 Subject: [PATCH 07/10] Add files via upload --- ...ve Distance Formula Calculation iBeacon.xlsx | Bin 0 -> 13858 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 lib/scripts/[Shared] Power Curve Distance Formula Calculation iBeacon.xlsx diff --git a/lib/scripts/[Shared] Power Curve Distance Formula Calculation iBeacon.xlsx b/lib/scripts/[Shared] Power Curve Distance Formula Calculation iBeacon.xlsx new file mode 100644 index 0000000000000000000000000000000000000000..0105e215ad162c2cbe6d1d3b9fa15b0b5ee14eb9 GIT binary patch literal 13858 zcmbVz1yo!~w=OQBahKqM;NG}Pa3@%BcXxLU8r+@W?(XjHL4#ZH01q<%yOWtaciwup zdaXXE8_uq(UE98@uVp2`A<#fzU|>Kdn-4yM{MOK3?w!r)^o(_E?d|@!Fwi<%m>(;v zTP@L}JwZMos?G!*XC+o>swft|M_0)ESe&`sY=gHsn=k;RzPq`62b(*Ap;TNW4IiV| zzvsSp%bDO`ed#-?9gs)ti`Z2-4G%sNEefLr=pt~6?e@fa5AOo@b;B7cUL|0!8`0>! z2=*7(ctL+~zfL6pv`)SQK6s{VAhzP$Xg$koc_Qo?Lkdj7=(GAxL$n`FtEe4>-*oaK zH8W3B3qiMeK!~MayAr@?uy>boL?yF;5QX8}MIw4`ciovSTDw7_6)Suru|1>ThHSAn}^;5+@*g|U2ITsB4$CeM-x^O7O1 z^NpH|Qveh!7gF`i1z!TYv{V_O>uVw$4W*b>hm@ULP$hxpY~hdiAJ!Zx8jw`8u(Tng zHnD>l3r18~t*JM|;Vf>MWD1EfSrsKK)(yD+dy3zqdnU#{e^D{r$oJo}d7Fm*Wk*Gp zXch`46g~c0BqsYxWdLG$4)ru>$~IJiQzEDuptt(qY;A+2Y9+s?Kr`W7Mww25h%_9_ zUwFHTogC@*`_2@j-Y}4TS%30aOIKbpfF{QjP*g z-)&2x&JQHVt8&gsUeEYokW=o^8%mgg$bK%u5FJ+K(>u=`C)bOe+lKYy2apohY)d+h z5Lc~-I76zjzE!z%(kOumV`}%r5EJn-OcyzkTX<^I$T?rwe3h+_0v($l6&sn$<+ocw zxu!v$Y*$lylIh>x-gK*w_MNbfRQl(4QdN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LtPSimUj4LJaoDn(5b3Ay zlV5LbsF-bG5v3!72i~%{6t6bi;ldlJo|yS{Ckyg8oJM)#-UAaK9iu=49pL&b*`jvl z(4wT|RHf(yWdT+5NYCD;fju2cs5T3h5d*3lDZ{vxVOZ-2akfQyvLUQTzc0DsB|h?d zlZ^5WvVz+tD&mNykP=^}&u^tEjYyW*Lg9l3jAT?gmU^};)vXGdK-W^l`SrD828AwK z^eU}J;fftsOxgs4%Vn9qu3+DR$C!7Ma;N^t@Q@6;{0S53DPD?hxfK_=v@$$^5Qf&BRskl#t^uLbL0+dusvD*4*q>uzn?Yzby$}#PX02v-_Do*JX!j?l;2Nl{yHoa?7vI-$5X1m3;Z1j{&iRw zFH!m*hV_ry`W*=Ubyxthzf1XTSbsvuzYpv8I`*%|Bv1ZJ;D19?f0yukVene-{@J!E z{*drr)$iXQ{XL1jRt|r*S?d3q&Ht?<{{Haqas4&V{n_+se?9!i{Qq0l`@5XqgXU`% u__IaO{Us;-{lVY8{57Wj*<9%VF~Z79K)#>_5D>(d7aRl#2q@$0r~d;s(Y6Qx literal 0 HcmV?d00001 From 7f1611e3f4f383d96e2479e00b83e11b452951b0 Mon Sep 17 00:00:00 2001 From: Shubham gupta Ggps <24877361+gptshubham595@users.noreply.github.com> Date: Tue, 11 Jul 2023 12:04:16 +0530 Subject: [PATCH 08/10] Update Readme.md --- lib/scripts/Readme.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/lib/scripts/Readme.md b/lib/scripts/Readme.md index 9f2fc3a8c..2cdcd6cf2 100644 --- a/lib/scripts/Readme.md +++ b/lib/scripts/Readme.md @@ -24,3 +24,13 @@ By utilizing this equation and the coefficients obtained, it becomes possible to - Finally, the code generates a scatter plot of the raw data points (`xData` and `yData`) and overlays the fitted curve based on the `fittedParameters`. The plot is displayed using `matplotlib.pyplot` and then closed. - Overall, this code performs a curve-fitting analysis on economic data, finds the best-fit curve using a genetic algorithm and curve_fit, and visualizes the results through a scatter plot. + +## Excel Sheet + +- The provided Excel sheet serves as a reference tool for comparing and analyzing distance values based on measured RSSI (Received Signal Strength Indication) values. It is designed to work in conjunction with the script mentioned earlier to obtain the coefficients required for the distance comparison. + + - The Excel sheet allows users to input the necessary data, including the measured RSSI values and corresponding distance values. These values are typically obtained from experimental measurements or data collection processes. + + - Once the data is entered into the Excel sheet, the script mentioned earlier comes into play. It uses the curve fitting algorithm to find the best-fit curve that approximates the relationship between RSSI values and distances. By fitting the data to a mathematical equation, the script determines the coefficients that provide the closest match to the observed data. + + - These coefficients are then obtained from the script and can be manually entered into the Excel sheet. By doing so, the Excel sheet can utilize the coefficients to calculate and display the estimated distances corresponding to new or additional RSSI values. From 6177fb83b7505def22f55b28504ad9ea4b101a2a Mon Sep 17 00:00:00 2001 From: Shubham gupta Ggps <24877361+gptshubham595@users.noreply.github.com> Date: Tue, 11 Jul 2023 12:12:24 +0530 Subject: [PATCH 09/10] Update Readme.md --- lib/scripts/Readme.md | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/lib/scripts/Readme.md b/lib/scripts/Readme.md index 2cdcd6cf2..d37ea7ed2 100644 --- a/lib/scripts/Readme.md +++ b/lib/scripts/Readme.md @@ -34,3 +34,46 @@ By utilizing this equation and the coefficients obtained, it becomes possible to - Once the data is entered into the Excel sheet, the script mentioned earlier comes into play. It uses the curve fitting algorithm to find the best-fit curve that approximates the relationship between RSSI values and distances. By fitting the data to a mathematical equation, the script determines the coefficients that provide the closest match to the observed data. - These coefficients are then obtained from the script and can be manually entered into the Excel sheet. By doing so, the Excel sheet can utilize the coefficients to calculate and display the estimated distances corresponding to new or additional RSSI values. + +## INSTRUCTION TO BUILD YOUR OWN SHEET + +### Calculating Formula Constants + + After taking distance measurements for a specific Android device, the next step is to run a power regression to get the A, B and C constants used in the y=A*x^B+C formula. + +### Make a spreadsheet + + Create a new spreadsheet using Excel, Google Docs or similar. You can see an example spreadsheet [here](https://docs.google.com/spreadsheets/d/1ymREowDj40tYuA5CXd4IfC4WYPXxlx5hq1x8tQcWWCI/edit?usp=sharing) that you can follow as a guide. + + - Paste Your Data + - Paste your measured iPhone 1m RSSI average into table 1. + - Paste your measured RSSI values at various distances for the Android device into table 2. + - Step 1: Calculate Ratio + - Make a new column beside your measured RSSI values at various distances. Divide your measured RSSI at each distance by the iPhone 1m measured RSSI. + +### Step 2: Format Data for Regression + + Make two new columns and copy your ratio values into the first column and the distance values into the second column. This will align your dependent and independent varaibles for the power regression. + +### Step 3: Run the Regression + +While there are many tools that can be used to run a power regression, the online website [here](http://www.xuru.org/rt/powr.asp) may be the easiest. Just paste the two columns from the previous step into the form field, and it will output the A and B constants. + +### Step 4: Test the Prediction + + Make four new columns to form table 5: RSSI, Ratio, Actual Distance, Predicted Distance, and paste for existing values into the first three. For the fourth column, calculate the predicted distance using the formula y=A*x^B. + +### Step 4. Calculate C + + The power regression assumes a zero intercept. In order to optimize distance estimates at 1 meter, we add an intercept variable C. To do this, subtract the actual distance from the predicted distance in table 5 above, and put this in table 6. + +### Step 5. Test the Prediction again + + Make four new columns to form table 7: RSSI, Ratio, Actual Distance, Predicted Distance, and paste for existing values into the first three. For the fourth column, calculate the predicted distance using the formula y=A*x^B+C. This is the final formula. + +### Step 6. Validate Results + + Check the predicted distances against the actual distances to see that the formula provides a reasonable fit for the device. You may wish to compare if this customized formula predicts distance better than the default Nexus formula with the library before submitting the constants for inclusion in the library. + +### Step 7. Submit a Pull Request + Submit a new Pull Request to the Android Beacon Library project, providing a link to your spreadsheet calculations. From 184b52d897a8d7631a867f73162462b77ce581fb Mon Sep 17 00:00:00 2001 From: Shubham gupta Ggps <24877361+gptshubham595@users.noreply.github.com> Date: Thu, 20 Jul 2023 02:35:30 +0530 Subject: [PATCH 10/10] Update model-distance-calculations.json --- .../model-distance-calculations.json | 66 +------------------ 1 file changed, 3 insertions(+), 63 deletions(-) diff --git a/lib/src/main/resources/model-distance-calculations.json b/lib/src/main/resources/model-distance-calculations.json index 395d2030c..2bda2d1fd 100644 --- a/lib/src/main/resources/model-distance-calculations.json +++ b/lib/src/main/resources/model-distance-calculations.json @@ -31,74 +31,14 @@ "default": false }, { - "coefficient1": 1.60433254, - "coefficient2": 5.33443408, - "coefficient3": 0, + "coefficient1": 0.1862616782, + "coefficient2": 8.235367435, + "coefficient3": -0.45324519, "version":"6.0", "build_number":"MPE24.49-18", "model":"XT1092", "manufacturer":"Motorola", "default": false - }, - { - "coefficient1": 2.65, - "coefficient2": 3.91, - "coefficient3": 1.61, - "version":"12.0", - "build_number":"SP1A.210812.016", - "model":"CPH2401", - "manufacturer":"Oneplus", - "default": false - }, - { - "coefficient1": 0.000475, - "coefficient2": 25.65, - "coefficient3": 5.86, - "version":"6.0", - "build_number":"", - "model":"", - "manufacturer":"Google", - "default": false - }, - { - "coefficient1": 0.102139, - "coefficient2": 13.18, - "coefficient3": 2.38, - "version":"6.0", - "build_number":"", - "model":"", - "manufacturer":"Oppo", - "default": false - }, - { - "coefficient1":1.660582 , - "coefficient2": 6.05, - "coefficient3": 0.67, - "version":"6.0", - "build_number":"", - "model":"", - "manufacturer":"Redmi", - "default": false - }, - { - "coefficient1": 1.35070638 , - "coefficient2": 7.31428284, - "coefficient3": 0, - "version":"6.0", - "build_number":"", - "model":"", - "manufacturer":"samsung", - "default": false - }, - { - "coefficient1": 1.9504739, - "coefficient2": 5.42879314, - "coefficient3": 0, - "version":"6.0", - "build_number":"", - "model":"", - "manufacturer":"Vivo", - "default": false } ] }