Files
Copilot 0c2e2f9849 Fix CTT alarm configuration to reference alarms under AnalogSource and BooleanSource nodes (#3830)
# Description

Fixes the issue where alarms could not be properly initialized via the
CTT (`--ctt`) flag. The fix addresses both the server-side
initialization and the CTT configuration node references.

The fix involves two complementary changes:

1. **Async Node Manager Registration**: The root cause was that the
`AlarmNodeManager` and other async node managers were never being
registered when the Reference Server started. Without the
`AlarmNodeManager` being initialized, the Alarms namespace was not
registered, making it unavailable when `ApplyCTTModeAsync` attempted to
use it.

2. **Correct CTT Configuration References**: The CTT configuration file
now includes explicit namespace references for alarm types that
correctly reference their actual location in the address space. After
the A&C implementation changes, alarms are now children of
`AnalogSource` and `BooleanSource` nodes (not direct children of the
Alarms folder), and the CTT configuration has been updated to reflect
this structure.

## Changes Made

**ConsoleReferenceServer startup
(`Applications/ConsoleReferenceServer/Program.cs`)**
- Added explicit registration of async node managers before server
startup
- Ensures that the `AlarmNodeManager` and all other async factories are
properly initialized
- Follows the same pattern already used for GDS node manager
registration
- Added registration loop to process all async node manager factories

**CTT Configuration (`Applications/UAReferenceServer.ctt.xml`)**
- Updated explicit namespace references for 8 alarm type Input Nodes to
point to the correct source nodes:
  - **Analog-based alarms** → `ns=7;s=Alarms.AnalogSource`:
    - DiscrepancyAlarmType
    - LimitAlarmType
    - ExclusiveLimitAlarmType
    - ExclusiveDeviationAlarmType
    - NonExclusiveDeviationAlarmType
    - AlarmConditionType
  - **Boolean-based alarms** → `ns=7;s=Alarms.BooleanSource`:
    - OffNormalAlarmType
    - SystemOffNormalAlarmType
- Minimal surgical changes: only the namespace mappings were updated to
reference the correct source nodes

The async node managers are now registered between the sync node manager
registration (`server.Create()`) and the server startup
(`server.StartAsync()`), ensuring all namespaces are available when CTT
initialization occurs.

## Testing

- ✅ Server with `--ctt` flag now properly initializes the Alarms
namespace
- ✅ CTT alarms can be enabled without "namespace does not exist" error
- ✅ Explicit namespace mappings correctly reference alarm types under
their respective source nodes
- ✅ Follows existing code patterns for consistency
- ✅ No build or analyzer warnings introduced
- ✅ Build succeeds with 0 warnings, 0 errors

## Related Issues

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: Roman Ettlinger <romanett98@gmail.com>
2026-06-04 13:33:31 +02:00
..

OPC Foundation UA .NET Standard Reference Server

Introduction

The console reference server can be configured using several console parameters. Some of these parameters are explained in more detail below.

To see all available parameters call console reference server with the parameter -h.

Reverse Connect

The OPC UA reverse connect feature allows an OPC UA server to initiate the connection to a client, rather than the traditional model where clients connect to servers. This is particularly useful in scenarios where the server is behind a firewall or NAT, making it difficult for clients to directly connect to it.

How to use Reverse Connect

To enable reverse connect mode, specify the client endpoint URL using the --rc or --reverseconnect parameter:

dotnet ConsoleReferenceServer.dll --rc=opc.tcp://localhost:65300

or

dotnet ConsoleReferenceServer.dll --reverseconnect=opc.tcp://localhost:65300

Example: Server and Client with Reverse Connect

  1. Start the client with reverse connect listener on port 65300:

    dotnet ConsoleReferenceClient.dll --rc=opc.tcp://localhost:65300 opc.tcp://localhost:62541/Quickstarts/ReferenceServer
    
  2. In a separate terminal, start the server with reverse connect to the client:

    dotnet ConsoleReferenceServer.dll --rc=opc.tcp://localhost:65300 -a
    

The server will establish a reverse connection to the client endpoint, and the client will use this connection to communicate with the server.

Additional Options

  • -a or --autoaccept: Auto accept untrusted certificates (for testing only)
  • -c or --console: Log to console
  • -l or --log: Log app output
  • -t or --timeout: Timeout in seconds to exit application

For the complete list of options, use --help.