For this project, we used PragmaStudio to use the language.
- To build the project, in the tree, right-click on the system and Build.
- To launch a simulation, in the tree structure, right-click on the system and Debug.
Initially our objective was simply to manage a protocol that receives data (here a string) from the user, inserts it into data messages (here a string with previous data) and delivers it on arrival.
In the second part we had to insert a disruptive element. Between the protocol and the user, we add a layer that can split packets randomly. It must be able to split data messages as well as acknowledgements.
Subsequently we complete the disruptive element which now has the possibility of losing packets.
After adding the possibility of duplicated packets and other lost packets, we need to make our protocol more reliable in order to deal with these error cases. To do this we use the alternating bit principle, also known as sliding window of size 1.
Loss management with the timer
Starting and resetting the timer
Warning
To use the timer in the simulation, you have to activate it via the menu Options → Timer → Real time timers.