-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathDynamicReportQualificationResultWindow.xaml.cs
More file actions
299 lines (262 loc) · 15 KB
/
Copy pathDynamicReportQualificationResultWindow.xaml.cs
File metadata and controls
299 lines (262 loc) · 15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
using System.Text;
using System.Windows;
using ArIED61850Tester.Services;
namespace ArIED61850Tester;
internal partial class DynamicReportQualificationResultWindow : Window
{
internal DynamicReportQualificationResultWindow(DynamicReportQualificationCommissioningResult result)
{
ArgumentNullException.ThrowIfNull(result);
InitializeComponent();
Title = "G2.3 Dynamic Reporting Qualification Evidence";
HeaderText.Text = "G2.3 Dynamic Reporting Qualification";
SummaryText.Text = result.Summary;
StateText.Text = result.SavedProfile?.State.ToString()
?? result.Coordinator?.Assessment.State.ToString()
?? (result.IsBlocked ? "Blocked" : "Not qualified");
EvidenceTextBox.Text = BuildG23Evidence(result);
if (result.IsSuccess && result.SavedProfile is not null)
SetPassBadge();
}
internal DynamicReportQualificationResultWindow(DynamicReportTriggerOptionsProbeCommissioningResult result)
{
ArgumentNullException.ThrowIfNull(result);
InitializeComponent();
Title = "P0 Isolated TrgOps Micro-Probe Evidence";
HeaderText.Text = "P0 Isolated TrgOps Micro-Probe";
SummaryText.Text = result.Summary;
StateText.Text = result.IsSuccess
? "P0 TrgOps Proven"
: result.IsBlocked
? "Blocked"
: result.CleanupSucceeded
? "Not proven / restored"
: "Restore unproven";
EvidenceTextBox.Text = BuildP0Evidence(result);
if (result.IsSuccess)
SetPassBadge();
}
internal DynamicReportQualificationResultWindow(DynamicReportActivationCommissioningResult result)
{
ArgumentNullException.ThrowIfNull(result);
InitializeComponent();
Title = "G2.4 One-URCB InformationReport Proof Evidence";
HeaderText.Text = "G2.4 One-URCB InformationReport Proof";
SummaryText.Text = result.Summary;
StateText.Text = result.SavedProfile?.State.ToString()
?? result.InputProfile?.State.ToString()
?? (result.IsBlocked ? "Blocked" : "Not proven");
EvidenceTextBox.Text = BuildG24Evidence(result);
if (result.IsSuccess && result.SavedProfile is not null)
SetPassBadge();
}
private void SetPassBadge()
{
StateBadge.Background = new System.Windows.Media.SolidColorBrush(System.Windows.Media.Color.FromRgb(236, 253, 243));
StateBadge.BorderBrush = new System.Windows.Media.SolidColorBrush(System.Windows.Media.Color.FromRgb(171, 225, 193));
StateText.Foreground = new System.Windows.Media.SolidColorBrush(System.Windows.Media.Color.FromRgb(6, 118, 71));
}
private static string BuildG23Evidence(DynamicReportQualificationCommissioningResult result)
{
var builder = new StringBuilder();
builder.AppendLine("ARSAS G2 DYNAMIC REPORTING QUALIFICATION EVIDENCE");
builder.AppendLine(new string('=', 62));
builder.AppendLine($"Result: {result.Summary}");
builder.AppendLine($"Blocked: {result.IsBlocked}");
builder.AppendLine($"Qualification success: {result.IsSuccess}");
if (result.Identity is not null)
{
builder.AppendLine();
builder.AppendLine("IED IDENTITY");
builder.AppendLine($"Stable identity: {result.Identity.StableIdentityKey}");
builder.AppendLine($"Model fingerprint: {result.Identity.ModelFingerprint}");
builder.AppendLine($"Model: {result.Identity.Model}");
builder.AppendLine($"Firmware: {result.Identity.FirmwareRevision}");
builder.AppendLine($"Profile revision: {result.Identity.ProfileRevision}");
}
builder.AppendLine();
builder.AppendLine("CLASS-A CANDIDATES");
builder.AppendLine($"Selected signals: {result.Candidates.SelectedSignalCount}");
builder.AppendLine($"Scalar ST/MX candidates: {result.Candidates.ScalarClassACount}");
builder.AppendLine($"Exact live mappings: {result.Candidates.ExactResolvedCount}");
builder.AppendLine($"Direct MMS reads passed: {result.Candidates.DirectReadValidatedCount}");
if (result.Coordinator is not null)
{
builder.AppendLine();
builder.AppendLine("QUALIFICATION LADDER");
builder.AppendLine(result.Coordinator.Summary);
builder.AppendLine($"Successful milestones: {string.Join(", ", result.Coordinator.SuccessfulMilestoneMemberCounts)}");
builder.AppendLine($"Failed milestone: {result.Coordinator.FailedMilestoneMemberCount}");
builder.AppendLine($"Failure localization: {result.Coordinator.FailureLocalizationAttempted}");
builder.AppendLine($"Fresh association required: {result.Coordinator.RequiresFreshAssociation}");
builder.AppendLine($"Envelope candidate: {result.Coordinator.EnvelopeCandidateAttemptId}");
}
if (result.SavedProfile is not null)
{
builder.AppendLine();
builder.AppendLine("PERSISTED PROFILE");
builder.AppendLine($"State: {result.SavedProfile.State}");
builder.AppendLine($"Safe exact envelope: {result.SavedProfile.ProvenSafeMemberCount} member(s)");
builder.AppendLine($"Proven Define request: {result.SavedProfile.ProvenSafeDefineRequestByteCount} byte(s)");
builder.AppendLine($"Negotiated max MMS PDU: {result.SavedProfile.NegotiatedMaxMmsPduSize?.ToString() ?? "unknown"}");
builder.AppendLine($"File: {result.ProfilePath}");
}
if (result.Candidates.Rejections.Count > 0)
{
builder.AppendLine();
builder.AppendLine("CANDIDATE REJECTIONS");
foreach (var rejection in result.Candidates.Rejections)
builder.AppendLine("- " + rejection);
}
builder.AppendLine();
builder.AppendLine("WIRE / SAFETY EVIDENCE");
foreach (var line in result.EvidenceLines)
builder.AppendLine(line);
builder.AppendLine();
builder.AppendLine("SAFETY STATE");
builder.AppendLine("EnvelopeQualified != RcbActivationProven != InformationReportProven != ProductionEligible");
builder.AppendLine("No automatic production dynamic RCB/URCB activation is enabled by this commissioning action.");
return builder.ToString();
}
private static string BuildP0Evidence(DynamicReportTriggerOptionsProbeCommissioningResult result)
{
var builder = new StringBuilder();
builder.AppendLine("ARSAS P0 ISOLATED TRGOPS MICRO-PROBE EVIDENCE");
builder.AppendLine(new string('=', 62));
builder.AppendLine($"Result: {result.Summary}");
builder.AppendLine($"Blocked: {result.IsBlocked}");
builder.AppendLine($"P0 success: {result.IsSuccess}");
builder.AppendLine($"Restore proven: {result.CleanupSucceeded}");
if (result.Identity is not null)
{
builder.AppendLine();
builder.AppendLine("IED IDENTITY");
builder.AppendLine($"Stable identity: {result.Identity.StableIdentityKey}");
builder.AppendLine($"Model fingerprint: {result.Identity.ModelFingerprint}");
builder.AppendLine($"Model: {result.Identity.Model}");
builder.AppendLine($"Firmware: {result.Identity.FirmwareRevision}");
builder.AppendLine($"Profile revision: {result.Identity.ProfileRevision}");
}
builder.AppendLine();
builder.AppendLine("P0 TARGET");
builder.AppendLine($"Input profile state: {result.InputProfile?.State.ToString() ?? "-"}");
builder.AppendLine($"URCB: {TextOrDash(result.RcbReference)}");
builder.AppendLine("Requested trigger options: dchg + GI");
builder.AppendLine("Correct canonical TrgOps raw target: 0244");
if (result.Probe is not null)
{
builder.AppendLine();
builder.AppendLine("TRGOPS READ / WRITE / RESTORE");
builder.AppendLine($"Original raw: {TextOrDash(result.Probe.OriginalRaw)}");
builder.AppendLine($"Requested raw: {TextOrDash(result.Probe.RequestedRaw)}");
builder.AppendLine($"Readback raw: {TextOrDash(result.Probe.ReadbackRaw)}");
builder.AppendLine($"Restore readback raw: {TextOrDash(result.Probe.RestoreReadbackRaw)}");
builder.AppendLine($"Requested semantic match: {result.Probe.RequestedComparison?.IsSemanticMatch.ToString() ?? "-"}");
builder.AppendLine($"Requested raw exact: {result.Probe.RequestedComparison?.IsRawExact.ToString() ?? "-"}");
builder.AppendLine($"Requested padding-only diff: {result.Probe.RequestedComparison?.PaddingOnlyDifference.ToString() ?? "-"}");
builder.AppendLine($"Restore semantic match: {result.Probe.RestoreComparison?.IsSemanticMatch.ToString() ?? "-"}");
builder.AppendLine($"Restore raw exact: {result.Probe.RestoreComparison?.IsRawExact.ToString() ?? "-"}");
builder.AppendLine($"Restore padding-only diff: {result.Probe.RestoreComparison?.PaddingOnlyDifference.ToString() ?? "-"}");
}
builder.AppendLine();
builder.AppendLine("WIRE / SAFETY EVIDENCE");
foreach (var line in result.EvidenceLines)
builder.AppendLine(line);
builder.AppendLine();
builder.AppendLine("SAFETY STATE");
builder.AppendLine("P0 writes TrgOps only on one forced-live proven-free URCB and immediately restores it.");
builder.AppendLine("No OptFlds, DatSet, Resv, RptEna, GI or dynamic DataSet service is used by P0.");
builder.AppendLine("P0 does not advance the G2 profile and production automatic dynamic reporting remains OFF.");
return builder.ToString();
}
private static string BuildG24Evidence(DynamicReportActivationCommissioningResult result)
{
var builder = new StringBuilder();
builder.AppendLine("ARSAS G2.4 ONE-URCB INFORMATIONREPORT PROOF EVIDENCE");
builder.AppendLine(new string('=', 68));
builder.AppendLine($"Result: {result.Summary}");
builder.AppendLine($"Blocked: {result.IsBlocked}");
builder.AppendLine($"G2.4 success: {result.IsSuccess}");
builder.AppendLine($"Cleanup proven: {result.CleanupSucceeded}");
if (result.Identity is not null)
{
builder.AppendLine();
builder.AppendLine("IED IDENTITY");
builder.AppendLine($"Stable identity: {result.Identity.StableIdentityKey}");
builder.AppendLine($"Model fingerprint: {result.Identity.ModelFingerprint}");
builder.AppendLine($"Model: {result.Identity.Model}");
builder.AppendLine($"Firmware: {result.Identity.FirmwareRevision}");
builder.AppendLine($"Profile revision: {result.Identity.ProfileRevision}");
}
builder.AppendLine();
builder.AppendLine("G2.3 INPUT ENVELOPE");
builder.AppendLine($"Input profile state: {result.InputProfile?.State.ToString() ?? "-"}");
builder.AppendLine($"Proven safe envelope: {result.InputProfile?.ProvenSafeMemberCount.ToString() ?? "-"} member(s)");
builder.AppendLine($"G2.4 exact members: {result.MemberReferences.Count}");
foreach (var member in result.MemberReferences)
builder.AppendLine("- " + member);
builder.AppendLine();
builder.AppendLine("ONE-URCB PROOF TARGET");
builder.AppendLine($"URCB: {TextOrDash(result.RcbReference)}");
builder.AppendLine($"Temporary DataSet: {TextOrDash(result.DataSetReference)}");
if (result.ActivationProof is not null)
{
builder.AppendLine();
builder.AppendLine("RCB ACTIVATION PROOF");
builder.AppendLine($"Success: {result.ActivationProof.IsSuccess}");
builder.AppendLine($"Fresh RCB availability: {result.ActivationProof.FreshRcbAvailabilityVerified}");
builder.AppendLine($"Exact DataSet readback: {result.ActivationProof.DataSetReadbackVerified}");
builder.AppendLine($"DatSet binding accepted: {result.ActivationProof.RcbDataSetBindingAccepted}");
builder.AppendLine($"RptEna accepted: {result.ActivationProof.RptEnaAccepted}");
builder.AppendLine($"Association healthy after activation: {result.ActivationProof.AssociationHealthyAfterActivation}");
builder.AppendLine($"Evidence ID: {result.ActivationProof.EvidenceId}");
}
if (result.InformationReportProof is not null)
{
builder.AppendLine();
builder.AppendLine("ACTUAL INFORMATIONREPORT PROOF");
builder.AppendLine($"Success: {result.InformationReportProof.IsSuccess}");
builder.AppendLine($"Kind: {result.InformationReportProof.Kind}");
builder.AppendLine($"Actual InformationReport received: {result.InformationReportProof.ActualInformationReportReceived}");
builder.AppendLine($"Report identity verified: {result.InformationReportProof.ReportIdentityVerified}");
builder.AppendLine($"Exact member mapping verified: {result.InformationReportProof.ExactMemberMappingVerified}");
builder.AppendLine($"Association healthy after report: {result.InformationReportProof.AssociationHealthyAfterReport}");
builder.AppendLine($"Report-authoritative proof points: {result.InformationReportProof.ReportAuthoritativePointCount}");
builder.AppendLine($"Evidence ID: {result.InformationReportProof.EvidenceId}");
}
if (result.SavedProfile is not null)
{
builder.AppendLine();
builder.AppendLine("PERSISTED PROFILE AFTER G2.4");
builder.AppendLine($"State: {result.SavedProfile.State}");
builder.AppendLine($"File: {result.ProfilePath}");
}
builder.AppendLine();
builder.AppendLine("WIRE / SAFETY EVIDENCE");
foreach (var line in result.EvidenceLines)
builder.AppendLine(line);
builder.AppendLine();
builder.AppendLine("SAFETY STATE");
builder.AppendLine("RptEna accepted != InformationReportProven");
builder.AppendLine("GI accepted != InformationReportProven");
builder.AppendLine("InformationReportProven != ProductionEligible");
builder.AppendLine("G2.4 uses one auxiliary URCB only and does not make production monitoring report-authoritative.");
builder.AppendLine("Production automatic dynamic reporting remains OFF until controlled G2.5 scale-out and all G2.6 physical regressions pass.");
return builder.ToString();
}
private static string TextOrDash(string? value)
=> string.IsNullOrWhiteSpace(value) ? "-" : value.Trim();
private void CopyEvidence_Click(object sender, RoutedEventArgs e)
{
try
{
Clipboard.SetText(EvidenceTextBox.Text ?? string.Empty);
}
catch (Exception ex)
{
MessageBox.Show(this, ex.Message, "Copy Evidence", MessageBoxButton.OK, MessageBoxImage.Warning);
}
}
private void Close_Click(object sender, RoutedEventArgs e)
=> Close();
}