You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Issue #1: Stagnant zone volume incorrectly zeroed when there's no net flow
Current Behavior:
When there is no net flow (inflow = outflow), vt = 0, and mixzone->v = vmz, the code incorrectly sets stagzone->v = 0 even when the stagnant zone contains water (stagzone->v > 0).
Expected Behavior:
When there is no net flow, the stagnant zone volume should remain unchanged if no water is being transferred between zones (vt = 0).
Code Location:
In tankmix2() function, the else branch of volume update section:
else
{
mixzone->v+=vnet;
mixzone->v=MIN(mixzone->v, vmz);
mixzone->v=MAX(0.0, mixzone->v);
stagzone->v=0.0; // This line incorrectly zeros the stagnant zone
}
Issue #2: Mixing zone volume calculation incorrect during partial stagnant zone emptying
Current Behavior:
When water is transferred from the stagnant zone to mixing zone but net outflow is larger (vt > 0 && vt < -vnet), the code sets mixzone->v = vmz, maintaining maximum volume despite net water loss.
Expected Behavior:
The mixing zone volume should account for both the water received from stagnant zone and net outflow: mixzone->v = vmz + vt + vnet
Code Location:
In tankmix2() function:
if (vt>0.0)
{
mixzone->v=vmz; // Should consider both transfer volume and net flowif (vnet>0.0) stagzone->v+=vt;
elsestagzone->v=MAX(0.0, ((stagzone->v) -vt));
}
Proposed Fix:
if (vt>0.0)
{
if (vnet>0.0)
{
stagzone->v+=vt;
mixzone->v=vmz;
}
else
{
stagzone->v=MAX(0.0, ((stagzone->v) -vt));
mixzone->v=vmz+vt+vnet; // fix the issue 2
}
}
else
{
mixzone->v+=vnet;
mixzone->v=MIN(mixzone->v, vmz);
mixzone->v=MAX(0.0, mixzone->v);
if (vmz-mixzone->v>0.0) stagzone->v=0.0; // fix the issue 1
}
The text was updated successfully, but these errors were encountered:
Issue #1: Stagnant zone volume incorrectly zeroed when there's no net flow
Current Behavior:
When there is no net flow (inflow = outflow),
vt = 0
, andmixzone->v = vmz
, the code incorrectly setsstagzone->v = 0
even when the stagnant zone contains water (stagzone->v > 0
).Expected Behavior:
When there is no net flow, the stagnant zone volume should remain unchanged if no water is being transferred between zones (
vt = 0
).Code Location:
In
tankmix2()
function, the else branch of volume update section:Issue #2: Mixing zone volume calculation incorrect during partial stagnant zone emptying
Current Behavior:
When water is transferred from the stagnant zone to mixing zone but net outflow is larger (
vt > 0 && vt < -vnet
), the code setsmixzone->v = vmz
, maintaining maximum volume despite net water loss.Expected Behavior:
The mixing zone volume should account for both the water received from stagnant zone and net outflow:
mixzone->v = vmz + vt + vnet
Code Location:
In
tankmix2()
function:Proposed Fix:
The text was updated successfully, but these errors were encountered: