modeling and simulation of fluid networks
simscape™ fluids™ blocks and connections represent one-dimensional flow paths. this means that internal component dynamics, such as the pressure variation along a pump blade, are not modeled in detail.
as with electric circuits, all network components have an associated across and through variable. unlike an electric circuit, some simscape fluids domains have more than one across and through variable. for example, in the thermal liquid domain, mass flow rate and energy flow rate are block through variables, and pressure and temperature are block across variables. blocks in the gas, moist air, and two-phase domains also have multiple through and across variables. for more information on block connections, ports, and variable types, see .
in fluids networks, flow is supported in either direction along connection lines. many simscape fluids blocks also support reversed flows. additionally, pressure and temperature are always absolute values. regardless of flow direction, the variable values remain positive.
it is essential that your network is grounded. simscape fluids blocks with internal volumes, called dynamic components, can act as a network ground due to their internally-defined states. furthermore, dynamic components within the network set the model initial conditions from the specified block parameters.
due to these internal volumes, fluid variables are calculated at internal nodes as part of the momentum balance over the block. you may observe different values if you choose to measure a variable at an internal node or at a port.
parameterizing a block
some blocks can be parameterized by different methods. you can parameterize these blocks by:
an analytical formulation
data from a data sheet
data from measurements
data tables may be 2-d or 3-d and are composed of independent vectors, such as from a test matrix. for example, in the block, the volumetric loss table, q_loss(dp,w,d) parameter is populated with the volumetric losses at each test point for pressure loss, shaft speed, and displacement volume, over the range of each parameter.
you can plot and check the data in a lookup table with the and blocks. see for more information.
start and simulate your model
the simscape fluids software provides multiple ways to simulate and analyze multidomain fluid networks in the simulink® environment.
to open the simscape model template, enter
ssc_new
at the matlab® command line. you can view the simscape fluids block library by enteringsimscapefluids_lib
on the matlab command line. drag blocks from the simscape library browser to the simulink editor to construct your model.to view and inspect your network variables before, during, and after simulation, use the . to learn more about initializing models and setting variable priorities, see . initial conditions for simscape fluids models are domain-dependent:
in the isothermal liquid domain, the initial pressure must be provided.
in the thermal liquid domain, the initial pressure and temperature must be provided.
in the gas domain, the initial pressure, and either the density or temperature must be provided.
in the moist air domain, the initial pressure, temperature, humidity quality, and trace gas amount must be provided.
in the two-phase domain, the initial pressure and either the phase quality, temperature, enthalpy, or internal energy must be provided.
you can view the results of a simulation by attaching a scope block to a sensor, or by enabling data logging and viewing the results in the results explorer. exporting data from the results explorer to the data inspector allows you to compare data between simulations. for more information, see and simulation data inspector.
scope blocks plot simulink signals. convert a simscape physical signal with a ps-simulink converter block to connect a physical signal to a scope block. see for more information.
to turn on data logging, from the simulink toolstrip, select modeling > model settings > model settings. in configuration parameters, select simscape. in the simscape pane, under data logging, set log simulation data to
all
and select open viewer after simulation.
to learn more about selecting and configuring the right solver for your system, see . the variable-step solvers
ode23t
andode15s
are versatile solvers that are suitable for a range of dynamics. to use simulink coder™ to generate code from your model, use theode14x
orode1be
solvers. for more information about code generation, see .
see for a detailed overview of a simscape modeling workflow.
modifying parameters
you can modify parameter values during simulation if they are run-time configurable. to learn more about configurable parameters and settings, see .
balancing accuracy, speed, and efficiency in your model
to change the accuracy, speed, and efficiency of your simulation, you can adjust one or more of the following parameters in configuration parameters:
relative tolerance
absolute tolerance
max step size
you can also adjust the constraint residual tolerance in the solver configuration block property inspector.
in most cases, the default tolerance values will produce a good balance between the
accuracy and speed of your model. however, in some cases you may wish to adjust the
max step size from its default setting of auto
,
which is calculated based on the simulation duration and not on the simulation dynamics. if
you are concerned that the solver may be missing significant behavior, you can change this
value to a smaller value.
for more information about the solver parameters, see:
see to learn more about when to adjust the constraint residual tolerance parameter value.