Research Article

Optimization of Transmission Signal Power through Observation of Congestion in VANets Using the Fuzzy Logic Approach: A Case Study in Highway and Urban Layout

Algorithm 7

Classification of the local congestion level.

// Fuzzy inference system
// Initial setting
updateNeighbors getNeighborhood ();
currentSpeed getSpeed ();
(5) currentDensity getDensity (updateNeighbors);
(6)
(7) // Fuzzification
(8) // Input variables
(9) fzSpeed fuzzification (currentSpeed);
(10) fzDensityfuzzification (currentDensity);
(11)
(12) // In: membership functions
(13) foreach membershipFuncIn[i] getRuleWith (
    fzSpeed, fzDensity) do
(14)
(15)   // Fuzzy inference engine with set of rules
(16)   membershipFuncOut[i] fuzzyInference (
    membershipFuncIn[i]);
(17) done
(18)
(19) // Out: membership functions
(20) foreach fzOut[i] membershipFuncOut () do
(21)
(22)   // Defuzzification with Eq. (2)
(23)   FzTraffic defuzzification (fzOut[i]);
(24) done
(25)
(26)
(27)   if  ( fzTraffic <= 0.28) then
(28)   congestion setFreeLevel (fzTraffic);
(29)
(30)  else if  (fzTraffic <= 0.54) then
(31)   congestion setWeakLevel (fzTraffic);
(32)
(33) else if  (fzTraffic <= 0.8) then
(34)   congestion setModerateLevel (fzTraffic);
(35)
(36)  else
(37)   congestion setSevereLevel (fzTraffic);
(38)
(39) end
(40)
(41) return (congestion);