# Connecting principles

A VolumePort connector (hollow icon) should be connected to a FlowPort connector (filled icon) in order to create a numerically robust and efficient system. The fuel system components only allow flow model-volume connections because of further restrictions imposed by the additional position information in the connectors. To build models using this pattern, make sure to always connect filled to unfilled connectors. Filled connectors indicate flow models, and unfilled connectors indicate volumes. Note that many components contain flags allowing you to introduce or remove volumes, and therefore to change from unfilled to filled connectors and vice versa.

#### Theory

VolumePort connectors denote pressures that are numerical states or are directly derived from them. FlowPort connectors denote components with static mass and energy balances and which therefore compute the massflow from the two pressures at the connectors (flow ports). If two filled connectors are connected additional non-linear equation systems may be created. If two hollow connectors are connected, the flow rate between them remains undefined.

#### Practice

We should use the alternating pattern of flow models and volume models. For the alternating patterns, boundary conditions imposing pressure are equivalent to volume models, and boundary conditions imposing mass flow are equivalent to flow models. For most of the components found in this library, there are ways to change whether its ports are a VolumePort of FlowPort by enabling or disabling dynamic volumes.

For example, components that extend from the FuelSystem.Templates.PartialTwoPortFlowmodel template are constructed from portA to portB as volume-flow-volume. By default the dynamic volumes are enabled by setting the parameters useVolA and useVolB to true.

The table below shows the flow/volume representation of components that extend from the PartialTwoPortFlowmodel template.

 useVolA useVolB Representation true true volume - flow - volume true false volume - flow false true flow - volume false false flow

At the same time, we define positions at these volume locations (link to FuelSystem.Information.GettingStart.Positioning). In order to capture system dynamics properly and avoid slow models (due to unnecessarily stiff equation systems), the volumes should usually be activated in the components with largest volume. Then, the precedence should normally be:

1. Tanks and junction points/mixing volumes must always contain dynamic volumes.
2. Usually, we add dynamic volumes to pipes. Also, this is required if we want to model heat transfer. If the pipe is between two components that have volumes per 1 then can decide to neglect volume dynamics and switch volumes off. If the pipe is directly connected to another pipe then the pipes should usually be lumped together. If the pipe is directly connected to a flow model (e.g., valve, pump), then the dynamic volume should be moved to the connector next to this flow model. Use the parameters dynVolAtA/dynVolAtB for this.
3. In most cases the above information is sufficient to set up models properly. For flow models (e.g., valve, pump) dynamic volumes should be switched off in most cases. Only if direct connections between flow models are required (e.g., valve to pump without pipe of relevant length in between (e.g., shorter than 0.2m) then in either of the directly connected flow models the dynamic volume should be switched on. For fuel systems in general, it is rarely a good idea to include very small volumes (volumes smaller than 1 liter).

Time constants should be set to reflect the typical system time constants. These are provided with the defaults. For fuel systems in general, it is rarely a good idea to select very quick time constants (time constants below 0.1 seconds)

#### Connections in Lumped Pipe

In LumpedPipe, users can define the position of volume in within the pipe typically either at the ports or in between the pipes. The positioning of the volume strictly depends on the type of model that is connected to the LumpedPipe either flow or volume model to follow the connecting principle that is discussed above. The parameters dynVol, dynVolAtA and dynVolAtB are used to set the volume and position in the LumpedPipe component.

If dynVol = true and dynVolAtA & dynVolAtB = false, then the volume will be positioned in the middle of the pipe. This positioning of volume will help when the LumpedPipe is connected in between two volume models say between two tanks.

If dynVol & dynVolAtA = true and dynVolAtB=false, then the volume will be positioned at portA. Or if dynVol & dynVolAtB = true and dynVolAtA=false, then the volume will be positioned at portB. This type of volume positioning is prefered when the LumpedPipe is connected between a volume and flow model at either ends i.e pipe connection between tank and valve or tank and pump. And depending on where the valve/pump (flow) model is connected in the pipe, the volume is set at that port. If the flow model is connected to portA of the pipe, then the volume will be set at portA.

If dynVol, dynVolAtA and dynVolAtB = true, then the volume is positioned at both portA and portB. The type of volume positioning is best suited when the LumpedPipe is connected between two flow models i.e between two valve or pump models.