Implementing a simple Round Robin Fair Queue scheduling algorithm for data packets considering 3 data streams

23 次查看(过去 30 天)
Hello Team,
We are trying to implement the Round Robin Fair queue scheduling algorithm using simulink and further have to generate C++ code from this model. Here we are using
Here in this algorithm data packets are sorted based on the priority of each packet and then further added into the respective queues (FIFO), for simplicity we have considered 3 queues (data streams). Then data outgoing from these queues have to scheduled in fair round robin fashion. To define fairness here we are considering that for non empty queue with high priority 3 packets are serviced first, then 2 packets from Mid priority queue and 1 packet from low priority queue.
If any of the queue is empty then next queue has to be considered for scheduling.
My current approach:
Sorted the data into different priority queues, for the queue I am using queue block from messages & events however I am finding it difficult to track number packets in the queue and number of packets departed.
I am sharing the file here, kindly request you to help me in this regard.
Many thanks in advance.
Best Regards,
Srikar

回答(1 个)

Githin George
Githin George 2023-11-3
Hello,
I understand you are trying to implement a Round Robin Fair Queue Scheduling algorithm for data streams of 3 different priorities and you are facing difficulty in tracking the number of packets in the queue and number of packets departed.
I would suggest modelling a control logic to identify which queue to select data from after every scheduling event. I’ve attached a Simulink model here that does the exact same.
The subsystem basically takes in as input the ‘current state’ of the scheduler and ‘queue state’ values and outputs the ‘next state’ of the scheduler based on the following logic. The states of the scheduler are as follows. State 0 – entry state. State 1 – High priority queue, 1 packet sent. State 2 – High priority queue, 2 packets sent. Similarly, till state 6. The logic models how the state change occurs, and based on the output state of the subsystem, the correct message can be retrieved from the queue.
I hope this helps.
  1 个评论
Srikar
Srikar 2023-11-7
Hello George,
Thanks to answer, but I wasn't able to open this model as it is saved in using 2023a. I am currently using R2022b.
Would be nice if you may share me with back versioned slx file. I am eager to check the model changes.

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Simulink Coder 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by