Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Two flows with different cycle merge into the same link #27

Open
mopean opened this issue Jun 28, 2022 · 2 comments
Open

Two flows with different cycle merge into the same link #27

mopean opened this issue Jun 28, 2022 · 2 comments

Comments

@mopean
Copy link

mopean commented Jun 28, 2022

Hi,
Thanks for your code. I am running an example on the project.
My example has two flows as follows:

Flow flow0 = new Flow(Flow.UNICAST);
flow0.setStartDevice(dev4);
flow0.addToPath(switch0);
flow0.addToPath(switch2);
flow0.setEndDevice(dev10);
flow0.setFlowSendingPeriodicity(2000);


Flow flow1 = new Flow(Flow.UNICAST);
flow1.setStartDevice(dev5);
flow1.addToPath(switch1);
flow1.addToPath(switch2);
flow1.setEndDevice(dev10);
flow1.setFlowSendingPeriodicity(3000);

The topology is:

Dev4 -> SW0 -> SW2 -> Dev10
                ^
                |
Dev5 -> Sw1 -> 

And the result is:

>>>> INFORMATION OF SWITCH: switch0 <<<<
    Port list - 
        => Port name:       switch0Port1
        Connects to:     switch2
        Cycle start:    0.0
        Cycle duration: 2000.0
        Fragments:       flow1Fragment1, 
        Priority number: 7
          Index 0 Slot start:      1949.088
          Index 0 Slot duration:   8.004
        ------------------------


>>>> INFORMATION OF SWITCH: switch1 <<<<
    Port list - 
        => Port name:       switch1Port1
        Connects to:     switch2
        Cycle start:    0.0
        Cycle duration: 3000.0
        Fragments:       flow2Fragment1, 
        Priority number: 7
          Index 0 Slot start:      2940.996
          Index 0 Slot duration:   8.0
        ------------------------


>>>> INFORMATION OF SWITCH: switch2 <<<<
    Port list - 
        => Port name:       switch2Port9
        Connects to:     dev10
        Cycle start:    0.0
        Cycle duration: 1000.0
        Fragments:       flow1Fragment2, flow2Fragment2, 
        Priority number: 7
          Index 0 Slot start:      949.992
          Index 0 Slot duration:   50.0
        ------------------------

I notice that Cycle duration of Switch2 is 1ms. It means that there is a slot in 1ms. But cycle of flow0 is 2ms, and cycle of flow1 is 3ms. There will has two slot without packets within every 6ms.

I think it is better that the Cycle duration of Switch2 shall be 6ms (i.e. Least Common Multiple of two flow). In each cycle, there are four time slots .
dbe31be1-9365-4c04-b278-f14dcfd5f216

Which part of the code do I need to modify?
Thanks

@ACassimiro
Copy link
Owner

Hello. The default strategy for schedule generation uses a strategy that we call "microcyles" which, as you pointed out, generates a cycle of size equals to the greatest common divisor of all flow periods. To use the least common multiple instead, a scheduling strategy that we refer to "hypercycle", after declaring a port of a switch, use the method setUseHyperCycle(true) on that port to enable the hypercycle strategy on its cycle.

@mopean
Copy link
Author

mopean commented Aug 15, 2022

hi,Thank you for your response. I have set the port of switch2 to hypercycle which is connected to dev10 in my example.

Dev4 -> SW0 -> SW2 -> Dev10
                ^
                |
Dev5 -> Sw1 -> 

Code:

		Port switch2Port=switch2.createPort(dev10, cycle100);
		switch2Port.setUseHyperCycle(true);

But it doesn't seem to work,the Cycle duration of Switch2 is still 1ms.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants