View full-text article in PMC Sensors (Basel). 2023 Sep 14;23(18):7889. doi: 10.3390/s23187889 Search in PMC Search in PubMed View in NLM Catalog Add to search Copyright and License information © 2023 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (https://creativecommons.org/licenses/by/4.0/). PMC Copyright notice 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 (W≤Avg && Ploss<Pup_curr) {9: Pup_next=1−W∗Pup_org+Pup_curr;10: Pdown_next=Pdown_curr+W∗Pdown_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_curr−W∗Pdown_org;17: Pup_next=Pup_curr−1−W∗Pup_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.length≥10 {27: history.pop0;28: }