Use Powerconnections in Subsystems #1012
Answered
by
fwitte
HaSchneider
asked this question in
Q&A
|
How can I use powerconnections as interfacing connections in Subsystems? class MySubsystem(Subsystem):
def __init__(self, label):
self.num_in = 2
self.num_out = 1
super().__init__(label)
def create_network(self):
hex= SimpleHeatExchanger('hex')
c1 = Connection(self.inlet, "out1", hex, "in1", label="1")
c2 = Connection(hex, "out1", self.outlet, "in1", label="2")
pc1 = PowerConnection(self.inlet, "power_out1", hex, "t", label="3")
self.add_conns(c1, c2, pc1)
mysub = MySubsystem('mySubsystem')
nw = Network()
so = Source("source")
si = Sink("sink")
ps= PowerSource('heat')
c1 = Connection(so, "out1", mysub, "in1", label="1")
c2 = Connection(mysub, "out1", si, "in1", label="2")
c3 = PowerConnection(ps, "out1", mysub, "in2", label="3")
nw.add_conns(c1, c2)
nw.add_subsystems(mysub)Results in: ValueError: Error creating connection. Specified connector for inlet of class SubsystemInterface (power_out1) is not available. Select one of the following connectors . |
Answered by
fwitte
Jun 25, 2026
Replies: 1 comment 4 replies
|
Hi @HaSchneider, quick and unfortunate answer: Not possible right now (#839). But this is a good incentive to change that. I will make a draft for a Best |
4 replies
Answer selected by
HaSchneider
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi @HaSchneider,
quick and unfortunate answer: Not possible right now (#839). But this is a good incentive to change that. I will make a draft for a
SubsystemInterface(and respective changes toSubsystem) this weekend (unless you are faster ;)).Best