Examples for PLC-Lab

When PLC-Lab is installed, sample systems are also installed. These are stored in the user's document directory in the folder "PlcLab-Editor\Examples".

In these installations, certain properties of PLC-Lab are used. You can use the systems to get to know these properties or to change the settings and explore the resulting behavior. It is also possible to copy parts of the systems to the clipboard and then paste them into your own systems.

All examples can be simulated without a PLC program or GRAFCET. The IM device is used for the required operands (See also: The IM device). This way the examples run on all editions of PLC-Lab.

If you want to use an example together with a PLC or a GRAFCET, you have to manually rewire the required operands to the Sim-Device. The flag operands can then be changed to input or output operands. Below is a description of the automatic or manual rewiring: Rewiring operands to another device

In the following we will name the examples, give a short description and point out special features.

In the example a box column drill is implemented. The drilling machine can be switched on and moved forward or backward. The drill is displayed as a graphic and animated when the drill is switched on.

Special feature

The clock marker within the IM memory area is used to animate the drill when switched on.

See also: Using the clock flags of the IM device

A calculator object is used which performs an AND operation between the operand of the drill and the clock flag IM.M65534.1. This means that the result operand toggles as soon as the drill is switched on. This operand is then used to toggle the two graphics in the dynamic rectangle object.

The color of the decoration rectangle, which symbolizes the metal block to be drilled, has been set to an opacity of 50% to make the penetration of the drill visible.

Used objects

  • Calculator object
  • Dynamic objects
  • Static objects
  • Switch objects
  • Prismatic joint

In the example, a liquid tank with an anlog supply and drain is implemented. The supply and drain can each be adjusted via a slider. The current fill level of the tank is displayed via a tacho object. In addition, the tank has two binary level sensors; their status indicates the upper and lower level. The status is indicated via a lamp object.

Special feature

In the properties of the liquid object, the maximum level is set to 1000 increments. The binary sensor for the upper level reacts in the range 900-1000; the sensor for the lower level is set to the range 0-100. The analog value of the current fill level is written into a word operand and is specified on the tacho object.

The analog supply of the tank comes from a word operand; its value is influenced via a slider object in the range 0-100. The same applies to the analog drain; this word operand can also be changed in value via a slider object.

The supply and the drain are visualized with tube objects. An animated pump is also used in the supply and drain of the tank. The tubing and the animation of the pumps is controlled by the analog value of the inlet and drain.

The pump animation is implemented using a dynamic ellipse object and a revolute joint. The spin velocity is directly dependent on the analog value of the inlet or drain.

The color switching of the pipelines is implemented by means of a calculator object. Here the function type "Greater than" is used. For example, as soon as the analog value of the supply is greater than 0, a bit operand has the status '1'. This bit operand is used to switch the color of the pipelines.

Used objects

  • Liquid object
  • Calculator object
  • Dynamic objects
  • Tube objects
  • Static objects
  • Switch objects
  • Revolute joint
  • Slider
  • Tacho object
  • Lamp objects

In the example, a liquid tank with a binary supply and drain is implemented. The supply and drain can each be adjusted via a push-button. The current fill level of the tank is displayed via a tacho object. In addition, the tank has two binary level sensors; their status indicates the upper and lower level. The status is indicated via a lamp object.

Special feature

In the properties of the liquid object, the maximum level is set to 1000 increments. The binary sensor for the upper level reacts in the range 900-1000; the sensor for the lower level is set to the range 0-100. The analog value of the current fill level is written into a word operand and is specified on the tacho object.

The binary supply of the tank comes from a bit operand; its value is influenced via a switch object. The number of increments of the supply at status '1' of the operand is made via a range specification. The range 0-20 was specified. This means that if the operand has the status '1', 20 increments are added per cycle. With status '0' there is no supply. The same applies to the drain. The range 0-20 was also specified here.

The supply and the drain are visualized with tube objects. An animated pump is also used in the supply and drain of the tank. The tubing and the animation of the pumps is controlled by the binary value of the inlet and drain.

The pump animation is implemented using a dynamic ellipse object and a revolute joint. The spin velocity is constant. The clockwise rotation is directly dependent on the bit operands of the supply or drain.

The color switching of the tubing is also implemented directly with the operands for the supply and drain.

