Add heat exchangers

This commit is contained in:
2026-07-14 16:29:12 +02:00
parent b0d2bf4bdc
commit 44a605598e
9 changed files with 177 additions and 59 deletions
+14 -2
View File
@@ -54,11 +54,23 @@ namespace PamhagenSysCtrl.Helpers.Pipeline {
return p;
}
public Path? GetPath(IEnumerable<INode> points, Func<INode, bool>? valid = null) {
if (points.Count() < 2) throw new ArgumentException("Path is too short");
var start = points.First();
var path = new Path(start, []);
foreach (var end in points.Skip(1)) {
if (GetPath(start, end, valid, visited: [..path.Hops.Select(h => h.Node)]) is not Path p)
return null;
path.Hops = [..path.Hops, ..p.Hops];
start = end;
}
return path;
}
public Path? GetPath(INode start, INode end, Func<INode, bool>? valid = null, HashSet<INode>? visited = null) {
if (!Nodes.Contains(start) || !Nodes.Contains(end)) throw new ArgumentException("Start/end node not contained in graph");
valid ??= a => true;
visited ??= [];
visited.Add(start);
visited = [.. visited ?? [], start];
List<(IEdge, INode)> hops = [];
Path? path = null;
foreach (var o in start.Outputs) {