-
-
Notifications
You must be signed in to change notification settings - Fork 209
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
Stream connector equations missing when used in subsystem #3171
Comments
MTK's connectors are designed according to https://specification.modelica.org/master/connectors-and-connections.html. This might be intentional behavior given that specification and the discussion in #3008. I'm working on figuring this out myself to provide a concrete reason for this behavior. |
This is intentional. In the "not working" example, both connectors are "inside connectors". The spec mentions:
Which justifies the missing stream equations. In the second example with 6 equations, the equations setting flow variables to zero comes from the fact that both connectors are outer connectors. Outer connectors are expected to connect to other components. If they were, those equations would not be generated. |
This confused me. In the standard
And indeed, in my own code, I had forgotten
that now succeeds, 👍 I'll close this, but if any of the above is mistaken, I'd appreciate a correction. Thank you for investigating! |
The definition of inside and outside connectors is in https://specification.modelica.org/master/connectors-and-connections.html#inside-and-outside-connectors. They are defined with respect to a component. |
Right, I understand this explanation for
suggests that we couldn't use stream connections in such a system. However it looks like this is not the correct interpretation, since
And indeed inside connectors that use |
Describe the bug 🐞
Stream connector equations are present when used to connect connectors directly, but absent when used in a submodel.
Relatedly, I have (not shared, not MWE'ed) model code with only two components connected via
stream
, that unexpectedly fails, but succeeds when the connector type isacross
.Expected behavior
Stream equations should be there.
A system of two components connected via
across
should be equivalent to a connection viastream
(AFAIK!)Minimal Reproducible Example 👇
From https://discourse.julialang.org/t/stream-connections-of-subsystems/121279, by @se-schmitt. See also SciML/ProcessSimulator.jl#17
However, when the components are directly inside a single
@mtkmodel
, the equations are there:Another demonstration of the problem is that when taking out the
, [connect = Stream]
part (making itacross
), the number of equations formy_sys
grows by 1 (bad;stream
should have more equations), but shrinks by 1 forsys2
(as expected).Environment (please complete the following information):
using Pkg; Pkg.status()
versioninfo()
The text was updated successfully, but these errors were encountered: