80d62a0c5f
Background: hazard_patterns_extended.go (HP045-074) and _extended2.go (HP074-102) shared their entire ID range with the semantically-different patterns in hazard_patterns_cobot.go, hazard_patterns_press.go, hazard_patterns_operational.go and hazard_patterns_extended_dguv.go. The collision had lived unnoticed because TestGetBuiltinHazardPatterns_- UniqueIDs only checks the 44 builtin patterns (HP001-HP044). Examples of the collision: - HP059 = "Kollision Mensch-Roboter" (cobot.go) vs "Kupplung — mechanisch" (extended.go) - HP060 = "Quetschen durch Werkzeug am Cobot" (cobot.go) vs "Diagnosemodul — Software" (extended.go) - HP073 = "Wartung ohne LOTO" (operational.go) vs "Hydraulikventil — hydraulisch" (extended.go) At runtime collectAllPatterns() returned both patterns under the same ID which made downstream lookups (e.g. hazardPatternMeasures map keyed by pattern_id) non-deterministic — last-loaded wins, dropping the other pattern's mitigation set silently. Rename strategy (no deletes — both patterns are real and earn their SuggestedMeasureIDs after the category-filter work): extended.go HP045..HP073 -> HP1800..HP1828 (29 IDs) extended2.go HP074..HP102 -> HP1830..HP1858 (29 IDs) cobot/press/operational/extended_dguv keep their original IDs because: - compliance_triggers.go references HP059/HP060 with the cobot meaning - pattern_engine_test.go references HP073 with the LOTO/maintenance meaning - phase3_4_test.go references HP073 the same way New regression test: - TestAllPatterns_UniqueIDs runs over collectAllPatterns() and fails if ANY pattern in the runtime set duplicates an ID. The old TestGetBuiltinHazardPatterns_UniqueIDs stays for the builtin subset. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
335 lines
14 KiB
Go
335 lines
14 KiB
Go
package iace
|
|
|
|
// GetExtendedHazardPatterns returns 58 additional patterns
|
|
// derived from the Rule Library documents (R051-R1550).
|
|
// These supplement the 44 built-in patterns in hazard_patterns.go.
|
|
// Patterns HP045-HP073 are defined here; HP074-HP102 in hazard_patterns_extended2.go.
|
|
func GetExtendedHazardPatterns() []HazardPattern {
|
|
return append(getExtendedHazardPatternsA(), getExtendedHazardPatternsB()...)
|
|
}
|
|
|
|
// getExtendedHazardPatternsA returns patterns HP045-HP073.
|
|
func getExtendedHazardPatternsA() []HazardPattern {
|
|
return []HazardPattern{
|
|
{
|
|
ID: "HP1800", NameDE: "Aktor — elektrisch", NameEN: "Actuator — electrical",
|
|
RequiredComponentTags: []string{"actuator_part"},
|
|
RequiredEnergyTags: []string{"electrical_energy"},
|
|
RequiredLifecycles: []string{"maintenance"},
|
|
GeneratedHazardCats: []string{"mechanical_hazard"},
|
|
SuggestedMeasureIDs: []string{"M141"},
|
|
SuggestedEvidenceIDs: []string{"E21"},
|
|
Priority: 80,
|
|
// Source: R341
|
|
},
|
|
{
|
|
ID: "HP1801", NameDE: "Aktor — mechanisch", NameEN: "Actuator — mechanical",
|
|
RequiredComponentTags: []string{"actuator_part"},
|
|
RequiredEnergyTags: []string{"kinetic"},
|
|
RequiredLifecycles: []string{"operation"},
|
|
GeneratedHazardCats: []string{"mechanical_hazard"},
|
|
SuggestedMeasureIDs: []string{"M141"},
|
|
SuggestedEvidenceIDs: []string{"E08"},
|
|
Priority: 80,
|
|
// Source: R340
|
|
},
|
|
{
|
|
ID: "HP1802", NameDE: "KI-Steuerung — Software", NameEN: "Ai Controller — software",
|
|
RequiredComponentTags: []string{"has_ai", "has_software", "programmable"},
|
|
RequiredEnergyTags: []string{},
|
|
RequiredLifecycles: []string{"operation"},
|
|
GeneratedHazardCats: []string{"ai_misclassification"},
|
|
SuggestedMeasureIDs: []string{"M133", "M227", "M141"},
|
|
SuggestedEvidenceIDs: []string{"E15"},
|
|
Priority: 75,
|
|
// Source: R590, R1090
|
|
},
|
|
{
|
|
ID: "HP1803", NameDE: "Kabelbaum — elektrisch", NameEN: "Cable Harness — electrical",
|
|
RequiredComponentTags: []string{"electrical_part"},
|
|
RequiredEnergyTags: []string{"electrical_energy"},
|
|
RequiredLifecycles: []string{"installation", "operation"},
|
|
GeneratedHazardCats: []string{"electrical_hazard"},
|
|
SuggestedMeasureIDs: []string{"M481", "M141"},
|
|
SuggestedEvidenceIDs: []string{"E20"},
|
|
Priority: 80,
|
|
// Source: R065, R570, R1070
|
|
},
|
|
{
|
|
ID: "HP1804", NameDE: "Kabelsystem — elektrisch", NameEN: "Cable System — electrical",
|
|
RequiredComponentTags: []string{"electrical_part"},
|
|
RequiredEnergyTags: []string{"electrical_energy"},
|
|
RequiredLifecycles: []string{"installation", "operation"},
|
|
GeneratedHazardCats: []string{"electrical_hazard"},
|
|
SuggestedMeasureIDs: []string{"M481", "M141"},
|
|
SuggestedEvidenceIDs: []string{"E20"},
|
|
Priority: 80,
|
|
// Source: R317, R318
|
|
},
|
|
{
|
|
ID: "HP1805", NameDE: "Kamerasystem — elektrisch", NameEN: "Camera System — electrical",
|
|
RequiredComponentTags: []string{"sensor_part"},
|
|
RequiredEnergyTags: []string{"electrical_energy"},
|
|
RequiredLifecycles: []string{"operation"},
|
|
GeneratedHazardCats: []string{"ai_misclassification"},
|
|
SuggestedMeasureIDs: []string{"M133", "M227", "M141"},
|
|
SuggestedEvidenceIDs: []string{"E20"},
|
|
Priority: 75,
|
|
// Source: R074, R328
|
|
},
|
|
{
|
|
ID: "HP1806", NameDE: "Druckluftleitung — pneumatisch", NameEN: "Compressed Air Line — pneumatic",
|
|
RequiredComponentTags: []string{"pneumatic_part"},
|
|
RequiredEnergyTags: []string{"pneumatic_pressure"},
|
|
RequiredLifecycles: []string{"maintenance"},
|
|
GeneratedHazardCats: []string{"pneumatic_hydraulic"},
|
|
SuggestedMeasureIDs: []string{"M021"},
|
|
SuggestedEvidenceIDs: []string{"E20"},
|
|
Priority: 70,
|
|
// Source: R070
|
|
},
|
|
{
|
|
ID: "HP1807", NameDE: "Kompressor — pneumatisch", NameEN: "Compressor — pneumatic",
|
|
RequiredComponentTags: []string{"high_pressure", "noise_source", "pneumatic_part"},
|
|
RequiredEnergyTags: []string{"pneumatic_pressure"},
|
|
RequiredLifecycles: []string{"operation"},
|
|
GeneratedHazardCats: []string{"pneumatic_hydraulic"},
|
|
SuggestedMeasureIDs: []string{"M022"},
|
|
SuggestedEvidenceIDs: []string{"E14"},
|
|
Priority: 70,
|
|
// Source: R578, R1078
|
|
},
|
|
{
|
|
ID: "HP1808", NameDE: "Schaltschrank — elektrisch", NameEN: "Control Cabinet — electrical",
|
|
RequiredComponentTags: []string{"electrical_part", "high_voltage"},
|
|
RequiredEnergyTags: []string{"electrical_energy"},
|
|
RequiredLifecycles: []string{"maintenance", "operation"},
|
|
GeneratedHazardCats: []string{"electrical_hazard"},
|
|
SuggestedMeasureIDs: []string{"M481", "M482", "M141"},
|
|
SuggestedEvidenceIDs: []string{"E10", "E20"},
|
|
Priority: 80,
|
|
// Source: R061, R062, R315, R316, R566, R567, R1066, R1067
|
|
},
|
|
{
|
|
ID: "HP1809", NameDE: "Steuerungsschnittstelle — Software", NameEN: "Control Interface — software",
|
|
RequiredComponentTags: []string{"has_software", "user_interface"},
|
|
RequiredEnergyTags: []string{},
|
|
RequiredLifecycles: []string{"operation"},
|
|
GeneratedHazardCats: []string{"software_fault"},
|
|
SuggestedMeasureIDs: []string{"M101", "M113"},
|
|
SuggestedEvidenceIDs: []string{"E14"},
|
|
Priority: 70,
|
|
// Source: R080, R334
|
|
},
|
|
{
|
|
ID: "HP1810", NameDE: "Steuerung — elektrisch", NameEN: "Controller — electrical",
|
|
RequiredComponentTags: []string{"has_software", "programmable"},
|
|
RequiredEnergyTags: []string{"electrical_energy"},
|
|
RequiredLifecycles: []string{"restart"},
|
|
GeneratedHazardCats: []string{"mechanical_hazard"},
|
|
SuggestedMeasureIDs: []string{"M061", "M141"},
|
|
SuggestedEvidenceIDs: []string{"E08"},
|
|
Priority: 80,
|
|
// Source: R339, R598, R1098
|
|
},
|
|
{
|
|
ID: "HP1811", NameDE: "Foerderband — mechanisch", NameEN: "Conveyor Belt — mechanical",
|
|
RequiredComponentTags: []string{"entanglement_risk", "moving_part", "rotating_part"},
|
|
RequiredEnergyTags: []string{"kinetic"},
|
|
RequiredLifecycles: []string{"automatic_operation", "cleaning", "operation"},
|
|
GeneratedHazardCats: []string{"mechanical_hazard"},
|
|
SuggestedMeasureIDs: []string{"M061", "M002", "M141"},
|
|
SuggestedEvidenceIDs: []string{"E20", "E21"},
|
|
Priority: 80,
|
|
// Source: R053, R054, R556, R557, R1056, R1057
|
|
},
|
|
{
|
|
ID: "HP1812", NameDE: "Foerdersystem — mechanisch", NameEN: "Conveyor System — mechanical",
|
|
RequiredComponentTags: []string{"entanglement_risk", "moving_part", "rotating_part"},
|
|
RequiredEnergyTags: []string{"kinetic"},
|
|
RequiredLifecycles: []string{"cleaning", "operation"},
|
|
GeneratedHazardCats: []string{"mechanical_hazard"},
|
|
SuggestedMeasureIDs: []string{"M061", "M002", "M141"},
|
|
SuggestedEvidenceIDs: []string{"E20", "E21"},
|
|
Priority: 80,
|
|
// Source: R305, R306
|
|
},
|
|
{
|
|
ID: "HP1813", NameDE: "Kuehlgeraet — thermisch", NameEN: "Cooling Unit — thermal",
|
|
RequiredComponentTags: []string{"high_temperature"},
|
|
RequiredEnergyTags: []string{"thermal"},
|
|
RequiredLifecycles: []string{"operation"},
|
|
GeneratedHazardCats: []string{"thermal_hazard"},
|
|
SuggestedMeasureIDs: []string{"M141"},
|
|
SuggestedEvidenceIDs: []string{"E14"},
|
|
Priority: 70,
|
|
// Source: R581, R1081
|
|
},
|
|
{
|
|
ID: "HP1814", NameDE: "Kupplung — mechanisch", NameEN: "Coupling — mechanical",
|
|
RequiredComponentTags: []string{"rotating_part"},
|
|
RequiredEnergyTags: []string{"kinetic"},
|
|
RequiredLifecycles: []string{"operation"},
|
|
GeneratedHazardCats: []string{"mechanical_hazard"},
|
|
SuggestedMeasureIDs: []string{"M012"},
|
|
SuggestedEvidenceIDs: []string{"E08"},
|
|
Priority: 80,
|
|
// Source: R056, R564, R1064
|
|
},
|
|
{
|
|
ID: "HP1815", NameDE: "Diagnosemodul — Software", NameEN: "Diagnostic Module — software",
|
|
RequiredComponentTags: []string{"has_software", "safety_device"},
|
|
RequiredEnergyTags: []string{},
|
|
RequiredLifecycles: []string{"operation"},
|
|
GeneratedHazardCats: []string{"software_fault"},
|
|
SuggestedMeasureIDs: []string{"M105", "M141"},
|
|
SuggestedEvidenceIDs: []string{"E14"},
|
|
Priority: 70,
|
|
// Source: R596, R1096
|
|
},
|
|
{
|
|
ID: "HP1816", NameDE: "Firewall — Software", NameEN: "Firewall — software",
|
|
RequiredComponentTags: []string{"networked", "security_device"},
|
|
RequiredEnergyTags: []string{},
|
|
RequiredLifecycles: []string{"operation"},
|
|
GeneratedHazardCats: []string{"unauthorized_access"},
|
|
SuggestedMeasureIDs: []string{"M188", "M186", "M141"},
|
|
SuggestedEvidenceIDs: []string{"E16"},
|
|
Priority: 85,
|
|
// Source: R587, R1087
|
|
},
|
|
{
|
|
ID: "HP1817", NameDE: "Firmware — Software", NameEN: "Firmware — software",
|
|
RequiredComponentTags: []string{"has_software", "programmable"},
|
|
RequiredEnergyTags: []string{},
|
|
RequiredLifecycles: []string{"software_update"},
|
|
GeneratedHazardCats: []string{"update_failure"},
|
|
SuggestedMeasureIDs: []string{"M188", "M186", "M141"},
|
|
SuggestedEvidenceIDs: []string{"E18"},
|
|
Priority: 70,
|
|
// Source: R338, R597, R1097
|
|
},
|
|
{
|
|
ID: "HP1818", NameDE: "Ofen — thermisch", NameEN: "Furnace — thermal",
|
|
RequiredComponentTags: []string{"high_temperature"},
|
|
RequiredEnergyTags: []string{"thermal"},
|
|
RequiredLifecycles: []string{"operation"},
|
|
GeneratedHazardCats: []string{"thermal_hazard"},
|
|
SuggestedMeasureIDs: []string{"M141"},
|
|
SuggestedEvidenceIDs: []string{"E20"},
|
|
Priority: 70,
|
|
// Source: R326, R580, R1080
|
|
},
|
|
{
|
|
ID: "HP1819", NameDE: "Ofenkammer — thermisch", NameEN: "Furnace Chamber — thermal",
|
|
RequiredComponentTags: []string{"high_temperature"},
|
|
RequiredEnergyTags: []string{"thermal"},
|
|
RequiredLifecycles: []string{"operation"},
|
|
GeneratedHazardCats: []string{"thermal_hazard"},
|
|
SuggestedMeasureIDs: []string{"M141"},
|
|
SuggestedEvidenceIDs: []string{"E20"},
|
|
Priority: 70,
|
|
// Source: R072
|
|
},
|
|
{
|
|
ID: "HP1820", NameDE: "Getriebe — mechanisch", NameEN: "Gearbox — mechanical",
|
|
RequiredComponentTags: []string{"pinch_point", "rotating_part"},
|
|
RequiredEnergyTags: []string{"kinetic"},
|
|
RequiredLifecycles: []string{"operation"},
|
|
GeneratedHazardCats: []string{"mechanical_hazard"},
|
|
SuggestedMeasureIDs: []string{"M004"},
|
|
SuggestedEvidenceIDs: []string{"E08"},
|
|
Priority: 80,
|
|
// Source: R055, R563, R1063
|
|
},
|
|
{
|
|
ID: "HP1821", NameDE: "Heizelement — thermisch", NameEN: "Heating Element — thermal",
|
|
RequiredComponentTags: []string{"high_temperature"},
|
|
RequiredEnergyTags: []string{"thermal"},
|
|
RequiredLifecycles: []string{"operation"},
|
|
GeneratedHazardCats: []string{"thermal_hazard"},
|
|
SuggestedMeasureIDs: []string{"M141"},
|
|
SuggestedEvidenceIDs: []string{"E10"},
|
|
Priority: 70,
|
|
// Source: R071, R325, R579, R1079
|
|
},
|
|
{
|
|
ID: "HP1822", NameDE: "HMI-Bedienterminal — elektrisch", NameEN: "Hmi — electrical",
|
|
RequiredComponentTags: []string{"has_software", "user_interface"},
|
|
RequiredEnergyTags: []string{"electrical_energy"},
|
|
RequiredLifecycles: []string{"operation"},
|
|
GeneratedHazardCats: []string{"hmi_error"},
|
|
SuggestedMeasureIDs: []string{"M131"},
|
|
SuggestedEvidenceIDs: []string{"E20"},
|
|
Priority: 70,
|
|
// Source: R333
|
|
},
|
|
{
|
|
ID: "HP1823", NameDE: "HMI-Panel — elektrisch", NameEN: "Hmi Panel — electrical",
|
|
RequiredComponentTags: []string{"has_software", "user_interface"},
|
|
RequiredEnergyTags: []string{"electrical_energy"},
|
|
RequiredLifecycles: []string{"operation"},
|
|
GeneratedHazardCats: []string{"hmi_error"},
|
|
SuggestedMeasureIDs: []string{"M131"},
|
|
SuggestedEvidenceIDs: []string{"E20"},
|
|
Priority: 70,
|
|
// Source: R079, R591, R1091
|
|
},
|
|
{
|
|
ID: "HP1824", NameDE: "Hydraulikzylinder — hydraulisch", NameEN: "Hydraulic Cylinder — hydraulic",
|
|
RequiredComponentTags: []string{"high_force", "high_pressure", "hydraulic_part", "moving_part"},
|
|
RequiredEnergyTags: []string{"hydraulic_pressure"},
|
|
RequiredLifecycles: []string{"maintenance", "operation"},
|
|
GeneratedHazardCats: []string{"mechanical_hazard"},
|
|
SuggestedMeasureIDs: []string{"M021", "M022"},
|
|
SuggestedEvidenceIDs: []string{"E08", "E11", "E20"},
|
|
Priority: 80,
|
|
// Source: R066, R319, R320, R572, R1072
|
|
},
|
|
{
|
|
ID: "HP1825", NameDE: "Hydraulikschlauch — hydraulisch", NameEN: "Hydraulic Hose — hydraulic",
|
|
RequiredComponentTags: []string{"high_pressure", "hydraulic_part"},
|
|
RequiredEnergyTags: []string{"hydraulic_pressure"},
|
|
RequiredLifecycles: []string{"operation"},
|
|
GeneratedHazardCats: []string{"pneumatic_hydraulic"},
|
|
SuggestedMeasureIDs: []string{"M051"},
|
|
SuggestedEvidenceIDs: []string{"E11"},
|
|
Priority: 70,
|
|
// Source: R067, R321, R573, R1073
|
|
},
|
|
{
|
|
ID: "HP1826", NameDE: "Hydraulikpumpe — hydraulisch", NameEN: "Hydraulic Pump — hydraulic",
|
|
RequiredComponentTags: []string{"high_pressure", "hydraulic_part"},
|
|
RequiredEnergyTags: []string{"hydraulic_pressure"},
|
|
RequiredLifecycles: []string{"operation"},
|
|
GeneratedHazardCats: []string{"pneumatic_hydraulic"},
|
|
SuggestedMeasureIDs: []string{"M021", "M022"},
|
|
SuggestedEvidenceIDs: []string{"E11", "E14"},
|
|
Priority: 70,
|
|
// Source: R068, R322, R571, R1071
|
|
},
|
|
{
|
|
ID: "HP1827", NameDE: "Hydrauliksystem — hydraulisch", NameEN: "Hydraulic System — hydraulic",
|
|
RequiredComponentTags: []string{"high_pressure", "hydraulic_part"},
|
|
RequiredEnergyTags: []string{"hydraulic_pressure"},
|
|
RequiredLifecycles: []string{"maintenance"},
|
|
GeneratedHazardCats: []string{"mechanical_hazard"},
|
|
SuggestedMeasureIDs: []string{"M021"},
|
|
SuggestedEvidenceIDs: []string{"E20"},
|
|
Priority: 80,
|
|
// Source: R575, R1075
|
|
},
|
|
{
|
|
ID: "HP1828", NameDE: "Hydraulikventil — hydraulisch", NameEN: "Hydraulic Valve — hydraulic",
|
|
RequiredComponentTags: []string{"high_pressure", "hydraulic_part"},
|
|
RequiredEnergyTags: []string{"hydraulic_pressure"},
|
|
RequiredLifecycles: []string{"operation"},
|
|
GeneratedHazardCats: []string{"pneumatic_hydraulic"},
|
|
SuggestedMeasureIDs: []string{"M522", "M539", "M141"},
|
|
SuggestedEvidenceIDs: []string{"E14"},
|
|
Priority: 70,
|
|
// Source: R574, R1074
|
|
},
|
|
}
|
|
}
|