Python project for analyzing alarm data from building monitoring systems. Includes alarm analyzer, plotting, tests, and source data files.
1.8 KiB
1.8 KiB
Alarm Analysis
Python project for analyzing alarm data from building monitoring systems (CSV alarm logs + XLSX sensor reports).
Commands
# Activate virtual environment
source alarm_analysis_env/Scripts/activate # Windows Git Bash
# or: alarm_analysis_env\Scripts\activate # Windows CMD
# Run full analysis (no plots)
python run_analysis.py
# Generate plots (requires matplotlib display)
python create_plots.py
# Run tests
python test_changes.py
python test_duration_fix.py
python test_mapping.py
python test_enhanced_plotting.py
Architecture
alarm_analyzer.py— MainAlarmAnalyzerclass (~96KB). Handles data loading, alarm categorization, event pairing, duration calculation, basic/advanced analysis, uptime metrics, and export.run_analysis.py— Entry point that runs the full pipeline without visualizations.create_plots.py— Generates alarm dashboard, duration analysis, and sensor analysis plots.
Data Files
CardinalAlarmsDec25.csv— Raw alarm data (columns: Alarm_Id, Sensor_Id, Date, Description, LogTime)SensorReport Cardinal 2025-12-23_processed.xlsx— Sensor descriptions and group mappingsexclusion_config.json— JSON format:{"excluded_groups": ["GroupName1"]}groups_to_skip.txt— Text format: one group name per line
Key Patterns
- Alarm types are parsed from Description field via regex: Hi/Lo Alarm, Hi/Lo Warning, Error, Normal
- Events are paired (alarm start -> Normal end) to calculate durations
- Sensor mapping links Sensor_Id to human-readable names and groups from the XLSX file
- Visualization imports are deferred (
_import_viz_libs()) so analysis can run headless - Output goes to
output/(CSVs) andplots/(PNGs)
Dependencies
Python 3.13 with: pandas, numpy, matplotlib, seaborn, openpyxl