ModelingToolkit variable metadata for connectors

Hi! In the MTK documentation, specifically page Contextual Variable Types · ModelingToolkit.jl ( it reads:

In many engineering systems some variables act like “flows” while others do not. For example, in circuit models you have current which flows, and the related voltage which does not. Or in thermal models you have heat flows. In these cases, the connect statement enforces conservation of flow between all of the connected components.

I first came across this in the Acausal Component-Based Modeling · ModelingToolkit.jl ( tutorial:

@connector function Pin(;name)
    sts = @variables v(t)=1.0 i(t)=1.0 [connect = Flow]
    ODESystem(Equation[], t, sts, []; name=name)

I’ve come across Connectors · Issue #814 · SciML/ModelingToolkit.jl (

I understand there’s three different options for the connect metadata, Equality, Flow, and Stream, as shown in the source: ModelingToolkit.jl/variables.jl at master · SciML/ModelingToolkit.jl · GitHub.

Can someone explain what these three options represent and how they could be used? Thanks ^^

P.S.: I came across Simulating Big Models in Julia with ModelingToolkit | Workshop | JuliaCon 2021 - YouTube, so I can see how, in the RC circuit example, it was before [connect = Flow] was a thing, and how it helped to simplify for this case.

It needs more docs. Open an issue to put it in the queue. It’s the same as Modelica though:

Fluids are hard man.