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("StatsRuntime")]
[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("1e5f4d65-4d90-4529-896f-3a72ddc8052b")]
// 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,329 @@
//------------------------------------------------------------------------------
// 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 ArchestrA.Core;
using ArchestrA.Toolkit;
namespace ArchestrA.Toolkit.Watchdog
{
[Guid("85ca8612-8c40-4e51-b8b5-8588f2af5e59")]
/// <summary>
/// Summary description for Watchdog
/// </summary>
public class StatsRuntime : 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 CMxTime LastTimeout
{
get { return InternalReferenceOnly.LastTimeout; }
set { InternalReferenceOnly.LastTimeout.Set(value); }
}
private CMxInteger TimeoutCnt
{
get { return InternalReferenceOnly.TimeoutCnt; }
set { InternalReferenceOnly.TimeoutCnt.Set(value); }
}
private CMxBoolean Reset
{
get { return InternalReferenceOnly.Reset; }
set { InternalReferenceOnly.Reset.Set(value); }
}
private CMxElapsedTime DelayMax
{
get { return InternalReferenceOnly.DelayMax; }
set { InternalReferenceOnly.DelayMax.Set(value); }
}
private CMxElapsedTime DelayAverage
{
get { return InternalReferenceOnly.DelayAverage; }
set { InternalReferenceOnly.DelayAverage.Set(value); }
}
#endregion Attributes
#region Internal Reference Only
//Toolkit code required to access the attributes declared in the Object Class
private Stats 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.
bool m_PreviousTimeoutCondition;
TimeSpan m_PreviousTimeSinceChange;
TimeSpan m_DelayTotal;
long m_ChangeDetectedCount;
#endregion Declarations
public StatsRuntime()
{
InternalReferenceOnly = new Stats();
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(StatsRuntime_RuntimeGetStatusDesc);
base.RuntimeSetScanState += new RuntimeSetScanStateDelegate(StatsRuntime_RuntimeSetScanState);
base.RuntimeExecute += new RuntimeExecuteDelegate(StatsRuntime_RuntimeExecute);
base.RuntimeShutdown += new RuntimeShutdownDelegate(StatsRuntime_RuntimeShutdown);
base.RuntimeStartup += new RuntimeStartupDelegate(StatsRuntime_RuntimeStartup);
base.RuntimeDynamic += new RuntimeDynamicSetHandlerDelegate(StatsRuntime_RuntimeDynamic);
base.RuntimeInitialize += new RuntimeInitializeDelegate(StatsRuntime_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("Reset", new RuntimeSetHandlerDelegate(ResetSetHandler));
#endregion Runtime Set Handler Registration
#region Primitive Wrapper Initialization - Toolkit generated code
#endregion Primitive Wrapper Initialization
#region Primitive Advise only Activate Registration - Toolkit generated code
#endregion Primitive Advise only Activate Initialization
}
private void StatsRuntime_RuntimeInitialize(object sender)
{
//------------------------------------------------------------------------------
// TODO: Runtime - Initialize
//
// Do not read or write attribute values of this primitive during Initialize
//------------------------------------------------------------------------------
}
private void StatsRuntime_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 CurrentTimeoutCondition;
GetBoolean("myparent.Timeout", out CurrentTimeoutCondition);
if (!m_PreviousTimeoutCondition && CurrentTimeoutCondition)
{
TimeoutCnt++;
LastTimeout = GetScanTime();
}
//Compute the average delay by maintaining a sum/count of all the time elapsed between input changes,
//(since the last reset) and dividing by the number input changes detected
//
TimeSpan CurrentTimeSinceChange;
GetElapsedTime("myparent.TimeSinceChange", out CurrentTimeSinceChange);
if (CurrentTimeSinceChange.Ticks == 0) //The input just changed
{
m_DelayTotal = m_DelayTotal + m_PreviousTimeSinceChange;
DelayAverage = new TimeSpan(m_DelayTotal.Ticks / ++m_ChangeDetectedCount);
}
//Compute the maximum delay
if (CurrentTimeSinceChange > DelayMax)
{
DelayMax = CurrentTimeSinceChange;
}
//Save these values for tests made during the next scan (see above)
m_PreviousTimeoutCondition = CurrentTimeoutCondition;
m_PreviousTimeSinceChange = CurrentTimeSinceChange;
}
private void StatsRuntime_RuntimeShutdown(object sender)
{
//------------------------------------------------------------------------------
// TODO: Runtime Event - Shutdown
//
// Clean up dynamic allocation, release open resources, etc.
//------------------------------------------------------------------------------
// Activate marked attributes before shutting down
AdviseOnlyActivateAttributes();
}
private void StatsRuntime_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);
// 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 StatsRuntime_RuntimeSetScanState(object sender, RuntimeSetScanStateEventArgs e)
{
//------------------------------------------------------------------------------
// TODO: Runtime Event - SetScanState
//
// Perform actions when the object goes on or off scan.
//------------------------------------------------------------------------------
}
private void StatsRuntime_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)
{
default:
e.status = GetText((int)e.detailedErrorCode);
break;
}
}
private void StatsRuntime_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 ResetSetHandler(object sender, ref RuntimeSetHandlerEventArgs e)
{
TimeoutCnt = 0;
LastTimeout = DateTime.MinValue;
DelayAverage = new TimeSpan(0);
DelayMax = new TimeSpan(0);
m_ChangeDetectedCount = 0;
m_DelayTotal = new TimeSpan(0);
}
}
}
@@ -0,0 +1,132 @@
<?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>{7E2D944C-A637-451B-A66D-E7861F1D4CBE}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>ArchestrA.Toolkit.Watchdog</RootNamespace>
<AssemblyName>WatchDogStatsRuntime1</AssemblyName>
<SignAssembly>true</SignAssembly>
<AssemblyOriginatorKeyFile>..\..\Watchdog.snk</AssemblyOriginatorKeyFile>
<FileUpgradeFlags>
</FileUpgradeFlags>
<OldToolsVersion>3.5</OldToolsVersion>
<UpgradeBackupLocation>
</UpgradeBackupLocation>
<IsWebBootstrapper>false</IsWebBootstrapper>
<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>
<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>
<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="StatsRuntime.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Service Include="{94E38DFF-614B-4cbd-B67C-F211BB35CE8B}" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Statsobj\Statsobj.csproj">
<Project>{A7BA2304-935A-4DDD-80CC-E6387B2980E6}</Project>
<Name>Statsobj</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.2.0">
<Visible>False</Visible>
<ProductName>.NET Framework 2.0 %28x86%29</ProductName>
<Install>true</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Net.Framework.3.0">
<Visible>False</Visible>
<ProductName>.NET Framework 3.0 %28x86%29</ProductName>
<Install>false</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5">
<Visible>False</Visible>
<ProductName>.NET Framework 3.5</ProductName>
<Install>false</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
<Visible>False</Visible>
<ProductName>.NET Framework 3.5 SP1</ProductName>
<Install>false</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>