存档求解器回归基线与当前改动

纳管 AMESim 对齐基线、发布锁、回归测试及当前物理门禁调整。

更新日志仅记录已完成成果,并注明当前 HEAD 尚待真实 production 复跑与远端 workflow 验证。
This commit is contained in:
lujingze committed 2026-08-18 15:20:42 +00:00
1 parent 53f8601fec
commit a8c733883c
32 files changed
+47241 -108

No files matched your search

@@ -0,0 +1,952 @@
{
"schemaVersion": 1,
"id": "test_mql_8-production-0.2s-physical-state-v2.1",
"contractId": "physical-state-v2.1",
"caseId": "0.2s",
"lane": "production",
"sourceXmlSha256": "0a2d9331df9eb5974daec25a61c1238ba32b1742d933ffc8b16ce316c5627b0b",
"approval": {
"status": "candidate",
"generatedAt": "2026-08-18T07:35:03.491746+00:00",
"warning": "The correctness gate rejects this file until explicit approval."
},
"provenance": {
"localSourceReport": {
"path": "tests/baselines/simulation/test_mql_8/runs/2026-08-18-production-physical-state-v2.1-0.2.json",
"bytes": 380076,
"sha256": "c647fc7dab6c5cdaea188789dd8e0192d9caf374873afa1f5f5db0da9d69c49b",
"generatedAt": "2026-08-18T07:34:00.055573+00:00"
},
"amesim": {
"archivePath": "AmesimModels/test_mql.ame",
"archiveBytes": 21708800,
"archiveSha256": "cbc3aadd4569a49b3a63e5d66d4143ec16126c0f950df73fb637e07673c20fbb",
"members": [
{
"name": "test_mql_.var",
"bytes": 95371,
"sha256": "175010af62d254b34b1f876ff652feb903fe2ce88bee80d4dc0ef1d31f04067b"
},
{
"name": "test_mql_.results",
"bytes": 8968576,
"sha256": "434a2cdff1322565957934354154425868fa03737558636927cb0f3ec51f1760"
}
],
"referencePressurePa": 101300.0,
"role": "external calibration reference; not an equality claim"
},
"amesimStoredMassDataPaths": [
"mgas1@pn_c1_8",
"mgas1@pn_c1_9",
"mgas1@pn_c1_10",
"mgas1@pn_c1_11",
"mgas1@pn_c1_12",
"mgas1@pn_c1_13",
"mgas1@pn_c1_14",
"mgas1@pn_c1_15",
"mgas@pn_general_chamber",
"mgas@pn_general_chamber_2",
"mgas@pn_general_chamber_4",
"mgas@pn_general_chamber_5",
"mgas@pneumatic_65",
"mgas@pneumatic_66",
"mgas@pneumatic_68",
"mgas@pneumatic_69",
"mgas@pneumatic_70",
"mgas@pneumatic_71",
"mgas@pneumatic_72",
"mgas@pneumatic_73",
"mgas@pneumatic_74",
"mgas@pneumatic_75",
"mgas@pneumatic_76",
"mgas@pneumatic_77",
"mgas@pneumatic_78",
"mgas@pneumatic_79",
"mgas@pneumatic_80",
"mgas@pneumatic_81",
"mgas@pneumatic_82",
"mgas@pneumatic_83",
"mgas@pneumatic_84",
"mgas@pneumatic_85",
"mgas@pneumatic_86",
"mgas@pneumatic_87",
"mgas@pneumatic_88",
"mgas@pneumatic_91",
"mgas@pneumatic_92",
"mgas@pneumatic_93",
"mgas@pneumatic_94",
"mgas@pneumatic_95",
"mgas@pneumatic_96",
"mgas@pneumatic_97",
"mgas@pneumatic_98",
"mgas@pneumatic_99",
"mgas@pneumatic_101",
"mgas@pneumatic_102",
"mgas@pneumatic_103",
"mgas@pneumatic_104"
],
"comparisonPolicy": "Local values are the regression target; transformed AMESim values are retained visibly as an external calibration reference."
},
"layout": {
"projectionKeys": [
"pressure.pnch012_8.absolute",
"pressure.pnl0001_20.absolute",
"massFlow.pnl0001_20.port_1.intoComponent",
"massFlow.pnvo001_5.port_2.intoComponent",
"conservation.p4node2_8.massBalance",
"conservation.pnvo001_5.massBalance",
"conservation.pnl0001_20_pnch012_8.connectionMassBalance",
"conservation.totalStoredGasMass",
"discrete.pnvo001_5.openMode",
"discrete.mecmas21_9.endstopMode",
"discrete.mecmas21_10.endstopMode"
],
"projections": [
{
"key": "pressure.pnch012_8.absolute",
"category": "pressure",
"unit": "Pa",
"python": {
"sourceKeys": [
"amesim_pnch012_8.p"
],
"formula": "identity"
},
"amesim": {
"dataPaths": [
"press@pn_c1_8"
],
"sourceUnit": "Pa (gauge)",
"targetUnit": "Pa (absolute)",
"formula": "target = source + 101300",
"scale": 1.0,
"offset": 101300.0
},
"tolerance": {
"relative": 0.0002,
"absolute": 0.001
}
},
{
"key": "pressure.pnl0001_20.absolute",
"category": "pressure",
"unit": "Pa",
"python": {
"sourceKeys": [
"amesim_pnl0001_20.p"
],
"formula": "identity"
},
"amesim": {
"dataPaths": [
"p2@pneumatic_69"
],
"sourceUnit": "Pa (gauge)",
"targetUnit": "Pa (absolute)",
"formula": "target = source + 101300",
"scale": 1.0,
"offset": 101300.0
},
"tolerance": {
"relative": 0.0002,
"absolute": 0.001
}
},
{
"key": "massFlow.pnl0001_20.port_1.intoComponent",
"category": "massFlow",
"unit": "kg/s",
"python": {
"sourceKeys": [
"amesim_pnl0001_20.port_1.m_flow"
],
"formula": "identity"
},
"amesim": {
"dataPaths": [
"dm1@pneumatic_69"
],
"sourceUnit": "g/s (AMESim component orientation)",
"targetUnit": "kg/s (positive into generic component)",
"formula": "target = -source * 1e-3",
"scale": -0.001,
"offset": 0.0
},
"tolerance": {
"relative": 0.0002,
"absolute": 1e-09
}
},
{
"key": "massFlow.pnvo001_5.port_2.intoComponent",
"category": "massFlow",
"unit": "kg/s",
"python": {
"sourceKeys": [
"amesim_pnvo001_5.port_2.m_flow"
],
"formula": "identity"
},
"amesim": {
"dataPaths": [
"dm2@pn_morifice_1"
],
"sourceUnit": "g/s (AMESim component orientation)",
"targetUnit": "kg/s (positive into generic component)",
"formula": "target = -source * 1e-3",
"scale": -0.001,
"offset": 0.0
},
"tolerance": {
"relative": 0.0002,
"absolute": 1e-09
}
},
{
"key": "conservation.p4node2_8.massBalance",
"category": "conservation",
"unit": "kg/s",
"python": {
"sourceKeys": [
"amesim_p4node2_8.port_1.m_flow",
"amesim_p4node2_8.port_2.m_flow",
"amesim_p4node2_8.port_3.m_flow",
"amesim_p4node2_8.port_4.m_flow"
],
"formula": "sum"
},
"amesim": {
"dataPaths": [],
"note": "AMESim archive has no complete saved four-port tuple."
},
"tolerance": {
"relative": 0.0,
"absolute": 1e-09
}
},
{
"key": "conservation.pnvo001_5.massBalance",
"category": "conservation",
"unit": "kg/s",
"python": {
"sourceKeys": [
"amesim_pnvo001_5.port_2.m_flow",
"amesim_pnvo001_5.port_3.m_flow"
],
"formula": "sum"
},
"amesim": {
"dataPaths": [
"dm2@pn_morifice_1",
"dm3@pn_morifice_1"
],
"sourceUnit": "g/s",
"targetUnit": "kg/s",
"formula": "target = -(source1 + source2) * 1e-3"
},
"tolerance": {
"relative": 0.0,
"absolute": 1e-09
}
},
{
"key": "conservation.pnl0001_20_pnch012_8.connectionMassBalance",
"category": "conservation",
"unit": "kg/s",
"python": {
"sourceKeys": [
"amesim_pnl0001_20.port_1.m_flow",
"amesim_pnch012_8.port_1.m_flow"
],
"formula": "sum"
},
"amesim": {
"dataPaths": [],
"note": "PNCH012 port flow is not saved; local connector contract is authoritative."
},
"tolerance": {
"relative": 0.0,
"absolute": 1e-09
}
},
{
"key": "conservation.totalStoredGasMass",
"category": "conservation",
"unit": "kg",
"python": {
"sourceKeys": [
"amesim_pnch012_10.m",
"amesim_pnch012_11.m",
"amesim_pnch012_12.m",
"amesim_pnch012_13.m",
"amesim_pnch012_14.m",
"amesim_pnch012_15.m",
"amesim_pnch012_8.m",
"amesim_pnch012_9.m",
"amesim_pnch023_1.m",
"amesim_pnch023_2.m",
"amesim_pnch023_3.m",
"amesim_pnch023_4.m",
"amesim_pnl0001_1.m",
"amesim_pnl0001_10.m",
"amesim_pnl0001_11.m",
"amesim_pnl0001_13.m",
"amesim_pnl0001_14.m",
"amesim_pnl0001_15.m",
"amesim_pnl0001_16.m",
"amesim_pnl0001_17.m",
"amesim_pnl0001_18.m",
"amesim_pnl0001_19.m",
"amesim_pnl0001_2.m",
"amesim_pnl0001_20.m",
"amesim_pnl0001_21.m",
"amesim_pnl0001_25.m",
"amesim_pnl0001_26.m",
"amesim_pnl0001_27.m",
"amesim_pnl0001_4.m",
"amesim_pnl0001_5.m",
"amesim_pnl0001_7.m",
"amesim_pnl0001_9.m",
"amesim_pnl0002_1.m",
"amesim_pnl0002_2.m",
"amesim_pnl0002_3.m",
"amesim_pnl0002_4.m",
"amesim_pnl0002_5.m",
"amesim_pnl0002_6.m",
"amesim_pnl0002_7.m",
"amesim_pnl0002_8.m",
"amesim_pnl0003_1.m1",
"amesim_pnl0003_1.m2",
"amesim_pnl0003_2.m1",
"amesim_pnl0003_2.m2",
"amesim_pnl0003_3.m1",
"amesim_pnl0003_3.m2",
"amesim_pnl0003_4.m1",
"amesim_pnl0003_4.m2",
"amesim_pnl0003_5.m1",
"amesim_pnl0003_5.m2",
"amesim_pnl0003_6.m1",
"amesim_pnl0003_6.m2",
"amesim_pnl0003_7.m1",
"amesim_pnl0003_7.m2",
"amesim_pnl0003_8.m1",
"amesim_pnl0003_8.m2"
],
"formula": "sum"
},
"amesim": {
"dataPathSelection": "units == 'g' and signal starts with 'mgas'",
"sourceUnit": "g",
"targetUnit": "kg",
"formula": "target = sum(sources) * 1e-3"
},
"tolerance": {
"relative": 0.0002,
"absolute": 1e-09
}
},
{
"key": "discrete.pnvo001_5.openMode",
"category": "discreteMode",
"unit": "1",
"python": {
"sourceKeys": [
"amesim_pnvo001_5.xv"
],
"formula": "1 if opening >= 0.5 else 0"
},
"amesim": {
"dataPaths": [
"xv@pn_morifice_1"
],
"sourceUnit": "1",
"targetUnit": "mode code {0,1}",
"formula": "1 if source >= 0.5 else 0"
},
"tolerance": {
"relative": 0.0,
"absolute": 0.0
}
},
{
"key": "discrete.mecmas21_9.endstopMode",
"category": "discreteMode",
"unit": "1",
"python": {
"sourceKeys": [
"amesim_mecmas21_9.x",
"amesim_mecmas21_9.v",
"amesim_mecmas21_9.port_1.f",
"amesim_mecmas21_9.port_2.f"
],
"formula": "-1 lower, 0 free, +1 upper using boundary and net-force direction"
},
"amesim": {
"dataPaths": [
"x1@mass_friction_endstops_19",
"v1@mass_friction_endstops_19"
],
"lowerBound": -0.72,
"upperBound": 0.0,
"note": "No saved AMESim endstop code; reference is boundary occupancy."
},
"tolerance": {
"relative": 0.0,
"absolute": 0.0
}
},
{
"key": "discrete.mecmas21_10.endstopMode",
"category": "discreteMode",
"unit": "1",
"python": {
"sourceKeys": [
"amesim_mecmas21_10.x",
"amesim_mecmas21_10.v",
"amesim_mecmas21_10.port_1.f",
"amesim_mecmas21_10.port_2.f"
],
"formula": "-1 lower, 0 free, +1 upper using boundary and net-force direction"
},
"amesim": {
"dataPaths": [
"x1@mass_friction_endstops_18",
"v1@mass_friction_endstops_18"
],
"lowerBound": 0.0,
"upperBound": 0.37,
"note": "No saved AMESim endstop code; reference is boundary occupancy."
},
"tolerance": {
"relative": 0.0,
"absolute": 0.0
}
}
],
"projectionLayoutSha256": "55cc8f71ea72fd46f71f1ede2587aeb9f6d590bde8e97e881648f88a4a90dca6"
},
"checkpoints": [
{
"requestedTime": 0.0,
"values": [
100000.0,
100000.0,
0.0,
0.0,
0.0,
0.0,
0.0,
5.5668930151375235,
0.0,
1.0,
-1.0
],
"amesimReferenceValues": [
100000.00000000001,
100000.00000000001,
-0.0,
-0.0,
null,
-0.0,
null,
5.5668930151375235,
0.0,
1.0,
-1.0
]
},
{
"requestedTime": 0.04,
"values": [
100153.57210434608,
100152.45747547514,
6.682314111565264e-06,
-0.4978238221497115,
0.0,
0.0,
0.0,
5.5668930151375235,
1.0,
1.0,
-1.0
],
"amesimReferenceValues": [
100153.61882579065,
100152.49205385521,
6.672550142634319e-06,
-0.4978238226601424,
null,
-0.0,
null,
5.566893015142308,
1.0,
1.0,
-1.0
]
},
{
"requestedTime": 0.2,
"values": [
3620589.728099082,
3756379.1344475006,
-0.3723610392591412,
-0.3962730176377355,
1.8214596497756474e-17,
0.0,
0.0,
5.566893015137554,
1.0,
1.0,
-1.0
],
"amesimReferenceValues": [
3625053.2009413484,
3760735.7825351665,
-0.3728806429214546,
-0.3961933197727504,
null,
-0.0,
null,
5.566892994134813,
1.0,
1.0,
-1.0
]
}
],
"amesimAlignmentAtGeneration": {
"passed": true,
"issues": [],
"comparedValueCount": 25,
"excludedValueCount": 2,
"maxToleranceRatio": 0.6967416724836332,
"maxToleranceRatioUnbounded": false,
"worstValue": {
"requestedTime": 0.2,
"key": "massFlow.pnl0001_20.port_1.intoComponent",
"category": "massFlow",
"python": -0.3723610392591412,
"amesim": -0.3728806429214546,
"absoluteError": 0.0005196036623134059,
"relativeError": 0.0013934852135053246,
"allowedError": 0.0007457622858429093,
"toleranceRatio": 0.6967416724836332,
"unboundedToleranceRatio": false,
"evaluated": true,
"passed": true
},
"metrics": [
{
"requestedTime": 0.0,
"key": "pressure.pnch012_8.absolute",
"category": "pressure",
"python": 100000.0,
"amesim": 100000.00000000001,
"absoluteError": 1.4551915228366852e-11,
"relativeError": 1.455191522836685e-16,
"allowedError": 200.00100000000003,
"toleranceRatio": 7.275921234577252e-14,
"unboundedToleranceRatio": false,
"evaluated": true,
"passed": true
},
{
"requestedTime": 0.0,
"key": "pressure.pnl0001_20.absolute",
"category": "pressure",
"python": 100000.0,
"amesim": 100000.00000000001,
"absoluteError": 1.4551915228366852e-11,
"relativeError": 1.455191522836685e-16,
"allowedError": 200.00100000000003,
"toleranceRatio": 7.275921234577252e-14,
"unboundedToleranceRatio": false,
"evaluated": true,
"passed": true
},
{
"requestedTime": 0.0,
"key": "massFlow.pnl0001_20.port_1.intoComponent",
"category": "massFlow",
"python": 0.0,
"amesim": -0.0,
"absoluteError": 0.0,
"relativeError": 0.0,
"allowedError": 1e-09,
"toleranceRatio": 0.0,
"unboundedToleranceRatio": false,
"evaluated": true,
"passed": true
},
{
"requestedTime": 0.0,
"key": "massFlow.pnvo001_5.port_2.intoComponent",
"category": "massFlow",
"python": 0.0,
"amesim": -0.0,
"absoluteError": 0.0,
"relativeError": 0.0,
"allowedError": 1e-09,
"toleranceRatio": 0.0,
"unboundedToleranceRatio": false,
"evaluated": true,
"passed": true
},
{
"requestedTime": 0.0,
"key": "conservation.pnvo001_5.massBalance",
"category": "conservation",
"python": 0.0,
"amesim": -0.0,
"absoluteError": 0.0,
"relativeError": 0.0,
"allowedError": 1e-09,
"toleranceRatio": 0.0,
"unboundedToleranceRatio": false,
"evaluated": true,
"passed": true
},
{
"requestedTime": 0.0,
"key": "conservation.totalStoredGasMass",
"category": "conservation",
"python": 5.5668930151375235,
"amesim": 5.5668930151375235,
"absoluteError": 0.0,
"relativeError": 0.0,
"allowedError": 0.011133787030275047,
"toleranceRatio": 0.0,
"unboundedToleranceRatio": false,
"evaluated": true,
"passed": true
},
{
"requestedTime": 0.0,
"key": "discrete.pnvo001_5.openMode",
"category": "discreteMode",
"python": 0.0,
"amesim": 0.0,
"absoluteError": 0.0,
"relativeError": 0.0,
"allowedError": 0.0,
"toleranceRatio": 0.0,
"unboundedToleranceRatio": false,
"evaluated": true,
"passed": true
},
{
"requestedTime": 0.0,
"key": "discrete.mecmas21_9.endstopMode",
"category": "discreteMode",
"python": 1.0,
"amesim": 1.0,
"absoluteError": 0.0,
"relativeError": 0.0,
"allowedError": 0.0,
"toleranceRatio": 0.0,
"unboundedToleranceRatio": false,
"evaluated": true,
"passed": true
},
{
"requestedTime": 0.0,
"key": "discrete.mecmas21_10.endstopMode",
"category": "discreteMode",
"python": -1.0,
"amesim": -1.0,
"absoluteError": 0.0,
"relativeError": 0.0,
"allowedError": 0.0,
"toleranceRatio": 0.0,
"unboundedToleranceRatio": false,
"evaluated": true,
"passed": true
},
{
"requestedTime": 0.04,
"key": "pressure.pnch012_8.absolute",
"category": "pressure",
"python": 100153.57210434608,
"amesim": 100153.61882579065,
"absoluteError": 0.04672144456708338,
"relativeError": 4.6649781720170954e-07,
"allowedError": 200.3082376515813,
"toleranceRatio": 0.00023324774415094828,
"unboundedToleranceRatio": false,
"evaluated": true,
"passed": true
},
{
"requestedTime": 0.04,
"key": "pressure.pnl0001_20.absolute",
"category": "pressure",
"python": 100152.45747547514,
"amesim": 100152.49205385521,
"absoluteError": 0.03457838007307146,
"relativeError": 3.4525731076644157e-07,
"allowedError": 200.30598410771043,
"toleranceRatio": 0.00017262779355846724,
"unboundedToleranceRatio": false,
"evaluated": true,
"passed": true
},
{
"requestedTime": 0.04,
"key": "massFlow.pnl0001_20.port_1.intoComponent",
"category": "massFlow",
"python": 6.682314111565264e-06,
"amesim": 6.672550142634319e-06,
"absoluteError": 9.763968930944316e-09,
"relativeError": 0.0014633039426046946,
"allowedError": 1.4345100285268639e-08,
"toleranceRatio": 0.6806483563569921,
"unboundedToleranceRatio": false,
"evaluated": false,
"passed": null,
"exclusionReason": "signalDiscontinuityLeftRightLimitSemanticsNotComparableAt0.04s"
},
{
"requestedTime": 0.04,
"key": "massFlow.pnvo001_5.port_2.intoComponent",
"category": "massFlow",
"python": -0.4978238221497115,
"amesim": -0.4978238226601424,
"absoluteError": 5.104309197534462e-10,
"relativeError": 1.0253244150228433e-09,
"allowedError": 0.0009956486453202849,
"toleranceRatio": 5.126616926086898e-07,
"unboundedToleranceRatio": false,
"evaluated": false,
"passed": null,
"exclusionReason": "signalDiscontinuityLeftRightLimitSemanticsNotComparableAt0.04s"
},
{
"requestedTime": 0.04,
"key": "conservation.pnvo001_5.massBalance",
"category": "conservation",
"python": 0.0,
"amesim": -0.0,
"absoluteError": 0.0,
"relativeError": 0.0,
"allowedError": 1e-09,
"toleranceRatio": 0.0,
"unboundedToleranceRatio": false,
"evaluated": true,
"passed": true
},
{
"requestedTime": 0.04,
"key": "conservation.totalStoredGasMass",
"category": "conservation",
"python": 5.5668930151375235,
"amesim": 5.566893015142308,
"absoluteError": 4.784617146924575e-12,
"relativeError": 8.594771147766101e-13,
"allowedError": 0.011133787030284616,
"toleranceRatio": 4.2973851879060635e-10,
"unboundedToleranceRatio": false,
"evaluated": true,
"passed": true
},
{
"requestedTime": 0.04,
"key": "discrete.pnvo001_5.openMode",
"category": "discreteMode",
"python": 1.0,
"amesim": 1.0,
"absoluteError": 0.0,
"relativeError": 0.0,
"allowedError": 0.0,
"toleranceRatio": 0.0,
"unboundedToleranceRatio": false,
"evaluated": true,
"passed": true
},
{
"requestedTime": 0.04,
"key": "discrete.mecmas21_9.endstopMode",
"category": "discreteMode",
"python": 1.0,
"amesim": 1.0,
"absoluteError": 0.0,
"relativeError": 0.0,
"allowedError": 0.0,
"toleranceRatio": 0.0,
"unboundedToleranceRatio": false,
"evaluated": true,
"passed": true
},
{
"requestedTime": 0.04,
"key": "discrete.mecmas21_10.endstopMode",
"category": "discreteMode",
"python": -1.0,
"amesim": -1.0,
"absoluteError": 0.0,
"relativeError": 0.0,
"allowedError": 0.0,
"toleranceRatio": 0.0,
"unboundedToleranceRatio": false,
"evaluated": true,
"passed": true
},
{
"requestedTime": 0.2,
"key": "pressure.pnch012_8.absolute",
"category": "pressure",
"python": 3620589.728099082,
"amesim": 3625053.2009413484,
"absoluteError": 4463.4728422663175,
"relativeError": 0.0012312847825536048,
"allowedError": 7250.107401882698,
"toleranceRatio": 0.6156423063618685,
"unboundedToleranceRatio": false,
"evaluated": true,
"passed": true
},
{
"requestedTime": 0.2,
"key": "pressure.pnl0001_20.absolute",
"category": "pressure",
"python": 3756379.1344475006,
"amesim": 3760735.7825351665,
"absoluteError": 4356.648087665904,
"relativeError": 0.0011584563073795695,
"allowedError": 7521.472565070333,
"toleranceRatio": 0.5792280766798443,
"unboundedToleranceRatio": false,
"evaluated": true,
"passed": true
},
{
"requestedTime": 0.2,
"key": "massFlow.pnl0001_20.port_1.intoComponent",
"category": "massFlow",
"python": -0.3723610392591412,
"amesim": -0.3728806429214546,
"absoluteError": 0.0005196036623134059,
"relativeError": 0.0013934852135053246,
"allowedError": 0.0007457622858429093,
"toleranceRatio": 0.6967416724836332,
"unboundedToleranceRatio": false,
"evaluated": true,
"passed": true
},
{
"requestedTime": 0.2,
"key": "massFlow.pnvo001_5.port_2.intoComponent",
"category": "massFlow",
"python": -0.3962730176377355,
"amesim": -0.3961933197727504,
"absoluteError": 7.969786498507325e-05,
"relativeError": 0.00020115903274388008,
"allowedError": 0.0007923876395455008,
"toleranceRatio": 0.10057938943972738,
"unboundedToleranceRatio": false,
"evaluated": true,
"passed": true
},
{
"requestedTime": 0.2,
"key": "conservation.pnvo001_5.massBalance",
"category": "conservation",
"python": 0.0,
"amesim": -0.0,
"absoluteError": 0.0,
"relativeError": 0.0,
"allowedError": 1e-09,
"toleranceRatio": 0.0,
"unboundedToleranceRatio": false,
"evaluated": true,
"passed": true
},
{
"requestedTime": 0.2,
"key": "conservation.totalStoredGasMass",
"category": "conservation",
"python": 5.566893015137554,
"amesim": 5.566892994134813,
"absoluteError": 2.1002740879794146e-08,
"relativeError": 3.7727940705744284e-09,
"allowedError": 0.011133786988269626,
"toleranceRatio": 1.8863968658572583e-06,
"unboundedToleranceRatio": false,
"evaluated": true,
"passed": true
},
{
"requestedTime": 0.2,
"key": "discrete.pnvo001_5.openMode",
"category": "discreteMode",
"python": 1.0,
"amesim": 1.0,
"absoluteError": 0.0,
"relativeError": 0.0,
"allowedError": 0.0,
"toleranceRatio": 0.0,
"unboundedToleranceRatio": false,
"evaluated": true,
"passed": true
},
{
"requestedTime": 0.2,
"key": "discrete.mecmas21_9.endstopMode",
"category": "discreteMode",
"python": 1.0,
"amesim": 1.0,
"absoluteError": 0.0,
"relativeError": 0.0,
"allowedError": 0.0,
"toleranceRatio": 0.0,
"unboundedToleranceRatio": false,
"evaluated": true,
"passed": true
},
{
"requestedTime": 0.2,
"key": "discrete.mecmas21_10.endstopMode",
"category": "discreteMode",
"python": -1.0,
"amesim": -1.0,
"absoluteError": 0.0,
"relativeError": 0.0,
"allowedError": 0.0,
"toleranceRatio": 0.0,
"unboundedToleranceRatio": false,
"evaluated": true,
"passed": true
}
],
"toleranceProfile": {
"id": "amesim-alignment-reviewed-v1",
"byCategory": {
"pressure": {
"relative": 0.002,
"absolute": 0.001
},
"massFlow": {
"relative": 0.002,
"absolute": 1e-09
},
"conservation": {
"relative": 0.002,
"absolute": 1e-09
},
"discreteMode": {
"relative": 0.0,
"absolute": 0.0
}
},
"basis": "0.2% relative envelope for AMESim pressure/flow/inventory alignment; conservation retains a 1e-9 absolute floor and discrete modes are exact.",
"exclusions": [
{
"requestedTime": 0.04,
"category": "massFlow",
"reason": "The Python and AMESim samples at the signal discontinuity may represent different left/right limits. Raw errors remain recorded."
}
]
},
"policy": "diagnostic external-reference comparison; local golden is the regression gate"
}
}
@@ -0,0 +1,955 @@
{
"schemaVersion": 1,
"id": "test_mql_8-production-0.2s-physical-state-v2.1",
"contractId": "physical-state-v2.1",
"caseId": "0.2s",
"lane": "production",
"sourceXmlSha256": "0a2d9331df9eb5974daec25a61c1238ba32b1742d933ffc8b16ce316c5627b0b",
"approval": {
"status": "approved",
"approvedAt": "2026-08-18T07:35:25.264794+00:00",
"reviewedBy": "Codex OPT-00 physical-state-v2.1 gate",
"note": "Reviewed full 0/0.04/0.2 checkpoints: AMESim external alignment passed the declared 0.2% profile; t=0.04 mass-flow values retain errors but are excluded for explicit left/right-limit ambiguity; local p4node, PNVO, and connection mass-balance residuals pass the strict 1e-9 kg/s gate; discrete modes are exact.",
"candidatePath": "tests/baselines/simulation/test_mql_8/goldens/candidates/production-0.2s-physical-state-v2.1-candidate.json",
"candidateSha256": "699033337c30e6aed97538e886b81ff897fe2c455860b4ad1ed3293f580fb53a"
},
"provenance": {
"localSourceReport": {
"path": "tests/baselines/simulation/test_mql_8/runs/2026-08-18-production-physical-state-v2.1-0.2.json",
"bytes": 380076,
"sha256": "c647fc7dab6c5cdaea188789dd8e0192d9caf374873afa1f5f5db0da9d69c49b",
"generatedAt": "2026-08-18T07:34:00.055573+00:00"
},
"amesim": {
"archivePath": "AmesimModels/test_mql.ame",
"archiveBytes": 21708800,
"archiveSha256": "cbc3aadd4569a49b3a63e5d66d4143ec16126c0f950df73fb637e07673c20fbb",
"members": [
{
"name": "test_mql_.var",
"bytes": 95371,
"sha256": "175010af62d254b34b1f876ff652feb903fe2ce88bee80d4dc0ef1d31f04067b"
},
{
"name": "test_mql_.results",
"bytes": 8968576,
"sha256": "434a2cdff1322565957934354154425868fa03737558636927cb0f3ec51f1760"
}
],
"referencePressurePa": 101300.0,
"role": "external calibration reference; not an equality claim"
},
"amesimStoredMassDataPaths": [
"mgas1@pn_c1_8",
"mgas1@pn_c1_9",
"mgas1@pn_c1_10",
"mgas1@pn_c1_11",
"mgas1@pn_c1_12",
"mgas1@pn_c1_13",
"mgas1@pn_c1_14",
"mgas1@pn_c1_15",
"mgas@pn_general_chamber",
"mgas@pn_general_chamber_2",
"mgas@pn_general_chamber_4",
"mgas@pn_general_chamber_5",
"mgas@pneumatic_65",
"mgas@pneumatic_66",
"mgas@pneumatic_68",
"mgas@pneumatic_69",
"mgas@pneumatic_70",
"mgas@pneumatic_71",
"mgas@pneumatic_72",
"mgas@pneumatic_73",
"mgas@pneumatic_74",
"mgas@pneumatic_75",
"mgas@pneumatic_76",
"mgas@pneumatic_77",
"mgas@pneumatic_78",
"mgas@pneumatic_79",
"mgas@pneumatic_80",
"mgas@pneumatic_81",
"mgas@pneumatic_82",
"mgas@pneumatic_83",
"mgas@pneumatic_84",
"mgas@pneumatic_85",
"mgas@pneumatic_86",
"mgas@pneumatic_87",
"mgas@pneumatic_88",
"mgas@pneumatic_91",
"mgas@pneumatic_92",
"mgas@pneumatic_93",
"mgas@pneumatic_94",
"mgas@pneumatic_95",
"mgas@pneumatic_96",
"mgas@pneumatic_97",
"mgas@pneumatic_98",
"mgas@pneumatic_99",
"mgas@pneumatic_101",
"mgas@pneumatic_102",
"mgas@pneumatic_103",
"mgas@pneumatic_104"
],
"comparisonPolicy": "Local values are the regression target; transformed AMESim values are retained visibly as an external calibration reference."
},
"layout": {
"projectionKeys": [
"pressure.pnch012_8.absolute",
"pressure.pnl0001_20.absolute",
"massFlow.pnl0001_20.port_1.intoComponent",
"massFlow.pnvo001_5.port_2.intoComponent",
"conservation.p4node2_8.massBalance",
"conservation.pnvo001_5.massBalance",
"conservation.pnl0001_20_pnch012_8.connectionMassBalance",
"conservation.totalStoredGasMass",
"discrete.pnvo001_5.openMode",
"discrete.mecmas21_9.endstopMode",
"discrete.mecmas21_10.endstopMode"
],
"projections": [
{
"key": "pressure.pnch012_8.absolute",
"category": "pressure",
"unit": "Pa",
"python": {
"sourceKeys": [
"amesim_pnch012_8.p"
],
"formula": "identity"
},
"amesim": {
"dataPaths": [
"press@pn_c1_8"
],
"sourceUnit": "Pa (gauge)",
"targetUnit": "Pa (absolute)",
"formula": "target = source + 101300",
"scale": 1.0,
"offset": 101300.0
},
"tolerance": {
"relative": 0.0002,
"absolute": 0.001
}
},
{
"key": "pressure.pnl0001_20.absolute",
"category": "pressure",
"unit": "Pa",
"python": {
"sourceKeys": [
"amesim_pnl0001_20.p"
],
"formula": "identity"
},
"amesim": {
"dataPaths": [
"p2@pneumatic_69"
],
"sourceUnit": "Pa (gauge)",
"targetUnit": "Pa (absolute)",
"formula": "target = source + 101300",
"scale": 1.0,
"offset": 101300.0
},
"tolerance": {
"relative": 0.0002,
"absolute": 0.001
}
},
{
"key": "massFlow.pnl0001_20.port_1.intoComponent",
"category": "massFlow",
"unit": "kg/s",
"python": {
"sourceKeys": [
"amesim_pnl0001_20.port_1.m_flow"
],
"formula": "identity"
},
"amesim": {
"dataPaths": [
"dm1@pneumatic_69"
],
"sourceUnit": "g/s (AMESim component orientation)",
"targetUnit": "kg/s (positive into generic component)",
"formula": "target = -source * 1e-3",
"scale": -0.001,
"offset": 0.0
},
"tolerance": {
"relative": 0.0002,
"absolute": 1e-09
}
},
{
"key": "massFlow.pnvo001_5.port_2.intoComponent",
"category": "massFlow",
"unit": "kg/s",
"python": {
"sourceKeys": [
"amesim_pnvo001_5.port_2.m_flow"
],
"formula": "identity"
},
"amesim": {
"dataPaths": [
"dm2@pn_morifice_1"
],
"sourceUnit": "g/s (AMESim component orientation)",
"targetUnit": "kg/s (positive into generic component)",
"formula": "target = -source * 1e-3",
"scale": -0.001,
"offset": 0.0
},
"tolerance": {
"relative": 0.0002,
"absolute": 1e-09
}
},
{
"key": "conservation.p4node2_8.massBalance",
"category": "conservation",
"unit": "kg/s",
"python": {
"sourceKeys": [
"amesim_p4node2_8.port_1.m_flow",
"amesim_p4node2_8.port_2.m_flow",
"amesim_p4node2_8.port_3.m_flow",
"amesim_p4node2_8.port_4.m_flow"
],
"formula": "sum"
},
"amesim": {
"dataPaths": [],
"note": "AMESim archive has no complete saved four-port tuple."
},
"tolerance": {
"relative": 0.0,
"absolute": 1e-09
}
},
{
"key": "conservation.pnvo001_5.massBalance",
"category": "conservation",
"unit": "kg/s",
"python": {
"sourceKeys": [
"amesim_pnvo001_5.port_2.m_flow",
"amesim_pnvo001_5.port_3.m_flow"
],
"formula": "sum"
},
"amesim": {
"dataPaths": [
"dm2@pn_morifice_1",
"dm3@pn_morifice_1"
],
"sourceUnit": "g/s",
"targetUnit": "kg/s",
"formula": "target = -(source1 + source2) * 1e-3"
},
"tolerance": {
"relative": 0.0,
"absolute": 1e-09
}
},
{
"key": "conservation.pnl0001_20_pnch012_8.connectionMassBalance",
"category": "conservation",
"unit": "kg/s",
"python": {
"sourceKeys": [
"amesim_pnl0001_20.port_1.m_flow",
"amesim_pnch012_8.port_1.m_flow"
],
"formula": "sum"
},
"amesim": {
"dataPaths": [],
"note": "PNCH012 port flow is not saved; local connector contract is authoritative."
},
"tolerance": {
"relative": 0.0,
"absolute": 1e-09
}
},
{
"key": "conservation.totalStoredGasMass",
"category": "conservation",
"unit": "kg",
"python": {
"sourceKeys": [
"amesim_pnch012_10.m",
"amesim_pnch012_11.m",
"amesim_pnch012_12.m",
"amesim_pnch012_13.m",
"amesim_pnch012_14.m",
"amesim_pnch012_15.m",
"amesim_pnch012_8.m",
"amesim_pnch012_9.m",
"amesim_pnch023_1.m",
"amesim_pnch023_2.m",
"amesim_pnch023_3.m",
"amesim_pnch023_4.m",
"amesim_pnl0001_1.m",
"amesim_pnl0001_10.m",
"amesim_pnl0001_11.m",
"amesim_pnl0001_13.m",
"amesim_pnl0001_14.m",
"amesim_pnl0001_15.m",
"amesim_pnl0001_16.m",
"amesim_pnl0001_17.m",
"amesim_pnl0001_18.m",
"amesim_pnl0001_19.m",
"amesim_pnl0001_2.m",
"amesim_pnl0001_20.m",
"amesim_pnl0001_21.m",
"amesim_pnl0001_25.m",
"amesim_pnl0001_26.m",
"amesim_pnl0001_27.m",
"amesim_pnl0001_4.m",
"amesim_pnl0001_5.m",
"amesim_pnl0001_7.m",
"amesim_pnl0001_9.m",
"amesim_pnl0002_1.m",
"amesim_pnl0002_2.m",
"amesim_pnl0002_3.m",
"amesim_pnl0002_4.m",
"amesim_pnl0002_5.m",
"amesim_pnl0002_6.m",
"amesim_pnl0002_7.m",
"amesim_pnl0002_8.m",
"amesim_pnl0003_1.m1",
"amesim_pnl0003_1.m2",
"amesim_pnl0003_2.m1",
"amesim_pnl0003_2.m2",
"amesim_pnl0003_3.m1",
"amesim_pnl0003_3.m2",
"amesim_pnl0003_4.m1",
"amesim_pnl0003_4.m2",
"amesim_pnl0003_5.m1",
"amesim_pnl0003_5.m2",
"amesim_pnl0003_6.m1",
"amesim_pnl0003_6.m2",
"amesim_pnl0003_7.m1",
"amesim_pnl0003_7.m2",
"amesim_pnl0003_8.m1",
"amesim_pnl0003_8.m2"
],
"formula": "sum"
},
"amesim": {
"dataPathSelection": "units == 'g' and signal starts with 'mgas'",
"sourceUnit": "g",
"targetUnit": "kg",
"formula": "target = sum(sources) * 1e-3"
},
"tolerance": {
"relative": 0.0002,
"absolute": 1e-09
}
},
{
"key": "discrete.pnvo001_5.openMode",
"category": "discreteMode",
"unit": "1",
"python": {
"sourceKeys": [
"amesim_pnvo001_5.xv"
],
"formula": "1 if opening >= 0.5 else 0"
},
"amesim": {
"dataPaths": [
"xv@pn_morifice_1"
],
"sourceUnit": "1",
"targetUnit": "mode code {0,1}",
"formula": "1 if source >= 0.5 else 0"
},
"tolerance": {
"relative": 0.0,
"absolute": 0.0
}
},
{
"key": "discrete.mecmas21_9.endstopMode",
"category": "discreteMode",
"unit": "1",
"python": {
"sourceKeys": [
"amesim_mecmas21_9.x",
"amesim_mecmas21_9.v",
"amesim_mecmas21_9.port_1.f",
"amesim_mecmas21_9.port_2.f"
],
"formula": "-1 lower, 0 free, +1 upper using boundary and net-force direction"
},
"amesim": {
"dataPaths": [
"x1@mass_friction_endstops_19",
"v1@mass_friction_endstops_19"
],
"lowerBound": -0.72,
"upperBound": 0.0,
"note": "No saved AMESim endstop code; reference is boundary occupancy."
},
"tolerance": {
"relative": 0.0,
"absolute": 0.0
}
},
{
"key": "discrete.mecmas21_10.endstopMode",
"category": "discreteMode",
"unit": "1",
"python": {
"sourceKeys": [
"amesim_mecmas21_10.x",
"amesim_mecmas21_10.v",
"amesim_mecmas21_10.port_1.f",
"amesim_mecmas21_10.port_2.f"
],
"formula": "-1 lower, 0 free, +1 upper using boundary and net-force direction"
},
"amesim": {
"dataPaths": [
"x1@mass_friction_endstops_18",
"v1@mass_friction_endstops_18"
],
"lowerBound": 0.0,
"upperBound": 0.37,
"note": "No saved AMESim endstop code; reference is boundary occupancy."
},
"tolerance": {
"relative": 0.0,
"absolute": 0.0
}
}
],
"projectionLayoutSha256": "55cc8f71ea72fd46f71f1ede2587aeb9f6d590bde8e97e881648f88a4a90dca6"
},
"checkpoints": [
{
"requestedTime": 0.0,
"values": [
100000.0,
100000.0,
0.0,
0.0,
0.0,
0.0,
0.0,
5.5668930151375235,
0.0,
1.0,
-1.0
],
"amesimReferenceValues": [
100000.00000000001,
100000.00000000001,
-0.0,
-0.0,
null,
-0.0,
null,
5.5668930151375235,
0.0,
1.0,
-1.0
]
},
{
"requestedTime": 0.04,
"values": [
100153.57210434608,
100152.45747547514,
6.682314111565264e-06,
-0.4978238221497115,
0.0,
0.0,
0.0,
5.5668930151375235,
1.0,
1.0,
-1.0
],
"amesimReferenceValues": [
100153.61882579065,
100152.49205385521,
6.672550142634319e-06,
-0.4978238226601424,
null,
-0.0,
null,
5.566893015142308,
1.0,
1.0,
-1.0
]
},
{
"requestedTime": 0.2,
"values": [
3620589.728099082,
3756379.1344475006,
-0.3723610392591412,
-0.3962730176377355,
1.8214596497756474e-17,
0.0,
0.0,
5.566893015137554,
1.0,
1.0,
-1.0
],
"amesimReferenceValues": [
3625053.2009413484,
3760735.7825351665,
-0.3728806429214546,
-0.3961933197727504,
null,
-0.0,
null,
5.566892994134813,
1.0,
1.0,
-1.0
]
}
],
"amesimAlignmentAtGeneration": {
"passed": true,
"issues": [],
"comparedValueCount": 25,
"excludedValueCount": 2,
"maxToleranceRatio": 0.6967416724836332,
"maxToleranceRatioUnbounded": false,
"worstValue": {
"requestedTime": 0.2,
"key": "massFlow.pnl0001_20.port_1.intoComponent",
"category": "massFlow",
"python": -0.3723610392591412,
"amesim": -0.3728806429214546,
"absoluteError": 0.0005196036623134059,
"relativeError": 0.0013934852135053246,
"allowedError": 0.0007457622858429093,
"toleranceRatio": 0.6967416724836332,
"unboundedToleranceRatio": false,
"evaluated": true,
"passed": true
},
"metrics": [
{
"requestedTime": 0.0,
"key": "pressure.pnch012_8.absolute",
"category": "pressure",
"python": 100000.0,
"amesim": 100000.00000000001,
"absoluteError": 1.4551915228366852e-11,
"relativeError": 1.455191522836685e-16,
"allowedError": 200.00100000000003,
"toleranceRatio": 7.275921234577252e-14,
"unboundedToleranceRatio": false,
"evaluated": true,
"passed": true
},
{
"requestedTime": 0.0,
"key": "pressure.pnl0001_20.absolute",
"category": "pressure",
"python": 100000.0,
"amesim": 100000.00000000001,
"absoluteError": 1.4551915228366852e-11,
"relativeError": 1.455191522836685e-16,
"allowedError": 200.00100000000003,
"toleranceRatio": 7.275921234577252e-14,
"unboundedToleranceRatio": false,
"evaluated": true,
"passed": true
},
{
"requestedTime": 0.0,
"key": "massFlow.pnl0001_20.port_1.intoComponent",
"category": "massFlow",
"python": 0.0,
"amesim": -0.0,
"absoluteError": 0.0,
"relativeError": 0.0,
"allowedError": 1e-09,
"toleranceRatio": 0.0,
"unboundedToleranceRatio": false,
"evaluated": true,
"passed": true
},
{
"requestedTime": 0.0,
"key": "massFlow.pnvo001_5.port_2.intoComponent",
"category": "massFlow",
"python": 0.0,
"amesim": -0.0,
"absoluteError": 0.0,
"relativeError": 0.0,
"allowedError": 1e-09,
"toleranceRatio": 0.0,
"unboundedToleranceRatio": false,
"evaluated": true,
"passed": true
},
{
"requestedTime": 0.0,
"key": "conservation.pnvo001_5.massBalance",
"category": "conservation",
"python": 0.0,
"amesim": -0.0,
"absoluteError": 0.0,
"relativeError": 0.0,
"allowedError": 1e-09,
"toleranceRatio": 0.0,
"unboundedToleranceRatio": false,
"evaluated": true,
"passed": true
},
{
"requestedTime": 0.0,
"key": "conservation.totalStoredGasMass",
"category": "conservation",
"python": 5.5668930151375235,
"amesim": 5.5668930151375235,
"absoluteError": 0.0,
"relativeError": 0.0,
"allowedError": 0.011133787030275047,
"toleranceRatio": 0.0,
"unboundedToleranceRatio": false,
"evaluated": true,
"passed": true
},
{
"requestedTime": 0.0,
"key": "discrete.pnvo001_5.openMode",
"category": "discreteMode",
"python": 0.0,
"amesim": 0.0,
"absoluteError": 0.0,
"relativeError": 0.0,
"allowedError": 0.0,
"toleranceRatio": 0.0,
"unboundedToleranceRatio": false,
"evaluated": true,
"passed": true
},
{
"requestedTime": 0.0,
"key": "discrete.mecmas21_9.endstopMode",
"category": "discreteMode",
"python": 1.0,
"amesim": 1.0,
"absoluteError": 0.0,
"relativeError": 0.0,
"allowedError": 0.0,
"toleranceRatio": 0.0,
"unboundedToleranceRatio": false,
"evaluated": true,
"passed": true
},
{
"requestedTime": 0.0,
"key": "discrete.mecmas21_10.endstopMode",
"category": "discreteMode",
"python": -1.0,
"amesim": -1.0,
"absoluteError": 0.0,
"relativeError": 0.0,
"allowedError": 0.0,
"toleranceRatio": 0.0,
"unboundedToleranceRatio": false,
"evaluated": true,
"passed": true
},
{
"requestedTime": 0.04,
"key": "pressure.pnch012_8.absolute",
"category": "pressure",
"python": 100153.57210434608,
"amesim": 100153.61882579065,
"absoluteError": 0.04672144456708338,
"relativeError": 4.6649781720170954e-07,
"allowedError": 200.3082376515813,
"toleranceRatio": 0.00023324774415094828,
"unboundedToleranceRatio": false,
"evaluated": true,
"passed": true
},
{
"requestedTime": 0.04,
"key": "pressure.pnl0001_20.absolute",
"category": "pressure",
"python": 100152.45747547514,
"amesim": 100152.49205385521,
"absoluteError": 0.03457838007307146,
"relativeError": 3.4525731076644157e-07,
"allowedError": 200.30598410771043,
"toleranceRatio": 0.00017262779355846724,
"unboundedToleranceRatio": false,
"evaluated": true,
"passed": true
},
{
"requestedTime": 0.04,
"key": "massFlow.pnl0001_20.port_1.intoComponent",
"category": "massFlow",
"python": 6.682314111565264e-06,
"amesim": 6.672550142634319e-06,
"absoluteError": 9.763968930944316e-09,
"relativeError": 0.0014633039426046946,
"allowedError": 1.4345100285268639e-08,
"toleranceRatio": 0.6806483563569921,
"unboundedToleranceRatio": false,
"evaluated": false,
"passed": null,
"exclusionReason": "signalDiscontinuityLeftRightLimitSemanticsNotComparableAt0.04s"
},
{
"requestedTime": 0.04,
"key": "massFlow.pnvo001_5.port_2.intoComponent",
"category": "massFlow",
"python": -0.4978238221497115,
"amesim": -0.4978238226601424,
"absoluteError": 5.104309197534462e-10,
"relativeError": 1.0253244150228433e-09,
"allowedError": 0.0009956486453202849,
"toleranceRatio": 5.126616926086898e-07,
"unboundedToleranceRatio": false,
"evaluated": false,
"passed": null,
"exclusionReason": "signalDiscontinuityLeftRightLimitSemanticsNotComparableAt0.04s"
},
{
"requestedTime": 0.04,
"key": "conservation.pnvo001_5.massBalance",
"category": "conservation",
"python": 0.0,
"amesim": -0.0,
"absoluteError": 0.0,
"relativeError": 0.0,
"allowedError": 1e-09,
"toleranceRatio": 0.0,
"unboundedToleranceRatio": false,
"evaluated": true,
"passed": true
},
{
"requestedTime": 0.04,
"key": "conservation.totalStoredGasMass",
"category": "conservation",
"python": 5.5668930151375235,
"amesim": 5.566893015142308,
"absoluteError": 4.784617146924575e-12,
"relativeError": 8.594771147766101e-13,
"allowedError": 0.011133787030284616,
"toleranceRatio": 4.2973851879060635e-10,
"unboundedToleranceRatio": false,
"evaluated": true,
"passed": true
},
{
"requestedTime": 0.04,
"key": "discrete.pnvo001_5.openMode",
"category": "discreteMode",
"python": 1.0,
"amesim": 1.0,
"absoluteError": 0.0,
"relativeError": 0.0,
"allowedError": 0.0,
"toleranceRatio": 0.0,
"unboundedToleranceRatio": false,
"evaluated": true,
"passed": true
},
{
"requestedTime": 0.04,
"key": "discrete.mecmas21_9.endstopMode",
"category": "discreteMode",
"python": 1.0,
"amesim": 1.0,
"absoluteError": 0.0,
"relativeError": 0.0,
"allowedError": 0.0,
"toleranceRatio": 0.0,
"unboundedToleranceRatio": false,
"evaluated": true,
"passed": true
},
{
"requestedTime": 0.04,
"key": "discrete.mecmas21_10.endstopMode",
"category": "discreteMode",
"python": -1.0,
"amesim": -1.0,
"absoluteError": 0.0,
"relativeError": 0.0,
"allowedError": 0.0,
"toleranceRatio": 0.0,
"unboundedToleranceRatio": false,
"evaluated": true,
"passed": true
},
{
"requestedTime": 0.2,
"key": "pressure.pnch012_8.absolute",
"category": "pressure",
"python": 3620589.728099082,
"amesim": 3625053.2009413484,
"absoluteError": 4463.4728422663175,
"relativeError": 0.0012312847825536048,
"allowedError": 7250.107401882698,
"toleranceRatio": 0.6156423063618685,
"unboundedToleranceRatio": false,
"evaluated": true,
"passed": true
},
{
"requestedTime": 0.2,
"key": "pressure.pnl0001_20.absolute",
"category": "pressure",
"python": 3756379.1344475006,
"amesim": 3760735.7825351665,
"absoluteError": 4356.648087665904,
"relativeError": 0.0011584563073795695,
"allowedError": 7521.472565070333,
"toleranceRatio": 0.5792280766798443,
"unboundedToleranceRatio": false,
"evaluated": true,
"passed": true
},
{
"requestedTime": 0.2,
"key": "massFlow.pnl0001_20.port_1.intoComponent",
"category": "massFlow",
"python": -0.3723610392591412,
"amesim": -0.3728806429214546,
"absoluteError": 0.0005196036623134059,
"relativeError": 0.0013934852135053246,
"allowedError": 0.0007457622858429093,
"toleranceRatio": 0.6967416724836332,
"unboundedToleranceRatio": false,
"evaluated": true,
"passed": true
},
{
"requestedTime": 0.2,
"key": "massFlow.pnvo001_5.port_2.intoComponent",
"category": "massFlow",
"python": -0.3962730176377355,
"amesim": -0.3961933197727504,
"absoluteError": 7.969786498507325e-05,
"relativeError": 0.00020115903274388008,
"allowedError": 0.0007923876395455008,
"toleranceRatio": 0.10057938943972738,
"unboundedToleranceRatio": false,
"evaluated": true,
"passed": true
},
{
"requestedTime": 0.2,
"key": "conservation.pnvo001_5.massBalance",
"category": "conservation",
"python": 0.0,
"amesim": -0.0,
"absoluteError": 0.0,
"relativeError": 0.0,
"allowedError": 1e-09,
"toleranceRatio": 0.0,
"unboundedToleranceRatio": false,
"evaluated": true,
"passed": true
},
{
"requestedTime": 0.2,
"key": "conservation.totalStoredGasMass",
"category": "conservation",
"python": 5.566893015137554,
"amesim": 5.566892994134813,
"absoluteError": 2.1002740879794146e-08,
"relativeError": 3.7727940705744284e-09,
"allowedError": 0.011133786988269626,
"toleranceRatio": 1.8863968658572583e-06,
"unboundedToleranceRatio": false,
"evaluated": true,
"passed": true
},
{
"requestedTime": 0.2,
"key": "discrete.pnvo001_5.openMode",
"category": "discreteMode",
"python": 1.0,
"amesim": 1.0,
"absoluteError": 0.0,
"relativeError": 0.0,
"allowedError": 0.0,
"toleranceRatio": 0.0,
"unboundedToleranceRatio": false,
"evaluated": true,
"passed": true
},
{
"requestedTime": 0.2,
"key": "discrete.mecmas21_9.endstopMode",
"category": "discreteMode",
"python": 1.0,
"amesim": 1.0,
"absoluteError": 0.0,
"relativeError": 0.0,
"allowedError": 0.0,
"toleranceRatio": 0.0,
"unboundedToleranceRatio": false,
"evaluated": true,
"passed": true
},
{
"requestedTime": 0.2,
"key": "discrete.mecmas21_10.endstopMode",
"category": "discreteMode",
"python": -1.0,
"amesim": -1.0,
"absoluteError": 0.0,
"relativeError": 0.0,
"allowedError": 0.0,
"toleranceRatio": 0.0,
"unboundedToleranceRatio": false,
"evaluated": true,
"passed": true
}
],
"toleranceProfile": {
"id": "amesim-alignment-reviewed-v1",
"byCategory": {
"pressure": {
"relative": 0.002,
"absolute": 0.001
},
"massFlow": {
"relative": 0.002,
"absolute": 1e-09
},
"conservation": {
"relative": 0.002,
"absolute": 1e-09
},
"discreteMode": {
"relative": 0.0,
"absolute": 0.0
}
},
"basis": "0.2% relative envelope for AMESim pressure/flow/inventory alignment; conservation retains a 1e-9 absolute floor and discrete modes are exact.",
"exclusions": [
{
"requestedTime": 0.04,
"category": "massFlow",
"reason": "The Python and AMESim samples at the signal discontinuity may represent different left/right limits. Raw errors remain recorded."
}
]
},
"policy": "diagnostic external-reference comparison; local golden is the regression gate"
}
}
@@ -0,0 +1,629 @@
{
"schemaVersion": 1,
"id": "test_mql_8-production-0.2s-physical-state-v2-amesim-aligned",
"caseId": "0.2s",
"lane": "production",
"sourceXmlSha256": "0a2d9331df9eb5974daec25a61c1238ba32b1742d933ffc8b16ce316c5627b0b",
"approval": {
"status": "approved",
"approvedAt": "2026-08-18T07:35:01+00:00",
"basis": "AME-aligned source, full physical-state-v2.1 external-reference assessment, finite-series, checkpoint, signal-segment, mechanical-event, residual, audit, no-fallback, and output-shape gates passed in the locked Python 3.12 production environment."
},
"provenance": {
"sourceReport": {
"path": "tests/baselines/simulation/test_mql_8/runs/2026-08-18-production-physical-state-v2.1-0.2.json",
"sha256": "c647fc7dab6c5cdaea188789dd8e0192d9caf374873afa1f5f5db0da9d69c49b",
"generatedAt": "2026-08-18T07:34:00.055573+00:00",
"metadataCompatibility": {
"status": "current",
"differences": []
}
},
"amesimReference": {
"path": "AmesimModels/test_mql.ame",
"sha256": "cbc3aadd4569a49b3a63e5d66d4143ec16126c0f950df73fb637e07673c20fbb",
"role": "external physical-state-v2.1 calibration reference"
}
},
"physicalLayout": {
"projectionCategories": [
"state"
],
"stateKeys": [
"amesim_mecmas21_1.a",
"amesim_mecmas21_1.v",
"amesim_mecmas21_1.x",
"amesim_mecmas21_10.a",
"amesim_mecmas21_10.v",
"amesim_mecmas21_10.x",
"amesim_mecmas21_2.a",
"amesim_mecmas21_2.v",
"amesim_mecmas21_2.x",
"amesim_mecmas21_3.a",
"amesim_mecmas21_3.v",
"amesim_mecmas21_3.x",
"amesim_mecmas21_4.a",
"amesim_mecmas21_4.v",
"amesim_mecmas21_4.x",
"amesim_mecmas21_5.a",
"amesim_mecmas21_5.v",
"amesim_mecmas21_5.x",
"amesim_mecmas21_6.a",
"amesim_mecmas21_6.v",
"amesim_mecmas21_6.x",
"amesim_mecmas21_7.a",
"amesim_mecmas21_7.v",
"amesim_mecmas21_7.x",
"amesim_mecmas21_8.a",
"amesim_mecmas21_8.v",
"amesim_mecmas21_8.x",
"amesim_mecmas21_9.a",
"amesim_mecmas21_9.v",
"amesim_mecmas21_9.x",
"amesim_pnch012_10.U",
"amesim_pnch012_10.m",
"amesim_pnch012_11.U",
"amesim_pnch012_11.m",
"amesim_pnch012_12.U",
"amesim_pnch012_12.m",
"amesim_pnch012_13.U",
"amesim_pnch012_13.m",
"amesim_pnch012_14.U",
"amesim_pnch012_14.m",
"amesim_pnch012_15.U",
"amesim_pnch012_15.m",
"amesim_pnch012_8.U",
"amesim_pnch012_8.m",
"amesim_pnch012_9.U",
"amesim_pnch012_9.m",
"amesim_pnch023_1.U",
"amesim_pnch023_1.m",
"amesim_pnch023_2.U",
"amesim_pnch023_2.m",
"amesim_pnch023_3.U",
"amesim_pnch023_3.m",
"amesim_pnch023_4.U",
"amesim_pnch023_4.m",
"amesim_pnl0001_1.U",
"amesim_pnl0001_1.m",
"amesim_pnl0001_10.U",
"amesim_pnl0001_10.m",
"amesim_pnl0001_11.U",
"amesim_pnl0001_11.m",
"amesim_pnl0001_13.U",
"amesim_pnl0001_13.m",
"amesim_pnl0001_14.U",
"amesim_pnl0001_14.m",
"amesim_pnl0001_15.U",
"amesim_pnl0001_15.m",
"amesim_pnl0001_16.U",
"amesim_pnl0001_16.m",
"amesim_pnl0001_17.U",
"amesim_pnl0001_17.m",
"amesim_pnl0001_18.U",
"amesim_pnl0001_18.m",
"amesim_pnl0001_19.U",
"amesim_pnl0001_19.m",
"amesim_pnl0001_2.U",
"amesim_pnl0001_2.m",
"amesim_pnl0001_20.U",
"amesim_pnl0001_20.m",
"amesim_pnl0001_21.U",
"amesim_pnl0001_21.m",
"amesim_pnl0001_25.U",
"amesim_pnl0001_25.m",
"amesim_pnl0001_26.U",
"amesim_pnl0001_26.m",
"amesim_pnl0001_27.U",
"amesim_pnl0001_27.m",
"amesim_pnl0001_4.U",
"amesim_pnl0001_4.m",
"amesim_pnl0001_5.U",
"amesim_pnl0001_5.m",
"amesim_pnl0001_7.U",
"amesim_pnl0001_7.m",
"amesim_pnl0001_9.U",
"amesim_pnl0001_9.m",
"amesim_pnl0002_1.U",
"amesim_pnl0002_1.m",
"amesim_pnl0002_2.U",
"amesim_pnl0002_2.m",
"amesim_pnl0002_3.U",
"amesim_pnl0002_3.m",
"amesim_pnl0002_4.U",
"amesim_pnl0002_4.m",
"amesim_pnl0002_5.U",
"amesim_pnl0002_5.m",
"amesim_pnl0002_6.U",
"amesim_pnl0002_6.m",
"amesim_pnl0002_7.U",
"amesim_pnl0002_7.m",
"amesim_pnl0002_8.U",
"amesim_pnl0002_8.m",
"amesim_pnl0003_1.U1",
"amesim_pnl0003_1.U2",
"amesim_pnl0003_1.m1",
"amesim_pnl0003_1.m2",
"amesim_pnl0003_2.U1",
"amesim_pnl0003_2.U2",
"amesim_pnl0003_2.m1",
"amesim_pnl0003_2.m2",
"amesim_pnl0003_3.U1",
"amesim_pnl0003_3.U2",
"amesim_pnl0003_3.m1",
"amesim_pnl0003_3.m2",
"amesim_pnl0003_4.U1",
"amesim_pnl0003_4.U2",
"amesim_pnl0003_4.m1",
"amesim_pnl0003_4.m2",
"amesim_pnl0003_5.U1",
"amesim_pnl0003_5.U2",
"amesim_pnl0003_5.m1",
"amesim_pnl0003_5.m2",
"amesim_pnl0003_6.U1",
"amesim_pnl0003_6.U2",
"amesim_pnl0003_6.m1",
"amesim_pnl0003_6.m2",
"amesim_pnl0003_7.U1",
"amesim_pnl0003_7.U2",
"amesim_pnl0003_7.m1",
"amesim_pnl0003_7.m2",
"amesim_pnl0003_8.U1",
"amesim_pnl0003_8.U2",
"amesim_pnl0003_8.m1",
"amesim_pnl0003_8.m2"
],
"stateKeyLayoutSha256": "9c5276b19aebf5648aa0175a8b30eeb090ae48a645e00af5efe400679c2a19c0"
},
"tolerance": {
"relative": 0.0002,
"absolute": 1e-09,
"checkpointTimeAbsoluteSeconds": 1e-12
},
"physicalCheckpoints": [
{
"requestedTime": 0.0,
"values": [
-0.8167936695810981,
0.0,
0.0,
0.0,
0.0,
0.0,
-0.8167936695810981,
0.0,
0.0,
-0.8167936695810981,
0.0,
0.0,
-0.8167936695810981,
0.0,
0.0,
-0.8167936695810981,
0.0,
0.0,
-0.8167936695810981,
0.0,
0.0,
-0.8167936695810981,
0.0,
0.0,
-0.8167936695810981,
0.0,
0.0,
0.0,
0.0,
0.0,
-1563.893548405841,
0.002462855848963059,
-1563.893548405841,
0.002462855848963059,
-1563.893548405841,
0.002462855848963059,
-1563.893548405841,
0.002462855848963059,
-1563.893548405841,
0.002462855848963059,
-1563.893548405841,
0.002462855848963059,
-1563.893548405841,
0.002462855848963059,
-1563.893548405841,
0.002462855848963059,
-886868.3937230138,
1.374510850335198,
-886868.3937230138,
1.374510850335198,
-886868.3937230138,
1.374510850335198,
-886868.3937230138,
1.374510850335198,
-2395.136531414716,
0.0037120966016654976,
-2395.136531414716,
0.0037120966016654976,
-2395.136531414716,
0.0037120966016654976,
-32.754109884455104,
5.158193227968668e-05,
-32.754109884455104,
5.158193227968668e-05,
-32.754109884455104,
5.158193227968668e-05,
-32.754109884455104,
5.158193227968668e-05,
-32.754109884455104,
5.158193227968668e-05,
-32.754109884455104,
5.158193227968668e-05,
-32.754109884455104,
5.158193227968668e-05,
-2395.136531414716,
0.0037120966016654976,
-32.754109884455104,
5.158193227968668e-05,
-4.814854153014898,
7.582544045113939e-06,
-4.814854153014898,
7.582544045113939e-06,
-4.814854153014898,
7.582544045113939e-06,
-4.814854153014898,
7.582544045113939e-06,
-2395.136531414716,
0.0037120966016654976,
-2395.136531414716,
0.0037120966016654976,
-2395.136531414716,
0.0037120966016654976,
-2395.136531414716,
0.0037120966016654976,
-65.50821976891021,
0.00010316386455937335,
-65.50821976891021,
0.00010316386455937335,
-65.50821976891021,
0.00010316386455937335,
-65.50821976891021,
0.00010316386455937335,
-65.50821976891021,
0.00010316386455937335,
-65.50821976891021,
0.00010316386455937335,
-65.50821976891021,
0.00010316386455937335,
-65.50821976891021,
0.00010316386455937335,
-733.2050606371581,
-733.2050606371581,
0.0011363561025506627,
0.0011363561025506627,
-733.2050606371581,
-733.2050606371581,
0.0011363561025506627,
0.0011363561025506627,
-733.2050606371581,
-733.2050606371581,
0.0011363561025506627,
0.0011363561025506627,
-733.2050606371581,
-733.2050606371581,
0.0011363561025506627,
0.0011363561025506627,
-733.2050606371581,
-733.2050606371581,
0.0011363561025506627,
0.0011363561025506627,
-733.2050606371581,
-733.2050606371581,
0.0011363561025506627,
0.0011363561025506627,
-733.2050606371581,
-733.2050606371581,
0.0011363561025506627,
0.0011363561025506627,
-733.2050606371581,
-733.2050606371581,
0.0011363561025506627,
0.0011363561025506627
]
},
{
"requestedTime": 0.04,
"values": [
-0.7202663767630412,
-0.031313670277005726,
-0.0006393262654652846,
0.0,
0.0,
0.0,
-0.7202445746758257,
-0.03131326532214226,
-0.0006393222149083683,
-0.7202431079507902,
-0.031313245044468446,
-0.000639322126344006,
-0.7202608891564758,
-0.03131357572935321,
-0.000639325500334864,
-0.7203004770720824,
-0.03131467563203143,
-0.0006393436082476693,
-0.7203200385813013,
-0.031314937758515383,
-0.0006393445984135971,
-0.7203210417978083,
-0.03131494127751647,
-0.0006393443430309219,
-0.7203038829240781,
-0.031314872463294875,
-0.0006393483841598907,
0.0,
-1.3196376986328492e-22,
-2.1367171061617978e-27,
-1563.2317229265764,
0.0024627103498254554,
-1563.2320575702738,
0.002462711020582906,
-1563.2329311978795,
0.002462712553941299,
-1563.233271708201,
0.0024627131946489966,
-1563.2332458437982,
0.0024627131438128085,
-1563.2328271988004,
0.0024627123577517533,
-1563.2319625907526,
0.0024627108660579895,
-1563.2317089857306,
0.0024627103184389166,
-886868.3937230138,
1.374510850335198,
-886868.3937230138,
1.374510850335198,
-886868.3937230138,
1.374510850335198,
-886868.3937230138,
1.374510850335198,
-2395.136531414716,
0.0037120966016654976,
-2395.136531414716,
0.0037120966016654976,
-2395.136531414716,
0.0037120966016654976,
-32.75534627762145,
5.162913025809795e-05,
-32.755348137443136,
5.1629142243738343e-05,
-32.75534804136382,
5.162914291472205e-05,
-32.7553506164913,
5.162913577247215e-05,
-32.755345646102356,
5.1629112834267025e-05,
-32.75534577906393,
5.162910342320198e-05,
-32.75534577952895,
5.162910292904694e-05,
-2395.136531414716,
0.0037120966016654976,
-32.75534579846172,
5.1629111455848846e-05,
-4.815030419476938,
7.589448594417277e-06,
-4.815030011609514,
7.589450747154388e-06,
-4.815030010504332,
7.589450673612998e-06,
-4.815030207302603,
7.589452052046662e-06,
-2395.136531414716,
0.0037120966016654976,
-2395.136531414716,
0.0037120966016654976,
-2395.136531414716,
0.0037120966016654976,
-2395.136531414716,
0.0037120966016654976,
-65.50987529417476,
0.00010325724257177476,
-65.50922049387084,
0.00010325683053111428,
-65.50922023152388,
0.00010325682249857915,
-65.50983596710446,
0.00010325719283273935,
-65.51060953242626,
0.00010325766285951179,
-65.51060943575153,
0.00010325765252819858,
-65.51060962617947,
0.0001032576608609912,
-65.51061020790279,
0.00010325768895577629,
-733.2050606371581,
-733.2050606371581,
0.0011363561025506627,
0.0011363561025506627,
-733.2050606371581,
-733.2050606371581,
0.0011363561025506627,
0.0011363561025506627,
-733.2050606371581,
-733.2050606371581,
0.0011363561025506627,
0.0011363561025506627,
-733.2050606371581,
-733.2050606371581,
0.0011363561025506627,
0.0011363561025506627,
-733.2050606371581,
-733.2050606371581,
0.0011363561025506627,
0.0011363561025506627,
-733.2050606371581,
-733.2050606371581,
0.0011363561025506627,
0.0011363561025506627,
-733.2050606371581,
-733.2050606371581,
0.0011363561025506627,
0.0011363561025506627,
-733.2050606371581,
-733.2050606371581,
0.0011363561025506627,
0.0011363561025506627
]
},
{
"requestedTime": 0.2,
"values": [
2.633213298395276e-06,
1.1892894705560516e-06,
1.5894798508064198e-07,
0.0,
-2.578751264156614e-22,
-4.4071381894537746e-27,
2.632795658428222e-06,
1.189314089655013e-06,
1.589407569517069e-07,
2.632610849104822e-06,
1.1893270837855721e-06,
1.5893755046259315e-07,
2.6318631717003883e-06,
1.1893767434265974e-06,
1.5892477796136446e-07,
2.627345675136894e-06,
1.1896818589834777e-06,
1.588580216987135e-07,
2.626597124617547e-06,
1.189729910245627e-06,
1.5884573170762932e-07,
2.626716741360724e-06,
1.1897230638966853e-06,
1.5884742627218636e-07,
2.627662615850568e-06,
1.189655709206818e-06,
1.588644534572078e-07,
0.0,
-1.3196897803884347e-20,
2.911421882340363e-22,
-21722.04652916195,
0.06623994849325848,
-21723.45572154048,
0.06624103226621368,
-21805.8029650575,
0.06629330102524067,
-21807.348632461802,
0.06629448766538328,
-21807.718245902277,
0.06629475455162867,
-21841.35926610171,
0.06631660356825392,
-21724.166913573034,
0.06624154605298845,
-21722.236505250527,
0.06624008714645983,
-877966.3231213323,
1.2399467552157493,
-877966.3231959188,
1.2399467558278492,
-877963.9668549704,
1.2399274199318358,
-877963.9667803708,
1.2399274193197396,
-2232.5019275800073,
0.00315798322918964,
-2232.4899974231744,
0.003157926865311079,
-2232.5374050849664,
0.003157991047678687,
-1390.8326096413955,
0.0020292934150847593,
-1389.5677102640286,
0.0020284826306108832,
-1389.567755519397,
0.0020284825046839408,
-1389.5640026929677,
0.002028477899231957,
-1384.2773409257754,
0.0020250769587299407,
-1384.2734539740877,
0.002025072398131466,
-1384.273453362348,
0.002025072497347585,
-2232.5493408893735,
0.0031580474195833626,
-1384.2772469562626,
0.0020250771935230094,
-225.385588248691,
0.00032428657025173376,
-225.38393721998736,
0.0003242844761714517,
-225.38395476780747,
0.00032428450098976854,
-225.3856398271819,
0.0003242866434989134,
-2232.549339734738,
0.0031580474193159055,
-2232.501928009357,
0.003157983231060593,
-2232.489996268724,
0.0031579268650437325,
-2232.537405514378,
0.0031579910495496645,
-152.21172950802372,
0.002369452972089371,
-233.94138935309604,
0.0024219418441874473,
-234.03246203501217,
0.0024219979480173534,
-213.0564611194868,
0.002408520518742427,
-185.7911471147455,
0.0023910044024748737,
-185.83507440684312,
0.0023910306600708267,
-185.52866330836179,
0.0023908362272859114,
-113.23743631814425,
0.0023444176118442837,
-665.6994611241944,
-664.8834960853846,
0.0009422838620001763,
0.0009411594503803834,
-665.7201688784651,
-664.9043863133073,
0.0009423119505012294,
0.0009411876374833056,
-665.6994612846539,
-664.8834962525066,
0.0009422838626008165,
0.0009411594509858708,
-665.715814148825,
-664.8994727705187,
0.0009422941728241457,
0.000941169278566084,
-665.6951112104504,
-664.8785874929312,
0.0009422660888104697,
0.0009411410960587667,
-665.695111741859,
-664.8785880272087,
0.0009422660891455687,
0.0009411410963954202,
-665.7158139885557,
-664.8994726048427,
0.0009422941722236292,
0.0009411692779619336,
-665.7201683466378,
-664.9043857816836,
0.0009423119501658692,
0.0009411876371485153
]
}
],
"outputContract": {
"sha256": "ae78c3bc5c60768e1cfc9542267d89922ef10673c5da216f257323c4d94b7499"
}
}
@@ -1,26 +1,55 @@
{
"schemaVersion": 1,
"id": "test_mql_8-progressive-v3",
"description": "Primary generic-solver regression target for the restored eight-branch 0.005 s-grid authoritative inputs, with a short smoke gate before staged extension.",
"description": "Primary generic-solver regression target for the restored eight-branch inputs aligned to the test_mql AMESim archive, with a short smoke gate before staged extension.",
"source": {
"path": "tests/data/test-mql-8.xml",
"sha256": "6eb2753a15af66fd8e91c169c4587e66b0ace2164c08c2cb23a67aab5fd09164",
"bytes": 104109,
"sha256": "0a2d9331df9eb5974daec25a61c1238ba32b1742d933ffc8b16ce316c5627b0b",
"bytes": 104110,
"xmlIsAuthoritative": true,
"referenceArchive": {
"path": "AmesimModels/test_mql.ame",
"sha256": "cbc3aadd4569a49b3a63e5d66d4143ec16126c0f950df73fb637e07673c20fbb",
"bytes": 21708800,
"role": "authoritativePhysicalBaseline",
"resultStartTime": 0.0,
"resultStopTime": 10.0,
"resultSampleStep": 0.01,
"resultPointCount": 1002
},
"companionProject": {
"path": "tests/data/test-mql-8.json",
"sha256": "8d7a263691a9f09f39c92aba19ae1350911dc66b4904e98bae5f20592c5a3fcd",
"bytes": 272591,
"sha256": "b44bf540ccd1c293fe2af2b9b9052b540abf83961ad955a0f6a4ab40fbe0bb18",
"bytes": 272592,
"executionInput": false
},
"simulation": {
"tStart": 0.0,
"tStop": 5.0,
"sampleStep": 0.005,
"maxStep": 0.005,
"tStop": 10.0,
"sampleStep": 0.01,
"maxStep": 0.001,
"method": "BDF"
}
},
"acceptanceEvidence": {
"production0.2ApprovedReplay": {
"path": "tests/baselines/simulation/test_mql_8/runs/2026-08-18-production-opt00-approved-replay-0.2.json",
"sha256": "2e27cd54026a2612df88d1903431f3968e03599b2ca6eb83d9b98638cc051502",
"bytes": 398198,
"workerWallSeconds": 159.60707960650325,
"orchestrationWallSeconds": 160.47319143638015,
"acceptancePassed": true,
"regressionGoldenPassed": true,
"physicalStateV21GoldenPassed": true
},
"extensionDecision": {
"path": "tests/baselines/simulation/test_mql_8/runs/2026-08-18-production-opt00-extension-decision.json",
"sha256": "7d34aea736863788d9efa72c46910afffd543ddc46eacdf1c6aa9caeab202022",
"bytes": 1313,
"oneSecondOutcome": "eligible",
"extensionWasNotStarted": true
}
},
"historicalReports": [
{
"path": "tests/baselines/simulation/test_mql_8/runs/2026-08-17-solver-only-v1.json",
@@ -44,7 +73,7 @@
"sourceXmlSha256": "170463d65d074da01f0f9e9dab730b3815c94c1cc80b5190ec2e3fe623da74d3",
"status": "historicalOnly",
"compatibleWithCurrentSource": false,
"reason": "This accepted 0.2 s report predates the four restored PNL0001 branches and cannot validate the v3 source."
"reason": "This accepted 0.2 s report predates the four restored PNL0001 branches and the AMESim-aligned 10 s simulation settings; it remains historical evidence only."
},
{
"path": "tests/baselines/simulation/test_mql_8/runs/2026-08-17-production-v2-extension-decision.json",
@@ -52,7 +81,17 @@
"sourceXmlSha256": "170463d65d074da01f0f9e9dab730b3815c94c1cc80b5190ec2e3fe623da74d3",
"status": "historicalOnly",
"compatibleWithCurrentSource": false,
"reason": "This runtime extension decision was derived from the v2 source and is retained only as historical evidence."
"reason": "This runtime extension decision was derived from the superseded v2 source and must not control the AMESim-aligned v3 source."
}
],
"historicalGoldens": [
{
"path": "tests/baselines/simulation/test_mql_8/goldens/production-0.2s-v1.json",
"sha256": "99fa7b3631a89f59f86551847175f3701a1567d8d0bd10d87545734f17515d72",
"sourceXmlSha256": "170463d65d074da01f0f9e9dab730b3815c94c1cc80b5190ec2e3fe623da74d3",
"status": "historicalOnly",
"compatibleWithCurrentSource": false,
"reason": "This Python-state golden predates the four restored PNL0001 branches and the AMESim-aligned simulation settings; it must not approve the current v3 source."
}
],
"structure": {
@@ -90,7 +129,7 @@
"productionEquivalentOutput": false
},
"production": {
"description": "Acceptance lane: changes only tStop and preserves the source 0.005 s output and internal-step grid.",
"description": "Acceptance lane: changes only tStop and preserves the AMESim-aligned source 0.01 s output grid and 0.001 s internal-step cap.",
"samplingMode": "source",
"maxStepMode": "source",
"instrumentationMode": "standard",
@@ -121,7 +160,23 @@
"expectedSignalEventTimes": [
0.04
],
"expectedMechanicalTransitionTimes": []
"expectedMechanicalTransitionTimes": [],
"goldens": {
"production": {
"path": "tests/baselines/simulation/test_mql_8/goldens/production-0.2s-v2.json",
"sha256": "7ca8e859d7d2889d6608726eba0faf3441f0f2ad579799c2abdfe571fd49fd0e",
"role": "pythonDeterminismRegression",
"affectsPhysicalCorrectness": false
}
},
"physicalStateV21Goldens": {
"production": {
"path": "tests/baselines/simulation/test_mql_8/goldens/production-0.2s-physical-state-v2.1.json",
"sha256": "6f0752afe8c1f7690599c2709a76d9a1342f99f726c6c8593321dc6267e175b2",
"role": "amesimPhysicalBaseline",
"compareOnEveryRun": true
}
}
},
"1s": {
"stopTime": 1.0,
@@ -175,12 +230,16 @@
}
},
"correctness": {
"status": "partial",
"status": "complete",
"maximumScaledResidual": 1e-7,
"requireFiniteSeries": true,
"requireStrictlyIncreasingTimes": true,
"physicalProjectionCategories": [
"state"
"state",
"pressure",
"massFlow",
"conservation",
"discreteMode"
],
"stateRelativeTolerance": 0.0002,
"stateAbsoluteTolerance": 1e-9,
@@ -188,7 +247,10 @@
"eventTimeAbsoluteToleranceSeconds": 0.00002,
"signalEventTimeAbsoluteToleranceSeconds": 1e-12,
"mechanicalTransitionTimesAvailable": true,
"note": "The restored v3 source currently enforces structure, finite series, residuals, checkpoints, and events. Its v2 state golden is historical-only; a new reviewed v3 state golden remains pending."
"physicalBaselineAuthority": "amesim",
"compareAmesimOnEveryRun": true,
"pythonGoldenRole": "determinismDiagnosticOnly",
"note": "AMESim simulation results are the sole physical baseline and every production run reports current-to-AMESim relative errors. The exact Python-state golden detects determinism and implementation drift only; it cannot approve physical correctness. Longer progressive horizons remain independently staged work."
},
"execution": {
"causalExecutorV2Default": true,
@@ -0,0 +1,40 @@
{
"schemaVersion": 1,
"kind": "progressive-extension-decision",
"manifestId": "test_mql_8-progressive-v2",
"sourceXmlSha256": "0a2d9331df9eb5974daec25a61c1238ba32b1742d933ffc8b16ce316c5627b0b",
"sourceReport": "2026-08-18-production-opt00-approved-replay-0.2.json",
"sourceReportSha256": "2e27cd54026a2612df88d1903431f3968e03599b2ca6eb83d9b98638cc051502",
"lane": "production",
"observedCase": {
"caseId": "0.2s",
"outcome": "completed",
"workerWallSeconds": 159.60707960650325,
"orchestrationWallSeconds": 160.47319143638015,
"acceptancePassed": true,
"regressionGoldenPassed": true,
"physicalStateV21GoldenPassed": true
},
"predictionSafetyFactor": 1.5,
"decisions": [
{
"caseId": "1s",
"outcome": "eligible",
"predictedWallSeconds": 1197.0530970487744,
"softTimeoutSeconds": 1200.0,
"reason": "predictedWallWithinSoftBudget"
},
{
"caseId": "5s",
"outcome": "notEvaluated",
"reason": "predecessorNotRunInOpt00"
},
{
"caseId": "10s",
"outcome": "notEvaluated",
"reason": "predecessorNotRunInOpt00"
}
],
"extensionWasNotStarted": true,
"scopeReason": "OPT-00 closes at the approved production 0.2 s gate; longer progressive horizons remain separately staged work."
}
@@ -0,0 +1,631 @@
{
"schemaVersion": 1,
"id": "test_mql_full_branches-production-0.81s-physical-state-v2",
"caseId": "0.81s",
"lane": "production",
"sourceXmlSha256": "2fb95e65f5de0c85a6a17802aef74ea004087323fd00fd8d01acf0184ff71d48",
"approval": {
"status": "approved",
"approvedAt": "2026-08-18T07:25:28+00:00",
"basis": "OPT-00 locked Python 3.12 production repeat 1 passed finite-series, checkpoint, event, residual, audit, and no-fallback gates; repeats 2 and 3 replayed every projected value exactly."
},
"provenance": {
"sourceReport": {
"path": "tests/baselines/simulation/test_mql_full_branches/runs/2026-08-18-opt00-historical-repeat-1.json",
"sha256": "4659ae850eef4f1541b3172f783b01a1859744a3f0a50030e094c2c25f93e195",
"generatedAt": "2026-08-18T07:12:43.593117+00:00",
"metadataCompatibility": {
"status": "current",
"differences": []
}
}
},
"physicalLayout": {
"projectionCategories": [
"state"
],
"stateKeys": [
"branch_boundary_pnl0002_b_chamber.U",
"branch_boundary_pnl0002_b_chamber.m",
"branch_boundary_pnl0002_branch05_chamber.U",
"branch_boundary_pnl0002_branch05_chamber.m",
"branch_boundary_pnl00r_branch05_chamber.U",
"branch_boundary_pnl00r_branch05_chamber.m",
"branch_boundary_pnl00r_chamber.U",
"branch_boundary_pnl00r_chamber.m",
"mass_friction_endstops_10.a",
"mass_friction_endstops_10.v",
"mass_friction_endstops_10.x",
"mass_friction_endstops_11.a",
"mass_friction_endstops_11.v",
"mass_friction_endstops_11.x",
"mass_friction_endstops_12.a",
"mass_friction_endstops_12.v",
"mass_friction_endstops_12.x",
"mass_friction_endstops_13.a",
"mass_friction_endstops_13.v",
"mass_friction_endstops_13.x",
"mass_friction_endstops_18.a",
"mass_friction_endstops_18.v",
"mass_friction_endstops_18.x",
"mass_friction_endstops_19.a",
"mass_friction_endstops_19.v",
"mass_friction_endstops_19.x",
"pn_c1_10.U",
"pn_c1_10.m",
"pn_c1_11.U",
"pn_c1_11.m",
"pn_c1_8.U",
"pn_c1_8.m",
"pn_c1_9.U",
"pn_c1_9.m",
"pn_general_chamber.U",
"pn_general_chamber.m",
"pn_general_chamber_2.U",
"pn_general_chamber_2.m",
"pneumatic_65.U",
"pneumatic_65.m",
"pneumatic_66.U",
"pneumatic_66.m",
"pneumatic_68.U",
"pneumatic_68.m",
"pneumatic_69.U",
"pneumatic_69.m",
"pneumatic_75.U1",
"pneumatic_75.U2",
"pneumatic_75.m1",
"pneumatic_75.m2",
"pneumatic_76.U1",
"pneumatic_76.U2",
"pneumatic_76.m1",
"pneumatic_76.m2",
"pneumatic_80.U",
"pneumatic_80.m",
"pneumatic_83.U",
"pneumatic_83.m",
"pneumatic_85.U",
"pneumatic_85.m",
"pneumatic_86.U",
"pneumatic_86.m",
"pneumatic_87.U1",
"pneumatic_87.U2",
"pneumatic_87.m1",
"pneumatic_87.m2",
"pneumatic_88.U1",
"pneumatic_88.U2",
"pneumatic_88.m1",
"pneumatic_88.m2",
"pneumatic_95.U",
"pneumatic_95.m",
"pneumatic_96.U",
"pneumatic_96.m",
"pneumatic_97.U",
"pneumatic_97.m",
"pneumatic_98.U",
"pneumatic_98.m",
"pneumatic_99.U",
"pneumatic_99.m"
],
"stateKeyLayoutSha256": "65824cf9793e935481c106c9e673bd2034a439c6dc3d74997ae2b8149ced4fbe"
},
"tolerance": {
"relative": 0.0002,
"absolute": 1e-09,
"checkpointTimeAbsoluteSeconds": 1e-12
},
"physicalCheckpoints": [
{
"requestedTime": 0.0,
"values": [
-886868.3937230138,
1.374510850335198,
-886868.3937230138,
1.374510850335198,
-886868.3937230138,
1.374510850335198,
-886868.3937230138,
1.374510850335198,
-0.8167936695810981,
0.0,
0.0,
-0.8167936695810981,
0.0,
0.0,
-0.8167936695810981,
0.0,
0.0,
-0.8167936695810981,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
-1563.893548405841,
0.002462855848963059,
-1563.893548405841,
0.002462855848963059,
-1563.893548405841,
0.002462855848963059,
-1563.893548405841,
0.002462855848963059,
-886868.3937230138,
1.374510850335198,
-886868.3937230138,
1.374510850335198,
-32.754109884455104,
5.158193227968668e-05,
-32.754109884455104,
5.158193227968668e-05,
-32.754109884455104,
5.158193227968668e-05,
-32.754109884455104,
5.158193227968668e-05,
-733.2050606371581,
-733.2050606371581,
0.0011363561025506627,
0.0011363561025506627,
-733.2050606371581,
-733.2050606371581,
0.0011363561025506627,
0.0011363561025506627,
-65.50821976891021,
0.00010316386455937335,
-65.50821976891021,
0.00010316386455937335,
-65.50821976891021,
0.00010316386455937335,
-65.50821976891021,
0.00010316386455937335,
-733.2050606371581,
-733.2050606371581,
0.0011363561025506627,
0.0011363561025506627,
-733.2050606371581,
-733.2050606371581,
0.0011363561025506627,
0.0011363561025506627,
-65.50821976891021,
0.00010316386455937335,
-2395.136531414716,
0.0037120966016654976,
-2395.136531414716,
0.0037120966016654976,
-2395.136531414716,
0.0037120966016654976,
-2395.136531414716,
0.0037120966016654976
]
},
{
"requestedTime": 0.04,
"values": [
-879404.9359576713,
1.2522714879032233,
-879404.9358312349,
1.2522714867708487,
-886868.3937230138,
1.374510850335198,
-886868.3937230138,
1.374510850335198,
9.734498453326524e-06,
2.2165787255696986e-06,
7.615138175359735e-08,
6.899700674694032e-06,
1.6791980885681643e-06,
5.607885010135549e-08,
6.900102307554334e-06,
1.6791970458948259e-06,
5.6078837470433516e-08,
9.7344332607463e-06,
2.2165785543742696e-06,
7.615138012421167e-08,
0.0,
-1.3786916256412132e-25,
-5.521417937686967e-24,
0.0,
1.7204535623474844e-21,
-1.2449238864173693e-21,
-3836.4295505841374,
0.03971246371985885,
-8215.697802972754,
0.06449828662707775,
-8215.698180211439,
0.06449829186881316,
-3836.3905996761514,
0.03971246529726471,
-886868.3937230138,
1.374510850335198,
-886868.3937230138,
1.374510850335198,
-2323.937662655075,
0.003365680267480819,
-1558.6812613835866,
0.00229549447954163,
-1558.6815406132575,
0.0022954946593348505,
-2323.9377625288566,
0.0033656803769320197,
-733.2050606371582,
-733.2050606371581,
0.0011363561025506627,
0.0011363561025506627,
-733.2050606371581,
-733.2050606371581,
0.0011363561025506629,
0.001136356102550663,
-3931.718242540372,
0.005752354208859085,
-3931.719290698283,
0.005752354971956523,
-7784.908056387039,
0.011153351022249161,
1704.5017150238582,
0.001497027829154341,
-733.205060637158,
-733.2050606371581,
0.0011363561025506627,
0.0011363561025506629,
-733.2050606371581,
-733.2050606371581,
0.0011363561025506627,
0.0011363561025506627,
-7784.908156509664,
0.011153351115632995,
-2395.136531414716,
0.0037120966016654976,
-2395.136531414716,
0.0037120966016654976,
-2395.136531414716,
0.0037120966016654976,
-2395.136531414716,
0.0037120966016654976
]
},
{
"requestedTime": 0.69,
"values": [
-860379.0245019491,
1.1985497181126685,
-860379.0247699278,
1.1985497182559621,
-874070.5350132573,
1.2108685641280736,
-874070.5351659104,
1.2108685651503308,
6.302155088633299e-07,
2.0477201022089e-06,
1.739862170731644e-06,
6.885582115501165e-07,
2.072356484372671e-06,
1.7151425366011e-06,
6.88283471390605e-07,
2.0723565171342975e-06,
1.7151425037886711e-06,
6.301060784608125e-07,
2.0477201243571633e-06,
1.739862148436311e-06,
0.0,
2.0520928869397134e-22,
4.9098612203217504e-20,
0.0,
4.7142848729216316e-20,
-2.0780593120000206e-21,
-95711.13598161584,
0.2330223756901088,
-99484.30868025024,
0.23540556157200768,
-99484.30933223445,
0.23540556198958848,
-95711.12399082902,
0.23302236813021637,
-874021.6128809263,
1.2105342428506563,
-874021.6127639221,
1.2105342420477019,
-4699.544021984157,
0.006579168843426967,
-4720.142085434138,
0.006592090149576305,
-4720.142089865395,
0.006592090152448902,
-4699.544238887633,
0.006579168980161733,
-720.548977698558,
-720.2062838344375,
0.000998791691638376,
0.00099856697258834,
-722.1637803310383,
-722.0477500247466,
0.0010005181981378461,
0.0010004330928084816,
-8639.330806039252,
0.012679745952732602,
-8639.330537692149,
0.012679745783851644,
-8909.106011748408,
0.012849685563490313,
1389.1739707221775,
0.006354956657485442,
-722.1637801799975,
-722.0477531282031,
0.001000518198664749,
0.0010004330953830574,
-720.5489778046637,
-720.2062839511643,
0.0009987916917054815,
0.0009985669726623582,
-8909.106148651528,
0.012849685649995602,
-2357.5431522121776,
0.00326741144588273,
-2355.7331452897465,
0.0032646046108505246,
-2355.733147442795,
0.0032646046116421414,
-2357.543151890905,
0.0032674114436482805
]
},
{
"requestedTime": 0.7,
"values": [
-860379.8819972485,
1.1985586239832504,
-860379.8822663656,
1.1985586241379014,
-873989.7214316746,
1.210316350104016,
-873989.7215632556,
1.2103163509793102,
-2.1975173149257897e-06,
2.02734183270263e-06,
1.7602360080939606e-06,
-2.245873911306262e-06,
2.0517263968615454e-06,
1.7357614512099663e-06,
-2.2355280816555024e-06,
2.051726429425243e-06,
1.7357614187243355e-06,
-2.1975464187562464e-06,
2.0273418547326992e-06,
1.7602359860195857e-06,
0.0,
2.013739831250115e-21,
4.909861220321753e-20,
0.0,
4.665200046136569e-20,
-1.9566383001493946e-21,
-96560.09354570496,
0.2335572995463288,
-100288.67701814357,
0.23591263994887818,
-100288.677678112,
0.23591264036701443,
-96560.0816929563,
0.23355729206770598,
-873947.8864856226,
1.2100313452817673,
-873947.8863858595,
1.2100313445985562,
-4706.906282326286,
0.006583785685946545,
-4721.89741006748,
0.006593168289865688,
-4721.897404439745,
0.006593168286323642,
-4706.906483656017,
0.006583785812787189,
-720.6545512340357,
-720.3217292925623,
0.0009985764249686698,
0.0009983591472543481,
-722.1508419312411,
-722.0421232665894,
0.0010001323660439989,
0.00100005352811943,
-8642.043554742524,
0.012681407602717975,
-8642.043293601184,
0.012681407438297841,
-8909.49862797875,
0.012849959429845414,
1389.0998959067165,
0.006354964303801297,
-722.1508452424541,
-722.0421258113258,
0.0010001323686673997,
0.001000053530255132,
-720.6545510297586,
-720.3217293326904,
0.0009985764248405691,
0.0009983591472800236,
-8909.498764806547,
0.012849959516004638,
-2357.35674156337,
0.0032660606424093387,
-2355.921025330427,
0.0032637130423187337,
-2355.921027270413,
0.0032637130430599385,
-2357.3567413654787,
0.003266060640560602
]
},
{
"requestedTime": 0.8,
"values": [
-860175.1606710927,
1.1970987817186032,
-860175.1609442824,
1.1970987819042118,
-873416.0554547055,
1.206445289457375,
-873416.0554726648,
1.2064452895529436,
-1.949198776856065e-06,
1.826519161772371e-06,
1.9528536810215616e-06,
-1.971406163647771e-06,
1.848554964674094e-06,
1.930697446050263e-06,
-1.9711186178028582e-06,
1.8485549941949607e-06,
1.930697416668372e-06,
-1.94919528439641e-06,
1.826519181824015e-06,
1.9528536610522474e-06,
8.892500282325972,
2.5187368473853223e-21,
4.909861220321753e-20,
-16.252500528926326,
4.576919129896975e-20,
-1.9530653259948938e-21,
-104471.75361732666,
0.23818832921650948,
-107803.92242364622,
0.24029497741554184,
-107803.92309836508,
0.2402949778374652,
-104471.7429655161,
0.2381883224928943,
-873404.5104492744,
1.2063684021036665,
-873404.5104388825,
1.2063684020307441,
-4704.300638717692,
0.006574703133691949,
-4693.326778314112,
0.006567696268767441,
-4693.326526389924,
0.006567696110012524,
-4704.3007263131885,
0.006574703188787359,
-721.1607141734798,
-720.9310979144485,
0.0009965662267659527,
0.0009964191642398892,
-721.9230383692676,
-721.8772183273541,
0.0009972429132872915,
0.0009972108290529252,
-8703.980749781746,
0.012705472199729761,
-8703.980555484635,
0.01270547207717158,
-8967.989302068207,
0.012872002894864527,
1377.5687495145785,
0.006346840211910472,
-721.9230326537768,
-721.8772199435517,
0.0009972429097436842,
0.0009972108301285444,
-721.1607123097651,
-720.9310970023907,
0.000996566225592321,
0.0009964191636655784,
-8967.989425383095,
0.0128720029723915,
-2356.03147928222,
0.0032562562535671563,
-2356.668143012874,
0.0032561870649935125,
-2356.668143725967,
0.0032561870653915977,
-2356.031477688963,
0.0032562562523787346
]
},
{
"requestedTime": 0.81,
"values": [
-860055.7816079621,
1.1962534043760158,
-860055.7818796586,
1.1962534045522308,
-873367.9088398638,
1.206124190328161,
-873367.9088547124,
1.206124190402843,
8.857774649477797,
0.08873345197507769,
0.00044583262150923715,
8.857774480804801,
0.08873347304797707,
0.0004458106820297355,
8.857774445663672,
0.08873347304800631,
0.0004458106820006473,
8.857774661221775,
0.08873345197509747,
0.00044583262148946694,
8.857778206680395,
0.08873165793329868,
0.00044386167425480166,
-16.206598333861397,
-0.16235697968747592,
-0.0008121695210045893,
-105735.3088635258,
0.23897151058696434,
-109037.397892104,
0.24109191168512564,
-109037.39857007933,
0.2410919121122127,
-105735.29829660244,
0.23897150391654698,
-873350.1784581648,
1.206006248314118,
-873350.1784501448,
1.2060062482571396,
-4682.546337026962,
0.006553210204193263,
-4667.866605288969,
0.006543088564608954,
-4667.866320678238,
0.006543088385317721,
-4682.546417371199,
0.006553210254794004,
-721.1212567696082,
-720.9136270898001,
0.0009960146033417782,
0.0009958781343227421,
-721.8635886622386,
-721.8407704168852,
0.0009969210574287178,
0.0009968996150299173,
-8724.337750229228,
0.012701926255908602,
-8724.337567825336,
0.012701926140963282,
-8998.36421558522,
0.012879100492327268,
1364.3747046167766,
0.00633752606051716,
-721.8635847156165,
-721.8407700947419,
0.000996921054988454,
0.0009968996148721218,
-721.121255394678,
-720.9136259824896,
0.0009960146024759352,
0.0009958781336253564,
-8998.364330621043,
0.012879100564768854,
-2355.9148119653287,
0.0032552690027748852,
-2356.531146237746,
0.0032546207052266537,
-2356.5311468883583,
0.0032546207055964556,
-2355.914810407958,
0.0032552690016484026
]
}
],
"outputContract": {
"sha256": "e7596daa27144f14d5210c100126fa0c413862ed8a8e4bf525195b2e6070e0f9"
}
}
@@ -0,0 +1,886 @@
{
"schemaVersion": 1,
"id": "test_mql_full_branches-production-2.10s-physical-state-v2",
"caseId": "2.10s",
"lane": "production",
"sourceXmlSha256": "2fb95e65f5de0c85a6a17802aef74ea004087323fd00fd8d01acf0184ff71d48",
"approval": {
"status": "approved",
"approvedAt": "2026-08-18T07:25:28+00:00",
"basis": "OPT-00 locked Python 3.12 production repeat 1 passed finite-series, checkpoint, event, residual, audit, and no-fallback gates; repeats 2 and 3 replayed every projected value exactly."
},
"provenance": {
"sourceReport": {
"path": "tests/baselines/simulation/test_mql_full_branches/runs/2026-08-18-opt00-historical-repeat-1.json",
"sha256": "4659ae850eef4f1541b3172f783b01a1859744a3f0a50030e094c2c25f93e195",
"generatedAt": "2026-08-18T07:12:43.593117+00:00",
"metadataCompatibility": {
"status": "current",
"differences": []
}
}
},
"physicalLayout": {
"projectionCategories": [
"state"
],
"stateKeys": [
"branch_boundary_pnl0002_b_chamber.U",
"branch_boundary_pnl0002_b_chamber.m",
"branch_boundary_pnl0002_branch05_chamber.U",
"branch_boundary_pnl0002_branch05_chamber.m",
"branch_boundary_pnl00r_branch05_chamber.U",
"branch_boundary_pnl00r_branch05_chamber.m",
"branch_boundary_pnl00r_chamber.U",
"branch_boundary_pnl00r_chamber.m",
"mass_friction_endstops_10.a",
"mass_friction_endstops_10.v",
"mass_friction_endstops_10.x",
"mass_friction_endstops_11.a",
"mass_friction_endstops_11.v",
"mass_friction_endstops_11.x",
"mass_friction_endstops_12.a",
"mass_friction_endstops_12.v",
"mass_friction_endstops_12.x",
"mass_friction_endstops_13.a",
"mass_friction_endstops_13.v",
"mass_friction_endstops_13.x",
"mass_friction_endstops_18.a",
"mass_friction_endstops_18.v",
"mass_friction_endstops_18.x",
"mass_friction_endstops_19.a",
"mass_friction_endstops_19.v",
"mass_friction_endstops_19.x",
"pn_c1_10.U",
"pn_c1_10.m",
"pn_c1_11.U",
"pn_c1_11.m",
"pn_c1_8.U",
"pn_c1_8.m",
"pn_c1_9.U",
"pn_c1_9.m",
"pn_general_chamber.U",
"pn_general_chamber.m",
"pn_general_chamber_2.U",
"pn_general_chamber_2.m",
"pneumatic_65.U",
"pneumatic_65.m",
"pneumatic_66.U",
"pneumatic_66.m",
"pneumatic_68.U",
"pneumatic_68.m",
"pneumatic_69.U",
"pneumatic_69.m",
"pneumatic_75.U1",
"pneumatic_75.U2",
"pneumatic_75.m1",
"pneumatic_75.m2",
"pneumatic_76.U1",
"pneumatic_76.U2",
"pneumatic_76.m1",
"pneumatic_76.m2",
"pneumatic_80.U",
"pneumatic_80.m",
"pneumatic_83.U",
"pneumatic_83.m",
"pneumatic_85.U",
"pneumatic_85.m",
"pneumatic_86.U",
"pneumatic_86.m",
"pneumatic_87.U1",
"pneumatic_87.U2",
"pneumatic_87.m1",
"pneumatic_87.m2",
"pneumatic_88.U1",
"pneumatic_88.U2",
"pneumatic_88.m1",
"pneumatic_88.m2",
"pneumatic_95.U",
"pneumatic_95.m",
"pneumatic_96.U",
"pneumatic_96.m",
"pneumatic_97.U",
"pneumatic_97.m",
"pneumatic_98.U",
"pneumatic_98.m",
"pneumatic_99.U",
"pneumatic_99.m"
],
"stateKeyLayoutSha256": "65824cf9793e935481c106c9e673bd2034a439c6dc3d74997ae2b8149ced4fbe"
},
"tolerance": {
"relative": 0.0002,
"absolute": 1e-09,
"checkpointTimeAbsoluteSeconds": 1e-12
},
"physicalCheckpoints": [
{
"requestedTime": 0.0,
"values": [
-886868.3937230138,
1.374510850335198,
-886868.3937230138,
1.374510850335198,
-886868.3937230138,
1.374510850335198,
-886868.3937230138,
1.374510850335198,
-0.8167936695810981,
0.0,
0.0,
-0.8167936695810981,
0.0,
0.0,
-0.8167936695810981,
0.0,
0.0,
-0.8167936695810981,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
-1563.893548405841,
0.002462855848963059,
-1563.893548405841,
0.002462855848963059,
-1563.893548405841,
0.002462855848963059,
-1563.893548405841,
0.002462855848963059,
-886868.3937230138,
1.374510850335198,
-886868.3937230138,
1.374510850335198,
-32.754109884455104,
5.158193227968668e-05,
-32.754109884455104,
5.158193227968668e-05,
-32.754109884455104,
5.158193227968668e-05,
-32.754109884455104,
5.158193227968668e-05,
-733.2050606371581,
-733.2050606371581,
0.0011363561025506627,
0.0011363561025506627,
-733.2050606371581,
-733.2050606371581,
0.0011363561025506627,
0.0011363561025506627,
-65.50821976891021,
0.00010316386455937335,
-65.50821976891021,
0.00010316386455937335,
-65.50821976891021,
0.00010316386455937335,
-65.50821976891021,
0.00010316386455937335,
-733.2050606371581,
-733.2050606371581,
0.0011363561025506627,
0.0011363561025506627,
-733.2050606371581,
-733.2050606371581,
0.0011363561025506627,
0.0011363561025506627,
-65.50821976891021,
0.00010316386455937335,
-2395.136531414716,
0.0037120966016654976,
-2395.136531414716,
0.0037120966016654976,
-2395.136531414716,
0.0037120966016654976,
-2395.136531414716,
0.0037120966016654976
]
},
{
"requestedTime": 0.04,
"values": [
-879404.9359576713,
1.2522714879032233,
-879404.9358312349,
1.2522714867708487,
-886868.3937230138,
1.374510850335198,
-886868.3937230138,
1.374510850335198,
9.734498453326524e-06,
2.2165787255696986e-06,
7.615138175359735e-08,
6.899700674694032e-06,
1.6791980885681643e-06,
5.607885010135549e-08,
6.900102307554334e-06,
1.6791970458948259e-06,
5.6078837470433516e-08,
9.7344332607463e-06,
2.2165785543742696e-06,
7.615138012421167e-08,
0.0,
-1.3786916256412132e-25,
-5.521417937686967e-24,
0.0,
1.7204535623474844e-21,
-1.2449238864173693e-21,
-3836.4295505841374,
0.03971246371985885,
-8215.697802972754,
0.06449828662707775,
-8215.698180211439,
0.06449829186881316,
-3836.3905996761514,
0.03971246529726471,
-886868.3937230138,
1.374510850335198,
-886868.3937230138,
1.374510850335198,
-2323.937662655075,
0.003365680267480819,
-1558.6812613835866,
0.00229549447954163,
-1558.6815406132575,
0.0022954946593348505,
-2323.9377625288566,
0.0033656803769320197,
-733.2050606371582,
-733.2050606371581,
0.0011363561025506627,
0.0011363561025506627,
-733.2050606371581,
-733.2050606371581,
0.0011363561025506629,
0.001136356102550663,
-3931.718242540372,
0.005752354208859085,
-3931.719290698283,
0.005752354971956523,
-7784.908056387039,
0.011153351022249161,
1704.5017150238582,
0.001497027829154341,
-733.205060637158,
-733.2050606371581,
0.0011363561025506627,
0.0011363561025506629,
-733.2050606371581,
-733.2050606371581,
0.0011363561025506627,
0.0011363561025506627,
-7784.908156509664,
0.011153351115632995,
-2395.136531414716,
0.0037120966016654976,
-2395.136531414716,
0.0037120966016654976,
-2395.136531414716,
0.0037120966016654976,
-2395.136531414716,
0.0037120966016654976
]
},
{
"requestedTime": 0.69,
"values": [
-860379.0245019491,
1.1985497181126685,
-860379.0247699278,
1.1985497182559621,
-874070.5350132573,
1.2108685641280736,
-874070.5351659104,
1.2108685651503308,
6.302155088633299e-07,
2.0477201022089e-06,
1.739862170731644e-06,
6.885582115501165e-07,
2.072356484372671e-06,
1.7151425366011e-06,
6.88283471390605e-07,
2.0723565171342975e-06,
1.7151425037886711e-06,
6.301060784608125e-07,
2.0477201243571633e-06,
1.739862148436311e-06,
0.0,
2.0520928869397134e-22,
4.9098612203217504e-20,
0.0,
4.7142848729216316e-20,
-2.0780593120000206e-21,
-95711.13598161584,
0.2330223756901088,
-99484.30868025024,
0.23540556157200768,
-99484.30933223445,
0.23540556198958848,
-95711.12399082902,
0.23302236813021637,
-874021.6128809263,
1.2105342428506563,
-874021.6127639221,
1.2105342420477019,
-4699.544021984157,
0.006579168843426967,
-4720.142085434138,
0.006592090149576305,
-4720.142089865395,
0.006592090152448902,
-4699.544238887633,
0.006579168980161733,
-720.548977698558,
-720.2062838344375,
0.000998791691638376,
0.00099856697258834,
-722.1637803310383,
-722.0477500247466,
0.0010005181981378461,
0.0010004330928084816,
-8639.330806039252,
0.012679745952732602,
-8639.330537692149,
0.012679745783851644,
-8909.106011748408,
0.012849685563490313,
1389.1739707221775,
0.006354956657485442,
-722.1637801799975,
-722.0477531282031,
0.001000518198664749,
0.0010004330953830574,
-720.5489778046637,
-720.2062839511643,
0.0009987916917054815,
0.0009985669726623582,
-8909.106148651528,
0.012849685649995602,
-2357.5431522121776,
0.00326741144588273,
-2355.7331452897465,
0.0032646046108505246,
-2355.733147442795,
0.0032646046116421414,
-2357.543151890905,
0.0032674114436482805
]
},
{
"requestedTime": 0.7,
"values": [
-860379.8819972485,
1.1985586239832504,
-860379.8822663656,
1.1985586241379014,
-873989.7214316746,
1.210316350104016,
-873989.7215632556,
1.2103163509793102,
-2.1975173149257897e-06,
2.02734183270263e-06,
1.7602360080939606e-06,
-2.245873911306262e-06,
2.0517263968615454e-06,
1.7357614512099663e-06,
-2.2355280816555024e-06,
2.051726429425243e-06,
1.7357614187243355e-06,
-2.1975464187562464e-06,
2.0273418547326992e-06,
1.7602359860195857e-06,
0.0,
2.013739831250115e-21,
4.909861220321753e-20,
0.0,
4.665200046136569e-20,
-1.9566383001493946e-21,
-96560.09354570496,
0.2335572995463288,
-100288.67701814357,
0.23591263994887818,
-100288.677678112,
0.23591264036701443,
-96560.0816929563,
0.23355729206770598,
-873947.8864856226,
1.2100313452817673,
-873947.8863858595,
1.2100313445985562,
-4706.906282326286,
0.006583785685946545,
-4721.89741006748,
0.006593168289865688,
-4721.897404439745,
0.006593168286323642,
-4706.906483656017,
0.006583785812787189,
-720.6545512340357,
-720.3217292925623,
0.0009985764249686698,
0.0009983591472543481,
-722.1508419312411,
-722.0421232665894,
0.0010001323660439989,
0.00100005352811943,
-8642.043554742524,
0.012681407602717975,
-8642.043293601184,
0.012681407438297841,
-8909.49862797875,
0.012849959429845414,
1389.0998959067165,
0.006354964303801297,
-722.1508452424541,
-722.0421258113258,
0.0010001323686673997,
0.001000053530255132,
-720.6545510297586,
-720.3217293326904,
0.0009985764248405691,
0.0009983591472800236,
-8909.498764806547,
0.012849959516004638,
-2357.35674156337,
0.0032660606424093387,
-2355.921025330427,
0.0032637130423187337,
-2355.921027270413,
0.0032637130430599385,
-2357.3567413654787,
0.003266060640560602
]
},
{
"requestedTime": 0.8,
"values": [
-860175.1606710927,
1.1970987817186032,
-860175.1609442824,
1.1970987819042118,
-873416.0554547055,
1.206445289457375,
-873416.0554726648,
1.2064452895529436,
-1.949198776856065e-06,
1.826519161772371e-06,
1.9528536810215616e-06,
-1.971406163647771e-06,
1.848554964674094e-06,
1.930697446050263e-06,
-1.9711186178028582e-06,
1.8485549941949607e-06,
1.930697416668372e-06,
-1.94919528439641e-06,
1.826519181824015e-06,
1.9528536610522474e-06,
8.892500282325972,
2.5187368473853223e-21,
4.909861220321753e-20,
-16.252500528926326,
4.576919129896975e-20,
-1.9530653259948938e-21,
-104471.75361732666,
0.23818832921650948,
-107803.92242364622,
0.24029497741554184,
-107803.92309836508,
0.2402949778374652,
-104471.7429655161,
0.2381883224928943,
-873404.5104492744,
1.2063684021036665,
-873404.5104388825,
1.2063684020307441,
-4704.300638717692,
0.006574703133691949,
-4693.326778314112,
0.006567696268767441,
-4693.326526389924,
0.006567696110012524,
-4704.3007263131885,
0.006574703188787359,
-721.1607141734798,
-720.9310979144485,
0.0009965662267659527,
0.0009964191642398892,
-721.9230383692676,
-721.8772183273541,
0.0009972429132872915,
0.0009972108290529252,
-8703.980749781746,
0.012705472199729761,
-8703.980555484635,
0.01270547207717158,
-8967.989302068207,
0.012872002894864527,
1377.5687495145785,
0.006346840211910472,
-721.9230326537768,
-721.8772199435517,
0.0009972429097436842,
0.0009972108301285444,
-721.1607123097651,
-720.9310970023907,
0.000996566225592321,
0.0009964191636655784,
-8967.989425383095,
0.0128720029723915,
-2356.03147928222,
0.0032562562535671563,
-2356.668143012874,
0.0032561870649935125,
-2356.668143725967,
0.0032561870653915977,
-2356.031477688963,
0.0032562562523787346
]
},
{
"requestedTime": 1.0,
"values": [
-821832.18723991,
1.0200651174775017,
-821832.18747001,
1.0200651176202795,
-867004.8037748901,
1.1678210257789237,
-867004.8037842558,
1.1678210258114112,
5.337506036671112,
1.4692397997585764,
0.1599133361094105,
5.337515379170655,
1.4692397472726986,
0.1599133103986336,
5.337515143153142,
1.4692397472727232,
0.15991331039860968,
5.337506972429692,
1.4692397997585922,
0.15991333610939415,
5.337478209825592,
1.4692396558157577,
0.1599111725256627,
-9.54931997607691,
-2.6696065452676345,
-0.2915209059087121,
-265725.0471201981,
0.37065108819994863,
-274733.0912934626,
0.38314931696882704,
-274733.09196309303,
0.38314931740574626,
-265725.0371165716,
0.3706510817652048,
-865080.8367860075,
1.1575072978479832,
-865080.836781886,
1.157507297823738,
-3796.0300072134555,
0.004795940055001584,
-3536.527034352294,
0.004541242546837507,
-3536.5270264260203,
0.004541242541783211,
-3796.030006397544,
0.004795940054530253,
-669.6911044196434,
-669.5192067053738,
0.000896344956139504,
0.0008958075886883069,
-706.3131229180824,
-705.7453980192186,
0.0009508631922671181,
0.0009500270072581424,
-7576.544518407595,
0.009496349448619141,
-7576.544516641329,
0.009496349447543061,
-8495.442747354022,
0.010545461510647114,
-396.7407438874708,
0.004826437204332604,
-706.3131229284975,
-705.7453980286242,
0.0009508631922926857,
0.0009500270072830445,
-669.6911041651043,
-669.5192060345452,
0.0008963449559782043,
0.0008958075882644087,
-8495.442745022583,
0.010545461509227754,
-2334.4069259408425,
0.003123729270270666,
-2231.2112738065657,
0.002986126319734133,
-2231.211273855305,
0.0029861263197482296,
-2334.4069257629353,
0.0031237292700972397
]
},
{
"requestedTime": 2.0,
"values": [
-772286.4682624673,
0.9179360053806332,
-772286.4692545742,
0.9179360060143595,
-803031.5764482999,
0.9390697516259071,
-803031.5764679932,
0.9390697516680178,
-5.5966665968298915e-09,
6.713197714589101e-08,
0.3700023585738787,
-4.6964269131422045e-08,
8.296314048540649e-08,
0.3700023428086111,
-2.4841283448040484e-08,
8.29631490450475e-08,
0.37000234280860256,
4.3330946937203405e-08,
6.713198290867542e-08,
0.3700023585738729,
0.0,
-1.1654046974175209e-19,
0.37,
0.0,
-3.1507290824741586e-13,
-0.72,
-437317.9315829484,
0.6466111001653223,
-453928.6983570724,
0.6571847803274807,
-453928.69829577766,
0.6571847802863814,
-437317.92241094704,
0.6466110943182897,
-802960.6941217952,
0.9388828023997754,
-802960.694111656,
0.938882802373437,
-4284.7599403173035,
0.005077450257846326,
-4343.976212113444,
0.005115234066714636,
-4343.976212068701,
0.0051152340666703175,
-4284.7599132929745,
0.005077450240619749,
-662.1434159057197,
-661.7970678665274,
0.0007748418062540021,
0.0007746177710019782,
-663.5584177841083,
-663.4278440347166,
0.000776034735673773,
0.0007759468226959079,
-8120.656733496484,
0.009869069686396056,
-8120.656590103802,
0.009869069595030996,
-8328.371203371178,
0.010001111074316178,
-1647.6116574692712,
0.005744784430325623,
-663.5584178697704,
-663.4278441405601,
0.0007760347357471679,
0.000775946822781371,
-662.1434159537747,
-661.7970678998525,
0.0007748418062849091,
0.0007746177710225603,
-8328.371132243179,
0.010001111028980096,
-2168.153541946679,
0.002535378014133708,
-2164.6176191131335,
0.002532440207666662,
-2164.6176190758297,
0.002532440207628468,
-2168.153486402468,
0.0025353779787030337
]
},
{
"requestedTime": 2.05,
"values": [
-772640.2579114933,
0.9189711020154747,
-772640.2589106868,
0.9189711026533357,
-802668.8163858769,
0.9381125189656889,
-802668.8163913072,
0.9381125189701648,
-1.1839671060442924e-07,
6.848947280509e-08,
0.37000236198352005,
-9.816722013056278e-08,
8.350267455159574e-08,
0.3700023469893441,
-9.857350960373879e-08,
8.350268244045684e-08,
0.3700023469893362,
-9.438255801796913e-08,
6.84894782408154e-08,
0.3700023619835146,
0.0,
-1.1644108142482222e-19,
0.37,
0.0,
-3.150728667970711e-13,
-0.72,
-436877.0913448419,
0.6470168220031571,
-453182.789784899,
0.6574025955544724,
-453182.78972087207,
0.6574025955125712,
-436877.08234619617,
0.6470168162690852,
-802668.9179584626,
0.9381130502939634,
-802668.9179569854,
0.93811305029142,
-4285.669856693608,
0.0050823610773067076,
-4354.119008990314,
0.005125983105252238,
-4354.11901311425,
0.005125983107881825,
-4285.669816785954,
0.00508236105187094,
-662.3977781264183,
-662.0512100662392,
0.0007748078072798002,
0.0007745870872944216,
-663.4643136874881,
-663.3368456649802,
0.0007754873920209047,
0.0007754062014915902,
-8144.606717144718,
0.009892956807728209,
-8144.606576808627,
0.009892956718340342,
-8356.938599998502,
0.010028108806575306,
-1651.8254437402938,
0.005756202827816742,
-663.4643140644157,
-663.336846204431,
0.0007754873922663931,
0.000775406201901327,
-662.3977787097264,
-662.0512095396308,
0.0007748078076617882,
0.0007745870869169965,
-8356.938530080884,
0.010028108762001683,
-2167.3598235897343,
0.002533287559515925,
-2164.9943210453084,
0.002531780415394501,
-2164.9943209833646,
0.002531780415326603,
-2167.3597687183774,
0.0025332875249184767
]
},
{
"requestedTime": 2.1,
"values": [
-772729.849215003,
0.919232833810773,
-772729.8502213629,
0.9192328344649761,
-802748.5417139007,
0.9383229687007891,
-802748.5416937041,
0.938322968645941,
-1.5475961845368147e-07,
6.633051283469949e-08,
0.3700023653554917,
-1.6945006791502238e-07,
8.0606090679709e-08,
0.3700023510933796,
-1.6974110621958972e-07,
8.060609824063203e-08,
0.3700023510933721,
-1.5545636415481566e-07,
6.633051807899984e-08,
0.37000236535548653,
0.0,
-1.164558438137342e-19,
0.37,
0.0,
-3.1507286064810157e-13,
-0.72,
-436285.01209659013,
0.646815227151306,
-452333.92653835827,
0.6570381274463638,
-452333.9264734677,
0.6570381273931875,
-436285.00323808845,
0.6468152214977394,
-802747.7609731702,
0.9383213576466783,
-802747.7609716613,
0.9383213576459569,
-4169.822958852925,
0.005009690287404794,
-4279.837336800422,
0.005079777604819243,
-4279.83737473691,
0.0050797776289221675,
-4169.822929680966,
0.005009690268749923,
-662.0363168630721,
-658.7502160682232,
0.0007747218486607169,
0.0007726291344808584,
-662.5313787250212,
-655.702207731343,
0.0007750276677438138,
0.0007706784944489166,
-8148.173203124546,
0.00989744668242247,
-8148.173078272971,
0.009897446602767727,
-8360.714796856231,
0.010032755342377334,
-1652.8900562718827,
0.005759128268286419,
-662.5313698561031,
-655.7022069331298,
0.000775027662068701,
0.0007706784939136677,
-662.0363583491554,
-658.7501715937773,
0.0007747218750818736,
0.0007726291061561864,
-8360.714717131163,
0.010032755291451692,
-2167.569222453132,
0.002533854003606723,
-2165.094351906718,
0.0025322965276950117,
-2165.0943434975566,
0.0025322965223399637,
-2167.569167946825,
0.002533853968955365
]
}
],
"outputContract": {
"sha256": "5ed1efeba81d0f0a47bd1e0513f5503fc507cac8ae8c08f96602f10c1266eb86"
}
}
@@ -1,7 +1,7 @@
{
"schemaVersion": 1,
"id": "test_mql_full_branches-historical-v1",
"description": "Historical slow-region and 2.05 s regression target for the generic solver.",
"description": "Historical slow-region and 2.05 s production regression target with three locked-environment repeats and approved state goldens.",
"source": {
"path": "tests/data/test_mql-full-branches-01-04.xml",
"sha256": "2fb95e65f5de0c85a6a17802aef74ea004087323fd00fd8d01acf0184ff71d48",
@@ -60,7 +60,7 @@
0.0,
0.04,
0.69,
0.70,
0.7,
0.8,
0.81
],
@@ -68,7 +68,13 @@
0.04,
0.8
],
"expectedMechanicalTransitionTimes": []
"expectedMechanicalTransitionTimes": [],
"goldens": {
"production": {
"path": "tests/baselines/simulation/test_mql_full_branches/goldens/production-0.81s-v1.json",
"sha256": "72c4ccf995c7904f80598934bf59fe88cff2f9b85e003396befc4ae3f37a4e53"
}
}
},
"2.10s": {
"stopTime": 2.1,
@@ -78,7 +84,7 @@
0.0,
0.04,
0.69,
0.70,
0.7,
0.8,
1.0,
2.0,
@@ -88,19 +94,35 @@
"expectedSignalEventTimes": [
0.04,
0.8
]
],
"expectedMechanicalTransitionTimes": [
1.1199696877773673,
1.1331667954945566,
1.2023983086085228
],
"goldens": {
"production": {
"path": "tests/baselines/simulation/test_mql_full_branches/goldens/production-2.10s-v1.json",
"sha256": "5fced8349404c9dd1f6284b76af3f1e24ed0933df76fb4b5d2a419b719f64d4c"
}
}
}
},
"correctness": {
"status": "partial",
"maximumScaledResidual": 1e-7,
"status": "complete",
"maximumScaledResidual": 1e-07,
"requireFiniteSeries": true,
"requireStrictlyIncreasingTimes": true,
"stateRelativeTolerance": 0.0002,
"eventTimeAbsoluteToleranceSeconds": 0.00002,
"eventTimeAbsoluteToleranceSeconds": 2e-05,
"signalEventTimeAbsoluteToleranceSeconds": 1e-12,
"mechanicalTransitionTimesAvailable": true,
"note": "Historical checkpoints are recorded; approved physical-state-v2 golden values remain pending."
"note": "OPT-00 production 0.81/2.10 s state, event, output-shape, finite-series, residual, audit, and no-fallback contracts are approved and replayed exactly across three locked-environment runs.",
"physicalProjectionCategories": [
"state"
],
"stateAbsoluteTolerance": 1e-09,
"checkpointTimeAbsoluteToleranceSeconds": 1e-12
},
"execution": {
"causalExecutorV2Default": true,
@@ -116,5 +138,33 @@
"deferAfterFailureOrTimeout": true,
"deferWhenPredictedWallExceedsSoftTimeout": true,
"longTestEnvironmentVariable": "RUN_TEST_MQL_FULL_BRANCHES_LONG_REGRESSION"
},
"acceptanceEvidence": {
"status": "approved",
"lane": "production",
"repeatCount": 3,
"physicalValuesIdenticalAcrossRepeats": true,
"reports": [
{
"path": "tests/baselines/simulation/test_mql_full_branches/runs/2026-08-18-opt00-historical-repeat-1.json",
"sha256": "4659ae850eef4f1541b3172f783b01a1859744a3f0a50030e094c2c25f93e195",
"bytes": 314699
},
{
"path": "tests/baselines/simulation/test_mql_full_branches/runs/2026-08-18-opt00-historical-repeat-2.json",
"sha256": "99892d0aca554baca7f72ae00412337f6815f62cb7a4349dfe3006db66b4549f",
"bytes": 315044
},
{
"path": "tests/baselines/simulation/test_mql_full_branches/runs/2026-08-18-opt00-historical-repeat-3.json",
"sha256": "569bf7e576bd56f956f2125921680a570ee16f445f5d3d7cbff16a4f4cc12f85",
"bytes": 315606
}
],
"workerWallSeconds2p10": {
"minimum": 113.49742291588336,
"median": 114.07500359974802,
"maximum": 115.86820452474058
}
}
}
+4 -4
View File
@@ -10196,9 +10196,9 @@
],
"simulation": {
"t_start": 0,
"t_stop": 5,
"step": 0.005,
"max_step": 0.005,
"t_stop": 10,
"step": 0.01,
"max_step": 0.001,
"method": "BDF"
}
}
}
+2 -2
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<System name="test-mql-8" schemaVersion="3" unitSystem="SI">
<Simulation tStart="0" tStop="5" sampleStep="0.005" maxStep="0.005" method="BDF"/>
<Simulation tStart="0" tStop="10" sampleStep="0.01" maxStep="0.001" method="BDF"/>
<Components>
<Component id="pn_gas_data" type="amesim_helium_medium" modelVersion="0.1.0">
<Parameter name="gi" value="1"/>
@@ -2075,4 +2075,4 @@
<Endpoint component="amesim_p4node2_6" port="port_2"/>
</Connection>
</Connections>
</System>
</System>
+240 -6
View File
@@ -26,6 +26,13 @@ from app.simulation.benchmark_regression import (
)
PHYSICAL_STATE_V21_REPORT = (
DEFAULT_MANIFEST_PATH.parent
/ "runs"
/ "2026-08-18-production-physical-state-v2.1-0.2.json"
)
def _completed_result(request: RegressionCaseRequest, *, wall_seconds: float = 0.01):
signal_times = (
[0.04, 0.8]
@@ -125,16 +132,24 @@ class RegressionManifestTests(unittest.TestCase):
self.assertTrue(manifest["source"]["xmlIsAuthoritative"])
self.assertEqual(
manifest["source"]["sha256"],
"6eb2753a15af66fd8e91c169c4587e66b0ace2164c08c2cb23a67aab5fd09164",
"0a2d9331df9eb5974daec25a61c1238ba32b1742d933ffc8b16ce316c5627b0b",
)
self.assertEqual(Path(manifest["_sourcePath"]).name, "test-mql-8.xml")
self.assertEqual(
manifest["source"]["companionProject"]["sha256"],
"8d7a263691a9f09f39c92aba19ae1350911dc66b4904e98bae5f20592c5a3fcd",
"b44bf540ccd1c293fe2af2b9b9052b540abf83961ad955a0f6a4ab40fbe0bb18",
)
self.assertFalse(
manifest["source"]["companionProject"]["executionInput"]
)
self.assertEqual(
manifest["source"]["referenceArchive"]["role"],
"authoritativePhysicalBaseline",
)
self.assertEqual(
Path(manifest["_referenceArchivePath"]).name,
"test_mql.ame",
)
self.assertEqual(manifest["historicalReports"][0]["status"], "historicalOnly")
self.assertFalse(
manifest["historicalReports"][0]["compatibleWithCurrentSource"]
@@ -146,6 +161,86 @@ class RegressionManifestTests(unittest.TestCase):
self.assertFalse(
manifest["historicalReports"][2]["compatibleWithCurrentSource"]
)
physical_state_golden = manifest["_physicalStateV21Goldens"]["0.2s"][
"production"
]
self.assertEqual(physical_state_golden["approval"]["status"], "approved")
self.assertEqual(
physical_state_golden["_sha256"],
"6f0752afe8c1f7690599c2709a76d9a1342f99f726c6c8593321dc6267e175b2",
)
self.assertTrue(
physical_state_golden["amesimAlignmentAtGeneration"]["passed"]
)
self.assertEqual(
manifest["correctness"]["physicalBaselineAuthority"], "amesim"
)
self.assertTrue(manifest["correctness"]["compareAmesimOnEveryRun"])
self.assertEqual(
manifest["correctness"]["pythonGoldenRole"],
"determinismDiagnosticOnly",
)
self.assertEqual(
manifest["variants"]["0.2s"]["goldens"]["production"]["role"],
"pythonDeterminismRegression",
)
self.assertEqual(
manifest["variants"]["0.2s"]["physicalStateV21Goldens"][
"production"
]["role"],
"amesimPhysicalBaseline",
)
def test_manifest_rejects_physical_state_v21_golden_hash_mismatch(self) -> None:
manifest = json.loads(DEFAULT_MANIFEST_PATH.read_text(encoding="utf-8"))
manifest["variants"]["0.2s"]["physicalStateV21Goldens"]["production"][
"sha256"
] = "0" * 64
with tempfile.TemporaryDirectory(
dir=DEFAULT_MANIFEST_PATH.parents[4], prefix=".v21-manifest-test-"
) as temporary_directory:
manifest_path = Path(temporary_directory) / "manifest.json"
manifest_path.write_text(json.dumps(manifest), encoding="utf-8")
with self.assertRaisesRegex(
RegressionManifestError,
"physical-state-v2.1 golden hash mismatch",
):
load_regression_manifest(manifest_path)
def test_manifest_rejects_amesim_archive_hash_mismatch(self) -> None:
manifest = json.loads(DEFAULT_MANIFEST_PATH.read_text(encoding="utf-8"))
manifest["source"]["referenceArchive"]["sha256"] = "0" * 64
with tempfile.TemporaryDirectory(
dir=DEFAULT_MANIFEST_PATH.parents[4], prefix=".amesim-manifest-test-"
) as temporary_directory:
manifest_path = Path(temporary_directory) / "manifest.json"
manifest_path.write_text(json.dumps(manifest), encoding="utf-8")
with self.assertRaisesRegex(
RegressionManifestError,
"AMESim reference archive hash mismatch",
):
load_regression_manifest(manifest_path)
def test_manifest_rejects_amesim_golden_provenance_mismatch(self) -> None:
loaded = load_regression_manifest(DEFAULT_MANIFEST_PATH)
golden = json.loads(
json.dumps(loaded["_physicalStateV21Goldens"]["0.2s"]["production"])
)
golden["provenance"]["amesim"]["archiveSha256"] = "0" * 64
manifest = json.loads(DEFAULT_MANIFEST_PATH.read_text(encoding="utf-8"))
with tempfile.TemporaryDirectory(
dir=DEFAULT_MANIFEST_PATH.parents[4], prefix=".amesim-provenance-test-"
) as temporary_directory:
manifest_path = Path(temporary_directory) / "manifest.json"
manifest_path.write_text(json.dumps(manifest), encoding="utf-8")
with patch(
"app.simulation.benchmark_regression.load_physical_state_v21_golden",
return_value=golden,
), self.assertRaisesRegex(
RegressionManifestError,
"AMESim baseline provenance",
):
load_regression_manifest(manifest_path)
def test_in_memory_derivative_does_not_change_authoritative_xml(self) -> None:
manifest = load_regression_manifest(DEFAULT_MANIFEST_PATH)
@@ -159,9 +254,9 @@ class RegressionManifestTests(unittest.TestCase):
max_step=0.005,
)
self.assertEqual(source_simulation_config(before)["tStop"], 5.0)
self.assertEqual(source_simulation_config(before)["sampleStep"], 0.005)
self.assertEqual(source_simulation_config(before)["maxStep"], 0.005)
self.assertEqual(source_simulation_config(before)["tStop"], 10.0)
self.assertEqual(source_simulation_config(before)["sampleStep"], 0.01)
self.assertEqual(source_simulation_config(before)["maxStep"], 0.001)
self.assertEqual(source_simulation_config(derived)["tStop"], 1.0)
self.assertEqual(source_simulation_config(derived)["sampleStep"], 0.02)
self.assertEqual(source_simulation_config(derived)["maxStep"], 0.005)
@@ -399,6 +494,145 @@ class BoundedChildProcessTests(unittest.TestCase):
class ProgressiveSuiteTests(unittest.TestCase):
@staticmethod
def _physical_state_v21_result_executor():
source_report = json.loads(
PHYSICAL_STATE_V21_REPORT.read_text(encoding="utf-8")
)
results = {case["caseId"]: case for case in source_report["cases"]}
def execute(request: RegressionCaseRequest) -> dict[str, object]:
return json.loads(json.dumps(results[request.case_id]))
return execute
def test_production_report_replays_through_active_v21_acceptance(self) -> None:
report = run_regression_suite(
DEFAULT_MANIFEST_PATH,
lane="production",
case_ids=["0.2s"],
case_executor=self._physical_state_v21_result_executor(),
)
case = report["cases"][1]
evaluation = case["acceptance"]["physicalStateV21Golden"]
self.assertEqual(case["outcome"], "completed")
self.assertTrue(case["acceptance"]["passed"])
self.assertTrue(evaluation["configured"])
self.assertTrue(evaluation["evaluated"])
self.assertTrue(evaluation["passed"])
self.assertEqual(evaluation["baselineAuthority"], "amesim")
self.assertEqual(evaluation["metricCount"], 33)
self.assertEqual(evaluation["availableBaselineValueCount"], 27)
self.assertEqual(evaluation["unavailableBaselineValueCount"], 6)
self.assertEqual(evaluation["comparedValueCount"], 25)
self.assertEqual(evaluation["excludedValueCount"], 2)
self.assertAlmostEqual(
evaluation["maxToleranceRatio"], 0.6967416724836332
)
self.assertAlmostEqual(
evaluation["worstValue"]["relativeError"],
0.0013934852135053246,
)
self.assertTrue(
all(
"actual" in metric and "amesimBaseline" in metric
for metric in evaluation["metrics"]
)
)
self.assertEqual(evaluation["issues"], [])
self.assertTrue(evaluation["amesimAlignmentAtGenerationPassed"])
regression = case["acceptance"]["regressionGolden"]
self.assertEqual(regression["role"], "determinismDiagnosticOnly")
self.assertFalse(regression["affectsPhysicalCorrectness"])
def test_v21_conservation_drift_fails_runner_acceptance(self) -> None:
execute_source = self._physical_state_v21_result_executor()
def drifted(request: RegressionCaseRequest) -> dict[str, object]:
result = execute_source(request)
if request.case_id == "0.2s":
result["worker"]["summary"]["physicalStateV21"]["checkpoints"][-1][
"values"
]["conservation.p4node2_8.massBalance"] = 2.0e-9
return result
report = run_regression_suite(
DEFAULT_MANIFEST_PATH,
lane="production",
case_ids=["0.2s"],
case_executor=drifted,
)
case = report["cases"][1]
evaluation = case["acceptance"]["physicalStateV21Golden"]
self.assertEqual(case["outcome"], "correctness_failed")
self.assertFalse(case["acceptance"]["passed"])
self.assertIn(
"physicalStateV21LocalInvariantMismatch",
case["acceptance"]["issues"],
)
self.assertFalse(evaluation["passed"])
self.assertEqual(
evaluation["localInvariants"]["worstValue"]["key"],
"conservation.p4node2_8.massBalance",
)
def test_python_state_drift_is_diagnostic_when_amesim_gate_passes(self) -> None:
execute_source = self._physical_state_v21_result_executor()
def drifted(request: RegressionCaseRequest) -> dict[str, object]:
result = execute_source(request)
if request.case_id == "0.2s":
values = result["worker"]["summary"]["physicalContract"][
"checkpoints"
][-1]["stateValues"]
first_key = next(iter(values))
values[first_key] += 1.0
return result
report = run_regression_suite(
DEFAULT_MANIFEST_PATH,
lane="production",
case_ids=["0.2s"],
case_executor=drifted,
)
case = report["cases"][1]
diagnostic = case["acceptance"]["regressionGolden"]
self.assertEqual(case["outcome"], "completed")
self.assertTrue(case["acceptance"]["passed"])
self.assertFalse(diagnostic["passed"])
self.assertIn("stateCheckpointGoldenValueMismatch", diagnostic["issues"])
self.assertEqual(diagnostic["acceptanceIssues"], [])
self.assertTrue(case["acceptance"]["physicalStateV21Golden"]["passed"])
def test_amesim_baseline_drift_is_the_physical_acceptance_gate(self) -> None:
execute_source = self._physical_state_v21_result_executor()
def drifted(request: RegressionCaseRequest) -> dict[str, object]:
result = execute_source(request)
if request.case_id == "0.2s":
result["worker"]["summary"]["physicalStateV21"]["checkpoints"][-1][
"values"
]["pressure.pnch012_8.absolute"] += 1.0e6
return result
report = run_regression_suite(
DEFAULT_MANIFEST_PATH,
lane="production",
case_ids=["0.2s"],
case_executor=drifted,
)
case = report["cases"][1]
evaluation = case["acceptance"]["physicalStateV21Golden"]
self.assertEqual(case["outcome"], "correctness_failed")
self.assertFalse(case["acceptance"]["passed"])
self.assertIn("amesimReferenceToleranceMismatch", case["acceptance"]["issues"])
self.assertFalse(evaluation["passed"])
self.assertEqual(evaluation["worstValue"]["amesimBaseline"], 3625053.2009413484)
def test_requesting_late_case_also_runs_every_predecessor(self) -> None:
calls: list[str] = []
@@ -585,7 +819,7 @@ class ProgressiveSuiteTests(unittest.TestCase):
self.assertEqual(
seen,
[("solver-only", 0.02, 0.05), ("production", 0.005, 0.005)],
[("solver-only", 0.02, 0.05), ("production", 0.01, 0.001)],
)
+98 -3
View File
@@ -2,6 +2,7 @@ from __future__ import annotations
from importlib import metadata
import os
import platform
from pathlib import Path
import re
import sys
@@ -13,6 +14,11 @@ REQUIREMENTS_PATH = REPOSITORY_ROOT / "requirements.txt"
CONSTRAINTS_PATH = (
REPOSITORY_ROOT / "constraints" / "python312-direct.txt"
)
RELEASE_LOCK_PATH = (
REPOSITORY_ROOT
/ "constraints"
/ "python312-linux-x86_64.lock"
)
PYTHON_VERSION_PATH = REPOSITORY_ROOT / ".python-version"
VERIFY_ENVIRONMENT_VARIABLE = "SYSTEM_SIMULATION_VERIFY_LOCKED_ENV"
@@ -24,6 +30,37 @@ REFERENCE_DIRECT_VERSIONS = {
"scipy": "1.18.0",
"uvicorn": "0.52.3",
}
REFERENCE_LOCKED_VERSIONS = {
"annotated-doc": "0.0.5",
"annotated-types": "0.8.0",
"anyio": "4.14.2",
"click": "8.4.2",
"fastapi": "0.141.1",
"h11": "0.16.0",
"httptools": "0.8.0",
"idna": "3.18",
"lxml": "6.1.1",
"numpy": "2.5.2",
"pydantic": "2.13.4",
"pydantic-core": "2.46.4",
"python-dotenv": "1.2.3",
"pyyaml": "6.0.3",
"scipy": "1.18.0",
"starlette": "1.6.0",
"typing-extensions": "4.16.0",
"typing-inspection": "0.4.4",
"uvicorn": "0.52.3",
"uvloop": "0.22.1",
"watchfiles": "1.2.0",
"websockets": "17.0.1",
}
LOCK_REQUIREMENT_PATTERN = re.compile(
r"(?P<name>[A-Za-z0-9_.-]+)"
r"(?:\[(?P<extras>[A-Za-z0-9_,.-]+)\])?"
r"==(?P<version>[^\s;]+)\s+"
r"--hash=sha256:(?P<digest>[0-9a-f]{64})\Z"
)
def _active_lines(path: Path) -> tuple[str, ...]:
@@ -57,6 +94,33 @@ def _constraint_versions() -> dict[str, str]:
return result
def _release_lock_options() -> tuple[str, ...]:
return tuple(
line
for line in _active_lines(RELEASE_LOCK_PATH)
if line.startswith("--")
)
def _release_lock_entries() -> dict[str, tuple[str, str, str | None]]:
result: dict[str, tuple[str, str, str | None]] = {}
for line in _active_lines(RELEASE_LOCK_PATH):
if line.startswith("--"):
continue
match = LOCK_REQUIREMENT_PATTERN.fullmatch(line)
if match is None:
raise AssertionError(f"Invalid release-lock entry: {line!r}")
normalized = _normalized_name(match.group("name"))
if normalized in result:
raise AssertionError(f"Duplicate release-lock entry: {normalized}")
result[normalized] = (
match.group("version"),
match.group("digest"),
match.group("extras"),
)
return result
class DependencyConstraintContractTests(unittest.TestCase):
def test_python_reference_version_is_explicit(self) -> None:
self.assertEqual(
@@ -87,18 +151,49 @@ class DependencyConstraintContractTests(unittest.TestCase):
}.isdisjoint(_constraint_versions())
)
def test_linux_release_lock_pins_and_hashes_complete_environment(
self,
) -> None:
self.assertEqual(
_release_lock_options(),
("--only-binary=:all:", "--require-hashes"),
)
entries = _release_lock_entries()
self.assertEqual(
{name: entry[0] for name, entry in entries.items()},
REFERENCE_LOCKED_VERSIONS,
)
self.assertTrue(all(len(entry[1]) == 64 for entry in entries.values()))
self.assertEqual(entries["uvicorn"][2], "standard")
self.assertTrue(
all(
entry[2] is None
for name, entry in entries.items()
if name != "uvicorn"
)
)
self.assertEqual(
{
name: REFERENCE_LOCKED_VERSIONS[name]
for name in REFERENCE_DIRECT_VERSIONS
},
REFERENCE_DIRECT_VERSIONS,
)
@unittest.skipUnless(
os.getenv(VERIFY_ENVIRONMENT_VARIABLE, "").strip().lower()
in {"1", "true", "yes", "on"},
f"Set {VERIFY_ENVIRONMENT_VARIABLE}=1 to verify installed versions.",
)
def test_installed_environment_matches_reference_constraints(self) -> None:
def test_installed_environment_matches_linux_release_lock(self) -> None:
self.assertEqual(sys.version_info[:3], (3, 12, 3))
self.assertEqual(sys.platform, "linux")
self.assertEqual(platform.machine().lower(), "x86_64")
installed = {
name: metadata.version(name)
for name in REFERENCE_DIRECT_VERSIONS
for name in REFERENCE_LOCKED_VERSIONS
}
self.assertEqual(installed, REFERENCE_DIRECT_VERSIONS)
self.assertEqual(installed, REFERENCE_LOCKED_VERSIONS)
if __name__ == "__main__":
+64 -1
View File
@@ -1,12 +1,14 @@
from __future__ import annotations
import hashlib
import json
import os
from pathlib import Path
import unittest
from app.main import compile_system_xml_network
from app.simulation.benchmark_regression import (
evaluate_regression_golden,
load_regression_manifest,
run_regression_suite,
source_simulation_config,
@@ -85,6 +87,60 @@ class MqlFullBranchesStaticRegressionTests(unittest.TestCase):
expected["hasMechanicalStateEvents"],
)
def test_three_production_repeats_replay_approved_goldens_exactly(self) -> None:
repository_root = Path(self.manifest["_repositoryRoot"])
evidence = self.manifest["acceptanceEvidence"]
self.assertEqual(evidence["status"], "approved")
self.assertEqual(evidence["lane"], "production")
self.assertEqual(evidence["repeatCount"], 3)
self.assertTrue(evidence["physicalValuesIdenticalAcrossRepeats"])
expected_counts = {"0.81s": 480, "2.10s": 720}
stable_signatures: dict[str, object] = {}
for report_reference in evidence["reports"]:
report_path = repository_root / report_reference["path"]
payload = report_path.read_bytes()
self.assertEqual(len(payload), report_reference["bytes"])
self.assertEqual(
hashlib.sha256(payload).hexdigest(),
report_reference["sha256"],
)
report = json.loads(payload)
self.assertEqual(report["lane"], "production")
self.assertEqual(
report["source"]["sha256"], self.manifest["source"]["sha256"]
)
for case_id in self.manifest["sequence"]:
case = next(
item for item in report["cases"] if item["caseId"] == case_id
)
self.assertEqual(case["outcome"], "completed")
self.assertTrue(case["acceptance"]["passed"])
summary = case["worker"]["summary"]
golden = self.manifest["_goldens"][case_id]["production"]
audit = evaluate_regression_golden(summary, golden)
self.assertTrue(audit["passed"], audit)
self.assertEqual(
audit["comparedValueCount"], expected_counts[case_id]
)
self.assertEqual(audit["maxAbsoluteError"], 0.0)
self.assertEqual(audit["maxToleranceRatio"], 0.0)
self.assertEqual(audit["issues"], [])
diagnostics = dict(summary["diagnostics"])
diagnostics.pop("performance", None)
signature = {
"physicalContract": summary["physicalContract"],
"eventTrace": summary["eventTrace"],
"outputContract": summary["outputContract"],
"diagnosticsWithoutPerformance": diagnostics,
}
if case_id not in stable_signatures:
stable_signatures[case_id] = signature
else:
self.assertEqual(stable_signatures[case_id], signature)
def test_both_horizons_have_the_expected_signal_schedule(self) -> None:
assert self.validation.document is not None
system = GenericFluidSystem(
@@ -105,9 +161,16 @@ class MqlFullBranchesStaticRegressionTests(unittest.TestCase):
)
class MqlFullBranchesLongRegressionTests(unittest.TestCase):
def test_both_horizons_complete_within_their_safety_budgets(self) -> None:
report = run_regression_suite(MANIFEST_PATH, lane="solver-only")
report = run_regression_suite(MANIFEST_PATH, lane="production")
outcomes = [case["outcome"] for case in report["cases"]]
self.assertEqual(outcomes, ["completed", "completed"], report["cases"])
self.assertTrue(
all(
case["acceptance"]["regressionGolden"]["passed"]
for case in report["cases"]
),
report["cases"],
)
if __name__ == "__main__":
+487
View File
@@ -0,0 +1,487 @@
from __future__ import annotations
import copy
import hashlib
import json
from pathlib import Path
import tempfile
import unittest
from unittest.mock import patch
from app.simulation.benchmark_regression import summarize_simulation_result
from app.simulation.physical_state_v21 import (
PHYSICAL_STATE_V21_ID,
PhysicalStateV21Error,
approve_candidate_golden,
assess_report_against_amesim,
build_amesim_reference,
build_candidate_golden,
compare_contract_to_amesim,
evaluate_physical_state_v21,
load_approved_golden,
project_physical_state_v21,
write_candidate_golden,
)
REPO_ROOT = Path(__file__).resolve().parents[1]
AMESIM_ARCHIVE = REPO_ROOT / "AmesimModels" / "test_mql.ame"
CANDIDATE_REPORT = (
REPO_ROOT
/ "tests/baselines/simulation/test_mql_8/runs"
/ "2026-08-18-production-amesim-aligned-v1-candidate-0.2.json"
)
def _variable(key: str, quantity: str, unit: str, category: str) -> dict[str, str]:
return {"key": key, "quantity": quantity, "unit": unit, "category": category}
def _synthetic_result() -> dict[str, object]:
times = [0.0, 0.04, 0.2]
variables: list[dict[str, str]] = []
series: dict[str, list[float]] = {"time": times}
def add(
key: str,
values: list[float],
quantity: str,
unit: str,
category: str,
) -> None:
variables.append(_variable(key, quantity, unit, category))
series[key] = values
add("amesim_pnch012_8.p", [100_000.0, 200_000.0, 300_000.0], "pressure", "Pa", "thermodynamic")
add("amesim_pnl0001_20.p", [100_000.0, 210_000.0, 310_000.0], "pressure", "Pa", "thermodynamic")
add("amesim_pnl0001_20.port_1.m_flow", [-0.1, -0.2, -0.3], "mass_flow", "kg/s", "port")
add("amesim_pnch012_8.port_1.m_flow", [0.1, 0.2, 0.3], "mass_flow", "kg/s", "port")
add("amesim_pnvo001_5.port_2.m_flow", [-0.2, -0.3, -0.4], "mass_flow", "kg/s", "port")
add("amesim_pnvo001_5.port_3.m_flow", [0.2, 0.3, 0.4], "mass_flow", "kg/s", "port")
for port, values in enumerate(
([0.4, 0.5, 0.6], [-0.1, -0.2, -0.3], [-0.2, -0.2, -0.2], [-0.1, -0.1, -0.1]),
start=1,
):
add(f"amesim_p4node2_8.port_{port}.m_flow", list(values), "mass_flow", "kg/s", "port")
add("amesim_pnvo001_5.xv", [0.0, 1.0, 1.0], "dimensionless", "", "derived")
add("amesim_mecmas21_9.x", [0.0, 0.0, 0.0], "length", "m", "state")
add("amesim_mecmas21_9.v", [0.0, 0.0, 0.0], "velocity", "m/s", "state")
add("amesim_mecmas21_9.port_1.f", [1.0, 1.0, 1.0], "force", "N", "port")
add("amesim_mecmas21_9.port_2.f", [2.0, 2.0, 2.0], "force", "N", "port")
add("amesim_mecmas21_10.x", [0.0, 0.0, 0.0], "length", "m", "state")
add("amesim_mecmas21_10.v", [0.0, 0.0, 0.0], "velocity", "m/s", "state")
add("amesim_mecmas21_10.port_1.f", [-2.0, -2.0, -2.0], "force", "N", "port")
add("amesim_mecmas21_10.port_2.f", [-1.0, -1.0, -1.0], "force", "N", "port")
add("storage_a.m", [1.0, 2.0, 3.0], "mass", "kg", "state")
add("storage_b.m", [4.0, 3.0, 2.0], "mass", "kg", "state")
return {
"success": True,
"status": "completed",
"partial": False,
"simulatedUntil": 0.2,
"requestedStopTime": 0.2,
"variables": variables,
"series": series,
"final": {key: values[-1] for key, values in series.items() if key != "time"},
"diagnostics": {},
}
class PhysicalStateProjectionTests(unittest.TestCase):
def test_projects_all_categories_with_units_and_strict_balances(self) -> None:
contract = project_physical_state_v21(
_synthetic_result(), checkpoint_times=(0.0, 0.04, 0.2), sample_step=0.04
)
self.assertEqual(contract["id"], PHYSICAL_STATE_V21_ID)
self.assertEqual(
contract["projectionCategories"],
["pressure", "massFlow", "conservation", "discreteMode"],
)
self.assertEqual(len(contract["layout"]["projectionKeys"]), 11)
endpoint = contract["checkpoints"][-1]["values"]
self.assertEqual(endpoint["conservation.totalStoredGasMass"], 5.0)
self.assertAlmostEqual(endpoint["conservation.p4node2_8.massBalance"], 0.0)
self.assertAlmostEqual(endpoint["conservation.pnvo001_5.massBalance"], 0.0)
self.assertAlmostEqual(
endpoint["conservation.pnl0001_20_pnch012_8.connectionMassBalance"], 0.0
)
self.assertEqual(endpoint["discrete.pnvo001_5.openMode"], 1.0)
self.assertEqual(endpoint["discrete.mecmas21_9.endstopMode"], 1.0)
self.assertEqual(endpoint["discrete.mecmas21_10.endstopMode"], -1.0)
pressure = contract["layout"]["projections"][0]["amesim"]
self.assertEqual(pressure["offset"], 101_300.0)
flow = contract["layout"]["projections"][2]["amesim"]
self.assertEqual(flow["scale"], -1.0e-3)
def test_fails_closed_on_wrong_source_unit(self) -> None:
result = _synthetic_result()
next(
variable
for variable in result["variables"]
if variable["key"] == "amesim_pnch012_8.p"
)["unit"] = "bar"
with self.assertRaisesRegex(PhysicalStateV21Error, "Unexpected metadata"):
project_physical_state_v21(result, checkpoint_times=(0.2,), sample_step=0.2)
def test_benchmark_summary_attaches_v21_only_to_matching_result(self) -> None:
summary = summarize_simulation_result(
_synthetic_result(), checkpoint_times=(0.0, 0.2), sample_step=0.2
)
self.assertEqual(summary["physicalStateV21"]["id"], PHYSICAL_STATE_V21_ID)
class AmesimReferenceTests(unittest.TestCase):
def test_reference_records_archive_hash_units_signs_and_known_endpoint(self) -> None:
reference = build_amesim_reference(AMESIM_ARCHIVE, checkpoint_times=(0.2,))
values = reference["checkpoints"][0]["values"]
self.assertAlmostEqual(values["pressure.pnch012_8.absolute"], 3_625_053.2009413484)
self.assertAlmostEqual(
values["massFlow.pnl0001_20.port_1.intoComponent"],
-0.3728806429214546,
)
self.assertEqual(values["discrete.mecmas21_9.endstopMode"], 1.0)
self.assertEqual(values["discrete.mecmas21_10.endstopMode"], -1.0)
provenance = reference["provenance"]
self.assertEqual(provenance["archivePath"], "AmesimModels/test_mql.ame")
self.assertEqual(len(provenance["archiveSha256"]), 64)
self.assertEqual(
[member["name"] for member in provenance["members"]],
["test_mql_.var", "test_mql_.results"],
)
def test_current_candidate_endpoint_passes_explicit_amesim_alignment_profile(self) -> None:
assessment = assess_report_against_amesim(
CANDIDATE_REPORT, archive_path=AMESIM_ARCHIVE
)
comparison = assessment["comparison"]
self.assertEqual(assessment["coverage"], "legacyEndpointOnly")
self.assertTrue(comparison["passed"])
self.assertEqual(comparison["comparedValueCount"], 9)
self.assertEqual(comparison["metricCount"], 11)
self.assertEqual(comparison["availableBaselineValueCount"], 9)
self.assertEqual(comparison["unavailableBaselineValueCount"], 2)
self.assertEqual(len(comparison["metrics"]), 11)
self.assertTrue(
all(
{
"requestedTime",
"key",
"category",
"actual",
"amesimBaseline",
"absoluteError",
"relativeError",
"evaluated",
"passed",
}
<= set(metric)
for metric in comparison["metrics"]
)
)
self.assertEqual(
comparison["worstValue"]["key"],
"massFlow.pnl0001_20.port_1.intoComponent",
)
self.assertAlmostEqual(
comparison["worstValue"]["relativeError"],
0.0013934852135053246,
)
self.assertEqual(
comparison["toleranceProfile"]["byCategory"]["discreteMode"]["relative"],
0.0,
)
def test_signal_jump_mass_flows_record_errors_but_are_not_evaluated(self) -> None:
contract = project_physical_state_v21(
_synthetic_result(), checkpoint_times=(0.0, 0.04, 0.2), sample_step=0.04
)
reference_checkpoints = []
for checkpoint in contract["checkpoints"]:
values = dict(checkpoint["values"])
values["conservation.p4node2_8.massBalance"] = None
values[
"conservation.pnl0001_20_pnch012_8.connectionMassBalance"
] = None
if checkpoint["requestedTime"] == 0.04:
values["massFlow.pnl0001_20.port_1.intoComponent"] += 100.0
values["massFlow.pnvo001_5.port_2.intoComponent"] -= 100.0
reference_checkpoints.append(
{"requestedTime": checkpoint["requestedTime"], "values": values}
)
comparison = compare_contract_to_amesim(
contract, {"checkpoints": reference_checkpoints}
)
excluded = [
metric
for metric in comparison["metrics"]
if metric["requestedTime"] == 0.04 and metric["category"] == "massFlow"
]
self.assertTrue(comparison["passed"])
self.assertEqual(comparison["metricCount"], 33)
self.assertEqual(comparison["availableBaselineValueCount"], 27)
self.assertEqual(comparison["unavailableBaselineValueCount"], 6)
self.assertEqual(comparison["comparedValueCount"], 25)
self.assertEqual(comparison["excludedValueCount"], 2)
self.assertEqual(len(comparison["metrics"]), 33)
self.assertEqual(len(excluded), 2)
self.assertTrue(all(metric["evaluated"] is False for metric in excluded))
self.assertTrue(all(metric["passed"] is None for metric in excluded))
self.assertTrue(all(metric["absoluteError"] > 99.0 for metric in excluded))
self.assertTrue(
all("LeftRightLimit" in metric["exclusionReason"] for metric in excluded)
)
self.assertNotIn(comparison["worstValue"], excluded)
unavailable = [
metric
for metric in comparison["metrics"]
if metric["amesimBaseline"] is None
]
self.assertEqual(len(unavailable), 6)
self.assertTrue(all(metric["evaluated"] is False for metric in unavailable))
self.assertTrue(all(metric["absoluteError"] is None for metric in unavailable))
self.assertTrue(all(metric["relativeError"] is None for metric in unavailable))
def test_relative_error_uses_the_amesim_baseline_denominator(self) -> None:
contract = project_physical_state_v21(
_synthetic_result(), checkpoint_times=(0.2,), sample_step=0.2
)
values = dict(contract["checkpoints"][0]["values"])
key = "pressure.pnch012_8.absolute"
values[key] = 0.5 * values[key]
comparison = compare_contract_to_amesim(
contract,
{"checkpoints": [{"requestedTime": 0.2, "values": values}]},
)
metric = next(item for item in comparison["metrics"] if item["key"] == key)
expected = abs(metric["actual"] - metric["amesimBaseline"]) / abs(
metric["amesimBaseline"]
)
self.assertAlmostEqual(metric["relativeError"], expected)
self.assertAlmostEqual(metric["relativeErrorPercent"], 100.0 * expected)
self.assertTrue(metric["relativeErrorDefined"])
def test_zero_amesim_baseline_has_undefined_relative_error(self) -> None:
contract = project_physical_state_v21(
_synthetic_result(), checkpoint_times=(0.2,), sample_step=0.2
)
values = dict(contract["checkpoints"][0]["values"])
key = "massFlow.pnl0001_20.port_1.intoComponent"
values[key] = -0.0
comparison = compare_contract_to_amesim(
contract,
{"checkpoints": [{"requestedTime": 0.2, "values": values}]},
)
metric = next(item for item in comparison["metrics"] if item["key"] == key)
self.assertIsNone(metric["relativeError"])
self.assertIsNone(metric["relativeErrorPercent"])
self.assertFalse(metric["relativeErrorDefined"])
self.assertEqual(metric["relativeErrorReason"], "zeroAmesimBaseline")
self.assertEqual(metric["comparisonBasis"], "absoluteNearZero")
self.assertEqual(
json.loads(json.dumps(comparison, allow_nan=False))["baselineAuthority"],
"amesim",
)
class ReviewedGoldenProtocolTests(unittest.TestCase):
def _report_and_reference(self):
contract = project_physical_state_v21(
_synthetic_result(), checkpoint_times=(0.0, 0.04, 0.2), sample_step=0.04
)
report = {
"generatedAt": "2026-08-18T00:00:00+00:00",
"source": {"sha256": "a" * 64},
"cases": [{
"caseId": "0.2s",
"lane": "production",
"worker": {"summary": {"physicalStateV21": contract}},
}],
}
keys = contract["layout"]["projectionKeys"]
reference_checkpoints = []
for checkpoint in contract["checkpoints"]:
reference_checkpoints.append({
"requestedTime": checkpoint["requestedTime"],
"values": {key: checkpoint["values"][key] for key in keys},
})
reference = {
"schemaVersion": 1,
"provenance": {
"archivePath": "AmesimModels/synthetic.ame",
"archiveBytes": 2,
"archiveSha256": "b" * 64,
"members": [
{"name": "synthetic.var", "bytes": 1, "sha256": "c" * 64},
{
"name": "synthetic.results",
"bytes": 1,
"sha256": "d" * 64,
},
],
},
"storedMassDataPaths": ["mgas@synthetic"],
"checkpoints": reference_checkpoints,
}
return contract, report, reference
def test_candidate_requires_exact_hash_and_is_approved_to_a_new_file(self) -> None:
contract, report, reference = self._report_and_reference()
with tempfile.TemporaryDirectory(
dir=REPO_ROOT, prefix=".physical-state-v21-test-"
) as temporary_directory:
root = Path(temporary_directory)
report_path = root / "report.json"
report_path.write_text(json.dumps(report), encoding="utf-8")
candidate_path = root / "candidate.json"
approved_path = root / "approved.json"
with patch(
"app.simulation.physical_state_v21.build_amesim_reference",
return_value=reference,
):
write_candidate_golden(report_path, candidate_path)
candidate = json.loads(candidate_path.read_text(encoding="utf-8"))
local_report = candidate["provenance"]["localSourceReport"]
self.assertFalse(Path(local_report["path"]).is_absolute())
self.assertEqual(local_report["bytes"], report_path.stat().st_size)
candidate_sha = hashlib.sha256(candidate_path.read_bytes()).hexdigest()
with self.assertRaisesRegex(PhysicalStateV21Error, "SHA mismatch"):
approve_candidate_golden(
candidate_path,
approved_path,
expected_candidate_sha256="0" * 64,
reviewed_by="reviewer",
note="reviewed",
)
approve_candidate_golden(
candidate_path,
approved_path,
expected_candidate_sha256=candidate_sha,
reviewed_by="reviewer",
note="units, signs, and errors reviewed",
)
golden = load_approved_golden(approved_path)
self.assertFalse(Path(golden["approval"]["candidatePath"]).is_absolute())
golden["checkpoints"][-1]["values"][0] += 1.0e9
self.assertTrue(evaluate_physical_state_v21(contract, golden)["passed"])
changed = copy.deepcopy(contract)
changed["checkpoints"][-1]["values"]["pressure.pnch012_8.absolute"] += 1000.0
failure = evaluate_physical_state_v21(changed, golden)
self.assertFalse(failure["passed"])
self.assertIn("amesimReferenceToleranceMismatch", failure["issues"])
def test_approval_rejects_failed_or_tampered_alignment(self) -> None:
_contract, report, reference = self._report_and_reference()
with tempfile.TemporaryDirectory() as temporary_directory:
root = Path(temporary_directory)
report_path = root / "report.json"
report_path.write_text(json.dumps(report), encoding="utf-8")
original_path = root / "candidate.json"
with patch(
"app.simulation.physical_state_v21.build_amesim_reference",
return_value=reference,
):
write_candidate_golden(report_path, original_path)
original = json.loads(original_path.read_text(encoding="utf-8"))
failed_alignment = copy.deepcopy(original)
failed_alignment["amesimAlignmentAtGeneration"]["passed"] = False
failed_path = root / "failed-alignment.json"
failed_path.write_text(json.dumps(failed_alignment), encoding="utf-8")
with self.assertRaisesRegex(
PhysicalStateV21Error, "AMESim alignment at generation"
):
approve_candidate_golden(
failed_path,
root / "failed-approved.json",
expected_candidate_sha256=hashlib.sha256(
failed_path.read_bytes()
).hexdigest(),
reviewed_by="reviewer",
note="must not override a failed alignment",
)
failed_metric = copy.deepcopy(original)
evaluated_metric = next(
metric
for metric in failed_metric["amesimAlignmentAtGeneration"]["metrics"]
if metric["evaluated"]
)
evaluated_metric["passed"] = False
failed_metric_path = root / "failed-metric.json"
failed_metric_path.write_text(json.dumps(failed_metric), encoding="utf-8")
with self.assertRaisesRegex(PhysicalStateV21Error, "evaluated metric"):
approve_candidate_golden(
failed_metric_path,
root / "failed-metric-approved.json",
expected_candidate_sha256=hashlib.sha256(
failed_metric_path.read_bytes()
).hexdigest(),
reviewed_by="reviewer",
note="must not override a failed metric",
)
def test_approval_rejects_local_conservation_residual(self) -> None:
_contract, report, reference = self._report_and_reference()
with tempfile.TemporaryDirectory() as temporary_directory:
root = Path(temporary_directory)
report_path = root / "report.json"
report_path.write_text(json.dumps(report), encoding="utf-8")
original_path = root / "candidate.json"
with patch(
"app.simulation.physical_state_v21.build_amesim_reference",
return_value=reference,
):
write_candidate_golden(report_path, original_path)
candidate = json.loads(original_path.read_text(encoding="utf-8"))
key = "conservation.p4node2_8.massBalance"
value_index = candidate["layout"]["projectionKeys"].index(key)
candidate["checkpoints"][1]["values"][value_index] = 2.0e-9
tampered_path = root / "conservation-residual.json"
tampered_path.write_text(json.dumps(candidate), encoding="utf-8")
with self.assertRaisesRegex(
PhysicalStateV21Error, "local conservation residual"
):
approve_candidate_golden(
tampered_path,
root / "residual-approved.json",
expected_candidate_sha256=hashlib.sha256(
tampered_path.read_bytes()
).hexdigest(),
reviewed_by="reviewer",
note="must not override a local conservation failure",
)
def test_candidate_writer_refuses_overwrite_and_unapproved_file_is_rejected(self) -> None:
_contract, report, reference = self._report_and_reference()
with tempfile.TemporaryDirectory() as temporary_directory:
root = Path(temporary_directory)
report_path = root / "report.json"
report_path.write_text(json.dumps(report), encoding="utf-8")
output = root / "candidate.json"
with patch(
"app.simulation.physical_state_v21.build_amesim_reference",
return_value=reference,
):
write_candidate_golden(report_path, output)
with self.assertRaisesRegex(PhysicalStateV21Error, "overwrite"):
write_candidate_golden(report_path, output)
with self.assertRaisesRegex(PhysicalStateV21Error, "approval.status"):
load_approved_golden(output)
if __name__ == "__main__":
unittest.main()
+85 -3
View File
@@ -154,6 +154,26 @@ class TestMql8StaticRegressionTests(unittest.TestCase):
self.assertEqual(audit["maxAbsoluteError"], 0.0)
self.assertEqual(audit["maxToleranceRatio"], 0.0)
def test_approved_production_golden_replays_its_source_report(self) -> None:
repository_root = Path(self.manifest["_repositoryRoot"])
reference = self.manifest["variants"]["0.2s"]["goldens"]["production"]
golden = load_regression_golden(
repository_root / reference["path"],
expected_sha256=reference["sha256"],
repository_root=repository_root,
)
source_report = golden["provenance"]["sourceReport"]
report = json.loads(
(repository_root / source_report["path"]).read_text(encoding="utf-8")
)
case = next(item for item in report["cases"] if item["caseId"] == "0.2s")
audit = evaluate_regression_golden(case["worker"]["summary"], golden)
self.assertTrue(audit["passed"], audit)
self.assertEqual(audit["comparedValueCount"], 426)
self.assertEqual(audit["maxAbsoluteError"], 0.0)
self.assertEqual(audit["maxToleranceRatio"], 0.0)
def test_historical_v2_extension_decision_remains_auditable(self) -> None:
repository_root = Path(self.manifest["_repositoryRoot"])
runs = repository_root / "tests/baselines/simulation/test_mql_8/runs"
@@ -202,7 +222,70 @@ class TestMql8StaticRegressionTests(unittest.TestCase):
self.assertEqual(first_decision["outcome"], "deferred")
self.assertTrue(decision["simulationWasNotStartedForDeferredCases"])
def test_periodic_main_lane_uses_the_current_production_source(self) -> None:
def test_extension_decision_is_bound_to_the_current_report_and_budget(self) -> None:
repository_root = Path(self.manifest["_repositoryRoot"])
evidence = self.manifest["acceptanceEvidence"]
decision_reference = evidence["extensionDecision"]
decision_path = repository_root / decision_reference["path"]
decision_payload = decision_path.read_bytes()
decision = json.loads(decision_payload)
report_reference = evidence["production0.2ApprovedReplay"]
report_path = repository_root / report_reference["path"]
report_payload = report_path.read_bytes()
report = json.loads(report_payload)
source_case = next(
item for item in report["cases"] if item["caseId"] == "0.2s"
)
first_decision = decision["decisions"][0]
self.assertEqual(
decision["sourceXmlSha256"], self.manifest["source"]["sha256"]
)
self.assertEqual(decision["sourceReport"], report_path.name)
self.assertEqual(len(report_payload), report_reference["bytes"])
self.assertEqual(
hashlib.sha256(report_payload).hexdigest(), report_reference["sha256"]
)
self.assertEqual(len(decision_payload), decision_reference["bytes"])
self.assertEqual(
hashlib.sha256(decision_payload).hexdigest(),
decision_reference["sha256"],
)
self.assertEqual(
hashlib.sha256(report_payload).hexdigest(),
decision["sourceReportSha256"],
)
self.assertTrue(source_case["acceptance"]["passed"])
self.assertEqual(
decision["observedCase"]["workerWallSeconds"],
source_case["worker"]["wallSeconds"],
)
expected_prediction = (
source_case["worker"]["wallSeconds"]
* self.manifest["variants"]["1s"]["stopTime"]
/ source_case["stopTime"]
* self.manifest["execution"]["predictionSafetyFactor"]
)
self.assertAlmostEqual(
first_decision["predictedWallSeconds"], expected_prediction
)
self.assertLessEqual(
first_decision["predictedWallSeconds"],
first_decision["softTimeoutSeconds"],
)
self.assertEqual(first_decision["outcome"], "eligible")
self.assertEqual(first_decision["reason"], "predictedWallWithinSoftBudget")
self.assertEqual(
[item["outcome"] for item in decision["decisions"]],
["eligible", "notEvaluated", "notEvaluated"],
)
self.assertTrue(decision["extensionWasNotStarted"])
self.assertEqual(
decision["scopeReason"],
"OPT-00 closes at the approved production 0.2 s gate; longer progressive horizons remain separately staged work.",
)
def test_periodic_main_lane_exercises_the_approved_production_golden(self) -> None:
workflow = (
Path(self.manifest["_repositoryRoot"])
/ ".github/workflows/solver-regression.yml"
@@ -210,12 +293,11 @@ class TestMql8StaticRegressionTests(unittest.TestCase):
self.assertIn("default: production", workflow)
self.assertIn("inputs.lane || 'production'", workflow)
self.assertNotIn("goldens", self.manifest["variants"]["0.2s"])
@unittest.skipUnless(
os.getenv(LONG_RUN_ENVIRONMENT, "").strip().lower() in {"1", "true", "yes"},
f"Set {LONG_RUN_ENVIRONMENT}=1 to run bounded 0.005/0.2/1/5/10 s integration.",
f"Set {LONG_RUN_ENVIRONMENT}=1 to run bounded 0.01/0.2/1/5/10 s integration.",
)
class TestMql8ProgressiveLongRegressionTests(unittest.TestCase):
@classmethod
+857
View File
@@ -0,0 +1,857 @@
from __future__ import annotations
import ast
from collections import Counter
from collections.abc import Mapping
from dataclasses import dataclass
import hashlib
import json
import math
import operator
from pathlib import Path
import re
import tarfile
import unittest
import xml.etree.ElementTree as ET
from app.simulation.registry import get_component_model_spec
from app.simulation.reporting.amesim_results import load_test_mql_amesim_results
REPOSITORY_ROOT = Path(__file__).resolve().parents[1]
AME_PATH = REPOSITORY_ROOT / "AmesimModels" / "test_mql.ame"
JSON_PATH = REPOSITORY_ROOT / "tests/data/test-mql-8.json"
XML_PATH = REPOSITORY_ROOT / "tests/data/test-mql-8.xml"
MANIFEST_PATH = (
REPOSITORY_ROOT
/ "tests/baselines/simulation/test_mql_8/manifest.json"
)
EXPECTED_AME_SHA256 = (
"cbc3aadd4569a49b3a63e5d66d4143ec16126c0f950df73fb637e07673c20fbb"
)
EXPECTED_AME_BYTES = 21_708_800
EXPECTED_MODEL_TYPE_COUNT = 20
EXPECTED_NODE_COUNT = 157
EXPECTED_PARAMETER_COUNT = 1_092
EXPECTED_CONNECTION_COUNT = 178
EXPECTED_RESULT_POINT_COUNT = 1_002
AMESIM_REFERENCE_PRESSURE_PA = 101_300.0
_BINARY_OPERATORS = {
ast.Add: operator.add,
ast.Sub: operator.sub,
ast.Mult: operator.mul,
ast.Div: operator.truediv,
ast.Pow: operator.pow,
}
_UNARY_OPERATORS = {ast.UAdd: operator.pos, ast.USub: operator.neg}
# Public component names for AMESim state/output values that are promoted to
# explicit initial-value parameters. Unlisted names map one-to-one.
_SOURCE_FIELD_BY_PARAMETER = {
"amesim_mecmas21": {"v0": "v1", "x0": "x1"},
"amesim_pnch012": {"p0": "press", "T0": "temp"},
"amesim_pnch023": {"p0": "press", "T0": "temp"},
"amesim_pnl0001": {"p0": "p2", "T0": "t2"},
"amesim_pnl0002": {"p0": "pctr", "T0": "tctr"},
"amesim_pnl0003": {
"p1_0": "p1",
"T1_0": "t1",
"p2_0": "p2",
"T2_0": "t2",
},
"amesim_step0": {"initial": "out0", "final": "out1", "time": "t0"},
}
_FIXED_PUBLIC_DEFAULTS = {
"amesim_pnch012": {
"vol1": 0.0,
"vol2": 0.0,
"vol3": 0.0,
"vol4": 0.0,
"dvol1": 0.0,
"dvol2": 0.0,
"dvol3": 0.0,
"dvol4": 0.0,
},
"amesim_pnvo001": {"opening0": 1.0},
}
_GAUGE_PRESSURE_FIELDS = {"press", "p1", "p2", "pctr"}
_SOURCE_TO_SI_SCALE = {
("mm", "m"): 1.0e-3,
("mm**2", "m2"): 1.0e-6,
("L", "m3"): 1.0e-3,
("N/mm", "N/m"): 1.0e3,
("N/(mm/s)", "N/(m/s)"): 1.0e3,
}
_EQUIVALENT_UNIT_PAIRS = {
("", ""),
("null", ""),
("degree", ""),
("J/m**2/K/s", "W/(m2*K)"),
("N/m**2", "Pa"),
("m**2", "m2"),
("N/(m/s)**2", "N/(m/s)^2"),
}
_SELECTABLE_UNITS_BY_QUANTITY = {
"area": {"m2", "cm2", "mm2"},
"heat_transfer_coefficient": {"W/(m2*K)"},
"pressure": {"Pa", "kPa", "MPa", "bar"},
"volume": {"m3", "L", "mL"},
"temperature": {"K", "degC"},
"length": {"m", "cm", "mm"},
}
@dataclass(frozen=True)
class AmesimValue:
expression: str
unit: str
@dataclass(frozen=True)
class AmesimContract:
simulation_values: tuple[float, ...]
node_types: Mapping[str, str]
parameters: Mapping[str, Mapping[str, float]]
edges: tuple[tuple[str, str], ...]
component_count: int
modeled_line_count: int
direct_line_count: int
contact_count: int
def _element_text(body: str, name: str) -> str | None:
match = re.search(rf"<{name}>(.*?)</{name}>", body, flags=re.DOTALL)
return match.group(1).strip() if match else None
def _required_element_text(body: str, name: str) -> str:
value = _element_text(body, name)
if value is None:
raise AssertionError(f"AME circuit element is missing <{name}>.")
return value
def _blocks(body: str, name: str) -> list[str]:
return re.findall(
rf"<{name}>\s*(.*?)\s*</{name}>", body, flags=re.DOTALL
)
def _evaluate_expression(expression: str, variables: Mapping[str, float]) -> float:
parsed = ast.parse(expression.strip().replace("^", "**"), mode="eval")
def evaluate(node: ast.AST) -> float:
if (
isinstance(node, ast.Constant)
and isinstance(node.value, (int, float))
and not isinstance(node.value, bool)
):
return float(node.value)
if isinstance(node, ast.Name):
if node.id not in variables:
raise ValueError(f"unknown AME expression variable {node.id!r}")
return float(variables[node.id])
if isinstance(node, ast.BinOp) and type(node.op) in _BINARY_OPERATORS:
return float(
_BINARY_OPERATORS[type(node.op)](
evaluate(node.left), evaluate(node.right)
)
)
if isinstance(node, ast.UnaryOp) and type(node.op) in _UNARY_OPERATORS:
return float(_UNARY_OPERATORS[type(node.op)](evaluate(node.operand)))
raise ValueError(f"unsupported expression node {type(node).__name__}")
value = evaluate(parsed.body)
if not math.isfinite(value):
raise ValueError(f"expression is not finite: {expression!r}")
return value
def _public_model_type(submodel: str) -> str:
return (
"amesim_helium_medium"
if submodel == "PNGD00"
else f"amesim_{submodel.lower()}"
)
def _value_fields(entity_body: str) -> dict[str, AmesimValue]:
fields: dict[str, AmesimValue] = {}
for kind in ("RPARAM", "IPARAM", "IVAR", "EVAR"):
for field_body in _blocks(entity_body, kind):
name = _element_text(field_body, "VARNAME")
value = _element_text(field_body, "VALUE")
if name is not None and value is not None:
fields[name] = AmesimValue(
value, _element_text(field_body, "UNITS") or ""
)
return fields
def _resolve_globals(cir_text: str) -> dict[str, float]:
remaining = {
_required_element_text(body, "GLOB_PARAM_NAME"): _required_element_text(
body, "VALUE"
)
for body in _blocks(cir_text, "GLOBALPARAM")
}
resolved: dict[str, float] = {}
while remaining:
progressed = False
for name, expression in tuple(remaining.items()):
try:
resolved[name] = _evaluate_expression(expression, resolved)
except ValueError:
continue
del remaining[name]
progressed = True
if not progressed:
raise AssertionError(
"Unable to resolve AME globals: " + ", ".join(sorted(remaining))
)
return resolved
def _source_value_in_public_units(
source: AmesimValue,
*,
target_unit: str,
source_name: str,
globals_: Mapping[str, float],
) -> float:
value = _evaluate_expression(source.expression, globals_)
if source_name in _GAUGE_PRESSURE_FIELDS:
if (source.unit, target_unit) != ("Pa", "Pa"):
raise AssertionError(
f"Unexpected gauge-pressure units for {source_name}: "
f"{source.unit!r} -> {target_unit!r}."
)
return value + AMESIM_REFERENCE_PRESSURE_PA
pair = (source.unit, target_unit)
if pair in _SOURCE_TO_SI_SCALE:
return value * _SOURCE_TO_SI_SCALE[pair]
if source.unit == target_unit or pair in _EQUIVALENT_UNIT_PAIRS:
return value
raise AssertionError(
f"No AME-to-public conversion for {source_name}: "
f"{source.unit!r} -> {target_unit!r}."
)
def _expected_parameters(
entity_body: str,
model_type: str,
globals_: Mapping[str, float],
) -> dict[str, float]:
spec = get_component_model_spec(model_type)
fields = _value_fields(entity_body)
expected = {
parameter.name: float(parameter.default) for parameter in spec.parameters
}
source_names = _SOURCE_FIELD_BY_PARAMETER.get(model_type, {})
fixed_defaults = _FIXED_PUBLIC_DEFAULTS.get(model_type, {})
unbound: list[str] = []
for parameter in spec.parameters:
source_name = source_names.get(parameter.name, parameter.name)
if source_name in fields:
expected[parameter.name] = _source_value_in_public_units(
fields[source_name],
target_unit=parameter.unit,
source_name=source_name,
globals_=globals_,
)
elif parameter.name in fixed_defaults:
expected[parameter.name] = fixed_defaults[parameter.name]
if float(parameter.default) != expected[parameter.name]:
raise AssertionError(
f"{model_type}.{parameter.name} changed its fixed public "
"default without an AME source-field mapping."
)
elif not (
(model_type == "amesim_forc" and parameter.name == "direction")
or (
model_type == "amesim_helium_medium"
and parameter.name == "property_model"
)
):
unbound.append(parameter.name)
if unbound:
raise AssertionError(
f"AME parameter mapping is incomplete for {model_type}: "
+ ", ".join(unbound)
)
if model_type == "amesim_forc":
geometry = _required_element_text(entity_body, "COMP_GEOMETRY")
if geometry not in {"2", "8"}:
raise AssertionError(f"Unsupported FORC geometry {geometry!r}.")
expected["direction"] = 1.0 if geometry == "2" else -1.0
if model_type == "amesim_helium_medium":
codes = tuple(
_evaluate_expression(fields[name].expression, globals_)
for name in ("fluidType", "eosType", "gasSetting")
)
if codes != (12.0, 6.0, 1.0):
raise AssertionError(
"PNGD00 no longer selects helium/Peng-Robinson."
)
expected["property_model"] = 0.0
return expected
def _load_ame_contract(path: Path) -> AmesimContract:
with tarfile.open(path) as archive:
cir_file = archive.extractfile("test_mql_.cir")
sim_file = archive.extractfile("test_mql_.sim")
if cir_file is None or sim_file is None:
raise AssertionError(
"AME archive is missing test_mql_.cir or test_mql_.sim."
)
cir_text = cir_file.read().decode("latin1")
simulation_values = tuple(
float(value)
for value in sim_file.read().decode("ascii").splitlines()[0].split()
)
globals_ = _resolve_globals(cir_text)
component_bodies = _blocks(cir_text, "COMP")
line_bodies = _blocks(cir_text, "LINE")
node_types: dict[str, str] = {}
parameters: dict[str, Mapping[str, float]] = {}
for index, body in enumerate(component_bodies):
key = f"component:{index}"
model_type = _public_model_type(
_required_element_text(body, "SUB_NAME")
)
node_types[key] = model_type
parameters[key] = _expected_parameters(body, model_type, globals_)
# PORT_CONNECT=1 is an AMESim contact; line-backed ports use value 2 and
# are reconstructed from LINES_LIST below.
directed_contacts: set[
tuple[tuple[int, int], tuple[int, int]]
] = set()
contacts: set[tuple[tuple[int, int], tuple[int, int]]] = set()
for component_index, body in enumerate(component_bodies):
for port_index, port_body in enumerate(_blocks(body, "COMP_PORT")):
if _required_element_text(port_body, "PORT_CONNECT") != "1":
continue
for connection_body in _blocks(port_body, "CONNECT"):
target_index = int(
_required_element_text(
connection_body, "CONNECT_ENTITY_NUM"
)
)
target_port = int(
_required_element_text(
connection_body, "CONNECT_ENTITY_PORT"
)
)
endpoint = (component_index, port_index)
target = (target_index, target_port)
directed_contacts.add((endpoint, target))
contacts.add(tuple(sorted((endpoint, target))))
for endpoint, target in directed_contacts:
if (target, endpoint) not in directed_contacts:
raise AssertionError(
"AME component contact is not reciprocal: "
f"{endpoint} -> {target}."
)
edges = [
(f"component:{first[0]}", f"component:{second[0]}")
for first, second in contacts
]
direct_line_count = 0
modeled_line_count = 0
for line_index, body in enumerate(line_bodies):
if (
_required_element_text(body, "LINE_START_TYPE") != "0"
or _required_element_text(body, "LINE_END_TYPE") != "0"
):
raise AssertionError(
"test_mql contains a non-component line endpoint."
)
start = (
"component:"
+ _required_element_text(body, "LINE_START_ENTITY")
)
end = (
"component:"
+ _required_element_text(body, "LINE_END_ENTITY")
)
if start not in node_types or end not in node_types:
raise AssertionError(
f"AME line references an unknown endpoint: {start}, {end}."
)
submodel = _required_element_text(body, "SUB_NAME")
if submodel == "DIRECT":
direct_line_count += 1
edges.append((start, end))
continue
modeled_line_count += 1
key = f"line:{line_index}"
model_type = _public_model_type(submodel)
node_types[key] = model_type
parameters[key] = _expected_parameters(
body, model_type, globals_
)
edges.extend(((start, key), (key, end)))
return AmesimContract(
simulation_values=simulation_values,
node_types=node_types,
parameters=parameters,
edges=tuple(edges),
component_count=len(component_bodies),
modeled_line_count=modeled_line_count,
direct_line_count=direct_line_count,
contact_count=len(contacts),
)
def _numeric_project_value(value: object) -> float:
if isinstance(value, bool):
raise AssertionError(
"Boolean is not a valid project parameter value."
)
if isinstance(value, (int, float)):
result = float(value)
elif isinstance(value, str):
result = _evaluate_expression(value, {})
else:
raise AssertionError(
f"Unsupported project parameter value {value!r}."
)
if not math.isfinite(result):
raise AssertionError(
f"Project parameter value is not finite: {value!r}."
)
return result
def _parameter_fingerprint(
values: Mapping[str, object],
) -> tuple[tuple[str, str], ...]:
# Fifteen significant digits collapse only normal IEEE-754 expression
# noise (for example 100000.00000000001 versus 100000).
return tuple(
sorted(
(name, format(_numeric_project_value(value), ".15g"))
for name, value in values.items()
)
)
def _topology_fingerprints(
node_types: Mapping[str, str],
edges: tuple[tuple[str, str], ...],
*,
rounds: int = 12,
) -> tuple[Counter[str], ...]:
adjacency = {node_id: [] for node_id in node_types}
for first, second in edges:
if first not in adjacency or second not in adjacency:
raise AssertionError(
f"Unknown topology endpoint: {first}, {second}."
)
adjacency[first].append(second)
adjacency[second].append(first)
colors = {
node_id: hashlib.sha256(model_type.encode()).hexdigest()
for node_id, model_type in node_types.items()
}
fingerprints: list[Counter[str]] = []
for _ in range(rounds):
colors = {
node_id: hashlib.sha256(
repr(
(
node_types[node_id],
colors[node_id],
sorted(
colors[neighbor]
for neighbor in adjacency[node_id]
),
)
).encode()
).hexdigest()
for node_id in node_types
}
fingerprints.append(Counter(colors.values()))
return tuple(fingerprints)
class TestMqlAmeAuthorityContractTests(unittest.TestCase):
@classmethod
def setUpClass(cls) -> None:
cls.ame_payload = AME_PATH.read_bytes()
cls.ame = _load_ame_contract(AME_PATH)
cls.project = json.loads(JSON_PATH.read_text(encoding="utf-8"))
cls.xml_root = ET.parse(XML_PATH).getroot()
cls.manifest = json.loads(
MANIFEST_PATH.read_text(encoding="utf-8")
)
def test_manifest_and_results_bind_the_exact_ame_archive(self) -> None:
self.assertEqual(len(self.ame_payload), EXPECTED_AME_BYTES)
self.assertEqual(
hashlib.sha256(self.ame_payload).hexdigest(),
EXPECTED_AME_SHA256,
)
reference = self.manifest["source"]["referenceArchive"]
self.assertEqual(
reference,
{
"path": "AmesimModels/test_mql.ame",
"sha256": EXPECTED_AME_SHA256,
"bytes": EXPECTED_AME_BYTES,
"role": "authoritativePhysicalBaseline",
"resultStartTime": 0.0,
"resultStopTime": 10.0,
"resultSampleStep": 0.01,
"resultPointCount": EXPECTED_RESULT_POINT_COUNT,
},
)
self.assertEqual(
(REPOSITORY_ROOT / reference["path"]).resolve(),
AME_PATH.resolve(),
)
# .sim: start, stop, print interval, ..., maximum integration step.
self.assertGreaterEqual(len(self.ame.simulation_values), 6)
self.assertEqual(self.ame.simulation_values[0], 0.0)
self.assertEqual(self.ame.simulation_values[1], 10.0)
self.assertEqual(self.ame.simulation_values[2], 0.01)
self.assertEqual(self.ame.simulation_values[5], 0.001)
results = load_test_mql_amesim_results(AME_PATH)
self.assertEqual(
len(results.times), EXPECTED_RESULT_POINT_COUNT
)
self.assertEqual(
results.times[0], reference["resultStartTime"]
)
self.assertEqual(
results.times[-1], reference["resultStopTime"]
)
self.assertTrue(
all(
left < right
for left, right in zip(
results.times, results.times[1:]
)
)
)
step = reference["resultSampleStep"]
self.assertTrue(
all(
math.isclose(
time,
round(time / step) * step,
rel_tol=0.0,
abs_tol=1.0e-10,
)
for time in results.times
)
)
def test_json_inventory_parameters_and_topology_derive_from_ame(
self,
) -> None:
nodes = self.project["nodes"]
edges = self.project["edges"]
json_node_types = {
node["id"]: node["data"]["modelType"] for node in nodes
}
json_edges = tuple(
(edge["source"], edge["target"]) for edge in edges
)
self.assertEqual(self.ame.component_count, 117)
self.assertEqual(self.ame.modeled_line_count, 40)
self.assertEqual(self.ame.direct_line_count, 44)
self.assertEqual(self.ame.contact_count, 54)
self.assertEqual(
len(self.ame.node_types), EXPECTED_NODE_COUNT
)
self.assertEqual(
len(self.ame.edges), EXPECTED_CONNECTION_COUNT
)
self.assertEqual(
len(set(self.ame.node_types.values())),
EXPECTED_MODEL_TYPE_COUNT,
)
self.assertEqual(len(nodes), EXPECTED_NODE_COUNT)
self.assertEqual(len(edges), EXPECTED_CONNECTION_COUNT)
self.assertEqual(
len(set(json_node_types.values())),
EXPECTED_MODEL_TYPE_COUNT,
)
self.assertEqual(
Counter(self.ame.node_types.values()),
Counter(json_node_types.values()),
)
expected_parameter_count = sum(
len(values) for values in self.ame.parameters.values()
)
actual_parameter_count = sum(
len(node["data"]["parameters"]) for node in nodes
)
self.assertEqual(
expected_parameter_count, EXPECTED_PARAMETER_COUNT
)
self.assertEqual(
actual_parameter_count, EXPECTED_PARAMETER_COUNT
)
expected_by_type: dict[
str, Counter[tuple[tuple[str, str], ...]]
] = {}
for node_id, model_type in self.ame.node_types.items():
expected_by_type.setdefault(model_type, Counter()).update(
[
_parameter_fingerprint(
self.ame.parameters[node_id]
)
]
)
actual_by_type: dict[
str, Counter[tuple[tuple[str, str], ...]]
] = {}
for node in nodes:
model_type = node["data"]["modelType"]
actual_by_type.setdefault(model_type, Counter()).update(
[
_parameter_fingerprint(
node["data"]["parameters"]
)
]
)
self.assertEqual(actual_by_type, expected_by_type)
expected_edge_types = Counter(
tuple(
sorted(
(
self.ame.node_types[first],
self.ame.node_types[second],
)
)
)
for first, second in self.ame.edges
)
actual_edge_types = Counter(
tuple(
sorted(
(
json_node_types[first],
json_node_types[second],
)
)
)
for first, second in json_edges
)
self.assertEqual(actual_edge_types, expected_edge_types)
self.assertEqual(
_topology_fingerprints(
json_node_types, json_edges
),
_topology_fingerprints(
self.ame.node_types, self.ame.edges
),
)
def test_json_units_and_component_contracts_are_complete(
self,
) -> None:
for node in self.project["nodes"]:
with self.subTest(component=node["id"]):
data = node["data"]
self.assertEqual(
data["componentType"], data["modelType"]
)
spec = get_component_model_spec(data["modelType"])
self.assertEqual(
data["modelVersion"], spec.model_version
)
self.assertEqual(
set(data["parameters"]),
{
parameter.name
for parameter in spec.parameters
},
)
self.assertEqual(
{port["name"] for port in data["ports"]},
{port.name for port in spec.ports},
)
units = data.get("parameterUnits", {})
self.assertEqual(
set(units),
{
parameter.name
for parameter in spec.parameters
if parameter.unit
},
)
for parameter in spec.parameters:
if not parameter.unit:
continue
selected = units[parameter.name]
allowed = _SELECTABLE_UNITS_BY_QUANTITY.get(
parameter.quantity, {parameter.unit}
)
self.assertIn(selected, allowed, parameter.name)
def test_json_and_xml_match_by_id_parameter_endpoint_and_time(
self,
) -> None:
xml_components = self.xml_root.findall(
"./Components/Component"
)
xml_connections = self.xml_root.findall(
"./Connections/Connection"
)
xml_component_by_id = {
component.attrib["id"]: component
for component in xml_components
}
xml_connection_by_id = {
connection.attrib["id"]: connection
for connection in xml_connections
}
json_node_by_id = {
node["id"]: node for node in self.project["nodes"]
}
json_edge_by_id = {
edge["id"]: edge for edge in self.project["edges"]
}
self.assertEqual(
len(xml_component_by_id), len(xml_components)
)
self.assertEqual(
len(xml_connection_by_id), len(xml_connections)
)
self.assertEqual(
set(xml_component_by_id), set(json_node_by_id)
)
self.assertEqual(
set(xml_connection_by_id), set(json_edge_by_id)
)
for node_id, node in json_node_by_id.items():
with self.subTest(component=node_id):
component = xml_component_by_id[node_id]
data = node["data"]
self.assertEqual(
component.attrib["type"], data["modelType"]
)
self.assertEqual(
component.attrib["modelVersion"],
data["modelVersion"],
)
xml_parameters = {
parameter.attrib["name"]: float(
parameter.attrib["value"]
)
for parameter in component.findall("./Parameter")
}
json_parameters = {
name: _numeric_project_value(value)
for name, value in data["parameters"].items()
}
self.assertEqual(
set(xml_parameters), set(json_parameters)
)
for name, value in json_parameters.items():
self.assertTrue(
math.isclose(
xml_parameters[name],
value,
rel_tol=1.0e-13,
abs_tol=1.0e-13,
),
(
f"{node_id}.{name}: "
f"XML={xml_parameters[name]!r}, "
f"JSON={value!r}"
),
)
for edge_id, edge in json_edge_by_id.items():
with self.subTest(connection=edge_id):
endpoints = {
(
endpoint.attrib["component"],
endpoint.attrib["port"],
)
for endpoint in xml_connection_by_id[
edge_id
].findall("./Endpoint")
}
self.assertEqual(
endpoints,
{
(
edge["source"],
edge["sourceHandle"],
),
(
edge["target"],
edge["targetHandle"],
),
},
)
xml_simulation = self.xml_root.find("./Simulation")
self.assertIsNotNone(xml_simulation)
assert xml_simulation is not None
project_simulation = self.project["simulation"]
expected_simulation = {
"tStart": float(project_simulation["t_start"]),
"tStop": float(project_simulation["t_stop"]),
"sampleStep": float(project_simulation["step"]),
"maxStep": float(project_simulation["max_step"]),
}
for name, expected in expected_simulation.items():
self.assertEqual(
float(xml_simulation.attrib[name]), expected
)
self.assertEqual(
xml_simulation.attrib["method"],
project_simulation["method"],
)
self.assertEqual(
project_simulation["t_start"],
self.ame.simulation_values[0],
)
self.assertEqual(
project_simulation["t_stop"],
self.ame.simulation_values[1],
)
self.assertEqual(
project_simulation["step"],
self.ame.simulation_values[2],
)
self.assertEqual(
project_simulation["max_step"],
self.ame.simulation_values[5],
)
if __name__ == "__main__":
unittest.main()
+45 -1
View File
@@ -1,10 +1,14 @@
from __future__ import annotations
import csv
import tempfile
import unittest
from pathlib import Path
from app.simulation.reporting.amesim_results import load_test_mql_amesim_results
from app.simulation.reporting.amesim_results import (
AmesimResults,
load_test_mql_amesim_results,
)
from app.simulation.reporting.test_mql_comparison import (
DEFAULT_TEST_MQL_ALIGNMENT_PATHS,
TestMqlComparisonError,
@@ -84,6 +88,46 @@ class TestMqlComparisonTests(unittest.TestCase):
self.assertAlmostEqual(metric.mean_abs_error, 1.0)
self.assertGreater(metric.max_rel_error, 0.0)
def test_zero_amesim_baseline_does_not_invent_a_relative_denominator(self) -> None:
amesim_results = AmesimResults(
times=(0.0, 1.0),
variables=(),
saved_variable_indices=(),
series_by_data_path={"zero@baseline": (0.0, -0.0)},
final_values_by_data_path={"zero@baseline": -0.0},
)
comparison = compare_test_mql_series(
python_times=(0.0, 1.0),
python_series_by_data_path={"zero@baseline": (0.0, 1.0e-6)},
amesim_results=amesim_results,
data_paths=("zero@baseline",),
)
metric = comparison.metric("zero@baseline")
self.assertEqual(metric.max_abs_error, 1.0e-6)
self.assertEqual(metric.undefined_rel_error_count, 2)
self.assertEqual(metric.near_zero_baseline_count, 2)
self.assertEqual(comparison.undefined_rel_error_count, 2)
self.assertEqual(metric.max_rel_error, 0.0)
with tempfile.TemporaryDirectory() as temp_dir:
comparison_path, _summary_path, _comparison = (
write_test_mql_comparison_csv(
output_dir=Path(temp_dir),
python_times=(0.0, 1.0),
python_series_by_data_path={
"zero@baseline": (0.0, 1.0e-6)
},
amesim_results=amesim_results,
data_paths=("zero@baseline",),
)
)
with comparison_path.open(newline="", encoding="utf-8") as handle:
rows = list(csv.reader(handle))
self.assertEqual(rows[1][-1], "")
self.assertEqual(rows[2][-1], "")
def test_missing_data_path_is_rejected(self) -> None:
with self.assertRaises(TestMqlComparisonError):
compare_test_mql_series(