Hello, I’m looking for examples of building a dynamic heat exchanger model in Dyad. I have seen some examples with TwoPort
fluid models where mdot
is the flow variable.
My goal is to create a custom connector that includes enthalpy flow rate (Hdot
) as a variable. I understand this requires using the inStream()
operator in the component equations to handle the direction of energy flow correctly.
Could anyone share a tutorial or example that demonstrates creating a connector with both flow and stream variables for a 1D thermal-fluid modeling? Is it possible to do this in Dyad, similar to the examples in Modelica? 
For the connector, you can use a FluidPort
defined as below:
connector FluidPort
potential p::Pressure
flow m_flow::MassFlowRate
stream h_outflow::SpecificEnthalpy
end
Dyad (through the generated MTK code) already supports instream
. You can create a TwoPort
component with something along the lines of:
component TwoPort
port_a = FluidPort()
port_b = FluidPort)
relations
# Set relations for m_flow depending on case
port_a.h_outflow = instream(port_b.h_outflow)
port_b.h_outflow = instream(port_a.h_outflow)
end
You may be interested in Mike Tiller’s talk at JuliaCon 2025:
2 Likes
Thank you! I’ll watch the video and study more about acausal modeling. 
Hello, I have an additional question that came up while trying a few things on my own.
In the video, my understanding was that (1) the AbstractMedium
variable is first defined in Julia, and then (2) when configuring components like Source
and Valve
in Dyad, it interfaces with Julia to import and use that variable.
Similarly, I would like to create a symbolic function in Julia with the Helmholtz energy-based equation of state for R410a and then import it into Dyad.
Could I get a hint on how to import custom Julia variables or functions into Dyad? The Dyad documentation mentions using Pkg
to import external libraries/functions, but I will only be using this for modeling purposes in my local environment.
[Edit] Maybe I can follow the explanations of ‘Modules’.
Thank you! I’ll give it a try 