Auto: focas-f5a — cycle time per part / last cycle delta

Closes #272
This commit is contained in:
Joseph Doherty
2026-04-26 09:11:21 -04:00
parent 45770e8d90
commit e3d7c65f61
7 changed files with 711 additions and 9 deletions

View File

@@ -39,9 +39,12 @@ public sealed class FocasProductionFixedTreeTests
builder.Folders.ShouldContain(f => f.BrowseName == "Production" && f.DisplayName == "Production");
var prodVars = builder.Variables.Where(v =>
v.Info.FullName.Contains("::Production/")).ToList();
prodVars.Count.ShouldBe(4);
string[] expected = ["PartsProduced", "PartsRequired", "PartsTotal", "CycleTimeSeconds"];
foreach (var name in expected)
// Issue #272 (plan PR F5-a) added the two derived telemetry nodes
// LastCycleSeconds + LastCycleStartUtc on top of the original 4 F1-b
// wire-sourced fields, for 6 total Production/ children per device.
prodVars.Count.ShouldBe(6);
string[] int32Fields = ["PartsProduced", "PartsRequired", "PartsTotal", "CycleTimeSeconds"];
foreach (var name in int32Fields)
{
var node = prodVars.SingleOrDefault(v => v.BrowseName == name);
node.BrowseName.ShouldBe(name);
@@ -49,6 +52,17 @@ public sealed class FocasProductionFixedTreeTests
node.Info.SecurityClass.ShouldBe(SecurityClassification.ViewOnly);
node.Info.FullName.ShouldBe($"{Host}::Production/{name}");
}
// F5-a derived telemetry — LastCycleSeconds is Float64 (sub-second
// precision is meaningful at fast cycle times); LastCycleStartUtc is
// DateTime UTC, matching the Diagnostics/LastSuccessfulRead surface.
var lastSec = prodVars.SingleOrDefault(v => v.BrowseName == "LastCycleSeconds");
lastSec.BrowseName.ShouldBe("LastCycleSeconds");
lastSec.Info.DriverDataType.ShouldBe(DriverDataType.Float64);
lastSec.Info.SecurityClass.ShouldBe(SecurityClassification.ViewOnly);
var lastStart = prodVars.SingleOrDefault(v => v.BrowseName == "LastCycleStartUtc");
lastStart.BrowseName.ShouldBe("LastCycleStartUtc");
lastStart.Info.DriverDataType.ShouldBe(DriverDataType.DateTime);
lastStart.Info.SecurityClass.ShouldBe(SecurityClassification.ViewOnly);
}
[Fact]