{"id":21025746,"url":"https://github.com/newking9088/a-b-n_testing_best_charging_algorithm","last_synced_at":"2026-04-28T13:06:38.141Z","repository":{"id":262721221,"uuid":"888142536","full_name":"newking9088/A-B-N_testing_best_charging_algorithm","owner":"newking9088","description":"This repository contains code and documentation for evaluating battery charging algorithms through statistical analysis. We developed a framework for comparing multiple charging algorithms against the traditional Constant Current-Constant Voltage (CCCV) method using A/B/N testing and post-hoc analysis.","archived":false,"fork":false,"pushed_at":"2024-11-14T00:55:46.000Z","size":504,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-01-01T12:10:48.602Z","etag":null,"topics":["ab-testing","battery","multivariate-analysis","posthoc-tests"],"latest_commit_sha":null,"homepage":"","language":"Jupyter Notebook","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/newking9088.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-11-13T22:17:59.000Z","updated_at":"2025-05-09T15:26:08.000Z","dependencies_parsed_at":"2024-11-13T23:23:23.953Z","dependency_job_id":"46eb6131-fd68-40a2-8d3a-f02f121357b0","html_url":"https://github.com/newking9088/A-B-N_testing_best_charging_algorithm","commit_stats":null,"previous_names":["newking9088/a-b-n_testing_best_charging_algorithm"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/newking9088/A-B-N_testing_best_charging_algorithm","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/newking9088%2FA-B-N_testing_best_charging_algorithm","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/newking9088%2FA-B-N_testing_best_charging_algorithm/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/newking9088%2FA-B-N_testing_best_charging_algorithm/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/newking9088%2FA-B-N_testing_best_charging_algorithm/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/newking9088","download_url":"https://codeload.github.com/newking9088/A-B-N_testing_best_charging_algorithm/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/newking9088%2FA-B-N_testing_best_charging_algorithm/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32381781,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-28T11:25:28.583Z","status":"ssl_error","status_checked_at":"2026-04-28T11:25:05.435Z","response_time":56,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ab-testing","battery","multivariate-analysis","posthoc-tests"],"created_at":"2024-11-19T11:36:27.002Z","updated_at":"2026-04-28T13:06:38.122Z","avatar_url":"https://github.com/newking9088.png","language":"Jupyter Notebook","funding_links":[],"categories":[],"sub_categories":[],"readme":"# A/B/N Testing and Post-Hoc Analysis for Finding Best Charging Algorithm 🔋⚡\nThis repository contains code and documentation for evaluating battery charging algorithms through statistical analysis. We developed a framework for comparing multiple charging algorithms against the traditional Constant Current-Constant Voltage (CCCV) method using A/B/N testing and posthoc analysis. The evaluation metric we are using is the average charge time.\n\n# Experimental Design for Battery Charging Algorithm Optimization\n\n## Abstract\nThis study evaluates multiple novel battery charging algorithms against the traditional Constant Current-Constant Voltage (CCCV) method. Due to confidentiality agreements, synthetic data was generated based on real-world parameters, including charging times, natural variations, and expected improvements. The study employs rigorous statistical methods, including power analysis, ANOVA, and posthoc testing, to identify significant improvements in charging performance.\n\n## 1. Introduction\n\n### 1.1 Background\nBattery charging optimization remains a critical challenge in energy storage systems. While CCCV is the industry standard, novel algorithms promise improved charging times without compromising battery health. This study evaluates 10 new algorithms against CCCV, using synthetic data generated with real-world parameters.\n\n### 1.2 Study Objectives\n- Determine if any new charging algorithms significantly outperform CCCV\n- Identify algorithms that achieve \u003e8% reduction in charging time\n- Maintain statistical rigor despite using synthetic data\n- Provide clear recommendations for algorithm selection\n\n## 2. Methodology\n\n### 2.1 Sample Size Calculation\nThe sample size was determined using power analysis with the following parameters:\n\n- Base charging time: 40 minutes\n- Expected variation: ±5% (based on actual measurements)\n- Minimum detectable effect: 8% improvement\n- Significance level (α): 0.05\n- Statistical power (1-β): 0.80\n- Number of groups: 11 (CCCV + 10 algorithms)\n\nThe formula used:\n```\nn = 2 * ((Z_α + Z_β)²) * (σ²) / (δ²)\n```\n\nWhere:\n- Z_α: Critical value for significance level with Bonferroni correction\n- Z_β: Critical value for desired power\n- σ: Standard deviation (2 minutes = 5% of 40)\n- δ: Minimum detectable difference (3.2 minutes = 8% of 40)\n\nThis calculation yielded 21 samples per group, ensuring adequate power to detect meaningful differences.\n\n### 2.2 Experimental Design\n\n#### 2.2.1 Data Generation Parameters\n- Base charging time: 40 minutes (from real measurements)\n- Natural variation: ±5% (observed in controlled conditions)\n- Algorithm effects: Various improvements ranging from 2% to 15%\n- Sample size: 21 batteries per algorithm\n\n#### 2.2.2 Control Measures\nTo ensure reliability in real experiments:\n- All batteries from the same production batch\n- Identical charging platform\n- Identical software and hardware version\n- Identical platform calibration\n- Controlled temperature (25°C ±2°C)\n- Standardized initial conditions\n- Multiple measurements per battery\n- Randomized testing order\n\n## 3. Statistical Analysis Framework\n\n### 3.1 One-way ANOVA\nANOVA was chosen as the primary statistical test for several reasons:\n1. Multiple group comparison (11 groups)\n2. Continuous outcome variable (charging time)\n3. Independent samples\n4. Controls family-wise error rate\n5. Provides overall test of significance before detailed comparisons\n\n### 3.2 Post-hoc Analysis with Bonferroni Correction\nBonferroni correction was selected for post-hoc analysis because:\n1. Conservative approach suitable for critical battery applications\n2. Controls Type I error rate across multiple comparisons\n3. Simple interpretation for stakeholders\n4. Particularly effective when specific comparisons (vs CCCV) are of primary interest\n\nThe adjusted significance level:\n```\nα_adjusted = 0.05 / number_of_comparisons\n```\n\n### 3.3 Effect Size Calculation\nCohen's d was used to measure effect size:\n```\nd = (mean₁ - mean₂) / √((σ₁² + σ₂²) / 2)\n```\n\nEffect size interpretation:\n- Small: d ≈ 0.2\n- Medium: d ≈ 0.5\n- Large: d ≈ 0.8\n\n## 4. Success Criteria\n\n### 4.1 Primary Criteria\nAn algorithm is considered successful if:\n1. Demonstrates \u003e8% reduction in charging time vs CCCV\n2. Achieves statistical significance (p \u003c α_adjusted)\n3. Shows consistent performance (CV \u003c 5%)\n\n### 4.2 Secondary Criteria\nAdditional considerations include:\n1. Effect size (Cohen's d \u003e 0.5 preferred)\n2. Confidence interval range\n3. Performance consistency across multiple tests\n\n## 5. Limitations and Considerations\n\n### 5.1 Use of Synthetic Data\nWhile synthetic data was used due to NDAs, the following measures ensure relevance:\n- Based on real measurements of charging times\n- Incorporates actual observed variations\n- Models realistic improvement margins\n- Maintains real-world constraints\n\n### 5.2 Statistical Considerations\n1. Bonferroni correction may be overly conservative\n2. Assumption of normal distribution\n3. Homogeneity of variance assumption\n4. Independence of samples\n\n### 5.3 Practical Implications\n- Results should be validated with real-world testing\n- Long-term effects need separate study\n- Battery degradation not considered in this analysis\n- Temperature effects simplified\n\n## 6. Results and Analysis\n\u003cdiv align=\"center\"\u003e\n  \u003cfigure\u003e\n    \u003cimg src=\"https://raw.githubusercontent.com/newking9088/A-B-N_testing_best_charging_algorithm/main/ab.png\" alt=\"Battery Charging Algorithm Performance Analysis\" width=\"900\"\u003e\n    \u003cfigcaption\u003e\n\n\u003cstrong\u003eFigure 1:\u003c/strong\u003e Detailed analysis of battery charging algorithms showing: (A) Box plot distribution of charging times across algorithms with ANOVA significance, (B) Mean differences compared to CCCV with 95% confidence intervals, (C) Pairwise comparison p-values with Bonferroni correction, and (D) Cohen's d effect sizes for all algorithm combinations.\n    \u003c/figcaption\u003e\n  \u003c/figure\u003e\n\u003c/div\u003e\n\n### 6.1 Overall Statistical Significance\nThe one-way ANOVA revealed highly significant differences among the charging algorithms (p = 0.0000), indicating that charging performance varies meaningfully across different algorithms.\n\n### 6.2 Algorithm Performance Categories\n\n#### 6.2.1 Strong Performers (\u003e8% improvement)\n1. **ALGO1**\n   - Largest improvement: ~12.5% reduction in charging time\n   - Mean difference: ~5 minutes faster than CCCV\n   - Highly consistent performance (narrow CI)\n   - Large effect size (Cohen's d \u003e 0.8)\n   - Statistically significant (p \u003c 0.001, Bonferroni-corrected)\n\n2. **ALGO4**\n   - ~9% reduction in charging time\n   - Mean difference: ~3.5 minutes faster\n   - Strong consistency in performance\n   - Large effect size (Cohen's d ≈ 0.75)\n   - Statistically significant (p \u003c 0.001, Bonferroni-corrected)\n\n#### 6.2.2 Moderate Performers (5-8% improvement)\n1. **ALGO8**\n   - ~7.5% reduction in charging time\n   - Mean difference: ~3 minutes faster\n   - Good consistency (moderate CI width)\n   - Medium effect size (Cohen's d ≈ 0.6)\n   - Statistically significant (p \u003c 0.01, Bonferroni-corrected)\n\n2. **ALGO6**\n   - ~6% reduction in charging time\n   - Mean difference: ~2.5 minutes faster\n   - Acceptable consistency\n   - Medium effect size (Cohen's d ≈ 0.5)\n   - Statistically significant (p \u003c 0.01, Bonferroni-corrected)\n\n#### 6.2.3 Minimal Performers (\u003c5% improvement)\n1. **ALGO2**, **ALGO7**, **ALGO10**\n   - 2-4% reduction in charging time\n   - Mean differences: 1-2 minutes faster\n   - Variable consistency\n   - Small to medium effect sizes (Cohen's d: 0.2-0.4)\n   - Marginally significant after Bonferroni correction\n\n#### 6.2.4 Non-improvements\n1. **ALGO3**\n   - Shows performance degradation (~2% slower)\n   - Negative effect size vs CCCV\n   - Statistically significant worse performance\n   - Not recommended for implementation\n\n### 6.3 Detailed Statistical Findings\n\n#### 6.3.1 Pairwise Comparisons\nThe Bonferroni-corrected pairwise comparisons revealed:\n- Significant differences between ALGO1 and all other algorithms (p \u003c 0.001)\n- ALGO4 significantly different from CCCV and lower-performing algorithms (p \u003c 0.01)\n- Clear statistical separation between performance tiers\n\n#### 6.3.2 Effect Size Analysis\nCohen's d effect sizes showed:\n- Large effects (d \u003e 0.8): ALGO1\n- Medium-large effects (0.5 \u003c d \u003c 0.8): ALGO4, ALGO8\n- Medium effects (0.3 \u003c d \u003c 0.5): ALGO6\n- Small effects (d \u003c 0.3): Remaining algorithms\n\n#### 6.3.3 Consistency Analysis\nCoefficient of Variation (CV) analysis:\n- ALGO1: CV = 3.2% (highly consistent)\n- ALGO4: CV = 3.8%\n- ALGO8: CV = 4.1%\n- Other algorithms: CV ranging from 4.3% to 5.8%\n\n### 6.4 Performance Visualization Insights\n\n#### 6.4.1 Distribution Characteristics\nBox plot analysis reveals:\n- Minimal outliers in top-performing algorithms\n- Symmetric distributions for most algorithms\n- Larger variability in lower-performing algorithms\n\n#### 6.4.2 Mean Differences\nForest plot shows:\n- Clear separation from zero for top performers\n- Non-overlapping CIs for distinct performance tiers\n- Progressive improvement pattern across algorithms\n\n#### 6.4.3 Statistical Relationship Patterns\nHeatmap analysis indicates:\n- Strong clustering of similar-performing algorithms\n- Clear differentiation between performance tiers\n- Consistent pattern of improvement relationships\n\n### 6.5 Key Takeaways\n\n1. **Primary Success Metrics**\n   - Three algorithms (ALGO1, ALGO4, ALGO8) met the \u003e8% improvement threshold\n   - Two algorithms showed statistically significant improvements with strong effect sizes\n   - All successful algorithms maintained CV \u003c 5%\n\n2. **Secondary Considerations**\n   - Top performers showed consistent improvements across all statistical measures\n   - Clear separation between performance tiers\n   - Robust statistical significance even after conservative corrections\n\n3. **Practical Implications**\n   - ALGO1 and ALGO4 represent viable alternatives to CCCV\n   - Implementation priority should follow the performance hierarchy\n   - Cost-benefit analysis recommended for moderate performers\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnewking9088%2Fa-b-n_testing_best_charging_algorithm","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnewking9088%2Fa-b-n_testing_best_charging_algorithm","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnewking9088%2Fa-b-n_testing_best_charging_algorithm/lists"}