ACassimiro / TSNsched

Automated Schedule Generation for Time-Sensitive Networks (TSN).
GNU General Public License v3.0
82 stars 37 forks source link

Questions about Implementing TSNsched #34

Open Chih1126 opened 1 month ago

Chih1126 commented 1 month ago

Hello, I've been working on implementing TSNsched recently, and there are a few things I don't quite understand.

First: Is this the correct way to set up HyperCycle? Which parts need modification? 01

Second: If I want to set it to milliseconds, what code should I add?

Third: Regarding the Total number of scheduled packets in the .out file, I checked the paper, but it doesn't seem to mention this part, so I don't understand what it means. 02

Sorry for the numerous questions and thank you for your response.

ACassimiro commented 2 weeks ago

Hello @Chih1126. Apologies for the late reply.

First: Is this the correct way to set up HyperCycle? Which parts need modification?

Yes, it is. You don't have to make it explicit that you want to use Hypercycles, as it is the default mode for all ports. Something to keep an eye on is that depending on your topology, your schedule can be the same using hypercycles or microcycles.

Second: If I want to set it to milliseconds, what code should I add?

We use microsecond as the default unit for TSNsched. You can control the units if you use the .json input for TSNsched, instead of defining your topology in Java. I strongly recommend using the .json input for TSNsched as it is more readable and less complex. In a JSON file, if you want to define unit for the time that a packet takes to travel from a port to another, you only have to add the unit after the number. For instance "timeToTravel": 1, will use a time to travel of 1 microsecond; "timeToTravel": "1 ms", will use a time to travel of 1 millisecond. Certain objects, such as Switches allow you to set the units for all of its values with properties such as portSpeedSizeUnit, setting the speed units for all the ports in that switch.

The fields for the input JSON file can be seen in the project README, but I believe these links may also be useful for you:

Third: Regarding the Total number of scheduled packets in the .out file, I checked the paper, but it doesn't seem to mention this part, so I don't understand what it means.

In order to ensure that you will have a cyclic, deterministic behavior, try to design a schedule with a fixed amount of cycles and a fixed amount of packets to be transmitted within those cycles. On the output of TSNsched, the "Total number of scheduled packets" means how many packets the tool had to schedule in order to make sure that the provided cycle will work deterministically.

For a very trivial example, let's say you have a cycle of size X and a device that sends packets with a frequency of X/4. TSNsched will have to schedule 4 packets within that cycle to make sure that the designed cycle works. More advanced scenarios may consider various devices of different packet sending frequencies, and a cycle of size smaller than the frequencies themselves, creating a more convoluted problem (which is what we tried to solve with micro and hyper cycles).

I hope this helps! Let me know if you need further clarification.