Skip to content

Reject inconsistent propulsion edge power - #88

Draft
triet228 wants to merge 2 commits into
bugsfrom
bugs2
Draft

triet228 wants to merge 2 commits into
bugsfrom
bugs2

Conversation

@triet228

@triet228 triet228 commented Sep 16, 2026

Copy link
Copy Markdown
Member

Focused follow-up to #87. This PR is based on PR #86.

Upstream and downstream operational splits can each satisfy their own row-sum constraints while assigning different power to the same physical edge. CheckEdgePowerConsistency propagates sink demand and compares delivered power on each edge, including upstream edge efficiency. FAST rejects a mismatch with: "Edge power is not consistent. Your power splits are over-constrained."

% path losses, to recover power at every component from the sink demand.
ncomp = length(Arch);
Power = zeros(ncomp, 1);
Power(end) = SinkPower;
Power = PropulsionPkg.PowerFlow(Power, Arch', LamDwn, EtaDwn, -1);
% Compare delivered power on each source-to-target edge. The downstream
% split is a fraction of target demand; the upstream split is a fraction
% of source power and must include the upstream edge efficiency.
[Source, Target] = find(Arch);
DownIndex = sub2ind([ncomp, ncomp], Target, Source);
UpIndex = sub2ind([ncomp, ncomp], Source, Target);
DownEdge = Power(Target) .* LamDwn(DownIndex);
UpEdge = Power(Source) .* LamUps(UpIndex) .* EtaUps(UpIndex);
% Match PowerFlow's 1e-6 W convergence floor while allowing small
% relative rounding error at large power. Row sums alone cannot detect
% mismatched individual edge flows.
Tolerance = max(1.0e-06, 1.0e-08 * max(abs(DownEdge), abs(UpEdge)));
if (any(~isfinite(DownEdge)) || any(~isfinite(UpEdge)) || ...
any(abs(DownEdge - UpEdge) > Tolerance))
error("FAST:EdgePowerInconsistent", ...
"Edge power is not consistent. Your power splits are over-constrained.");
end

PropAnalysis evaluates both operational matrices at each mission point and runs the edge check, including downstream windmilling redistribution when applicable.

% edge flows that disagree even when both matrix row sums are valid.
for ipnt = 1:length(PreqSnk)
SplitUps = PropulsionPkg.EvalSplit(OperUps, LamUps(ipnt, :));
SplitDwn = PropulsionPkg.EvalSplit(OperDwn, LamDwn(ipnt, :));
if (any(Windmill(ipnt, :)))
SplitDwn = RedistForWindmill(SplitDwn, Windmill(ipnt, :), nsrc, ncomp);
end
PropulsionPkg.CheckEdgePowerConsistency( ...
Arch, SplitUps, SplitDwn, EtaUps, EtaDwn, PreqSnk(ipnt));
end

TestEdgePowerConsistency covers consistent and inconsistent edge flows; it is registered in TestFAST.

function [Success] = TestEdgePowerConsistency()

PropulsionPkg.TestEdgePowerConsistency();

Validation

PropulsionPkg.TestEdgePowerConsistency() and PropulsionPkg.TestEngineMotorRegressions() pass.

@triet228
triet228 added this pull request to stack #89 September 16, 2026 22:10
@triet228 triet228 linked an issue Sep 16, 2026 that may be closed by this pull request
@triet228 triet228 changed the title Reject inconsistent power split Reject inconsistent propulsion edge power Sep 16, 2026
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.

Edge Power Consistency

1 participant