ethercat-linux/scripts/tc-monitor-5h.ps1
Tony Cao f0163d8d70 800B PDO variant + long-term stability evidence + analysis docs
- twin_layout_blob_sized generalized: multi-entry TwinCAT line format
  (1 real @240bit + N continuation + remainder entry); 1024B path kept
  byte-identical; 800B = 27 entries verified on hardware
- 800B constants (PAYLOAD/SM 800), deployed as el6695_rt_800b
- 10-min + 5h stability runs: 18M cycles, zero errors, zero mismatches,
  PLC nMismatch frozen over the whole run (monitor_5h.csv evidence)
- docs: 800B plan/design/verification/test-report chapters,
  jitter analysis (NFS rootfs stall primary cause), D2000 dev plan
- scripts: 800B deploy/relink/verify, mismatch-delta, 5h monitor
2026-08-06 01:10:50 +08:00

31 lines
1.4 KiB
PowerShell

#Requires -RunAsAdministrator
# 5-hour stability monitor: logs PLC sync metrics to CSV every 60s.
$ErrorActionPreference = 'Continue'
Add-Type -Path 'C:\Program Files (x86)\Beckhoff\TwinCAT\3.1\Components\Base\v170\TwinCAT.Ads.dll'
$logFile = 'C:\Users\tonycao\work\ethercat-linux\monitor_5h.csv'
'timestamp,nCycles,bSync,nReturnedSeq,nMismatch,nProcMismatch' | Out-File $logFile -Encoding utf8
$start = Get-Date
for ($i = 0; $i -lt 300; $i++) {
try {
$c = New-Object TwinCAT.Ads.TcAdsClient
$c.Connect('169.254.176.217.1.1', 851)
$h1 = $c.CreateVariableHandle('GVL_Sync.nCycles')
$h2 = $c.CreateVariableHandle('GVL_Sync.bSync')
$h3 = $c.CreateVariableHandle('GVL_Sync.nReturnedSeq')
$h4 = $c.CreateVariableHandle('GVL_Sync.nMismatch')
$h5 = $c.CreateVariableHandle('GVL_Sync.nProcMismatch')
$nc = $c.ReadAny($h1, [uint64])
$bs = $c.ReadAny($h2, [bool])
$nrs = $c.ReadAny($h3, [uint64])
$nm = $c.ReadAny($h4, [int])
$npm = $c.ReadAny($h5, [uint32])
$c.Dispose()
$ts = (Get-Date).ToString('yyyy-MM-dd HH:mm:ss')
"$ts,$nc,$bs,$nrs,$nm,$npm" | Out-File $logFile -Append -Encoding utf8
} catch {
$ts = (Get-Date).ToString('yyyy-MM-dd HH:mm:ss')
"$ts,ERROR,,,," | Out-File $logFile -Append -Encoding utf8
}
Start-Sleep -Seconds 60
}