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,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("ArchestrA")]
[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("8f60c23a-adac-41fd-a589-8006d96dd206")]
// 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")]
@@ -0,0 +1,381 @@
//------------------------------------------------------------------------------
// 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.Watchdog
{
[Guid("886e73ad-ddb7-45ca-8ca2-e652e1e9bafd")]
/// <summary>
/// Summary description for Watchdog
/// </summary>
public class WatchdogRuntime : 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 Timeout
{
get { return InternalReferenceOnly.Timeout; }
set { InternalReferenceOnly.Timeout.Set(value); }
}
private CMxElapsedTime TimeSinceChange
{
get { return InternalReferenceOnly.TimeSinceChange; }
set { InternalReferenceOnly.TimeSinceChange.Set(value); }
}
private CMxElapsedTime Timeout_Limit
{
get { return InternalReferenceOnly.Timeout_Limit; }
set { InternalReferenceOnly.Timeout_Limit.Set(value); }
}
public __InputPrimitive1 InputPrimitive1 = null;
public class __InputPrimitive1 : InputPrimBase
{
protected override void Initialize(SupportWrapper _Wrapper)
{
if (_Value == null) { _Value = new CMxVariant(Wrapper, "MonitoredBit.Value"); }
if (_DataType == null) { _DataType = new CMxDataType(Wrapper, "MonitoredBit.DataType"); }
attrId = _Value.Attribute.shAttributeId;
primId = _Value.Attribute.shPrimitiveId;
dataType = _DataType.Value;
base.Initialize(Wrapper);
}
public SupportWrapper Wrapper = new SupportWrapper();
private CMxVariant _Value = null;
public CMxVariant Value
{
get { if (_Value == null) { _Value = new CMxVariant(Wrapper, "MonitoredBit.Value"); } return _Value; }
set { if (_Value == null) { _Value = new CMxVariant(Wrapper, "MonitoredBit.Value"); } _Value.Set(value); }
}
private CMxStatus _ReadStatus = null;
public CMxStatus ReadStatus
{
get { if (_ReadStatus == null) { _ReadStatus = new CMxStatus(Wrapper, "MonitoredBit.ReadStatus"); } return _ReadStatus; }
set { if (_ReadStatus == null) { _ReadStatus = new CMxStatus(Wrapper, "MonitoredBit.ReadStatus"); } _ReadStatus.Set(value); }
}
private CMxReference _InputSource = null;
public CMxReference InputSource
{
get { if (_InputSource == null) { _InputSource = new CMxReference(Wrapper, "MonitoredBit.InputSource"); } return _InputSource; }
set { if (_InputSource == null) { _InputSource = new CMxReference(Wrapper, "MonitoredBit.InputSource"); } _InputSource.Set(value); }
}
private CMxDataType _DataType = null;
public CMxDataType DataType
{
get { if (_DataType == null) { _DataType = new CMxDataType(Wrapper, "MonitoredBit.DataType"); } return _DataType; }
}
public AoAWrapper AoA = null;
public void SuspendUpdatesList()
{
if (AoA == null) { AoA = new AoAWrapper(Wrapper, new string[] { "MonitoredBit.Value" }); } AoA.SuspendUpdatesList();
}
public void ActivateUpdatesList()
{
if (AoA == null) { AoA = new AoAWrapper(Wrapper, new string[] { "MonitoredBit.Value" }); } AoA.ActivateUpdatesList();
}
public __InputPrimitive1(AObjectBase baseClass)
{
Wrapper.baseClass = baseClass;
}
}
#endregion Attributes
#region Internal Reference Only
//Toolkit code required to access the attributes declared in the Object Class
private WatchDog 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.
DateTime m_TimeOfLastChange;
bool m_LastInputValue;
#endregion Declarations
public WatchdogRuntime()
{
InternalReferenceOnly = new WatchDog();
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(WatchdogRuntime_RuntimeGetStatusDesc);
base.RuntimeSetScanState += new RuntimeSetScanStateDelegate(Watchdog_RuntimeSetScanState);
base.RuntimeExecute += new RuntimeExecuteDelegate(Watchdog_RuntimeExecute);
base.RuntimeShutdown += new RuntimeShutdownDelegate(Watchdog_RuntimeShutdown);
base.RuntimeStartup += new RuntimeStartupDelegate(Watchdog_RuntimeStartup);
base.RuntimeDynamic += new RuntimeDynamicSetHandlerDelegate(WatchdogRuntime_RuntimeDynamic);
base.RuntimeInitialize += new RuntimeInitializeDelegate(WatchdogRuntime_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("Timeout.Limit", new RuntimeSetHandlerDelegate(Timeout_LimitSetHandler));
#endregion Runtime Set Handler Registration
#region Primitive Wrapper Initialization - Toolkit generated code
InputPrimitive1 = new __InputPrimitive1(this);
#endregion Primitive Wrapper Initialization
#region Primitive Advise only Activate Registration - Toolkit generated code
#endregion Primitive Advise only Activate Initialization
}
private void WatchdogRuntime_RuntimeInitialize(object sender)
{
//------------------------------------------------------------------------------
// TODO: Runtime - Initialize
//
// Do not read or write attribute values of this primitive during Initialize
//------------------------------------------------------------------------------
}
private void Watchdog_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
bool CurrentBitValue = (bool)InputPrimitive1.GetValue();
DateTime Now = GetScanTime();
//Cache the current time internally if the monitored bit has just changed
if (CurrentBitValue != m_LastInputValue)
{
m_TimeOfLastChange = Now; //remember the current time
}
m_LastInputValue = CurrentBitValue;
//Now update the calculated attributes: "TimeSinceChange" and "Timeout.Condition"
TimeSinceChange = Now - m_TimeOfLastChange;
Timeout = TimeSinceChange > Timeout_Limit;
}
private void Watchdog_RuntimeShutdown(object sender)
{
//------------------------------------------------------------------------------
// TODO: Runtime Event - Shutdown
//
// Clean up dynamic allocation, release open resources, etc.
//------------------------------------------------------------------------------
// Activate marked attributes before shutting down
AdviseOnlyActivateAttributes();
}
private void Watchdog_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();
m_TimeOfLastChange = GetScanTime();
// Execute offscan code to initialize the object in its offscan state.
SetScanState(false);
// Suspend marked attributes at startup
AdviseOnlySuspendAttributes();
}
private void AdviseOnlySuspendAttributes()
{
// Required Method for Advise only Active.
// Do not modify this method via the code editor.
//
// WARNING: Changes made to this method will be overwritten by the code generator.
if (AdviseOnlyActiveEnabled)
{
}
}
private void AdviseOnlyActivateAttributes()
{
// Required Method for Advise only Active.
// Do not modify this method via the code editor.
//
// WARNING: Changes made to this method will be overwritten by the code generator.
if (AdviseOnlyActiveEnabled)
{
}
}
private void Watchdog_RuntimeSetScanState(object sender, RuntimeSetScanStateEventArgs e)
{
//------------------------------------------------------------------------------
// TODO: Runtime Event - SetScanState
//
// Perform actions when the object goes on or off scan.
//------------------------------------------------------------------------------
}
private void WatchdogRuntime_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("Timeout.Limit must be a positive number.");
break;
default:
e.status = GetText((int)e.detailedErrorCode);
break;
}
}
private void WatchdogRuntime_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 Timeout_LimitSetHandler(object sender, ref RuntimeSetHandlerEventArgs e)
{
if (e.Value < 0)
{
e.status.detail = 10000;
e.status.Category = MxStatusCategory.MxCategoryConfigurationError;
return;
}
Timeout_Limit.SetHandlerValue = e;
}
//TODO: Runtime SetHandler declaration
//private void Example_001SetHandler(object sender, ref RuntimeSetHandlerEventArgs e)
//{
// Example_001 = e.Value;
//}
}
}
@@ -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>{FCAA2DA3-97F2-4C42-BB09-6729738D6872}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>ArchestrA.Toolkit.Watchdog</RootNamespace>
<AssemblyName>WatchdogRuntime1</AssemblyName>
<SignAssembly>true</SignAssembly>
<AssemblyOriginatorKeyFile>..\Watchdog.snk</AssemblyOriginatorKeyFile>
<FileUpgradeFlags>
</FileUpgradeFlags>
<UpgradeBackupLocation>
</UpgradeBackupLocation>
<OldToolsVersion>3.5</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="WatchdogRuntime.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Service Include="{94E38DFF-614B-4cbd-B67C-F211BB35CE8B}" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Watchdog\Watchdog.csproj">
<Project>{0E30645D-B574-41BF-B302-64FEE3C8208A}</Project>
<Name>Watchdog</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<None Include="..\Watchdog.snk">
<Link>Watchdog.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>