6. Station IMS4: Practical Assignment

6.1. Goal

  • To create a physics-based model of the IMS4 station

  • To implement the state machine of IMS4 in a TIA Portal program

  • To control the physics model with the created state machine program via OPC UA

6.2. IMS4 Station Functionality

The purpose of the IMS4 station is to mount the top part to the already-existing base part. The bottom part arrives on a workpiece carrier being transported on a conveyor belt.

To achieve that purpose, the station uses a few sensors and actuators, shown in the following figure.

../../_images/ims4_r.PNG

Fig. 6.1 Sensors and actuators on the IMS4 station

Note

The IMS4 station has two latch cylinders. One on each side of the top part being separated.

../../_images/IMS4_3.png

Fig. 6.2 Latch mechanism

../../_images/IMS4_4.png

Fig. 6.3 Station’s functionality

../../_images/IMS4_5.png

Fig. 6.4 Station’s functionality

Note

The guiding magazine in the above figures is blinded out, however, the active collision surfaces assigned to it are shown in pink.

6.3. The Virtual Layer - Mechatronics Concept Designer

Physical properties should be assigned to different parts of the IMS4 station. Open the assembly file called IMS4.prt in Siemens NX and navigate to the Mechatronics Concept Designer application.

6.3.1. Top part, base part and workpiece carrier

The base part, top part (the part being mounted) and the workpiece carrier already have rigid body and collision bodies assigned to them. These objects are assigned on the single part’s level. To see the objects, double click on the respective part in the Assembly Navigator window and navigate to the Physics Navigator window.

Note

The definition of collisions: Two objects collide when they get in contact with and exert forces onto each other. Collisions are part of the station’s functionality. In the context of the simulation, collisions do not refer to accidents.

Rigid and collision bodies

Note

When assigning collision bodies to parts, only sides/areas of the part that will undergo collision during the simulation should be chosen. Avoid defining the entire part as a collision body, because it increases the complexity of the body and unnecessarily slows down the simulation.

Note

When assigning collision bodies to parts, try to choose simple geometry (box, cylinder, sphere, etc.) if complicated geometry (mesh) is not crucial for the physical behaviour of the part.

../../_images/top_part.PNG

Fig. 6.5 An example of collision body assignment. Collision surfaces are shown in pink. The upper part has a simplified geometry and surfaces on the part that will not undergo collision were not chosen, which reduces the complexity.

Todo

Assign collision bodies to the magazine surfaces that store the top parts and along which the top parts fall during the separation process. These surfaced keep the top parts in place and guide the top parts during the separation process. Assign other collision bodies to the left and right side areas for the conveyor belt. These areas help guide the carrier along the conveyor belt.

6.3.2. Conveyor belt

To simulate a conveyor belt, a rectangular surface will be used as a Transport surface. The band itself will be blinded out while the simulation is running.

Todo

Assign a Transport surface to the part 200213_TransportflaecheDUMMY. Do that on the Entire_Transport_Band level.

6.3.3. Mounting mechanism - latches

Rigid and collision bodies

The latches on both sides are what hold the parts from falling. They also separate the parts in two steps. Because they will collide with the top parts, rigid and collision bodies should be assigned to them. Because the latches’ shape is crucial to their functionality, the option mesh should be chosen when assigning collision bodies to both latches.

../../_images/latches.PNG

Fig. 6.6 Two latches are used to separate the parts on two steps.

Note

Assign physical properties to the latches on the LM9681_Montage assembly level. Can mesh be avoided? Try using a simplified collision geometry for the parts of the latch that actually collide.

Joints

Both latches should be allowed to rotate along the bolts on which they are mounted.

Todo

Assign hinge joints to both latches. Specify the axis vector and the anchor point around which the latches will rotate. Because the base of the joint will not be moving, the base object can be left unassigned. Give the joints a clear name.

Angular Spring Joints