Used objects

  • Liquid object
  • Dynamic objects
  • Tube objects
  • Static objects
  • Switch objects
  • Revolute joint
  • Tacho object
  • Lamp objects

In the example a conveying element is used to implement a conveyer belt in side view. The conveyer is supplied with objects that are created with the help of a creator.

Special feature

In this layout a conveying element is located above a horizontally arranged, static rectangle. The fill color of the conveying element is set to transparent, so it is only partially visible. The direction arrows and the border can also be removed by setting the property "Line thickness" in the section "Main Settings -> Appearance" to the value "0".

A dynamic ellipse object is placed to the left above the conveying element. This is held at this position by a constant distance joint. For this purpose, a static rectangle was placed above the circle, which serves as an anchor object for the connection.

The circle object serves as the parent object. The property "Object is a mother object with the ID", was set to the value "1". In the creator object, the property "Creator has the ID" is also set to the value "1". So the creator is responsible for these parent objects. There is also a trigger operand specified on the creator, which should trigger the creation of child objects on a positive edge. This operand is also entered on the switch object that is configured as a push-button. This means that pressing the push-button triggers the creation of a child object.

Used objects

  • Conveying element
  • Dynamic objects
  • Creator object
  • Static objects
  • Switch objects
  • Constant distance joint

In the example a conveying element is used to implement a conveyer belt in side view. The conveyer is supplied with objects that are created with the help of a creator. A cylinder is placed at the collection tank for the transported objects and a destroyer is attached to its piston rod.

Special feature

In this layout a conveying element is located above a horizontally arranged, static rectangle. The fill color of the conveying element is set to transparent, so it is only partially visible. The direction arrows and the border can also be removed by setting the property "Line thickness" in the section "Main Settings -> Appearance" to the value "0".

A dynamic ellipse object is placed to the left above the conveying element. This is held at this position by a constant distance joint. For this purpose, a static rectangle was placed above the circle, which serves as an anchor object for the connection.

The circle object is configured as the parent object. The property "Object is a mother object with the ID", was set to the value "1". In the creator object, the property "Creator has the ID" is also set to the value "1". So the creator is responsible for these parent objects. There is also a trigger operand specified on the creator, which should trigger the creation of child objects on a positive edge. This operand is also entered on the switch object that is configured as a push-button. This means that pressing the push-button triggers the creation of a child object.

A cylinder is placed at the right edge of the collection tank for the transported objects. A dynamic rectangle is attached to the piston rod of the cylinder by means of a "solid jointconnection to a body". This is configured as a destoyer by selecting the property "Object is a destoyer". The value "0" was also specified for the property "Object destroys child objects with ID". This means that all child objects are destroyed regardless of their ID. The cylinder extends when the "cylinder" push-button is pressed. Every child object that is touched by the destroyer is destroyed.

Used objects

  • Conveying element
  • Dynamic objects
  • Creator object
  • Destroyer
  • Static objects
  • Switch objects
  • Constant distance joint
  • Solid joint
  • Cylinder object

The example shows a pedestrian traffic light. The pedestrian pictogram for the red phase was composed of individual fixed rectangles and ellipses. The drawing board has been heavily zoomed in for comfortable placement of the objects. The simulation is then carried out with a scaling of 100% so that the impression is realistic.

Special feature

Switching the color of the pedestrian pictogram is done by a bit operand, which is specified for each section in the property "Operand switching fill color". The sections have the Z-order "0", while the red circle of the traffic light has the Z-order "-1". The sections of the pedestrian pictogram are thus displayed above the red circle.

Used objects

  • Static objects
  • Switch objects
  • Constant distance joint
  • Solid joint

In the example, a gripper is implemented, which "grips" an object with the help of a magnet. The gripper can move in a horizontal and vertical direction.

Special feature

For the horizontal movement of the gripper, a static rectangle is used as master object. This is connected to a dynamic rectangle (the slave object) via a "prismatic joint". Another dynamic rectangle forms a body group together with this slave object. This object in turn is the master object for vertical movement and is connected to the slave object (another dynamic rectangle) via another prismatic joint.

For the slave object for vertical movement, an operand is specified in the "Operand for magnet" property, which activates the object's magnet. This operand is also used to switch the color of the object so that the activation of the magnet can also be indicated visually. The object to be gripped is to be configured as magnetic by selecting the "Object is magnetic" property.

