Initial commit: Wonderware / System Platform tools and reference

Five tools under one repo, all docs organized per DOCS-GUIDE.md:

- aalogcli: .NET 4.8 / x86 CliFx CLI for reading System Platform binary
  logs (*.aaLGX) for LLM debugging, built on aaOpenSource/aaLog. Commands:
  last, tail, range, unread, fields. Stable JSON envelope under --llm-json.
  Build template under lib/build/ for rebuilding aaLogReader.dll.

- aot: ArchestrA Object Toolkit 2014 v4.0 reference material. Dev guide
  (Markdown converted from CHM), API reference for the ArchestrA.Toolkit
  namespace, and the Monitor / Watchdog VS sample solutions.

- graccesscli: .NET 4.8 / x86 CliFx CLI that automates Galaxy
  configuration via the ArchestrA GRAccess COM interop. Includes session
  daemon, IPC protocol, and llm-json envelope contract.

- grdb: SQL/DDL exploration of the Galaxy Repository database. DDL
  captures, reusable queries, hierarchy / contained-name <-> tag-name
  translation notes.

- histdb: LLM-oriented reference for AVEVA Historian retrieval. INSQL
  linked-server, extension tables, every wwXxx time-domain extension,
  every retrieval mode, alarm/event SQL recipes, REST API. Distilled
  from the 243-page Historian Retrieval Guide.

