diff --git a/README.md b/README.md index 0a28c62..4672ecf 100644 --- a/README.md +++ b/README.md @@ -93,82 +93,6 @@ dotnet run --project tools/opcuacli-dotnet -- alarms -u opc.tcp://localhost:4840 dotnet test ZB.MOM.WW.LmxOpcUa.slnx ``` -## Security Classification - -Galaxy attributes carry a `security_classification` that controls OPC UA write access. The server maps these to `AccessLevel` on each variable node: - -| Classification | Galaxy Level | OPC UA Access | -|---|---|---| -| 0 | FreeAccess | ReadWrite | -| 1 | Operate | ReadWrite | -| 2 | SecuredWrite | ReadOnly | -| 3 | VerifiedWrite | ReadOnly | -| 4 | Tune | ReadWrite | -| 5 | Configure | ReadWrite | -| 6 | ViewOnly | ReadOnly | - -See `gr/data_type_mapping.md` for the full mapping table. - -## Alarm Tracking - -When `AlarmTrackingEnabled` is true, the server creates `AlarmConditionState` nodes for Galaxy attributes with `AlarmExtension` primitives. It auto-subscribes to each alarm's `InAlarm` tag and reports OPC UA alarm events on state transitions: - -- `InAlarm` TRUE → alarm active event (severity from `Priority`, message from `DescAttrName`) -- `InAlarm` FALSE → alarm cleared event -- Condition refresh reports all currently retained alarms to newly subscribing clients - -## Historical Data Access - -When `Historian.Enabled` is true, the server handles OPC UA `HistoryRead` requests by querying the Wonderware Historian `Runtime` database: - -- **Raw reads** query `Runtime.dbo.History` with time range and max values -- **Processed reads** query `Runtime.dbo.AnalogSummaryHistory` with aggregates (Average, Minimum, Maximum, Count) -- Historized variables advertise `Historizing=true` and `AccessLevel` includes `HistoryRead` - -## Incremental Address Space Sync - -When the Galaxy detects a new deployment, the server compares the previous hierarchy and attributes against the new snapshot. Only changed gobject subtrees are torn down and rebuilt — unchanged nodes, subscriptions, and alarm tracking remain intact. See `partial_update.md` for details. - -## Configuration - -All settings in `appsettings.json`, overridable via environment variables: - -| Section | Key | Default | Description | -|---------|-----|---------|-------------| -| `OpcUa` | `Port` | `4840` | OPC UA server port | -| `OpcUa` | `EndpointPath` | `/LmxOpcUa` | Endpoint path | -| `OpcUa` | `GalaxyName` | `ZB` | Galaxy name (namespace URI) | -| `OpcUa` | `MaxSessions` | `100` | Maximum concurrent sessions | -| `OpcUa` | `AlarmTrackingEnabled` | `false` | Enable alarm condition tracking | -| `MxAccess` | `ClientName` | `LmxOpcUa` | MXAccess registration name | -| `MxAccess` | `AutoReconnect` | `true` | Auto-reconnect on disconnect | -| `MxAccess` | `ProbeTag` | `null` | Tag for connection health probing | -| `GalaxyRepository` | `ConnectionString` | `Server=localhost;Database=ZB;...` | ZB database connection | -| `GalaxyRepository` | `ChangeDetectionIntervalSeconds` | `30` | Deploy change polling interval | -| `GalaxyRepository` | `ExtendedAttributes` | `false` | Include primitive/system attributes | -| `Historian` | `Enabled` | `false` | Enable OPC UA historical data access | -| `Historian` | `ConnectionString` | `Server=localhost;Database=Runtime;...` | Historian Runtime database connection | -| `Historian` | `MaxValuesPerRead` | `10000` | Maximum values per HistoryRead request | -| `Dashboard` | `Enabled` | `true` | Enable HTTP status dashboard | -| `Dashboard` | `Port` | `8081` | Dashboard port | - -## Data Type Mapping - -| Galaxy Type | mx_data_type | OPC UA Type | NodeId | -|-------------|-------------|-------------|--------| -| Boolean | 1 | Boolean | i=1 | -| Integer | 2 | Int32 | i=6 | -| Float | 3 | Float | i=10 | -| Double | 4 | Double | i=11 | -| String | 5 | String | i=12 | -| DateTime | 6 | DateTime | i=13 | -| ElapsedTime | 7 | Double (seconds) | i=11 | -| Reference | 8 | String | i=12 | -| Enumeration | 13 | Int32 | i=6 | -| InternationalizedString | 15 | LocalizedText | i=21 | - -Array attributes use `ValueRank=1` with `ArrayDimensions` from the Galaxy attribute definition. - ## Project Structure ``` @@ -194,24 +118,10 @@ tests/ZB.MOM.WW.LmxOpcUa.Tests/ OpcUa/ Address space build/rebuild, diff, data conversion tests Wiring/ Component integration tests -tools/opcuacli-dotnet/ OPC UA CLI test tool (connect, browse, read, write, subscribe, historyread, alarms) +tools/opcuacli-dotnet/ OPC UA CLI test tool gr/ Galaxy repository docs, SQL queries, schema ``` -## Startup Sequence - -1. Load and validate configuration -2. Register `AppDomain.UnhandledException` handler -3. Create performance metrics -4. Connect MXAccess (STA thread + COM registration) -5. Start MXAccess monitor loop -6. Test Galaxy database connection -7. Start OPC UA server with programmatic config -8. Query hierarchy + attributes, build address space -9. Create alarm condition nodes and auto-subscribe to InAlarm tags (if enabled) -10. Start change detection polling (incremental sync on deploy) -11. Start status dashboard (HTML + JSON + health endpoint) - ## Component Documentation | Component | Description |