Important in this example are the density properties of the two rectangle objects that form the body group.

The slave object for the horizontal movement requires a density of "20", the master object for the vertical movement requires a density of "50". This gives the layout the necessary stability. The higher density also increases the mass of the respective objects. Also, the maximum force of the horizontal movement, i.e. the "prismatic joint", should not be set too high; in the example, a value of "10" has been set.

In the following video example a similar system is built step by step: Gripper with magnet

Used objects and properties

  • Dynamic objects
  • Magnet properties
  • Density and mass of objects
  • Static objects
  • Switch objects
  • Prismatic joint
  • Body group

In the example, a gripper is implemented, which "grips" an object with the help of a gripper plier. The gripper can move in a horizontal and vertical direction.

Special feature

For the horizontal movement of the gripper, a static rectangle is used as master object. This is connected to a dynamic rectangle (the slave object) via a "prismatic joint". Another dynamic rectangle forms a body group together with this slave object. This object in turn is the master object for vertical movement and is connected to the slave object (another dynamic rectangle) via another prismatic joint.

In the slave object of the vertical movement, two gripper arms are connected to the right and left via a "revolute joint" each. A limitation is active for both rotary movements. On the left from -70° to 0°, on the right from 0° to +70°.

Important in this example are the density properties to be set for the rectangle objects which form the body group and the anchor object for the rotary movements. The slave object for the horizontal movement requires a density of "20", the master object for the vertical movement requires a density of "50". A density of "10" is set for the anchor object of the rotary movement. This gives the layout the necessary stability. The higher density also increases the mass of the respective objects. Also, the maximum force of the horizontal movement, i.e. the "prismatic joint", should not be set too high; in the example, a value of "10" has been set.

In the following video example a similar system is built step by step: Gripper with pliers

Used objects and properties

  • Dynamic objects
  • Density and mass of objects
  • Static objects
  • Switch objects
  • Prismatic joint
  • Revolute joint
  • Body group

In the example, child objects are created by an assembly robot, moved by a conveying element, and fed to a destroyer.

Special feature

The example is intended to illustrate the duplication of complex parent objects using a creator. The assembly robot consists of a large number of individual objects that are connected to each other via joints. All objects have the same parent object ID. A child object created in this way has the same functionality as the parent object.

During a simulation, a child object is created by actuating the create button. More precisely, a large number of child objects are created, which have the same joints and properties as their parent objects. So the sum of the child objects created in one generation also results in an assembly robot. A new robot created in this way falls onto the conveying element and is transported by it in the direction of the destroyer object. If one of the child objects touches the destroyer, the entire generation is destroyed, i.e. in the example the entire robot.

Used objects and properties

  • Dynamic objects
  • Static objects
  • Switch objects
  • Prismatic joint
  • Revolute joint
  • Solid joint
  • Body group
  • Creator
  • Destroyer
  • Conveying element

The example shows a motor with its housing and shaft. When the motor is switched on, the rotary movement is visible.

Special feature

In this example two vector graphics are used. The files have the suffix ".XAML". The graphics are specified in the property "Vector image status 0". The advantage of vector graphics is that they are displayed in any size with high quality.

In the example, the motor housing is symbolized by such a graphic; so is the shaft of the motor. The shaft consists of a dynamic ellipse object that is connected to a static object via a wheel joint with shock absorber. The wheel joint is used to implement the rotary movement. The rotation is dependent on a bit operand.

Used objects and properties

  • Dynamic objects
  • Static objects
  • Switch objects
  • Wheel joint
  • Vector graphics

The example shows how two dynamic objects can be welded together and separated again.

Special feature

Dynamic rectangle objects are created via a creator. These then fall onto a conveying element. The conveying element transports the objects to the first processing station. Here we have a cylinder with a piston rod, to which a dynamic object is attached via a solid joint. In this object, the property "Operand create weld-joint" is assigned the constant "1". This means that the property is always active. If this object touches two other dynamic objects, then these are welded at the point touched. In this case, the objects are connected to each other and are transported together to the next processing station. This is where the counterpart is now located. The dynamic object attached to the cylinder rod has the constant "1", which is entered in the property "Operand remove weld joint". This means that when two dynamic objects come into contact with each other, the object removes their weld joint. The objects are now no longer connected.

