Skip to main content
letter
. 2020 Jul 30;20(15):4244. doi: 10.3390/s20154244
Algorithm 1. Sub-Classification Tracing.
Input: R = {RSSI1, RSSI2, …, RSSIn}//the collected RSSI samples
Output: NC, IC, DC
Define://initial the center of IC, NC, and DC
    IV = MAX(R), NV = AVERAGE(R), and DV = MIN(R)
    ICT = ϕ, NCT = ϕ, and DCT = ϕ  //temporal collections
    TD = ID = ND = DD = 0.0    //temporal values.
Classify:
For each (RSSIi ∈ R){
//calculate its distance to IV, NV, and DV
ID = abs (IV- RSSIi)
       ND = abs (NV- RSSIi)
       DD = abs (DV- RSSIi)
       //select the minimum distance
       TD = MIN ({ID, ND, DD})
       //add RSSIi to sub-classification
       If (TD= =ID)
       IC = IC + { RSSIi }
       Else if (TD= =ND)
    NC = NC+{ RSSIi }
    Else
    DC = DC + { RSSIi }
    }
Judge:
   //judge the change of sub-classification
   If (ICT = = NCT = = DCT = = ϕ){
       ICT = IC
       NCT = NC
       DCT = DC
       }
GOTO (Reset)
//if convergence, exit
   If (ICT = = IC and NCT = = NC and DCT = = DC)
   GOTO (Exit)
   Else {
       ICT = IC
       NCT = NC
       DCT = DC
       }
Reset: //reset the sub-classification center
IV = AVERAGE (IC)
    NV = AVERAGE (NC)
    DV = AVERAGE (DC)
    GOTO (Classify)
Exit:  //deal with ϕ
   If (NC = = ϕ) {
    TD = (ID + DD)/2
    NC+ = {TD}
    }
EXIT(-)