Building a basic model
Opening the library
File → Load Encrypted Library, then select the fileSFPLibDyn.mol.
Tools → Options, open theLibrariestab- in
User libraries loaded automatically on startupclick onAddindicating the location of the fileSFPLibDyn.mol.
With correct loading, the library will appear in the available libraries.

Check to have Modelica too
Make sure you have the Modelica library loaded by default, necessary to use some functions of our library.
Creating a new Model
To start using the SFPLibDyn library, let's open a new file:
- Click on the icon
or click File → New Modelica Class - Fill the
Namefield with the name of the file you are generating and make sure you have selected the SpecializationModel - After pressing the
OKbutton, the new file appears in the resource list of theLibrarieswindow
Opening a Modelica file
Opening an existing Modelica file
It is possible to open a Modelica file using one of the following methods:
- Select
File > Open Model/Library File(s)from the menu. - Click the
Open Model/Library File(s)button in the toolbar. - Click the
Open Model/Library File(s)button available in the bottom right corner of the Welcome Perspective. - Press Ctrl+O.
Building the model
With the new file open, make sure you are in the Diagram screen. In this view, you can create the circuit you want to test.
By expanding the SFPLibDyn library from the library tree, you can drag the models present inside it and drop them into the Diagram. This is where we can build the hydraulic circuit.
Upon each drop, an Object is created based on the released Model's information. A window will ask what name you want to assign to the Object. This name must be unique for all elements of the diagram.
Creating connections
To connect one component model to another, the user must first activate the connection mode
from the toolbar.
- Move the mouse over the connector: the cursor will change from arrow to cross.
- To start the connection, press the left mouse button and move the cursor while holding the button down.
- Release the left button.
- Move towards the destination connector and click when the cursor changes back to cross.
Let's try to reproduce this basic circuit. The library models that make up this example are:
- the fluid customization model:
SFPLibDyn > Properties > Hydraulic > FluidProp - a ramp signal:
SFPLibDyn > Signals > Sources > Ramp - a pressure source:
SFPLibDyn > Hydraulic > Sources > FlowrateSource - a volume:
SFPLibDyn > Volumes > Volume2p - a restriction:
SFPLibDyn > Orifices > Orifice - a discharge tank:
SFPLibDyn > Sources > Tank
FluidProp
This model must keep its original name and must never be renamed. (1)
- consequently, there cannot be more than one Object of the same type.
The ramp model provides a dimensionless signal of how much flow rate we want to generate in the circuit, transmitting it to Q which transforms it into a physical quantity of volumetric flow rate (L/min). The fluid is generated in a chamber that has an outlet through a restriction connected to discharge. (For more information on the structure and conventions of the Hydraulic library, consult the appropriate section)
With the diagram structure built, it is now possible to parameterize the individual elements to assign the desired quantities.
Parameterization
In the model, we are interested in setting:
- a flow rate ramp from 0 to 30 L/min in 5 s
- a diameter of 5 mm to the restriction
- have a volume of 10 cm3, sufficiently small not to have obvious compressibility effects in the system
- a tank at atmospheric pressure to collect the discharged fluid
By double-clicking on the individual Objects, a window opens that allows customizing each element of the circuit with the desired values.

The parameters to set are:
-
Model
ramp: it is sufficient to setslopeas in the image (1). It is important to emphasize that in this case the unit of measure is fixed in s-1. We will check in the next model that the signal is converted to L/min.-
as you can see, it is possible to insert simple equations.
Units of measure
In general, inserting an equation as a parameter automatically changes the unit of measure to ISO units.
-
-
Model
Q: the parameterscalerepresents the scale factor to apply to the input signal to obtain the outgoing volumetric flow rate expressed in m3/s (the parameter window reports the description of each parameter. If the description is not exhaustive, consult the official documentation of the component(1)). The default value1/60000corresponds to transforming L/min into m3/s, so no modifications are necessary.- To open the documentation of a specific component already inserted in a diagram: right-click on the component >
Open Classand open the Documentation window
- To open the documentation of a specific component already inserted in a diagram: right-click on the component >
-
Model
vol: to set the volume capacity, modify the entryvol_0. In this case, pay attention to the unit of measure. Since we want to start from an initial condition of empty circuit, it is necessary to setpressure.start= 0, otherwise the volume will start the simulation from 1 bar relative pressure. - Model
ORIF: to set the restriction diameter, open theDiametertab and modify the entrydiam. - Model
tank: this model also does not need modifications, since by default it is already set to be at atmospheric pressure (zero relative).
Download the model built so far.
With the model set, it is possible to proceed to simulation.
Simulation
By clicking on Simulation Setup
(see the Simulation chapter), you can set the simulation parameters.
In our example, it is sufficient to set the value of Stop Time = 5 s. Given the simplicity of the exercise, we do not need to modify the integration step or the integration tolerance.
Leaving the bottom checkbox Simulate checked, once you give OK to the window, the simulation will start automatically, otherwise click on the Simulate button.
In case of error
To resolve any compilation errors, it is necessary to read the outputs of the Messages Browser. The most common can be:
-
Too few equations, under-determined system. The model has X equation(s) and Y variable(s).
Check the Diagram and verify that you do not have open connections. If everything seems connected correctly, check that you do not have overlapping objects (common error using Ctrl+C and Ctrl+V)
-
INVALID LICENCECheck the license error section in the FAQ.
If the previous steps have been followed correctly, after passing the compilation and simulation phases, the Plotting section opens automatically.
Plotting the results
In the Variables Window, we can navigate through all the variables that the components make available. Those of interest to us are:
ORIF.q_flowwhich represents the volumetric flow rate passing through the restrictor, corresponding to the set ramp valueORIF.p_dropwhich represents the pressure drop across the restrictor
To open multiple graphs in parallel, use the first button New Plot Window of the dedicated bar
.
With the second button New Parametric Plot Window, you can set a parametric plot: holding the Shift button and selecting ORIF.q_flow places the volumetric flow rate value on the x-axis, releasing Shift and selecting ORIF.p_drop displays the graph of the restrictor's pressure loss as a function of the incoming volumetric flow rate.