It should be noted that only weld joints that were formed by welding during the simulation can be removed. If a "weld joint" was drawn between two dynamic objects in draw-mode, it cannot be removed. However, such a weld joint can break due to the application of force. See also: Removable weld-joint

Used objects and properties

  • Dynamic objects
  • Static objects
  • Cylinder objects
  • Switch objects
  • Creator
  • Welding
  • Remove weld-joint
  • Conveying element
  • Constant distance joint

In this example, a course is set up where the different joints are used in PLC-Lab.

Special feature

Two dynamic objects are connected by a removable weld joint. In the weld joint, the setting has been made that it can break. The maximum force is specified as 50N. The two objects serve as parent objects and are connected to a static object via two constant distance joints. This means that the parent objects remain in this position. The created child objects fall into a container, which was assembled from individual dynamic objects. These objects were connected to each other via solid joint, whereby the object that forms the bottom of the container was used as the master object in each case. The bottom of the container is connected to an underlying dynamic object via a revolute joint. The rotary movement was limited to the range 0° to 90°. This means that the container can be tilted and its contents emptied. Another dynamic object forms a body group with the anchor object of the rotary movement. This object is in turn the slave object of a "prismatic joint", which can be used to move the container up an inclined plane.

If the container is emptied at the upper part of the inclined plane, the objects fall into a container with wheel drive below. The drive was implemented usinga "wheel joint with shock absorber". This allows the container to be moved to the right so that it can topple over and the contents can be transported onwards. Conveying elements are used for this.

At the end is a cylinder which separates the welded objects from each other again by the application of force.

Used objects and properties

  • Dynamic objects
  • Static objects
  • Cylinder objects
  • Switch objects
  • Creator
  • Conveying element
  • Constant distance joint
  • Prismatic joint
  • Solid joint
  • Weld joint (breakable)
  • Wheel joint

In this example, an unbalance is generated during a rotary movement. This unbalance is measured via a wheel joint.

Special feature

A propeller is driven by means of a wheel joint with shock absorber. A dynamic elliptical object is attached to one side of the propeller. This forms a body group with the rest of the propeller (consisting of a dynamic rectangle). A word operand has been specified at the property "Density of the object" of the ellipse, the value of which can be changed by a slider in the range between 0 and 10. The spin velocity can also be changed via a slider. The rotation starts when a switch is pressed. The amplitude is measured at the wheel joint. A word operand is specified at the property "Operand amplitude of shock absorber" and its value is visualized via a tacho object.

Used objects and properties

  • Dynamic objects
  • Static objects
  • Switch objects
  • Body group
  • Wheel joint
  • Tacho object
  • Slider
  • Density of a dynamic object

In this example, objects with different physical properties are shown in action. The properties "Depends on gravity", "Restitution" and "Magnetic" were set individually for some of the objects. In addition, different collision groups are used.

Special feature

Three dynamic circle objects are placed in the upper left corner. These are parent objects that are connected to a static object by means of constant distance connections. The left circle object (with the brownish color) belongs to collision group 1, the other two to collision group 2. A separator is located below the circle objects. This separator separates the brown circle objects from the others. The brown, fixed rectangle has been assigned to collision group 2. As a result, the brown circle object does not collide with it and falls through it.

The two other circle objects collide with it and are thus deflected onto the rocker. The rocker was implemented with the help of a revolute joint, but the motor of the rotary movement was not activated.

If the rocker moves to the left because of the weight of the circle objects, they will fall on an inclined plane. The yellow circle objects behave similar to a rubber ball, because the value 0.8 (range 0.0 to 1.0) was specified in the "Restitution" property. These are therefore very elastic and are very likely to "jump" into the right chamber.

The grey circle objects behave more like metal spheres and roll down the inclined plane. These have a "restitution" of 0.0.

Because the grey circle objects are also set as magnetic, they will stick to the lower inclined plane as soon as you activate the magnet with the switch.

Used objects and properties

  • Dynamic objects
  • Static objects
  • Switch objects
  • Solid joint
  • Constant distance joint
  • Revolute joint
  • Collision groups
  • Restitution
  • Magnetism
  • Creator

