import networkx as nx
import matplotlib.pyplot as plt
import matplotlib.animation as animation
# 设置 matplotlib 支持中文显示
plt.rcParams['font.sans-serif'] = ['SimHei']
plt.rcParams['axes.unicode_minus'] = False
class Coordinator:
def __init__(self, name):
self.name = name
self.network = []
def start_network(self):
msg = f"{self.name} 启动网络"
print(msg)
return msg
def add_device(self, device):
self.network.append(device)
msg = f"{device.name} 加入网络"
print(msg)
return msg
def receive_data(self, data):
msg = f"{self.name} 接收到数据: {data}"