将从缓存文件中读取改成从内存数组中进行读取

This commit is contained in:
您çšpengqi
2025-10-10 09:49:30 +08:00
parent 5233d6ceaa
commit d3964811e9
5 changed files with 147 additions and 149 deletions

View File

@ -1,13 +1,14 @@
from snap7_client import Snap7Client
import logging
class PLCManager:
"""PLC连接管理器管理多个PLC连接"""
def __init__(self, plcs_config):
def __init__(self, plcs_config, reader_threads):
"""
初始化PLC管理器
Args:
plcs_config: PLC配置列表
"""
@ -17,7 +18,8 @@ class PLCManager:
self.plcs[name] = Snap7Client(
plc_config["ip"],
plc_config["rack"],
plc_config["slot"]
plc_config["slot"],
reader_threads
)
self.logger = logging.getLogger("PLCManager")
@ -29,7 +31,7 @@ class PLCManager:
"""连接所有配置的PLC"""
for name, client in self.plcs.items():
client.connect()
def get_connection_status(self):
"""获取所有PLC的连接状态"""
status = {}