certi-devel
[Top][All Lists]
Advanced

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

Re: [certi-dev] NERA implementation


From: Pierre Siron
Subject: Re: [certi-dev] NERA implementation
Date: Wed, 06 Feb 2013 11:17:56 +0100
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.4pre) Gecko/20091014 Fedora/3.0-2.8.b4.fc11 Thunderbird/3.0b4

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






reply via email to

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