Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use weighted distributions for "condensity" and heating logic #225

Open
wants to merge 348 commits into
base: main
Choose a base branch
from

Conversation

spahrenk
Copy link
Contributor

@spahrenk spahrenk commented Jan 22, 2025

This branch incorporates weighted distributions of the form
{{height0, height1, ..., height_final},{weight0, weight1, ..., weight_final}}
into HPWHsim. These replace std::vector arrays for expressing heating-power distributions and logic nodes. (The tank temperature profile remains expressed by a std::vector representing a fixed number of tank node temperatures.) The notation for weighted distributions is generally more flexible and compact than the previous forms, and is amenable to JSON data-model format. Normalization is automatic. The height range is taken as [0., height_final]. Heights are scaled upon export so that height_final = 1. Weights are scaled upon export to give a maximum weight of unity.

Existing distributions in Preset and File models are immediately converted to weighted form during loading. Most internal calculations for applying heat or checking logic temperatures are now performed using weighted logic. The transition is mostly obvious and will produce the same results for existing models. But additional conditions are enforced by the internal construction of these models that are not enforced directly when loading from a JSON data model. The distribution is assumed to be peaked about a certain heating or logic node in certain cases. Specifying a different distribution may produce unpredictable behavior:

  1. The function TempBasedHeatingLogic::getFractToMeetComparisonExternal is used for single-pass external condensers to prevent exceeding the shut-off condition during heating, but assumes the heating logic refers to a single node out of a fixed 12-node logic structure, which is enforced during initialization of these models. Specifying a different distribution will produce unpredictable behavior.
  2. Resistance heat-source elements are organized by position along the tank height, so that particular activation conditions can be applied the lowest element. The lowest non-zero height in the weighted distribution is used in this case. Resistance positions are also used in ResistanceFunctionsTest, but no cases were found that affect simulations.

@spahrenk spahrenk self-assigned this Jan 22, 2025
@spahrenk spahrenk requested a review from nealkruis January 22, 2025 20:28
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.

1 participant