Full OPC UA server on .NET Framework 4.8 (x86) exposing AVEVA System Platform Galaxy tags via MXAccess. Mirrors Galaxy object hierarchy as OPC UA address space, translating contained-name browse paths to tag-name runtime references. Components implemented: - Configuration: AppConfiguration with 4 sections, validator - Domain: ConnectionState, Quality, Vtq, MxDataTypeMapper, error codes - MxAccess: StaComThread, MxAccessClient (partial classes), MxProxyAdapter using strongly-typed ArchestrA.MxAccess COM interop - Galaxy Repository: SQL queries (hierarchy, attributes, change detection), ChangeDetectionService with auto-rebuild on deploy - OPC UA Server: LmxNodeManager (CustomNodeManager2), LmxOpcUaServer, OpcUaServerHost with programmatic config, SecurityPolicy None - Status Dashboard: HTTP server with HTML/JSON/health endpoints - Integration: Full 14-step startup, graceful shutdown, component wiring 175 tests (174 unit + 1 integration), all passing. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
3.0 KiB
3.0 KiB
CLAUDE.md
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
Purpose
The goal of this project is to identify and develop SQL queries that extract the Galaxy object hierarchy from the System Platform Galaxy Repository database in order to build a tag structure for an OPC UA server.
Specifically, we need to:
- Build the hierarchy of areas and automation objects (using contained names for human-readable browsing)
- Translate contained names to tag_names for read/write operations (e.g.,
TestMachine_001.DelmiaReceiverin the hierarchy becomesDelmiaReceiver_001when addressing tag values)
See layout.md for details on the hierarchy vs tag name relationship.
Key Files
Documentation
connectioninfo.md— Database connection details and sqlcmd usagelayout.md— Galaxy object hierarchy, contained_name vs tag_name translation, and target OPC UA structurebuild_layout_plan.md— Step-by-step plan for extracting hierarchy, attaching attributes, and monitoring for changesdata_type_mapping.md— Galaxy mx_data_type to OPC UA DataType mapping, including array handling (ValueRank, ArrayDimensions)
Queries
queries/hierarchy.sql— Deployed object hierarchy with browse names and parent relationshipsqueries/attributes.sql— User-defined (dynamic) attributes with data types and array dimensionsqueries/attributes_extended.sql— All attributes (system + user-defined) with data types and array dimensionsqueries/change_detection.sql— Pollgalaxy.time_of_last_deployto detect deployment changes
Schema Reference
schema.md— Full schema reference for all tables and views in the ZB databaseddl/tables/— Individual CREATE TABLE definitionsddl/views/— Individual view definitions
Working with the Galaxy Repository Database
The Galaxy Repository is the backing SQL Server database for Wonderware/AVEVA System Platform (Galaxy: ZB, localhost, Windows Auth). Key tables used by the queries:
- gobject — Object instances, hierarchy (contained_by_gobject_id, area_gobject_id), deployment state (deployed_package_id)
- template_definition — Object type categories (category_id distinguishes areas, engines, user-defined objects, etc.)
- dynamic_attribute — User-defined attributes on templates, inherited by instances via derived_from_gobject_id chain
- attribute_definition — System/primitive attributes
- primitive_instance — Links objects to their primitive components and attribute definitions
- galaxy — Single-row table with time_of_last_deploy for change detection
Use sqlcmd -S localhost -d ZB -E -Q "..." to run queries. See connectioninfo.md for details.
Conventions
- Store all connection parameters in
connectioninfo.md, not scattered across scripts. - Keep SQL query examples and extraction notes as Markdown files in this repo.
- If scripts are added (Python, PowerShell, etc.), document their usage and dependencies alongside them.