FlowDivider
Reduces the flow from port_a
to port_b
by n
. Useful for modeling parallel tubes efficiently by placing a FlowDivider
on each end of a tube. Extra flow is dumped into an open
port.
Usage
FlowDivider(n)
Parameters:
Name | Description | Units | Default value |
---|---|---|---|
n | Divide flow from port_a to port_b by n | – |
Connectors
Variables
Name | Description | Units |
---|---|---|
m_flow_a | Mass flow of port_a | kg/s |
m_flow_b | Mass flow of port_b | kg/s |
Behavior
Behavior of this component cannot be rendered because it includes path
variables.
Source
dyad
# Reduces the flow from `port_a` to `port_b` by `n`. Useful for modeling parallel
# tubes efficiently by placing a `FlowDivider` on each end of a tube.
# Extra flow is dumped into an `open` port.
component FlowDivider
port_a = Port()
port_b = Port()
open = Port()
# Divide flow from `port_a` to `port_b` by `n`
parameter n::Real
# Mass flow of `port_a`
variable m_flow_a::MassFlowRate
# Mass flow of `port_b`
variable m_flow_b::MassFlowRate
relations
continuity(port_a.medium, port_b.medium, open.medium)
m_flow_a = port_a.m_flow
m_flow_b = port_b.m_flow
m_flow_b = m_flow_a/n
open.m_flow = m_flow_a-m_flow_b
end
Flattened Source
dyad
# Reduces the flow from `port_a` to `port_b` by `n`. Useful for modeling parallel
# tubes efficiently by placing a `FlowDivider` on each end of a tube.
# Extra flow is dumped into an `open` port.
component FlowDivider
port_a = Port()
port_b = Port()
open = Port()
# Divide flow from `port_a` to `port_b` by `n`
parameter n::Real
# Mass flow of `port_a`
variable m_flow_a::MassFlowRate
# Mass flow of `port_b`
variable m_flow_b::MassFlowRate
relations
continuity(port_a.medium, port_b.medium, open.medium)
m_flow_a = port_a.m_flow
m_flow_b = port_b.m_flow
m_flow_b = m_flow_a/n
open.m_flow = m_flow_a-m_flow_b
metadata {}
end
Test Cases
This is setup code, that must be run before each test case.
julia
using HydraulicComponents
using ModelingToolkit, OrdinaryDiffEqDefault
using Plots
using CSV, DataFrames
snapshotsdir = joinpath(dirname(dirname(pathof(HydraulicComponents))), "test", "snapshots")
"/home/actions-runner-10/.julia/packages/HydraulicComponents/EtOYG/test/snapshots"
Related
Examples
Experiments
Analyses