8. Station IMS5: Practical Assignment
8.1. Goal
To create a physics-based model of the IMS5 station
To implement the state machine of IMS5 in a TIA Portal program
To control the physics model with the created state machine program via OPC UA
8.2. IMS5 Station Functionality
The purpose of the IMS5 station is to insert a bolt that connects the top part and the bottom part together. Both parts arrive on the workpiece carrier that is transported on a conveyor belt.
The station uses a few sensors and actuators shown in the following figure.
Fig. 8.1 Sensors and actuators on the IMS5 station
Note
A left end limit switch exists on the left end of the conveyor belt

Fig. 8.2 IMS5 mechanism
Note
The guiding magazine in the above animation is blinded out, however, the active collision surfaces assigned to it is shown in pink.
8.3. The Virtual Layer - Mechatronics Concept Designer
Physical properties should be assigned to different parts of the IMS5 station.
Open the assembly file called ASSEMBLY_IMS5.prt
in Siemens NX and navigate to the
Mechatronics Concept Designer
application.
8.3.1. Top part, base part, bolt, and workpiece carrier
The base part, top part, bolt (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.
Fig. 8.3 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 bolts and along which the bolts fall during the separation process. These surfaced keep the bolts in place and guide the bolts 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.
8.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.
8.3.3. Mounting Mechanism - Cylinders (Mounting Cylinder and Stopper Cylinder)
A pneumatic cylinder is used to push the bolt into the other pieces. Another cylinder is used as a stopper for the workpiece carrier.
Rigid and collision bodies
Todo
Assign rigid and collision bodies to the appropriate 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 rod 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 rod.
Todo
Assign sliding joints to each cylinder.
Note
As attachment object, the cylinder’s rod 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: Cylinder_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 sliding objects.
Note
Name the position controls appropriately. For example: Cylinder_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 bCylinder_out
.
Signal Name |
Signal Function |
|
---|---|---|
bStopper_down |
sets the stopper’s position control position to 5mm |
|
bCylinder_out |
sets the mounting cylinder’s position control position to 7mm |
Todo
Create 2 boolean signals in MCD for the position controls of the cylinders.
e sure to define the signals as 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; 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
.
Fig. 8.4 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 two more operations to control the mounting cylinder: One operations to drive the cylinder out and one
operation to drive the cylinder in. Use bCylinder_out
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.
8.3.4. Sensing Mechanism - Entry and Exit Sensors
Collision Sensor
The IMS5 has entry and exit sensors at the start and end of the conveyor belt (see section on IMS5 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
.
8.4. The Physical Layer – PLC Program
A program to control the IMS5 station can be found in the downloads. In this module, a PLC will be simulated to control the station.
8.4.1. TIA Portal
The following figure shows a state machine diagram for the IMS5 station. This state machine is implemented in the program.

Fig. 8.5 A state machine diagram for the IMS5 station’s functionality.
Todo
Open the program in TIA Portal.
Note
Outputs of the MCD Simulation are inputs of the IMS5
function block, and vice versa. Use the same exact
names that are used in the variables in the IMS5
function block in the MCD simulation also.
This allows for auto-mapping later.
Fig. 8.6 Variables of the IMS5 function block
8.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.
8.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.