WOLFRAM SYSTEM MODELER

Getting Started

# Wolfram Language

In[1]:=
`SystemModel["Modelica.Fluid.Dissipation.UsersGuide.GettingStarted"]`
Out[1]:=

# Information

This information is part of the Modelica Standard Library maintained by the Modelica Association.

The Fluid.Dissipation library provides convective heat transfer and pressure loss (HTPL) correlations for a broad range of energy devices to build up thermohydraulic energy systems.

This section introduces an implementation method for the integration of the provided HTPL functions by Fluid.Dissipation into own application models. Additionally you can find ready-to-use application models integrated into Modelica.Fluid as thermohydraulic framework (see package Fittings).
In the following the implementation method is described in 5 steps for a straight pipe as example. Generally the implementation method can be used for all HTPL correlations throughout the library in the same manner.

#### Step 1: Use/Create model with missing pressure loss correlation

All thermohydraulic systems using pressure loss calculations can be modelled for an incompressible case, where the pressure loss (DP) is calculated in dependence of a known mass flow rate (m_flow)

```DP = f(m_flow,...)
```

or a compressible case, where the mass flow rate (M_FLOW) is calculated in dependence of a known pressure loss (dp)

```M_FLOW = f(dp,...).
```

In both cases one target variable (DP for the compressible or M_FLOW for the incompressible case) is calculated as a function of the corresponding input variable (m_flow or dp respectively). Both functions for these cases can be found in the library for the pressure loss device of interest enlarged with a corresponding underscore describing its intended use (functionname_MFLOW for compressible or functionname_DP for incompressible calculation).

To create a simplified thermohydraulic model, the pressure loss (dp) and the mass flow rate (M_FLOW) have to be defined as unknown variables and only a functional correlation between them is still missing. Here the implementation for the compressible case of a flow model will be explained as example.

``` model straightPipe
//compressible case M_FLOW = f(dp)
SI.Pressure dp "Input pressure loss";
SI.MassFlowRate M_FLOW "Output mass flow rate";
end straightPipe

equation
end straightPipe
```

#### Step 2: Choose pressure loss function of interest

The HTPL correlations are modelled with functions for several devices. The pressure loss of a straight pipe to be modelled can be found by browsing through the Fluid.Dissipation library and looking up the function of interest, here:

```Fluid.Dissipation.PressureLoss.StraightPipe.dp_overall_MFLOW
```

This HTPL correlation for the compressible case of a straight pipe have to be dragged and dropped in the equation section of the equation layer of the model in Step 1.

```model straightPipe
//compressible case M_FLOW = f(dp)
SI.Pressure dp "Input pressure loss";
SI.MassFlowRate M_FLOW "Output mass flow rate";

equation
Fluid.Dissipation.PressureLoss.StraightPipe.dp_overall_MFLOW
end straightPipe
```

#### Step 3: Choose corresponding pressure loss records

The chosen function in Step 2 still needs its corresponding input values provided by records. These input records are split into one for input parameters (e.g., for geometry) and one for input variables (e.g., for fluid properties). The name of these input records are identical with the corresponding function but with the extension _IN_con for parameters and _IN_var for variables as input. These corresponding input record for the chosen function have to be dragged and dropped on the diagram layer of the model in Step 1.

```  Input parameter record:
Fluid.Dissipation.PressureLoss.StraightPipe.dp_overall_IN_con IN_con
Input variable record:
Fluid.Dissipation.PressureLoss.StraightPipe.dp_overall_IN_var IN_var
```

Now the equation layer of the model in Step 1 should look similar to the following (without comments and annotation):

```model straightPipe
...
//records
Fluid.Dissipation.PressureLoss.StraightPipe.dp_overall_IN_con IN_con;
Fluid.Dissipation.PressureLoss.StraightPipe.dp_overall_IN_var IN_var;

equation
Fluid.Dissipation.PressureLoss.StraightPipe.dp_overall_MFLOW
end straightPipe
```

#### Step 4: Build function-record construction

Now the input record have to be assigned to the chosen function in the equation layer. The resulting function-record implementation for the compressible case looks like the following:

```model straightPipe
...
equation
//compressible case
M_FLOW = Fluid.Dissipation.PressureLoss.StraightPipe.dp_overall_MFLOW(IN_con,IN_var,dp);
end straightPipe
```

Here the compressible case for the unknown mass flow rate (M_FLOW) is calculated by the known pressure difference (dp) out of the interfaces of the thermohydraulic framework and the input records (IN_con,IN_var) provide data like geometry and fluid properties for example.

#### Step 5: Assign record variables

In the last step the variables of the input records for the function have to be assigned. The assignment of the record variables can either be done directly in the record on the diagram layer or in the equation layer. The assignment of the input record in the equation layer results into the following model:

```model straightPipe
...
//compressible fluid flow
//input record

Fluid.Dissipation.Examples.Applications.PressureLoss.BaseClasses.StraightPipe.Overall.Pres
sureLossInput_con
IN_con(
d_hyd=d_hyd,
L=L,
roughness=roughness,
K=K);

Fluid.Dissipation.Examples.Applications.PressureLoss.BaseClasses.StraightPipe.Overall.Pres
sureLossInput_var
IN_var(
eta=eta,
rho=rho);
...
end straight Pipe;
```

If the implementation of a HTPL correlation is done in an existing application model, the unknown variables out of Step 1 (M_FLOW and dp for compressible or DP and m_flow for incompressible case) have to be adjusted to the model variables (typically the interface variables). The implementation of HTPL correlation into Modelica.Fluid can be found for flow models of several devices.