Skip to content

Latest commit

 

History

3 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

FPL Legacy Power Plant Monitoring System

Demo Overview for NextEra Energy

This is a realistic legacy .NET application (circa 2010-2014) that demonstrates common technical debt patterns found in energy sector applications. Perfect for showcasing Claude Code's modernization capabilities.


Application Context

Original Purpose: Real-time monitoring and maintenance scheduling for FPL power generation facilities

Original Developers:

  • John Mitchell (retired 2019)
  • Sarah Chen (retired 2018)

Last Major Update: 2014

Current Status: Production system requiring modernization


Files Included

1. PowerPlantMonitor.cs

Main monitoring system that tracks plant performance metrics and triggers maintenance alerts.

Key Functionality:

  • Real-time plant readings (temperature, pressure, vibration, output)
  • Automated maintenance threshold detection
  • Outage event processing
  • Grid balancing logic
  • Daily report generation

2. OutageScheduler.cs

Coordinates planned maintenance windows and calculates revenue impact.

Key Functionality:

  • Schedule planned outages
  • Revenue loss calculation (2012 pricing model)
  • Optimal maintenance window detection
  • Conflict checking
  • Stakeholder notifications

Legacy Code Patterns (Problems to Highlight)

1. Security Vulnerabilities

  • SQL Injection: All queries use string concatenation
    • Example: "SELECT * FROM PlantReadings WHERE PlantID = '" + plantId + "'"
  • Hardcoded Credentials: Database passwords in source code
    • User Id=sa;Password=FPL2010!
  • SMTP Credentials: Email passwords in plaintext
  • No Input Validation: User input directly concatenated into SQL

2. Outdated Patterns

  • Direct ADO.NET: No ORM (Entity Framework would be modern)
  • No Async/Await: All database calls are synchronous
  • DataTable Usage: Pre-LINQ patterns
  • ArrayList: Generic collections not used
  • Manual Connection Management: No using statements
  • File-based Logging: Should use structured logging (Serilog, NLog)

3. Poor Error Handling

  • Silent Failures: Errors written to text files without monitoring
  • Swallowed Exceptions: Try-catch blocks that don't propagate
  • No Retry Logic: Database operations fail permanently
  • Missing Finally Blocks: Connections may not close

4. Business Logic Issues

  • Hardcoded Values: Thresholds, pricing, capacity limits
  • Outdated Pricing: 2012 electricity rates ($95 peak, $45 off-peak)
  • Simplified Calculations: Real demand forecasting is much more complex
  • Missing Validation: No checks for null, negative values, etc.
  • Lost Tribal Knowledge: Comments reference regulations/specs no longer accessible

5. Architecture Problems

  • No Separation of Concerns: Business logic mixed with data access
  • Tight Coupling: Direct database dependencies everywhere
  • No Dependency Injection: Creates its own connections
  • No Testing: Impossible to unit test
  • No Interfaces: Cannot mock dependencies
  • Stateful: Connection object stored as instance variable

6. Maintainability Issues

  • TODOs Never Addressed: "TODO: This needs updating per FERC Order 764"
  • Deprecated Systems: References to paging systems, legacy SMTP
  • No Documentation: Complex business rules not explained
  • Magic Numbers: Thresholds without context
  • Long Methods: 50+ line methods doing multiple things

Demo Flow with Claude Code

Phase 1: Analysis & Understanding (5 mins)

  1. Open the codebase in Claude Code
  2. Ask: "Analyze this legacy power plant monitoring system and identify security vulnerabilities, outdated patterns, and modernization opportunities"
  3. Show how Claude Code:
    • Identifies SQL injection vulnerabilities
    • Flags hardcoded credentials
    • Recognizes legacy .NET patterns
    • Understands energy sector business logic

