@flexabrain/mcp-server
Version:
Advanced electrical schematic analysis MCP server with rail engineering expertise
403 lines • 17.1 kB
JavaScript
/**
* FlexaBrain MCP Server - Rail Electrical Component Database
*
* Comprehensive database of rail electrical components with specifications,
* standards, and maintenance requirements based on field expertise.
*/
import { ComponentType } from '../types/electrical.js';
/**
* Rail Electrical Component Recognition Patterns
* Based on international rail electrical standards and naming conventions
*/
export const RAIL_COMPONENT_PATTERNS = {
// Power Conversion Components
[ComponentType.CONVERTER]: {
patterns: [
/^A\d{1,4}[A-Z]?$/i, // A601, A1205A (Standard converter naming)
/^CONV\d+[A-Z]?$/i, // CONV01, CONV205B
/^INV\d+[A-Z]?$/i, // INV01, INV302A (Inverter section)
/^REC\d+[A-Z]?$/i, // REC01, REC205B (Rectifier section)
],
prefixes: ['A', 'CONV', 'INV', 'REC'],
description: 'Traction converters, auxiliary converters, and power electronic modules',
confidence_boost: 0.95,
typical_locations: ['roof', 'underframe', 'equipment_bay'],
context_clues: ['traction', 'auxiliary', 'power', 'converter', 'inverter', 'rectifier']
},
[ComponentType.TRANSFORMER]: {
patterns: [
/^TR?\d{1,4}[A-Z]?$/i, // TR205, T1001A
/^TRANS\d+[A-Z]?$/i, // TRANS01
/^TX\d+[A-Z]?$/i, // TX205A
],
prefixes: ['TR', 'T', 'TRANS', 'TX'],
description: 'Traction transformers, auxiliary transformers, and isolation transformers',
confidence_boost: 0.92,
typical_locations: ['roof', 'underframe', 'transformer_bay'],
context_clues: ['transformer', 'isolation', 'step-down', 'step-up', 'primary', 'secondary']
},
// Protection Components
[ComponentType.CIRCUIT_BREAKER]: {
patterns: [
/^CB\d{1,4}[A-Z]?$/i, // CB101, CB205A
/^Q\d{1,4}[A-Z]?$/i, // Q101, Q205A (IEC notation)
/^BR\d+[A-Z]?$/i, // BR101A
/^MCB\d+[A-Z]?$/i, // MCB101 (Miniature Circuit Breaker)
],
prefixes: ['CB', 'Q', 'BR', 'MCB'],
description: 'Main circuit breakers, feeder breakers, and protection devices',
confidence_boost: 0.92,
typical_locations: ['hv_cabinet', 'distribution_panel', 'switchboard'],
context_clues: ['breaker', 'protection', 'overcurrent', 'fault', 'trip']
},
[ComponentType.FUSE]: {
patterns: [
/^FU\d{1,4}[A-Z]?$/i, // FU101, FU205A
/^F\d{1,4}[A-Z]?$/i, // F101, F205A
],
prefixes: ['FU', 'F'],
description: 'High-voltage fuses and protection fuses',
confidence_boost: 0.88,
typical_locations: ['fuse_box', 'protection_panel'],
context_clues: ['fuse', 'protection', 'overcurrent']
},
[ComponentType.RELAY]: {
patterns: [
/^[A-Z]{1,3}R\d*[A-Z]?$/i, // KR101, TR205A, AR01
/^R\d{1,4}[A-Z]?$/i, // R101, R205A
/^REL\d+[A-Z]?$/i, // REL101A
],
prefixes: ['R', 'KR', 'TR', 'AR', 'REL'],
description: 'Control relays, protection relays, and auxiliary relays',
confidence_boost: 0.85,
typical_locations: ['control_cabinet', 'relay_panel'],
context_clues: ['relay', 'control', 'auxiliary', 'protection']
},
// Control Components
[ComponentType.CONTACTOR]: {
patterns: [
/^K\d{1,4}[A-Z]?$/i, // K101, K205A
/^KM\d{1,4}[A-Z]?$/i, // KM101, KM205A
/^C\d{1,4}[A-Z]?$/i, // C101, C205A
],
prefixes: ['K', 'KM', 'C'],
description: 'Main contactors, auxiliary contactors, and switching devices',
confidence_boost: 0.90,
typical_locations: ['control_cabinet', 'contactor_panel'],
context_clues: ['contactor', 'switching', 'control', 'auxiliary']
},
[ComponentType.SWITCH]: {
patterns: [
/^S\d{1,4}[A-Z]?$/i, // S101, S205A
/^SW\d+[A-Z]?$/i, // SW101A
],
prefixes: ['S', 'SW'],
description: 'Manual switches, selector switches, and control switches',
confidence_boost: 0.80,
typical_locations: ['operator_panel', 'control_desk'],
context_clues: ['switch', 'selector', 'manual', 'control']
},
// Connection Components
[ComponentType.JUNCTION_BOX]: {
patterns: [
/^J\d{1,4}[A-Z]?$/i, // J101, J205A
/^JP\d{1,4}[A-Z]?$/i, // JP101, JP205A
/^JB\d+[A-Z]?$/i, // JB101A
],
prefixes: ['J', 'JP', 'JB'],
description: 'Junction boxes, connection points, and terminal assemblies',
confidence_boost: 0.75,
typical_locations: ['underframe', 'cable_routing'],
context_clues: ['junction', 'connection', 'terminal', 'box']
},
[ComponentType.TERMINAL_BLOCK]: {
patterns: [
/^TB\d{1,4}[A-Z]?$/i, // TB101, TB205A
/^X\d{1,4}[A-Z]?$/i, // X101, X205A
],
prefixes: ['TB', 'X'],
description: 'Terminal blocks and connection strips',
confidence_boost: 0.70,
typical_locations: ['control_cabinet', 'junction_box'],
context_clues: ['terminal', 'block', 'connection', 'strip']
},
// Signal Components (8-digit format for rail signaling)
[ComponentType.SIGNAL_REFERENCE]: {
patterns: [
/^\d{8}$/, // 99010101 (Standard signal reference format)
/^\d{6,8}$/, // 991001, 99010101
],
prefixes: [],
description: 'Signal reference numbers and system identifiers',
confidence_boost: 0.98,
typical_locations: ['signal_cabinet', 'interlocking'],
context_clues: ['signal', 'reference', 'interlocking', 'control']
},
[ComponentType.SIGNAL_MODULE]: {
patterns: [
/^SM\d+[A-Z]?$/i, // SM101A
/^SIG\d+[A-Z]?$/i, // SIG101A
],
prefixes: ['SM', 'SIG'],
description: 'Signal processing modules and interface cards',
confidence_boost: 0.85,
typical_locations: ['signal_cabinet', 'control_room'],
context_clues: ['signal', 'module', 'interface', 'processing']
},
// Measurement Components
[ComponentType.AMMETER]: {
patterns: [
/^AI\d+[A-Z]?$/i, // AI101A (Ammeter Indicator)
/^AM\d+[A-Z]?$/i, // AM101A
],
prefixes: ['AI', 'AM'],
description: 'Current measurement devices and ammeters',
confidence_boost: 0.80,
typical_locations: ['control_panel', 'measurement_cabinet'],
context_clues: ['ammeter', 'current', 'measurement', 'A']
},
[ComponentType.VOLTMETER]: {
patterns: [
/^VI\d+[A-Z]?$/i, // VI101A (Voltage Indicator)
/^VM\d+[A-Z]?$/i, // VM101A
],
prefixes: ['VI', 'VM'],
description: 'Voltage measurement devices and voltmeters',
confidence_boost: 0.80,
typical_locations: ['control_panel', 'measurement_cabinet'],
context_clues: ['voltmeter', 'voltage', 'measurement', 'V', 'kV']
},
// Default cases for unknown components
[ComponentType.INVERTER]: {
patterns: [/^INV\d+[A-Z]?$/i],
prefixes: ['INV'],
description: 'Power inverter modules',
confidence_boost: 0.85,
typical_locations: ['power_cabinet'],
context_clues: ['inverter', 'power', 'conversion']
},
[ComponentType.RECTIFIER]: {
patterns: [/^REC\d+[A-Z]?$/i],
prefixes: ['REC'],
description: 'Rectifier modules and AC/DC converters',
confidence_boost: 0.85,
typical_locations: ['power_cabinet'],
context_clues: ['rectifier', 'ac/dc', 'conversion']
},
[ComponentType.SURGE_PROTECTOR]: {
patterns: [/^SP\d+[A-Z]?$/i, /^SPD\d+[A-Z]?$/i],
prefixes: ['SP', 'SPD'],
description: 'Surge protection devices',
confidence_boost: 0.80,
typical_locations: ['protection_panel'],
context_clues: ['surge', 'protection', 'SPD']
},
[ComponentType.PUSHBUTTON]: {
patterns: [/^PB\d+[A-Z]?$/i, /^BTN\d+[A-Z]?$/i],
prefixes: ['PB', 'BTN'],
description: 'Control pushbuttons and switches',
confidence_boost: 0.75,
typical_locations: ['operator_panel'],
context_clues: ['pushbutton', 'button', 'control']
},
[ComponentType.INDICATOR]: {
patterns: [/^IND\d+[A-Z]?$/i, /^LED\d+[A-Z]?$/i],
prefixes: ['IND', 'LED'],
description: 'Status indicators and pilot lights',
confidence_boost: 0.70,
typical_locations: ['operator_panel'],
context_clues: ['indicator', 'light', 'LED', 'status']
},
[ComponentType.CONNECTOR]: {
patterns: [/^CON\d+[A-Z]?$/i, /^CONN\d+[A-Z]?$/i],
prefixes: ['CON', 'CONN'],
description: 'Electrical connectors and plugs',
confidence_boost: 0.70,
typical_locations: ['cable_routing'],
context_clues: ['connector', 'plug', 'socket']
},
[ComponentType.CABLE]: {
patterns: [/^CAB\d+[A-Z]?$/i, /^CBL\d+[A-Z]?$/i],
prefixes: ['CAB', 'CBL'],
description: 'Power and control cables',
confidence_boost: 0.70,
typical_locations: ['cable_routing'],
context_clues: ['cable', 'wire', 'harness']
},
[ComponentType.FREQUENCY_METER]: {
patterns: [/^FI\d+[A-Z]?$/i, /^FM\d+[A-Z]?$/i],
prefixes: ['FI', 'FM'],
description: 'Frequency measurement devices',
confidence_boost: 0.80,
typical_locations: ['control_panel'],
context_clues: ['frequency', 'Hz', 'measurement']
},
[ComponentType.POWER_METER]: {
patterns: [/^PI\d+[A-Z]?$/i, /^PM\d+[A-Z]?$/i],
prefixes: ['PI', 'PM'],
description: 'Power measurement devices',
confidence_boost: 0.80,
typical_locations: ['control_panel'],
context_clues: ['power', 'watt', 'kW', 'MW', 'measurement']
},
[ComponentType.COMMUNICATION_MODULE]: {
patterns: [/^CM\d+[A-Z]?$/i, /^COM\d+[A-Z]?$/i],
prefixes: ['CM', 'COM'],
description: 'Communication interface modules',
confidence_boost: 0.80,
typical_locations: ['control_cabinet'],
context_clues: ['communication', 'interface', 'protocol']
},
[ComponentType.UNKNOWN]: {
patterns: [],
prefixes: [],
description: 'Unidentified component',
confidence_boost: 0.10,
typical_locations: [],
context_clues: []
},
[ComponentType.OTHER]: {
patterns: [],
prefixes: [],
description: 'Other electrical component',
confidence_boost: 0.20,
typical_locations: [],
context_clues: []
}
};
/**
* Rail-Specific Component Specifications
* Based on international rail electrical standards (IEC, EN, IEEE)
*/
const createDefaultSpec = () => ({
voltage_rating: { min: 24, max: 1000, unit: 'V_AC' },
current_rating: { min: 1, max: 100, unit: 'A' },
standards_compliance: ['EN 50155'],
safety_requirements: [
{ type: 'ELECTRICAL_SHOCK', voltage_class: 'LV' }
],
maintenance_intervals: {
inspection: { frequency: 12, unit: 'months' }
},
rail_specific: {
traction_systems: ['DC', 'AC'],
voltage_classes: ['LV'],
typical_applications: ['control', 'indication'],
interoperability_standards: ['EN 50155'],
environmental_ratings: ['EN50155']
}
});
export const RAIL_COMPONENT_SPECIFICATIONS = {
// High-priority rail components with detailed specifications
[ComponentType.CONVERTER]: {
voltage_rating: { min: 750, max: 25000, nominal: 3000, unit: 'V_DC' },
current_rating: { min: 100, max: 4000, nominal: 1000, unit: 'A' },
power_rating: { min: 100, max: 10000, nominal: 2000, unit: 'kW' },
frequency: { nominal: 50, tolerance: 2, unit: 'Hz' },
operating_temperature: { min: -40, max: 85, unit: 'C' },
standards_compliance: ['IEC 61375', 'EN 50155', 'IEEE 519', 'EN 50124'],
safety_requirements: [
{ type: 'ARC_FLASH', category: 2, ppe_required: true, voltage_class: 'HV' },
{ type: 'ELECTRICAL_SHOCK', voltage_class: 'HV' },
{ type: 'THERMAL', max_temperature: 85 }
],
maintenance_intervals: {
inspection: { frequency: 3, unit: 'months' },
testing: { frequency: 12, unit: 'months' },
overhaul: { frequency: 60, unit: 'months' }
},
rail_specific: {
traction_systems: ['DC', 'AC', 'DUAL'],
voltage_classes: ['750V_DC', '1500V_DC', '3000V_DC', '15kV_AC', '25kV_AC'],
typical_applications: ['traction_power', 'auxiliary_power', 'hotel_load'],
interoperability_standards: ['TSI', 'ERA', 'UIC'],
environmental_ratings: ['EN50155', 'IEC60068']
}
},
[ComponentType.CIRCUIT_BREAKER]: {
voltage_rating: { min: 415, max: 25000, nominal: 3000, unit: 'V_AC' },
current_rating: { min: 16, max: 6300, nominal: 1000, unit: 'A' },
standards_compliance: ['IEC 62271', 'IEEE C37.04', 'EN 50152', 'IEC 61850'],
safety_requirements: [
{ type: 'ARC_FLASH', category: 3, ppe_required: true, voltage_class: 'HV' },
{ type: 'MECHANICAL', operation_force: 'high' }
],
maintenance_intervals: {
inspection: { frequency: 6, unit: 'months' },
testing: { frequency: 12, unit: 'months' },
overhaul: { frequency: 120, unit: 'months' }
},
rail_specific: {
traction_systems: ['DC', 'AC'],
voltage_classes: ['LV', 'MV', 'HV'],
typical_applications: ['main_breaker', 'feeder_protection', 'motor_protection'],
interoperability_standards: ['IEC 62271', 'EN 50152'],
environmental_ratings: ['EN50155', 'IEC60068-2']
}
},
[ComponentType.TRANSFORMER]: {
voltage_rating: { min: 230, max: 25000, nominal: 15000, unit: 'V_AC' },
current_rating: { min: 10, max: 2000, nominal: 500, unit: 'A' },
power_rating: { min: 10, max: 15000, nominal: 2000, unit: 'kVA' },
frequency: { nominal: 50, tolerance: 1, unit: 'Hz' },
standards_compliance: ['IEC 60076', 'EN 50155', 'IEC 61378'],
safety_requirements: [
{ type: 'ELECTRICAL_SHOCK', voltage_class: 'HV' },
{ type: 'THERMAL', max_temperature: 105 }
],
maintenance_intervals: {
inspection: { frequency: 6, unit: 'months' },
testing: { frequency: 24, unit: 'months' },
overhaul: { frequency: 180, unit: 'months' }
},
rail_specific: {
traction_systems: ['AC'],
voltage_classes: ['15kV_AC', '25kV_AC'],
typical_applications: ['traction_transformer', 'auxiliary_transformer'],
interoperability_standards: ['EN 50388', 'IEC 61378'],
environmental_ratings: ['EN50155']
}
},
[ComponentType.CONTACTOR]: {
voltage_rating: { min: 24, max: 1000, nominal: 230, unit: 'V_AC' },
current_rating: { min: 5, max: 500, nominal: 100, unit: 'A' },
standards_compliance: ['IEC 60947-4', 'EN 50155'],
safety_requirements: [
{ type: 'ELECTRICAL_SHOCK', voltage_class: 'LV' }
],
maintenance_intervals: {
inspection: { frequency: 6, unit: 'months' },
testing: { frequency: 24, unit: 'months' }
},
rail_specific: {
traction_systems: ['DC', 'AC'],
voltage_classes: ['LV', 'MV'],
typical_applications: ['motor_control', 'auxiliary_switching'],
interoperability_standards: ['EN 50155'],
environmental_ratings: ['EN50155']
}
},
// All other components get default specifications
[ComponentType.INVERTER]: createDefaultSpec(),
[ComponentType.RECTIFIER]: createDefaultSpec(),
[ComponentType.FUSE]: createDefaultSpec(),
[ComponentType.SURGE_PROTECTOR]: createDefaultSpec(),
[ComponentType.RELAY]: createDefaultSpec(),
[ComponentType.SWITCH]: createDefaultSpec(),
[ComponentType.PUSHBUTTON]: createDefaultSpec(),
[ComponentType.INDICATOR]: createDefaultSpec(),
[ComponentType.JUNCTION_BOX]: createDefaultSpec(),
[ComponentType.TERMINAL_BLOCK]: createDefaultSpec(),
[ComponentType.CONNECTOR]: createDefaultSpec(),
[ComponentType.CABLE]: createDefaultSpec(),
[ComponentType.AMMETER]: createDefaultSpec(),
[ComponentType.VOLTMETER]: createDefaultSpec(),
[ComponentType.FREQUENCY_METER]: createDefaultSpec(),
[ComponentType.POWER_METER]: createDefaultSpec(),
[ComponentType.SIGNAL_MODULE]: createDefaultSpec(),
[ComponentType.SIGNAL_REFERENCE]: createDefaultSpec(),
[ComponentType.COMMUNICATION_MODULE]: createDefaultSpec(),
[ComponentType.UNKNOWN]: createDefaultSpec(),
[ComponentType.OTHER]: createDefaultSpec()
};
//# sourceMappingURL=rail-components.js.map