6e9f7c4a44db9b13d18051a988f902ca5ec97250
- 为OpcUaServiceManager添加日志记录功能,并实现OnBatchImportVariables事件处理器 - 为OpcUaService添加全面的日志记录,包括连接、断开、读写节点等操作 - 为DataEventService添加日志记录功能,跟踪数据加载和变量值变更事件 - 为S7ServiceManager添加OnBatchImportVariables事件处理器,处理批量导入变量事件 - 在VariableTableViewModel中改进变量添加逻辑,确保变量被正确添加到数据存储中 - 在VariableManagementService中完善变量表信息的填充逻辑
PMSWPF
OPC UA Service
This project includes an OPC UA service implementation that provides the following functionalities:
Features
- Connect to OPC UA servers
- Browse nodes in the OPC UA address space
- Read and write values from/to OPC UA nodes
- Add subscriptions for monitoring node changes
Usage
// Create an instance of the OPC UA service
var opcUaService = new OpcUaService();
// Connect to an OPC UA server
await opcUaService.CreateSession("opc.tcp://localhost:4840");
// Check connection status
if (opcUaService.IsConnected())
{
// Browse nodes
var rootNodeId = ObjectIds.RootFolder;
var references = opcUaService.BrowseNodes(rootNodeId);
// Read a value
var value = opcUaService.ReadValue(someNodeId);
// Write a value
opcUaService.WriteValue(someNodeId, newValue);
// Add a subscription
var subscription = opcUaService.AddSubscription("MySubscription");
}
// Disconnect when done
opcUaService.Disconnect();
Testing
Unit tests for the OPC UA service are included in the DMS.Infrastructure.UnitTests project. Run them using your preferred test runner.
Trigger System
The trigger system has been updated to support associating triggers with multiple variables instead of just one. This allows for more flexible trigger configurations where a single trigger can monitor multiple variables.
Key Changes
- Modified
TriggerDefinitionto use a list of variable IDs instead of a single variable ID - Added a new
TriggerVariablestable to maintain the many-to-many relationship between triggers and variables - Updated the UI to support selecting multiple variables when creating or editing triggers
- Updated all related services and repositories to handle the new many-to-many relationship
Description