In this example a folding water barrier is implemented.

Special feature

The barrier is moved by means of a "prismatic joint". In doing so, the attachment points must be rotated so that the objects do not "tilt". For this purpose, revolute joints are used to give the drive's points of action the necessary degrees of freedom.

Used objects and properties

  • Dynamic objects
  • Static objects
  • Prismatic joint
  • Revolute joint

In this example, three cylinders are firmly connected to each other. This means that the cylinder body of "cylinder 2" is attached to the piston rod of "cylinder 1". And the cylinder body of "cylinder 3" is attached to the piston rod of "cylinder 2".

Special feature

The joint between the piston rod and the cylinder body is made with a "Solid joint". The joint is always drawn starting from the cylinder body, so that this is the master object of the joint. A dynamic rectangle is attached to the piston rod of cylinder 3 (also via a solid joint), which is configured as a magnet. The magnet properties depend on a bit operand, which is switched by a switch object. When the magnet is switched on, this is also indicated by a color change of the object. When the magnet is switched on, you can grab the blue rectangle in the storage compartment because it is configured as magnetic.

In this way, the object can be gripped and transported to the other storage compartment by executing the cylinder movements.

Used objects and properties

  • Dynamic objects
  • Static objects
  • Cylinder objects
  • Solid joint
  • Switch objects
  • Magnetism

In this example, the height of objects on a conveyer belt is measured with the aid of a measuring pin. As soon as an object is within the measuring range, the pin is moved down until it touches the object. Then the measured value can be evaluated.

Special feature

The measuring pin is moved downwards by means of a prismatic joint This movement is triggered by sensor S1. As soon as S2 is actuated by the object to be measured, the evaluation can take place. The prismatic joint is set in such a way that it automatically moves upwards again when S1 is no longer actuated. This is achieved via the property "Reverse velocity if status of operands is zero". In the limit switches or the sensors of the prismatic joint, the property "Change min/max direction from position sensor" was selected. This means that the position sensor delivers the maximum value in the retracted state. In the extended state the value 0 is provided. This setting is ideal for the application.

The surface friction of the measuring pin was set to 0.10 so that the objects on the belt are only minimally affected by it. In addition, the maximum force of the prismatic joint is set as low as possible.

Used objects and properties

  • Dynamic objects
  • Static objects
  • Prismatic joint
  • Conveying element
  • Creator
  • Destroyer

In this example, a scale is implemented using a prismatic joint. As of version 1.5.0.5 of PLC-Lab, this joint has a sensor with the designation "sensor force N". For example, a word operand can be specified at this sensor. In these operands, the current force in Newton is then written, which the joint requires to hold the current position or to move to a new position.

Special feature

The second anchor object (slave) of the prismatic joint is located between two conveying elements. From the left, the rectangular objects are placed on the anchor. The prismatic joint now continues to try to hold the position of the anchor, but must apply a higher force to do so. The difference to the force, which is necessary without the load from the resting rectangle, is a measure for the weight of the rectangle object. In the example, the three rectangles have different masses, which can be read off the tacho object.

Used objects and properties

  • Dynamic objects
  • Static objects
  • Prismatic joint with sensor "Force N"
  • Conveying element
  • Creator
  • Destroyer
  • Tacho object

Blue rectangles are created in the example. These are subject to gravity and therefore fall downwards. They activate a limit switch, which changes the collision group of the object.

Special feature

The collision group to be set can be set via a slider object in a range between 1 and 3. Below this there are ramps which are assigned to the respective collision groups 1 to 3 and thus collide only with objects of this group.

Used objects and properties

  • Dynamic objects
  • Static objects
  • Creator
  • Destroyer
  • Limit switch
  • Conveying elements

In the next example, a circle object is transported by a conveying element. On the conveying element there is a limit switch which overwrites the collision group of the circle object in the case of a collision.

Special feature

The collision group to be written can be specified using a slider. Depending on the setting, the circular object is transported away by the auxiliary conveyer 1, 2, or 3. In the property "Additional collision groups", the auxiliary conveyer have been set so that they only transport objects of collision group 1, 2, or 3.

Used objects and properties

  • Dynamic objects
  • Static objects
  • Creator
  • Destroyer
  • Limit switch
  • Conveying elements