Each latch ‘latches’ back to its original position through an angular spring joint (also known as a simple torsion spring). Assign an Angular Spring Joint to each of the latches. Set the spring constant to 20 N.mm/°, damping to 0.1 N.mm.s/°, and relaxed position to 30° away from up-straight adjustment. The following figure shows the angular position of one latch. In a relaxed position (if there were no cylinder to collide with the latch), the latch would be at a 30° angle to the vertical axis. With the cylinder touching the latch, the 30° is never reached. The resulting new angle (marked in blue) is not relevant to setting the parameters of the Angular Spring Joints.

../../_images/latch_position.PNG

Fig. 6.7 Latch positioning with contact to the cylinder

Note

To check if the given parameters reflect the intented behaviour, one can run the simulation and see how the latches will rest. Always run the simulation on the top most hierarchy level i.e., in the IMS4 assembly and not in a sub-assembly.

Danger

Running the simulation in a sub-assembly might be handy, but it leads to an OPC UA communication bug. Avoid running the simulation unless its in the top most assembly level. If OPC UA communication is not working, see the troubleshooting section on how to fix it.

The angular position of the latches will be physically controlled by the latch cylinders. As the cylinders phyically push onto the latches, they induce the separating motion for the top parts magazined in the part tunnel. As the cylinders retract back, the latches latch back to their original position under the effect of their torsion springs.

6.3.4. Mounting Mechanism - Cylinders (Latch Cylinders and Stopper Cylinder)

Two cylinders are used to move the latches and create the part-separating motion. When the cylinders are retracted, the latches swing back to their original positions through a torsion spring attached to them (not shown in the CAD model).

../../_images/cylinders.PNG

Fig. 6.8 Two cylinders are used to push the two latches. One cylinder is used to stop the workpiece carrier.

Rigid and collision bodies

Todo

Assign rigid and collision bodies to the cylinder parts.

Note

When assigning rigid bodies to part, a few parts can be selected together and defined as one colelctive rigid body. This should be done if those parts will always undergo the same motion together. In the case of the stopper cylinder, the cylinder itself but also the attached gummy object around it can be selected together.

Joints

Each cylinder should be constrained in all directions but one. Since every cylinder will only be either driven out or in, a sliding joint should be assigned to each cylinder.

Todo

Assign sliding joints to each cylinder.

Note

As attachment object, the cylinder itself should be chosen. Becasue the housing of the cylinders will not move during the simulation, the base object can be left unselected. Selecting the housing of the cylinders as the base object is in this case optional.

Note

Make sure to name each of the joints appropriately. For example: Latch_1_SlidingJoint, Latch_2_SlidingJoint, and Stopper_SlidingJoint

Note

Define a lower limit of 0 and an upper limit of 10. This prevents the physical object of wandering beyond those limits.

Position Control

To control the position of the object on the sliding joint, position controls have to be assigned to the sliding joint objects.

Todo

Create position controls and assign them to each of the 3 sliding objects.

Note

Name the position controls appropriately. For example: Latch_1_PositionControl, Latch_2_PositionControl, and Stopper_PositionControl

Signals

In order to, in turn, control those position controls through boolean variables from the PLC program later (the goal), one should create signals in MCD and name them appropriately. For example: bStopper_down and bSwings_open.

Note

Only one signal can be responsible for triggering both latches. Therefore, do not create two signals for the two latches, but create one signal to control both of them.

Signal Name

Signal Function

bStopper_down

sets the stopper’s position control position to 5mm

bSwings_open

sets the latch’s position control position to 5mm

Todo

Create 2 boolean signals in MCD for the position controls of the cylinders. Be sure to define the signal as an Inputs, since they are inputs from MCD’s perspective.

Note

Do not link the signals to any runtime variables. These signals will trigger opertations later.

Note

You can create a symbol table for the all of those signals and call it PLCSIM_Advanced. Symbol tables are a good way to arrange and organize signals that are related together. Since these signals will communicate with PLCSIM Advanced, such a name for the symbol table provides clarity.

Operations

Operations are like if-statements in the MCD simulation. They can be used to trigger something in the simulation if an external (or internal) condition is met.

Todo

Create an operation to send the stopper cylinder down. Call it Stopper_down_operation for clarity.

Note

Operations can be found in the Sequence Editor menu on the left.

