ACassimiro / TSNsched

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

How to write code for one device sending two or more TSN flows? #5

Closed nwpucong closed 4 years ago

nwpucong commented 4 years ago

Thanks for your code, Cassimiro. In the example code, when need a tsn terminal, you define it like this:
"Device dev0 = new Device(1000, 0, 1000, 1625);"

Does it mean that one device can only send one tsn flow? How can it be allowed if we want the device to send two more TSN flows at one port?

ACassimiro commented 4 years ago

Hello,

You can link multiple flows to one device. Just instantiate a Flow object and use the method .setStartDevice(Device dev) to set the device dev as the source/sender/publisher of that flow. Its interesting to notice that a flow, by default, will have its sending periodicity and first sending time equals to the sending periodicity and first sending time of the source device, and these values are set on the Device constructor method, but you can overwrite those values by using the constructor method Flow(int type, float flowFirstSendingTime, float flowSendingPeriodicity) instead of using Flow(int type), which is the one used in the samples of code. If you insist in using the latter method for constructing your flow objects, you still can use the methods .setFlowFirstSendingTime(float flowFirstSendingTime) and .setFlowSendingPeriodicity(float flowSendingPeriodicity) on your flow objects to overwrite the device first sending time and periodicity on the flow (just make sure you set these values after setting the source device of your flow).

I hope this clarifies your questions. Feel free to ask anything that comes to mind.

nwpucong commented 4 years ago

Thank you for the reply. I will try it.