Skip to main content
. 2024 Feb 28;24(5):1552. doi: 10.3390/s24051552
Algorithm 1. Proposed self-tuning fuzzy logic controllers
Input:           Ppedal: pedal power
             Verr: velocity error
Output:           Pmotor: assisted motor power
Function:          ruleTuningModule(velocity error);
                       //return a new rule base;
             fuzzyLogicControl(pedal power, velocity error, rule base);
                   //return an assisted motor power;
Initialization:
1.  Initial setting of parameters.
2.  Ppedal ← 0;
3.  Verr ← 0;
4.  powerAssistedMode ← False;
5.  ruleTuningMode ← True;
6.  Set the rule base of pedal power and velocity error.
7.  RB← default; //rule base for the ordinary rider (0–100 W)
Main:
8.  while (powerAssistedMode == True) do
9.   Read and convert inputs to the pedal power and velocity error.
10.   if (ruleTuningMode == True) then
11.    Activate the rule tuning module.
12.    Adjust fuzzy rules according to velocity errors.
13.     RB← ruleTuningModule(verr);
14.   end if
15.   Compute the assisted motor power using the designed FLC.
16.   Pmotor ← fuzzyLogicControl (Ppedal, verr, RB);
17.  end while