Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: please i need help to convert fecn algorithm pseudocode to java code

  1. #1
    Junior Member
    Join Date
    Jan 2014
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default please i need help to convert fecn algorithm pseudocode to java code

    Per-Port Switch Variables:
    Nominal Capacity of the Port: C0
    Advertised Rate for the ith interval: ri
    Port State: Port Initialized
    Measured Port Capacity for ith Measurement Interval: Ci
    Bits received in the last measurement interval: bits received
    Bits transmitted in the last measurement interval: bits sent
    Bits in Queue at the beginning of current measurement interval: qlen
    Total Busy (transmit) time during last measurement interval: time busy
    Limited rate increase: r
    Algorithm Parameters:
    Initial Rate Divider: N0
    Measurement Interval in Switches: T
    T is also used for -timer (probe interval) in the sources
    Queue Control Parameters: a, b, c
    Exponential moving average: 
    Operational Parameters:
    Queue equilibrium: Qeq
    Queue Length under severe congestion: Qsc
    Default Values:
    N0 = 200, T = 1 ms,
    Qeq = 192, 000 bits, a = 1.1, b = 1.002, c = 0.1,  = 0.5
    Variable Initialization:
    Ci = C0, r = ri−1 = ri−2 = C0
    N0
    ,
    1
    Port Initialized = FALSE.
    Switch Event Routines:
    procedure EVENT T Timer Expired Routine()
    1: while T timer expires do
    2: if Port Initialized then
    3: Estimate Capacity()
    4: if bits received > 0 then
    5: Rate Allocation(qlen, bits received, ri−1, ri−2,Ci)
    6: else
    7: ri = C0
    N0
    8: end if
    9: else
    10: if bits received > 0 then
    11: Port Initialized = TRUE
    12: Rate Allocation(qlen, bits received, ri−1, ri−2,Ci)
    13: end if
    14: end if
    15: Reset T timer
    16: end while
    procedure EVENT Transmit Packet()
    1: if packet is tagged then
    2: if Rate in Tag  ri OR Rate in Tag == −1 then
    3: Rate in Tag = ri
    4: end if
    5: end if
    6: Forward the packet
    Subroutines:
    procedure Rate Allocation(qlen, bits received, ri−1, ri−2,Ci)
    1: Queue Control(fq, qlen,Qeq)
    2:  = bits received
    T×C×fq
    3: if  == 0 then
    4: if qlen < 1 then
    5: ri = Ci
    6: else
    7: ri = ri&#8722;1
    8: end if
    9: else
    2
    10: ri = min{Ci, ri&#8722;1
     }
    11: end if
    12: Exponential Averaging(ri, ri&#8722;1, ri&#8722;2)
    13: Limit Rate Increase(ri, ri&#8722;1, qlen,Qeq,r)
    14: Variable Capapcity Adjustment(Ci,Ci&#8722;1, ri, ri&#8722;1, ri&#8722;2)
    15: bits received = 0
    procedure Queue Control(fq, qlen,Qeq)
    1: if qlen  Qeq then
    2: fq = b×Qeq
    (b&#8722;1)×qlen+Qeq
    3: else
    4: fq = max
    n
    c, a×Qeq
    (a&#8722;1)×qlen+Qeq
    o
    5: end if
    Note: Queue control function can be implemented as a precomputed table
    procedure Exponential Averaging(ri, ri&#8722;2)
    1: ri = ri + (1 &#8722; )ri&#8722;2
    procedure Limit Rate Increase(ri, ri&#8722;1, qlen,Qeq,r)
    1: if qlen < Qeq then
    2: r = 1.414r
    3: else if qlen > Qsc then
    4: r = 0.707r
    5: end if
    6: if ri &#8722; ri&#8722;1 > r then
    7: ri = ri&#8722;1 + r
    8: end if
    procedure Variable Capacity Adjustment(Ci,Ci&#8722;1, ri, ri&#8722;1, ri&#8722;2)
    1: if Ci < Ci&#8722;1 then
    2: ri = Ci
    Ci&#8722;1
    ri
    3: ri&#8722;1 = Ci
    Ci&#8722;1
    ri&#8722;1
    4: end if
    5: ri&#8722;2 = ri&#8722;1
    6: ri&#8722;1 = ri
    3
    procedure Estimate Capacity(Ci, bits sent, time busy)
    1: Ci = bits sent
    time busy
    2: bits sent = 0
    3: time busy = 0
    Source Variables:
    Current Rate: R
    Source Parameters:  = T
    Feedback Valid Interval: 2T
    Initial Rate: R0 = C0
    N0
    Source Initialization:
    Set  timer to expired
    Tagging a sampled packet every  sec
    Set Feedback Valid Timer to expired
    Source Event Routines:
    procedure EVENT Send packet()
    1: if  timer expired then
    2: if Feedback Valid timer expired then
    3: R = R0
    4: end if
    5: Tag an outgoing packet and the rate field in Tag is set as -1;
    6: Send following packets at current rate R
    7: Reset  timer
    8: else
    9: Send following packet without tag at rate R
    10: end if
    procedure EVENT FECN Received()
    1: Set R to rate received
    2: Reset Feedback Valid Timer to 2T
    Attached Files Attached Files


  2. #2
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,042
    Thanks
    63
    Thanked 2,708 Times in 2,658 Posts

    Default Re: please i need help to convert fecn algorithm pseudocode to java code

    Do you have any specific questions about the code you are trying to write?
    What have you written so far?
    If you don't understand my answer, don't ignore it, ask a question.

Similar Threads

  1. Converting Insertion Sort pseudocode to running Java code
    By MarkDavisCode in forum What's Wrong With My Code?
    Replies: 1
    Last Post: July 30th, 2013, 10:45 PM
  2. assignment1- change pseudocode into java code
    By fasya alya in forum What's Wrong With My Code?
    Replies: 2
    Last Post: March 14th, 2013, 05:14 AM
  3. How would I create this solution algorithm using pseudocode? Im stuck..
    By meghere in forum What's Wrong With My Code?
    Replies: 3
    Last Post: February 14th, 2013, 01:52 AM
  4. How would I create this solution algorithm using pseudocode?
    By meghere in forum Algorithms & Recursion
    Replies: 1
    Last Post: February 13th, 2013, 10:43 PM
  5. Convert C/C++ code to Java
    By cristianll in forum What's Wrong With My Code?
    Replies: 13
    Last Post: November 14th, 2009, 02:43 AM