Skip to content

Integrate kpi-calculator from PyPI#63

Open
jarsarasty wants to merge 1 commit intomainfrom
feature/kpi-calculator-integration
Open

Integrate kpi-calculator from PyPI#63
jarsarasty wants to merge 1 commit intomainfrom
feature/kpi-calculator-integration

Conversation

@jarsarasty
Copy link

@jarsarasty jarsarasty commented Oct 16, 2025

  • Adds kpi-calculator>=0.4.0a2 as a dependency and calls it after each simulation run to calculate and embed KPIs into the output ESDL
  • Uses KpiManager.load_from_simulator to resolve simulator port-indexed results against the input ESDL, and
    build_esdl_string_with_kpis to embed the results into the output ESDL string
  • KPI failure is non-fatal: any exception is logged and the simulation result is returned without KPIs
  • Adds an integration test that runs a 2-hour ATES simulation end-to-end and verifies CAPEX and OPEX values match the cost data in test_ates.esdl

@jarsarasty jarsarasty marked this pull request as draft October 16, 2025 08:51
@jarsarasty jarsarasty marked this pull request as ready for review October 16, 2025 11:25
@jarsarasty jarsarasty force-pushed the feature/kpi-calculator-integration branch 3 times, most recently from a713153 to 685a0eb Compare January 8, 2026 12:41
@jarsarasty jarsarasty marked this pull request as draft January 9, 2026 09:16
@jarsarasty jarsarasty force-pushed the feature/kpi-calculator-integration branch 9 times, most recently from 5617f0c to 2122d49 Compare January 15, 2026 10:57
@jarsarasty jarsarasty requested a review from Copilot January 15, 2026 10:59
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR integrates KPI calculation functionality into the simulator-worker by adding the kpi-calculator package from PyPI. The integration adds KPI computation to the simulation workflow while maintaining graceful error handling to ensure simulations can complete even if KPI calculation fails.

Changes:

  • Added kpi-calculator>=0.1.1 dependency and updated urllib3 to 2.6.3
  • Integrated KPI calculation into simulator_worker.py after simulation completion
  • Added convert_simulator_to_kpi_format utility function to transform simulator output format to KPI calculator format
  • Added comprehensive integration tests for KPI functionality

Reviewed changes

Copilot reviewed 5 out of 6 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
pyproject.toml Added kpi-calculator dependency and updated pytest configuration to include new test file
dev-requirements.txt Updated urllib3 dependency version
src/simulator_worker/simulator_worker.py Integrated KPI calculation workflow with error handling
src/simulator_worker/utils.py Added utility function to convert simulator DataFrame format to KPI calculator format
unit_test/test_kpi_integration.py Added comprehensive integration tests for KPI functionality

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@jarsarasty jarsarasty force-pushed the feature/kpi-calculator-integration branch from 2122d49 to 7ae989c Compare January 15, 2026 14:56
@jarsarasty jarsarasty marked this pull request as ready for review January 15, 2026 15:01
@jarsarasty jarsarasty marked this pull request as draft January 15, 2026 16:02
@jarsarasty jarsarasty marked this pull request as ready for review January 29, 2026 15:49
@jarsarasty jarsarasty force-pushed the feature/kpi-calculator-integration branch from 969737b to 5ee1199 Compare February 25, 2026 16:27
@jarsarasty jarsarasty force-pushed the feature/kpi-calculator-integration branch from 5ee1199 to 85a8e8c Compare March 18, 2026 11:42
@jarsarasty jarsarasty changed the title Integrate KPI calculation into simulator-worker Integrate kpi-calculator from PyPI Mar 18, 2026
@jarsarasty jarsarasty force-pushed the feature/kpi-calculator-integration branch from 85a8e8c to 6c4befb Compare March 18, 2026 11:56
@jarsarasty jarsarasty force-pushed the feature/kpi-calculator-integration branch from 6c4befb to 770dfb1 Compare March 19, 2026 16:06
@jarsarasty
Copy link
Author

This PR is now updated with the new pre-release of the KPI calculator.

   - Add kpi-calculator>=0.4.0a2 dependency
   - Use KpiManager.load_from_simulator and build_esdl_string_with_kpis
   - Use logger.exception for KPI failure handling
   - Fix log message: "Results will be returned without KPIs"
   - Use ProtobufDict type annotation in integration test
   - Update energy KPI assertion to match actual simulator output
@jarsarasty jarsarasty force-pushed the feature/kpi-calculator-integration branch from 770dfb1 to 3615575 Compare March 19, 2026 16:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants