Skip to main content
. 2023 Sep 14;23(18):7889. doi: 10.3390/s23187889
Algorithm 2: Threshold Update Algorithm
1:  if (Current window is RTS window || Next window is RTS window){
2:       Pup_next=Pup_curr;
3:       Pdown_next=Pdown_curr;
4:   }
5:  else {
6:    W=0.2  (sum(history_loss)/history_loss.length)+0.8  Ploss;
7:    Avg=(Pup_org+Pdown_org )/2; 
8:    if (WAvg && Ploss<Pup_curr) {
9:            Pup_next=1WPup_org+Pup_curr;
10:          Pdown_next=Pdown_curr+WPdown_org;
11:          if (Pup_next>0.3)  {Pup_next=0.3; }
12:          if (Pdown_next>0.5)  { Pdown_next=0.5; }
13:          break;
14:    }
15:   if (W>Avg && Ploss>Pdown_curr) {
16:          Pdown_next=Pdown_currWPdown_org;
17:          Pup_next=Pup_curr1WPup_org;
18:          if (Pdown_next<0.3) {Pdown_next=0.3; }
19:          if (Pup_next<0.1)  { Pup_next=0.1; }
20:          break;
21:       }
22:      Pup_next=Pup_curr;
23:      Pdown_next=Pdown_curr;
24:   }
25:  history_loss.appendPloss;
26:  if history_loss.length10 {
27:   history.pop0;
28:  }