예제 #1
0

host = "127.0.0.1"

a = Agent("server1bdi@" + host, "secret")
a.setDebugToScreen()
a.start()

s1 = spade.DF.Service(name="s1",
                      owner=a.getAID(),
                      inputs=["Value"],
                      outputs=["Myoutput1"],
                      P=["Var(Value,0,Int)"],
                      Q=["Var(Myoutput1,1,Int)"])

a.registerService(s1, s1_method)

import time
tmp = True
while tmp:
    try:
        time.sleep(5)
    except:
        tmp = False

s = spade.DF.Service()
s.setOwner(a.getAID())
a.deregisterService(s)

a.stop()
sys.exit()
예제 #2
0
import spade
from spade.Agent import Agent

def s1_method(Value):
        return {"Myoutput1":1}

host = "127.0.0.1"

a = Agent("server1bdi@"+host,"secret")
a.setDebugToScreen()
a.start()

s1 = spade.DF.Service(name="s1", owner=a.getAID(), inputs=["Value"],outputs=["Myoutput1"],P=["Var(Value,0,Int)"],Q=["Var(Myoutput1,1,Int)"])

a.registerService(s1,s1_method)                

import time
tmp=True
while tmp:
    try:
        time.sleep(5)
    except:
        tmp=False

s = spade.DF.Service()
s.setOwner(a.getAID())
a.deregisterService(s)

a.stop()
sys.exit()
예제 #3
0
import spade
from spade.Agent import Agent

def s2_method(Myoutput1):
        return {"Myoutput2":2}

host = "127.0.0.1"

a = Agent("server2bdi@"+host,"secret")
a.setDebugToScreen()
a.start()

s2 = spade.DF.Service(name="s2", owner=a.getAID(), inputs=["Myoutput1"],outputs=["Myoutput2"],P=["Var(Myoutput1,1,Int)"],Q=["Var(Myoutput2,2,Int)"])

a.registerService(s2,s2_method)

import time
tmp=True
while tmp:
    try:
        time.sleep(5)
    except:
        tmp=False

s = spade.DF.Service()
s.setOwner(a.getAID())
a.deregisterService(s)

a.stop()
sys.exit()
예제 #4
0

host = "127.0.0.1"

a = Agent("server2bdi@" + host, "secret")
a.setDebugToScreen()
a.start()

s2 = spade.DF.Service(name="s2",
                      owner=a.getAID(),
                      inputs=["Myoutput1"],
                      outputs=["Myoutput2"],
                      P=["Var(Myoutput1,1,Int)"],
                      Q=["Var(Myoutput2,2,Int)"])

a.registerService(s2, s2_method)

import time
tmp = True
while tmp:
    try:
        time.sleep(5)
    except:
        tmp = False

s = spade.DF.Service()
s.setOwner(a.getAID())
a.deregisterService(s)

a.stop()
sys.exit()