Trying to make priority queue with two parallel FIFO queues.

4 vues (au cours des 30 derniers jours)
Muhammad Ashar
Muhammad Ashar le 8 Août 2023
Modifié(e) : Ninad le 23 Août 2023
I'm trying to modify a Simulink example. I'm using example openExample('simevents/QueuingStrategiesExample'). Instead of 4 queues, I'm going with 2 eliminating the other 2. The model I have in mind is that the data/signal will go from the shortest path (queue) but after alterting the example the signal is only going through one queue. I have to build up it further but somehow I can't find a way for the signal to read the other queue or in other words if one queue is completely empty (which is the case right now) the discrete signal should diverted to the empty queue therefore minimizing the time to reach to point B. Any insights to sort out this issue will be really appreciated. Thanksks

Réponses (1)

Ninad
Ninad le 23 Août 2023
Modifié(e) : Ninad le 23 Août 2023
I tried to reproduce the issue on my end, by opening the model and making the necessary changes to the model. Please try the following steps, because it seems to work for ne:
Step 1: To open the model run the following command in MATLAB command line: openExample('simevents/QueuingStrategiesExample')
Step 2: open the function block: seQueuingStrategies > Four Line Queue > Queue Selector > MATLAB Function
Step 3: Replace the code in the MATLAB function block (fcn) with the following code:
function y = fcn(u1, u2)
%#codegen
% Identify which input index is the smallest
[~,y] = min([u1 u2]);
Step 4: Change the Queue Selector Sub-system by removing the excess input signals.
Step 5: Open the Four Line Queue Sub-system make the following changes:
Open > Line Router and set the Number of output ports = 2
Open > Exit Path 1 and set the Number of input ports = 2
Delete > Customer Line 3 and Customer Line 4 and all the excess connections
To verify:
Add two scope blocks connecting to the Number of entities in block, n for Customer Line 1 and 2 respectively.
On running the model, you can visualize the two scope blocks and see that both the queues are receiving inputs.

Produits


Version

R2023a

Community Treasure Hunt

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

Start Hunting!

Translated by