certi-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [certi-dev] NERA implementation


From: Usman Awais
Subject: Re: [certi-dev] NERA implementation
Date: Wed, 6 Feb 2013 14:42:52 +0100

HI,

Thanks for the reply, but in my opinion both federates can call NERA. Until at some stage both call NER to progress ahead. 

If you see my code ( the code is same for 2 or N federates). Federate first calls the NERA and then NER. If both federates are using the same algo then there should not be a problem. 

In fact the code written by me is almost one-to-one translation of the algorithm  given in the Paper (Figure 1) you just sent. Please correct me if I am wrong..

Regards,
Muhammad Usman Awais




On Wed, Feb 6, 2013 at 11:17 AM, Pierre Siron <address@hidden> wrote:
Bonjour,
If I well understand your Python code,
if you have 2 federates,
the 2 federates will call NERA.

Many federates can call NERA,
but one federate must call NER
so that the federation could continue.

This is my understanding of :
Richard Fujimoto, "Zero lookahead and repeatability in the High Level Architecture"
http://www.cc.gatech.edu/computing/pads/PAPERS/Zero_Lookahead_and_Repeatability.pdf

Bien cordialement,
Pierre



Le 04/02/2013 17:01, Usman Awais a écrit :

Hi,

I am trying to use NERA in combination with NER, as suggested in the reference. A single federate works fine but more than one federates make the application hanged. In fact neither of the federates are granted with the time slice, so both of them hang. Here is the python code of the relevant section

def main (name, timeStep):
    print("Create ambassador")
    rtia = rti.RTIAmbassador()
    print(rtia)
    fedAmb = FederateAmb()
    fedAmb.initialize(rtia)
    try:

        rtia.createFederationExecution("Test", "Test.xml")
        fedAmb.creator = True
        print("Federation created.")
    except Exception , e:
        print("Federation exists: %s" % repr(e))
    finally:
        print ('Federation done.')

    try:
        rtia.joinFederationExecution(name, "Test", fedAmb)
        fedAmb.enableTimeSwitches(0.0)
        fedAmb.publish()
        fedAmb.subscribe()
        fedAmb.waitReadyToPopulate()
        fedAmb.registerInstance(name)
        fedAmb.waitReadyToRun()
        T_INCR = timeStep
        pt = 0
        while fedAmb.time < 500:
            pt = pt + T_INCR
            print('requested time : '+repr(pt))
            rtia.nextEventRequestAvailable(pt)
            while 1:
                if fedAmb.granted==False:
                    rtia.tick()
                else:
                    fedAmb.granted=False
                    break
            print('grnated time : '+ repr(fedAmb.time))
            fedAmb.X += 1
            fedAmb.Y += 1

            fedAmb.updateAttributes()
            rtia.nextEventRequest(fedAmb.time)

            while 1:
                if fedAmb.granted==False:
                    rtia.tick()
                else:
                    fedAmb.granted=False
                    break
    except Exception, e:
        print("Could not do, exception: %s" % repr(e))

    finally:
        try:
            fedAmb.terminate()
        except Exception, e:
            print("Could not do, exception: %s" % repr(e))
        try:
            rtia.resignFederationExecution(rti.ResignAction.DeleteObjectsAndReleaseAttributes)
        except Exception, e:
            print("Could not do, exception: %s" % repr(e))

        try:
            rtia.destroyFederationExecution('Test')
        except Exception, e:
            print("Could not do, exception: %s" % repr(e))

        print("Done.")


Regards,
Muhammad Usman Awais




--
CERTI-Devel mailing list
address@hidden
https://lists.nongnu.org/mailman/listinfo/certi-devel


reply via email to

[Prev in Thread] Current Thread [Next in Thread]