Skip to content

fix: address #227 - #228

Merged
t-kramer merged 1 commit into
developmentfrom
fix-btuh-conversion-error-#227
Nov 17, 2026
Merged

t-kramer merged 1 commit into
developmentfrom
fix-btuh-conversion-error-#227

Conversation

@t-kramer

Copy link
Copy Markdown
Collaborator

I fixed issue #227. It was mismatch between two conversion factors, not a precision or rounding problem.

The Edit Equipment Scenario modal used two different BTU/h factors for the heat rejection and recovery capacities:

  • Saving divided by 3.412 (BTUh_to_Wh), so 100000 BTU/h was stored as 29,308 W.
  • Displaying (in the modal and the scenario table) multiplied by 1 / 0.293, which is 3.41297.

So 100000 ÷ 3.412 × 3.41297 = 100028.4, which matches the screenshot of #227 . It only happens in I-P mode because the SI path is a plain kW ↔ W step.

Fix:

  • In pages/equipment_page.py, the save step now uses get_inverse_converter("power", unit_mode), which is the exact inverse of the converter used for display. 100000 BTU/h now saves as 29,300 W and reopens as 100000. This also replaces the separate SI kW → W branch.
  • utils/units.py: BTUh_to_W is now the exact factor: 1 BTU/h = 0.29307107 W, so 1 W = 3.41214 BTU/h. Every other BTU and ton factor is now calculated from it, including ton_to_W (now 3516.85 W, was 3516). The Wh_to_BTUh and BTUh_to_Wh functions and the kBTU and kBTU/h auto-scaling no longer have 3.412 typed into them. There's no 3.412 or 0.293 left in the code.

@t-kramer t-kramer self-assigned this Nov 17, 2026
@t-kramer t-kramer added the bug Something isn't working label Nov 17, 2026
@coderabbitai

coderabbitai Bot commented Nov 17, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 3e99144c-60c5-4207-a68a-001b18d7e7ad

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@t-kramer
t-kramer merged commit 600edcf into development Nov 17, 2026
3 checks passed
@t-kramer t-kramer mentioned this pull request Nov 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant