| Algorithm 10. Data Transmission Success Rate for Receiver: |
| DTSR Algorithm (Receiver Side) : Evaluates the LCS’s data reception fidelity. It captures laser signals, converts them to binary data, and computes the Transmission Success Rate, reflecting the accuracy of the received data against what was transmitted. |
| Input: Laser signals received on the solar cell |
| Output: DTSR value |
| 1: define receiveChar() function |
| 2: delay for transmitDuration milliseconds |
| 3: initialize receivedByte as 0 |
| 4: for i = 0 to 7 do |
| 5: if the analog read from SOLARPIN is greater than THRESHOLD then |
| 6: set the ith bit of receivedByte to 1 |
| 7: end if |
| 8: delay for transmitDuration milliseconds |
| 9: end for |
| 10: delay for transmitDuration milliseconds |
| 11: return the receivedByte as a char |
| 12: end function |
| 13: define loop() function |
| 14: reading <- analogRead(SOLARPIN) |
| 15: if reading is greater than THRESHOLD then |
| 16: receivedChar <- receiveChar() function |
| 17: if receivedChar is ’#’ then |
| 18: inTransmissionSession <- true |
| 19: totalChars <- 0 |
| 20: receivedChars <- 0 |
| 21: else if receivedChar is ’$’ then |
| 22: inTransmissionSession <- false |
| 23: calculate successRate as (receivedChars / totalChars * 100) |