The selected physics object of the operation is the stopper’s position control Stopper_PositionControl. The runtime parameter selected is the position, because this is the parameter to be manipulated by the operation. The new value is inserted in the Value column. Under Condition, the condition object selected is the signal bStopper_down. The if-value of the signal should be set to true.

../../_images/stopper_operation.PNG

Fig. 6.9 An operation to send the stopper’s sliding joint to position 5mm if the signal bStopper_down is true.

The equivalent in C++ would be:

if(bStopper_down == true) {stopper_sliding_position = 5;}

Todo

Create an additional operation that would set the value of Stopper_PositionControl to 0 mm if bStopper_down is false. Call the operation Stopper_up_operation.

Todo

Create 4 more operations to control both latch-cylinders: Two operations to drive the cylinders out and two operations to drive the cylinders in. Use bSwings_open as the boolean condition-variable for these operations.

Todo

Create a boolean signal and use an operation to turn the conveyor belt on and off.

6.3.5. Sensing Mechanism - Entry and Exit Sensors

Collision Sensor

The IMS4 has entry and exit sensors at the start and end of the conveyor belt (see section on IMS4 Station Functionality). These two sensors will be simulated as two small cubes with collision sensor properties.

Create a new block in mechanical concept under the Home tab. Give the block the dimensions of 10mm x 10mm x 10mm. Under the Assemblies tab, click on Create New to create a new model. Name the model something appropriate, like end_limit_switch_dummy and click OK. To select the block just created, navigate to Part Navigator on the left-side menu and choose the block that was just created. Now the block is a model and can be seen in the Assembly Navigator. Choose Move Component under the Assemblies tab and move the new block to where the sensor is supposed to be.

Note

When moving an object, clicking on Specify Orientation will enable you to drag on the three axis to move the object.

Now that the dummy-sensor is in place on the conveyor belt. Assign a collision sensor to it. Be sure to call the collision sensor something appropriate, like End_limit_switch_right.

Signal

For the dummy sensor to send its reading to the PLC, a signal should be created.

Todo:

Create a boolean signal and connect it with a runtime parameter. The physics object selected should be the End_limit_switch_right object. Be sure to define the signal as an Output, since it is an output from MCD’s perspective.

Note

It is important to give the signal a clear name. For example: bEnd_limit_switch_right. Where b in the beginning stands for boolean.

The entry sensor is done for now. Later, End_limit_switch_right will be mapped to a PLC signal with the exact same name.

Todo

Go through the same steps again and create a second sensor to detect the carrier’s exit. Call the new sensor signal bEnd_limit_switch_left.

6.4. The Physical Layer – PLC Program

A program to control the IMS4 station can be found in the downloads. In this module, a PLC will be simulated to control the station.

6.4.1. TIA Portal

The following figure shows a state machine diagram for the IMS4 station. This state machine is implemented in the program.

../../_images/ims4_state_machine.png

Fig. 6.10 A state machine diagram for the IMS4 station’s functionality.

Todo

Open the program in TIA Portal.

Note

Outputs of the MCD Simulation are inputs of the IMS4 function block, and vice versa. Use the same exact names that are used in the variables in the IMS4 function block in the MCD simulation also. This allows for auto-mapping later.

../../_images/ios.PNG

Fig. 6.11 Variables of the IMS4 function block

6.4.2. PLCSIM Advanced

Todo

Start PLCSIM Advanced and start a PLC simulation.

Note

Make sure the PLC simulated has the same name as the PLC in the TIA Portal program.

Note

Make sure PLCSIM Virtual Eth. Adapter is selected.

In TIA Portal, compile your program and upload it to the simulated PLC.

6.5. Controlling the MCD Application using the PLC Program

Todo

Make sure an OPC UA server is configured in the PLC program and connect to it in MCD. When including variables from the PLC program through OPC UA, choose the variables that you need to control the simulated production station.

Todo

In the Signal Mapping window in MCD, click the option Do Auto Mapping. This will automatically map identically-named signals to each other.

Todo

Run the simulation and watch the PLC’s variables in a watch table. The production station should now be controlled through the simulated PLC.