diff --git a/CLAUDE.md b/CLAUDE.md index 596ce4a6..d91625c2 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -45,6 +45,15 @@ Galaxy objects have two names: Example: browsing `TestMachine_001/DelmiaReceiver/DownloadPath` translates to MXAccess reference `DelmiaReceiver_001.DownloadPath`. +**Alias tags** (`GalaxyMxGateway`-backed equipment `Tag`s) are a lighter +alternative to relay virtual tags: they store the Galaxy reference as +`TagConfig.FullName` (`tag_name.AttributeName`) and surface it under a UNS name +via a direct driver subscription, delivering native MX quality/timestamp with no +Roslyn script. They are authored on the equipment page's **Tags** tab via the +"Add alias (browse Galaxy)" button. A relay→alias converter runs per-equipment +(Tags-tab toolbar) or fleet-wide at `/uns/convert-relays` (FleetAdmin-gated), +with a dry-run preview before applying. + ### Data Type Mapping Galaxy `mx_data_type` values map to OPC UA types (Boolean, Int32, Float, Double, String, DateTime, etc.). Array attributes use ValueRank=1 with ArrayDimensions from the Galaxy attribute definition. The driver-side mapping lives in `src/Drivers/ZB.MOM.WW.OtOpcUa.Driver.Galaxy/Browse/DataTypeMap.cs`. diff --git a/docs/Uns.md b/docs/Uns.md index 4fba23a3..677718f1 100644 --- a/docs/Uns.md +++ b/docs/Uns.md @@ -95,6 +95,46 @@ Add and edit virtual tags on the equipment page's **Virtual Tags** tab; the data type is chosen from the standard OPC UA type list and the Monaco script editor is available inline. +### Alias tags + +An **alias tag** surfaces a Galaxy attribute under a friendly UNS name without +requiring a Roslyn script. It is an ordinary equipment `Tag` bound to the +`GalaxyMxGateway` driver; the Galaxy reference is stored in `TagConfig` as +`{"FullName":"tag_name.AttributeName"}`. Because the value comes from a direct +driver subscription — not a script relay — quality and timestamp are native MX, +and there is no Roslyn overhead. + +**Adding an alias:** on the equipment **Tags** tab, click **Add alias (browse +Galaxy)**. A live Galaxy browse picker opens; navigate to the attribute you +want. After selecting it, set the tag **Name**, **DataType**, and **AccessLevel** +(default: read-only; opt in to write-through at your own discretion — writes go +through the Galaxy driver's security). The button is disabled when the +equipment's cluster has no `GalaxyMxGateway` driver instance. + +In the Tags list, alias tags show an **alias** badge and their Source as +`galaxy:`. There is no new entity type or schema +migration — the alias is just a `Tag` row with `DriverType = GalaxyMxGateway` +and the `FullName` field in its JSON config. + +**Relay → alias converter:** if you have existing "relay" virtual tags whose +scripts are nothing but `return ctx.GetTag("X").Value;`, a converter can +rewrite them as alias tags automatically: + +- **Per-equipment** — a toolbar action on the Tags tab opens a dry-run preview + (lists what will be converted and what will be skipped), then a confirm-apply + step. +- **Fleet-wide** — `/uns/convert-relays` (FleetAdmin-gated) runs the same + dry-run + apply across all equipment in the fleet. + +The converter skips and reports items it cannot safely migrate: +- virtual tags whose body is not a pure single-value relay +- virtual tags that are historized +- equipment whose cluster has no Galaxy gateway +- relay references containing `{{equip}}` tokens that cannot be resolved + +The converter edits the **draft config only** — deploy normally afterward to +activate the changes. + ## Bulk import **Import equipment CSV** (toolbar) bulk-creates equipment across many lines