SimPy를 사용하고 있으며 네트워크를 시뮬레이션하려고합니다.다른 모듈에서 객체 간의 상호 작용을 활성화하는 방법
이 내 주요 모듈 :
from SimPy.Simulation import *
import node0
import message0
import network0
reload (message0)
reload (node0)
reload(network0)
initialize()
topology=network0.Network()
activate(topology, topology.operate())
node1=node0.Node(1)
node1.interface.send(destination='node1')
simulate(until=25)
I 클래스 노드의 객체에 의해 활성화되는 클래스 메시지의 객체를 원하는,
class Message(Process):
def arrive(self, destination, myEvent=delay):
self.destination=destination
self.interrupt(topology)
클래스 Network (topology)
의 객체를 interrrupt합니다.
는하지만 오류 받고 있어요 :
NameError: global name 'topology' is not defined
를 그리고 객체가 글로벌하게하는 방법을 모르겠어요. 파이썬 셸에 토폴로지를 입력하면 개체 토폴로지가 표시되므로 메시지를 볼 수없는 이유는 무엇입니까?