Root contains:
- CLAUDE.md: thin index pointing into each tool's README.
- DOCS-GUIDE.md: doctrine for organizing docs for LLM consumption.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Joseph Doherty
2026-05-03 18:22:20 -04:00
commit 32f26272ae
411 changed files with 69973 additions and 0 deletions
@@ -0,0 +1,398 @@
//------------------------------------------------------------------------------
// Copyright (C) 2008 Invensys Systems Inc. All rights reserved.
//
// THIS CODE AND INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY
// KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
// PARTICULAR PURPOSE.
//------------------------------------------------------------------------------
using System;
using System.Runtime.InteropServices;
using System.Collections;
using ArchestrA.Core;
using ArchestrA.Toolkit;
namespace ArchestrA.Toolkit.Monitor
{
[Guid("df4726d8-fe33-4d79-a6a1-b8198f1e5ac1")]
/// <summary>
/// Summary description for Monitor
/// </summary>
public class MonitorRuntime : RuntimeBase
{
#region Attributes - Toolkit generated code
// The following C# properties have been defined to simplify access to
// attribute values - do not modify the contents of this region with
// the code editor.
private CMxBoolean ResetInputAvg
{
get { return InternalReferenceOnly.ResetInputAvg; }
set { InternalReferenceOnly.ResetInputAvg.Set(value); }
}
private CMxFloat PVHiLimit
{
get { return InternalReferenceOnly.PVHiLimit; }
set { InternalReferenceOnly.PVHiLimit.Set(value); }
}
private CMxDouble PVInputAvg
{
get { return InternalReferenceOnly.PVInputAvg; }
set { InternalReferenceOnly.PVInputAvg.Set(value); }
}
private CMxFloat PV
{
get { return InternalReferenceOnly.PV; }
set { InternalReferenceOnly.PV.Set(value); }
}
public __PVInputOutput PVInputOutput = null;
public class __PVInputOutput : InputOutputPrimBase
{
protected override void Initialize(SupportWrapper _Wrapper)
{
if (_ReadValue == null) { _ReadValue = new CMxVariant(Wrapper, "PVInputOutput.ReadValue"); }
if (_WriteValue == null) { _WriteValue = new CMxVariant(Wrapper, "PVInputOutput.WriteValue"); }
if (_DataType == null) { _DataType = new CMxDataType(Wrapper, "PVInputOutput.DataType"); }
attrId = _ReadValue.Attribute.shAttributeId;
attrId2 = _WriteValue.Attribute.shAttributeId;
primId = _ReadValue.Attribute.shPrimitiveId;
dataType = _DataType.Value;
base.Initialize(Wrapper);
}
public SupportWrapper Wrapper = new SupportWrapper();
private CMxStatus _ReadStatus = null;
public CMxStatus ReadStatus
{
get { if (_ReadStatus == null) { _ReadStatus = new CMxStatus(Wrapper, "PVInputOutput.ReadStatus"); } return _ReadStatus; }
set { if (_ReadStatus == null) { _ReadStatus = new CMxStatus(Wrapper, "PVInputOutput.ReadStatus"); } _ReadStatus.Set(value); }
}
private CMxVariant _ReadValue = null;
public CMxVariant ReadValue
{
get { if (_ReadValue == null) { _ReadValue = new CMxVariant(Wrapper, "PVInputOutput.ReadValue"); } return _ReadValue; }
set { if (_ReadValue == null) { _ReadValue = new CMxVariant(Wrapper, "PVInputOutput.ReadValue"); } _ReadValue.Set(value); }
}
private CMxReference _ReferenceSecondary = null;
public CMxReference ReferenceSecondary
{
get { if (_ReferenceSecondary == null) { _ReferenceSecondary = new CMxReference(Wrapper, "PVInputOutput.ReferenceSecondary"); } return _ReferenceSecondary; }
set { if (_ReferenceSecondary == null) { _ReferenceSecondary = new CMxReference(Wrapper, "PVInputOutput.ReferenceSecondary"); } _ReferenceSecondary.Set(value); }
}
private CMxReference _Reference = null;
public CMxReference Reference
{
get { if (_Reference == null) { _Reference = new CMxReference(Wrapper, "PVInputOutput.Reference"); } return _Reference; }
set { if (_Reference == null) { _Reference = new CMxReference(Wrapper, "PVInputOutput.Reference"); } _Reference.Set(value); }
}
private CMxDataType _DataType = null;
public CMxDataType DataType
{
get { if (_DataType == null) { _DataType = new CMxDataType(Wrapper, "PVInputOutput.DataType"); } return _DataType; }
}
private CMxVariant _WriteValue = null;
public CMxVariant WriteValue
{
get { if (_WriteValue == null) { _WriteValue = new CMxVariant(Wrapper, "PVInputOutput.WriteValue"); } return _WriteValue; }
set { if (_WriteValue == null) { _WriteValue = new CMxVariant(Wrapper, "PVInputOutput.WriteValue"); } _WriteValue.Set(value); }
}
private CMxStatus _WriteStatus = null;
public CMxStatus WriteStatus
{
get { if (_WriteStatus == null) { _WriteStatus = new CMxStatus(Wrapper, "PVInputOutput.WriteStatus"); } return _WriteStatus; }
set { if (_WriteStatus == null) { _WriteStatus = new CMxStatus(Wrapper, "PVInputOutput.WriteStatus"); } _WriteStatus.Set(value); }
}
public AoAWrapper AoA = null;
public void SuspendUpdatesList()
{
if (AoA == null) { AoA = new AoAWrapper(Wrapper, new string[] { "PVInputOutput.ReadValue" }); } AoA.SuspendUpdatesList();
}
public void ActivateUpdatesList()
{
if (AoA == null) { AoA = new AoAWrapper(Wrapper, new string[] { "PVInputOutput.ReadValue" }); } AoA.ActivateUpdatesList();
}
public __PVInputOutput(AObjectBase baseClass)
{
Wrapper.baseClass = baseClass;
}
}
#endregion Attributes
#region Internal Reference Only
//Toolkit code required to access the attributes declared in the Object Class
private Monitor InternalReferenceOnly = null;
#endregion Internal Reference Only
#region Declarations
//Declare Runtime Class Variables here.
//Variables declared in this region are available to all methods
//in the Runtime Class.
long totalReads;
double accumulatedInput;
#endregion Declarations
public MonitorRuntime()
{
InternalReferenceOnly = new Monitor();
this.AObjectInstance = InternalReferenceOnly;
#region Runtime Event Registration - Toolkit generated code
// Required region for Runtime Events - do not modify
// the contents of this region with the code editor.
base.RuntimeGetStatusDesc += new RuntimeGetStatusDescDelegate(MonitorRuntime_RuntimeGetStatusDesc);
base.RuntimeSetScanState += new RuntimeSetScanStateDelegate(Monitor_RuntimeSetScanState);
base.RuntimeExecute += new RuntimeExecuteDelegate(Monitor_RuntimeExecute);
base.RuntimeShutdown += new RuntimeShutdownDelegate(Monitor_RuntimeShutdown);
base.RuntimeStartup += new RuntimeStartupDelegate(Monitor_RuntimeStartup);
base.RuntimeDynamic += new RuntimeDynamicSetHandlerDelegate(MonitorRuntime_RuntimeDynamic);
base.RuntimeInitialize += new RuntimeInitializeDelegate(MonitorRuntime_RuntimeInitialize);
#endregion Runtime Event Registration
#region Runtime Set Handler Registration Toolkit generated code
// Required method for Runtime SetHandlers.
// Changes made using the code editor will appear in the Toolkit Editor.
//
// WARNING: Changes made to this region will result in a Shape Change.
// TODO: Runtime SetHandler registration
this.RegisterRuntimeSetHandler("ResetInputAvg", new RuntimeSetHandlerDelegate(ResetInputAvgSetHandler));
this.RegisterRuntimeSetHandler("PVHiLimit", new RuntimeSetHandlerDelegate(PVHiLimitSetHandler));
this.RegisterRuntimeSetHandler("PV", new RuntimeSetHandlerDelegate(PVSetHandler));
#endregion Runtime Set Handler Registration
#region Primitive Wrapper Initialization - Toolkit generated code
PVInputOutput = new __PVInputOutput(this);
#endregion Primitive Wrapper Initialization
#region Primitive Advise only Activate Registration - Toolkit generated code
#endregion Primitive Advise only Activate Initialization
}
private void MonitorRuntime_RuntimeInitialize(object sender)
{
//------------------------------------------------------------------------------
// TODO: Runtime - Initialize
//
// Do not read or write attribute values of this primitive during Initialize
//------------------------------------------------------------------------------
}
private void Monitor_RuntimeExecute(object sender)
{
//------------------------------------------------------------------------------
// TODO: Runtime - Execute
//
// This is where the main logic of the object periodically executes when
// the object is on scan.
//
// Read or write the attributes of this primitive using the generated
// properties (Value, Quality).
//------------------------------------------------------------------------------
#region Example code
// // The lines below both increment the value of the attribute "Attribute1" by 1
// Example_001 ++;
// Example_001 = Example_001 + 1;
//
// //Example_001 quality is set to Bad on Condition_001 being true.
// Example_001.Quality = (Condition_001 ? DataQuality.DataQualityBad : DataQuality.DataQualityGood);
//
// // The attribute "ElapsedTime" contains the time elapsed since the last reset
// ElapsedTime = GetScanTime() - TimeOfLastReset;
//
// // Increment the 3rd element of an array
// FloatArray[3] ++;
//
// // Increment all the elements of an array
// for( short counter = 1; counter <= FloatArray.Length; counter ++)
// {
// FloatArray[counter] ++;
// }
#endregion
if ((PVInputOutput.ReadStatus.Value.success == -1) && PVInputOutput.ReadValue.Quality.isGood)
{
float inputValue = (float)PVInputOutput.GetReadValue();
PV = inputValue;
accumulatedInput += Convert.ToDouble(inputValue);
totalReads++;
PVInputAvg = accumulatedInput / totalReads;
PVInputAvg.Quality = DataQuality.DataQualityGood;
}
}
private void Monitor_RuntimeShutdown(object sender)
{
//------------------------------------------------------------------------------
// TODO: Runtime Event - Shutdown
//
// Clean up dynamic allocation, release open resources, etc.
//------------------------------------------------------------------------------
}
private void Monitor_RuntimeStartup(object sender, RuntimeStartupEventArgs e)
{
//------------------------------------------------------------------------------
// TODO: Runtime Event - Startup
//
// Cache attributes. Cache Primitive IDs of other known primitives.
//------------------------------------------------------------------------------
// RestoreDynamicAttributes will recreate the Dynamic Attributes and restore the check pointed
// values during failover startup. The Failover Support for Dynamic Attributes option must
// be enabled via the Object Editor to support this function. To maintain the
// Dynamic Attribute values the CheckpointDynamicAttributeData function must be called
// when Dynamic Attribute values are modified (refer to the Dynamic Attribute Set Handler).
//RestoreDynamicAttributes();
// Execute offscan code to initialize the object in its offscan state.
SetScanState(false);
}
private void Monitor_RuntimeSetScanState(object sender, RuntimeSetScanStateEventArgs e)
{
//------------------------------------------------------------------------------
// TODO: Runtime Event - SetScanState
//
// Perform actions when the object goes on or off scan.
//------------------------------------------------------------------------------
if (e.onScan)
{
PVInputAvg.Quality = DataQuality.DataQualityInitializing;
}
else
{
PVInputAvg.Quality = DataQuality.DataQualityBad;
}
}
private void MonitorRuntime_RuntimeGetStatusDesc(object sender, ref RuntimeGetStatusDescEventArgs e)
{
//------------------------------------------------------------------------------
// TODO: Runtime Event - GetStatusDesc
//
// This routine provides a String for an error code when a client requests it.
// By default this method looks for an entry in the dictionary that has the
// DetailedErrorCode as the PhraseID.
//
// You need to change this implmentation if you want to provide embedded values
// within your messages, or you want to use string PhraseIDs instead of integer
// PhraseIDs.
//------------------------------------------------------------------------------
switch (e.detailedErrorCode)
{
case 10000:
e.status = GetText("HiLimitExceeded");
break;
default:
e.status = GetText((int)e.detailedErrorCode);
break;
}
}
private void MonitorRuntime_RuntimeDynamic(object sender, ref RuntimeSetHandlerEventArgs e)
{
string attrName = Get(e.attributeHandle.shAttributeId, e.attributeHandle.shPrimitiveId, EATTRIBUTEPROPERTY.idxAttribPropName);
//------------------------------------------------------------------------------
// TODO: Runtime Event - Dynamic Set Handler
//
// Implement set handler code for any dynamic attributes you create with set handlers
//------------------------------------------------------------------------------
// CheckpointDynamicAttributeData will update the checkpoint values for all Dynamic Attributes.
// To recreate Dynamic Attributes and restore Dynamic Attribute values the RestoreDynamicAttributes
// function must be called when starting up from failover (refer to the Startup method).
//CheckpointDynamicAttributeData();
#region Example
// if (attrName == "MyDynamic")
// {
// if (e.Value > 10)
// {
// LogWarning(string.Format("value for {0} must be less or equal to 10", attrName));
// }
// else
// {
// SetValue(attrName, e.Value);
// }
//
//
// return;
// }
#endregion
// if unhandled a warning is shown as a reminder
SetValue(e.attributeHandle.shAttributeId, e.attributeHandle.shPrimitiveId, e.Value);
LogWarning(string.Format("Uknown set handler for attribute '{0}'", attrName));
}
private void PVSetHandler(object sender, ref RuntimeSetHandlerEventArgs e)
{
if (e.Value > PVHiLimit)
{
e.status.detail = 10000;
e.status.Category = MxStatusCategory.MxCategoryOperationalError;
}
else
{
PV.SetHandlerValue = e;
PVInputOutput.WriteValue = e.Value;
}
}
private void PVHiLimitSetHandler(object sender, ref RuntimeSetHandlerEventArgs e)
{
PVHiLimit.SetHandlerValue = e;
}
private void ResetInputAvgSetHandler(object sender, ref RuntimeSetHandlerEventArgs e)
{
ResetInputAvg.SetHandlerValue = e;
totalReads = 0;
accumulatedInput = 0;
}
}
}
@@ -0,0 +1,118 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>9.0.21022</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{71A913E8-9A33-4A92-AD13-6B9023E5C8E5}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>ArchestrA.Toolkit.Monitor</RootNamespace>
<AssemblyName>MonitorRuntime5</AssemblyName>
<SignAssembly>true</SignAssembly>
<AssemblyOriginatorKeyFile>..\Monitor.snk</AssemblyOriginatorKeyFile>
<FileUpgradeFlags>
</FileUpgradeFlags>
<UpgradeBackupLocation>
</UpgradeBackupLocation>
<OldToolsVersion>4.0</OldToolsVersion>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<PublishUrl>publish\</PublishUrl>
<Install>true</Install>
<InstallFrom>Disk</InstallFrom>
<UpdateEnabled>false</UpdateEnabled>
<UpdateMode>Foreground</UpdateMode>
<UpdateInterval>7</UpdateInterval>
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
<UpdatePeriodically>false</UpdatePeriodically>
<UpdateRequired>false</UpdateRequired>
<MapFileExtensions>true</MapFileExtensions>
<ApplicationRevision>0</ApplicationRevision>
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
<IsWebBootstrapper>false</IsWebBootstrapper>
<UseApplicationTrust>false</UseApplicationTrust>
<BootstrapperEnabled>true</BootstrapperEnabled>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<RegisterForComInterop>false</RegisterForComInterop>
<PlatformTarget>x86</PlatformTarget>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<PlatformTarget>x86</PlatformTarget>
</PropertyGroup>
<ItemGroup>
<Reference Include="ArchestrA.Toolkit.ArchestrAObjectSupport, Version=4.0.0.0, Culture=neutral, PublicKeyToken=f787e550f2f530ee, processorArchitecture=MSI">
<SpecificVersion>False</SpecificVersion>
<HintPath>C:\Program Files\Archestra\Toolkits\AOT\bin\ArchestrA.Toolkit.ArchestrAObjectSupport.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="ArchestrA.Core, Version=1.0.0.0, Culture=neutral, PublicKeyToken=23106a86e706d0ae">
<SpecificVersion>False</SpecificVersion>
<HintPath>C:\Program Files\Archestra\Toolkits\AOT\bin\ArchestrA.Core.dll</HintPath>
<Private>True</Private>
</Reference>
</ItemGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="MonitorRuntime.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Service Include="{94E38DFF-614B-4cbd-B67C-F211BB35CE8B}" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Monitor\Monitor.csproj">
<Project>{0D1ADE9C-7960-4C20-A274-1FFEAAFF9315}</Project>
<Name>Monitor</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<None Include="..\Monitor.snk">
<Link>Monitor.snk</Link>
</None>
</ItemGroup>
<ItemGroup>
<BootstrapperPackage Include="Microsoft.Net.Client.3.5">
<Visible>False</Visible>
<ProductName>.NET Framework 3.5 SP1 Client Profile</ProductName>
<Install>false</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
<Visible>False</Visible>
<ProductName>.NET Framework 3.5 SP1</ProductName>
<Install>true</Install>
</BootstrapperPackage>
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
<PropertyGroup>
<PostBuildEvent>
</PostBuildEvent>
<PreBuildEvent>
</PreBuildEvent>
</PropertyGroup>
</Project>
@@ -0,0 +1,44 @@
//------------------------------------------------------------------------------
// Copyright (C) 2008 Invensys Systems Inc. All rights reserved.
//
// THIS CODE AND INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY
// KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
// PARTICULAR PURPOSE.
//------------------------------------------------------------------------------
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Runtime")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("test")]
[assembly: AssemblyProduct("Runtime")]
[assembly: AssemblyCopyright("Copyright © Wonderware 2006")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(true)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("e59227fc-54f8-45ec-895b-723cebc485af")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Revision and Build Numbers
// by using the '*' as shown below:
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.1.0.0")]