Liquids

The liquid object is typically used to simulate fill levels.

It offers numerous inlets and drains as well as sensors to detect the current fill level.

You can set the maximum fill level in the range of 100-65535 increments.

Inlets and drains of the liquid object

The liquid object has three inlets and three drains; you can specify an operand or a constant for each of these.

Word operands of type UInt16 are expected at the inlets and drains. Because PLC-Lab supports very flexible operand specifications thanks to range specifications, it is also possible to specify bit operands.

Example for the specification of a bit operand in the supply:

0-100 Sim.I12.3

This specification means that if the bit operand has the status '0', there is a supply of 0 increments per time unit. Status '1' has a supply of 100 increments.

Example for the specification of a word operand in the supply:

Sim.IW20

This specification means that the value in EW20 determines the number of increments of the supply per time unit.

Sensors of the liquid object

The current fill level can be read in increments via the analog fill level sensor.

The following is an example in which the current fill level is written in the Sim.IW2 operand and displayed in a text label.

The supply and drain can be controlled via buttons.

Two binary sensors can be set to any fill level. The detection range is specified as a range specification.

Example 1: Binary sensor

The first binary sensor is to be triggered at a fill level of 3000 to 3500 increments.

This means that we need the following specification:

2200-2500 Sim.I10.2

Example 2: Binary sensor

The second binary sensor is to be triggered at a fill level of 6000 to 6200 increments.

This means that we need the following specification:

8000-8200 Sim.I10.3

In the following layout, the two sensors are represented by LEDs:

Tip

If more than two binary sensors are necessary, additional binary sensors can be implemented by means of a calculator object.

In the following image, the bit operand Sim.I10.1 is set to status '1' if the fill level (stored in Sim.IW2 "Fill_level_increments" with the symbol fill level) is in the range 1000 to 1200. Select "In range" as the function type for the calculator object.

For a detailed description of the calculator object, click the following link:

The calculator object

Using liquid object for other purposes

The liquid object cannot only be used to represent liquids and the related features.

Other applications are also possible thanks to the wide range of available settings.

As a counter, for example.

In the following example, the falling parts are detected by a sensor and the value of the increments of a liquid object is increased. For this purpose, the property " Supply Trigger" was assigned to the operand, which is influenced by the sensor. If a positive edge is present at the operand of the sensor, the sum of the supplies of the liquid object is detected once; this increases the level (i.e. the increments) of the liquid object. The constant "1" was specified at supply 1 so that the value increases by the value 1 with each positive edge.

The operand of the reset button can be specified in the property "Drain Trigger". In addition, a constant is entered at one of the drains which corresponds to the maximum number of increments of the liquid object. As a result, when the reset button is pressed, the sum of the drains is recorded and the value is subtracted from the current fill level of the object. In the example this means that the level is 0 in any case.

Videos with examples of liquid objects

Below are some videos with examples where liquids are used.