V&V-Only Mode Usage Guide
Overview
The NetworkManager now supports a V&V-Only Mode that allows you to validate existing database data without re-parsing input files. This is perfect for:
- Quick validation of existing data
- Regression testing after changes
- Data quality assessment without processing overhead
- Troubleshooting data issues
How to Enable V&V-Only Mode
Method 1: Configuration File (Recommended)
Copy the V&V-only configuration file:
copy NetworkManager.VVOnly.appsettings.json NetworkManager.appsettings.jsonUpdate the database connection string in the copied file to point to your target database
Run the NetworkManager - it will automatically detect V&V-only mode
Method 2: Modify Existing Configuration
Open your existing
NetworkManager.appsettings.jsonAdd or modify the V&V section:
"V&V": {
"EnableV&VOnlyMode": true,
"V&VOnlyMode": {
"SkipParsing": true,
"SkipDatabaseInserts": true,
"ValidateExistingData": true,
"GenerateDetailedReport": true,
"ExportReportToFile": true,
"ReportOutputPath": "./validation_reports"
}
}Run the NetworkManager
V&V-Only Mode Features
🔍 Comprehensive Validation
- Count Validation: Verifies record counts and relationships
- Data Quality Checks: Validates data ranges and types
- Business Rule Validation: Ensures EPANET-specific rules are followed
- Database Connectivity: Tests all table access
📊 Detailed Reporting
- Console Output: Real-time validation results with ✅/⚠️/❌ indicators
- Log File: Comprehensive logging to file
- Export Report: Detailed text report with timestamp
- Performance Metrics: Validation timing and statistics
⚙️ Configurable Options
- Enable/Disable: Turn V&V-only mode on/off
- Report Generation: Control report creation and export
- Output Path: Specify where reports are saved
- Validation Rules: Configure data ranges and thresholds
What Gets Validated
📈 Count Validation
- Node count vs Quality count (should match)
- Link count vs Status count (should match)
- Demand count vs Junction count (reasonable relationship)
- TankMixing count vs Tank count (reasonable relationship)
- Energy count vs Pump count (reasonable relationship)
- Leakage count vs Pipe count (reasonable relationship)
🔍 Data Quality Validation
- Elevations: Check for null values
- Diameters: Check for invalid values (≤ 0)
- Emitter Coefficients: Check for negative values
- Status Values: Check for valid OPEN/CLOSED or numeric values
📋 Business Rule Validation
- Tank Mixing: Only tanks should have mixing models
- Pump Energy: Only pumps should have energy settings
- Pattern Uniqueness: All patterns should have unique IDs
- Data Consistency: Cross-table relationship validation
Sample Output
Console Output
##########################################################################
🔍 STANDALONE V&V VALIDATION
##########################################################################
📊 RECORD COUNTS:
Nodes: 150
Links: 200
Patterns: 5
Curves: 3
Time Parameters: 1
Options: 1
Demands: 120
Sources: 2
Reactions: 1
Tank Mixing: 3
Energy: 4
Emitters: 8
Leakage: 15
Quality: 150
Status: 200
Report: 1
✅ Node-Quality count match: 150
✅ Link-Status count match: 200
✅ Demand-Junction relationship valid: 120 demands for 125 junctions
✅ TankMixing-Tank relationship valid: 3 mixing models for 5 tanks
✅ Energy-Pump relationship valid: 4 energy records for 3 pumps
✅ Leakage-Pipe relationship valid: 15 leakage records for 180 pipes
✅ All nodes have elevation values
✅ All links have valid diameters
✅ All emitters have non-negative coefficients
✅ All status values are valid
✅ All mixing models are assigned to tanks
✅ All energy settings are assigned to pumps
✅ All patterns have unique IDs
##########################################################################
✅ V&V Validation completed: 0 errors, 0 warnings
✅ Validation PASSED - All checks successful
📄 Detailed report available at: ./validation_reports/vv_validation_report_20241215_143022.txt
Report File Content
=== NetworkManager V&V Validation Report ===
Generated: 2024-12-15 14:30:22
Validation Mode: Standalone V&V
Duration: 1250ms
=== SUMMARY ===
Validation Status: PASSED
Error Count: 0
Warning Count: 0
=== RECORD COUNTS ===
DataCurves: 3
Demands: 120
Emitters: 8
Energy: 4
Leakage: 15
Links: 200
Nodes: 150
Options: 1
Patterns: 5
Quality: 150
Reactions: 1
Report: 1
Sources: 2
Status: 200
TankMixing: 3
TimeParameters: 1
=== SUCCESS MESSAGES ===
✅ Node-Quality count match: 150
✅ Link-Status count match: 200
✅ Demand-Junction relationship valid: 120 demands for 125 junctions
✅ TankMixing-Tank relationship valid: 3 mixing models for 5 tanks
✅ Energy-Pump relationship valid: 4 energy records for 3 pumps
✅ Leakage-Pipe relationship valid: 15 leakage records for 180 pipes
✅ All nodes have elevation values
✅ All links have valid diameters
✅ All emitters have non-negative coefficients
✅ All status values are valid
✅ All mixing models are assigned to tanks
✅ All energy settings are assigned to pumps
✅ All patterns have unique IDs
=== DATA QUALITY METRICS ===
Total Records: 863
Tables with Data: 16
Empty Tables: 0
Configuration Options
V&V-Only Mode Settings
"V&V": {
"EnableV&VOnlyMode": true, // Enable V&V-only mode
"V&VOnlyMode": {
"SkipParsing": true, // Skip input file parsing
"SkipDatabaseInserts": true, // Skip database inserts
"ValidateExistingData": true, // Validate existing data
"GenerateDetailedReport": true, // Generate detailed report
"ExportReportToFile": true, // Export report to file
"ReportOutputPath": "./validation_reports" // Report output directory
}
}
Validation Settings
"Validation": {
"EnableCountValidation": true, // Enable count validation
"EnableDataQualityValidation": true, // Enable data quality checks
"EnableBusinessRuleValidation": true, // Enable business rule validation
"GenerateReport": true, // Generate validation report
"DataRanges": { // Data range validation
"Elevation": { "Min": -1000, "Max": 10000 },
"Diameter": { "Min": 0.1, "Max": 100 },
"EmitterCoefficient": { "Min": 0, "Max": 1000 }
},
"PerformanceThresholds": { // Performance monitoring
"MaxParseTimeMs": 5000,
"MaxMemoryUsageMB": 500
}
}
Use Cases
🔄 Regression Testing
After making changes to the NetworkManager, run V&V-only mode to ensure existing data is still valid.
🐛 Troubleshooting
When encountering data issues, use V&V-only mode to quickly identify problems without re-processing.
📊 Data Quality Assessment
Regularly run V&V-only mode to monitor data quality and catch issues early.
⚡ Performance Testing
Use V&V-only mode to test validation performance without the overhead of parsing.
Tips and Best Practices
- Regular Validation: Run V&V-only mode regularly to catch data issues early
- Report Archiving: Keep validation reports for historical comparison
- Configuration Management: Use separate config files for different environments
- Automated Testing: Integrate V&V-only mode into your testing pipeline
- Performance Monitoring: Use the performance thresholds to identify slow validations
Troubleshooting
Common Issues
❌ "Cannot connect to database"
- Check your connection string in the configuration
- Ensure the database server is running
- Verify database credentials
❌ "Cannot access table [TableName]"
- Check if the table exists in the database
- Verify table permissions
- Ensure the database schema is up to date
⚠️ "Validation warnings"
- Review the warning messages in the report
- Check if the warnings are expected for your data
- Consider adjusting validation thresholds if needed
Getting Help
If you encounter issues with V&V-only mode:
- Check the log files for detailed error messages
- Review the validation report for specific issues
- Verify your configuration settings
- Ensure your database schema is current