Phase 2: Security Fixes (5 mins)

  1. Ask: "Fix all SQL injection vulnerabilities using parameterized queries"
  2. Ask: "Remove hardcoded credentials and implement configuration-based connection strings"
  3. Show:
    • Systematic refactoring across all methods
    • Proper parameter usage
    • Configuration file setup

Phase 3: Modernization (10 mins)

  1. Ask: "Modernize this to use Entity Framework Core, async/await, and dependency injection"

  2. Show:

    • Creating entity models
    • DbContext implementation
    • Converting to async methods
    • Adding interfaces for testability
    • Dependency injection setup
  3. Ask: "Add comprehensive error handling with structured logging using Serilog"

  4. Show:

    • Proper exception handling
    • Retry policies
    • Structured log events

Phase 4: Testing & Documentation (5 mins)

  1. Ask: "Generate unit tests for the OutageScheduler class"
  2. Ask: "Create comprehensive XML documentation comments explaining the business logic"
  3. Show:
    • Test coverage generation
    • Mock setup for database dependencies
    • Clear documentation of tribal knowledge

Phase 5: Additional Enhancements (5 mins - if time)

  1. Ask: "Update the pricing model to use modern time-of-use rates and integrate with market price APIs"
  2. Ask: "Create a migration guide for deploying this modernized version"
  3. Show forward-thinking capabilities

Key Messages During Demo

For Bryan's Team:

  1. Understands Legacy Context: Claude Code recognizes 2010-era .NET patterns
  2. Security First: Automatically identifies injection vulnerabilities
  3. Domain Awareness: Understands power plant operations, grid balancing, FERC regulations
  4. Systematic Modernization: Not just code completion - full architectural improvements
  5. Testing & Documentation: Generates tests and docs that help offshore teams
  6. Lost Knowledge Recovery: Can explain undocumented business rules

Differentiation from GitHub Copilot:

  • Beyond Autocomplete: Copilot suggests next line; Claude Code refactors entire architecture
  • Security Analysis: Proactively identifies vulnerabilities, not just completes code
  • Context Understanding: 200K token window = entire legacy codebase
  • Business Logic: Understands domain-specific concepts (reserve margins, FERC compliance)
  • Full Lifecycle: Analysis → Security → Modernization → Testing → Documentation

Energy Sector Terminology (Shows Domain Understanding)

  • Peaker Plants: Backup generators for high demand periods
  • Reserve Margin: Excess capacity above forecast demand (typically 15%)
  • FERC Order 764: Federal regulation on frequency response
  • MWh: Megawatt-hour pricing unit
  • Grid Balancing: Matching generation to demand in real-time
  • Time-of-Use Rates: Peak vs off-peak pricing
  • Capacity Factor: Actual vs maximum output ratio

Questions This Demo Answers

  1. Can Claude Code understand our old codebase? YES - recognizes patterns from 2010
  2. Can it handle our domain complexity? YES - understands power generation operations
  3. Will it find security issues we missed? YES - SQL injection, credential exposure
  4. Can it help our offshore team? YES - generates tests and documentation
  5. Is it better than Copilot? YES - architectural modernization, not just completion
  6. Can it preserve business logic? YES - maintains domain rules while modernizing tech

Follow-up Opportunities

After the demo, offer to:

  1. Analyze one of their actual legacy codebases (NDA-protected session)
  2. Create a modernization roadmap for specific applications
  3. Pilot with team working on COBOL → Java migrations
  4. Workshop with offshore contractors on using Claude Code for testing/documentation

Technical Requirements

Framework: .NET Framework 4.0+ (legacy) → .NET 6+ (modernized) Database: SQL Server (connection strings would need updating for demo) Dependencies: System.Data.SqlClient, System.Net.Mail

Note: This is demonstration code - not meant to be executed without proper database setup. Focus on the CODE PATTERNS and MODERNIZATION CAPABILITIES, not runtime execution.

About

Legacy .NET power plant monitoring system for demonstrating Claude Code modernization capabilities - NextEra Energy demo

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages