4. Station IMS3: Practical Assignment
4.1. Goal
To create a physics-based model of the IMS3 station
To implement the state machine of IMS3 in a TIA Portal program
To control the physics model with the created state machine program via OPC UA
4.2. IMS3 Station Functionality
The purpose of the IMS3 station is to mount the base part on the workpiece carrier.
The station has a few sensors and actuators, shown in the following figure.
Fig. 4.1 Sensors and actuators on the IMS3 station

Fig. 4.2 The 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.
4.3. The Virtual Layer - Mechatronics Concept Designer
Physical properties should be assigned to different parts of the IMS3 station.
Open the assembly file called ASSEMBLY_IMS3.prt
in Siemens NX and navigate to the
Mechatronics Concept Designer
application.
4.3.1. Base part and workpiece carrier
The base 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
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, area etc.) if complicated geometry (mesh) is not crucial for the physical behaviour of the part.
Fig. 4.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 parts and along which the parts fall during the separation process. These surfaced keep the parts in place and guide the 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.
4.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 (double-click on Entire_Transport_Band
from the Assembly Navigator to enter that assembly’s level).
4.3.3. Mounting mechanism - latches
Rigid and collision bodies
A latch prevents the current part from falling and separates parts from the magazine when the mechanism is
triggered. Assign a rigid and collision body to the latch. Use the option mesh
for the collision body.
Fig. 4.4 A latch is used for the separation process.
Note
Assign physical properties to the latches on the LM9680_Vereinzeln_SE
assembly level. Can mesh be avoided? Try using a simplified collision geometry for the parts of the latch that actually collide.
Joint
The latch should be allowed to rotate around the bolt on which it is mounted.
Todo
Assign a hinge joint
to the latche. Specify the axis vector and the anchor point around which the latche
will rotate. Because the base of the joint (i.e., the rest of the assembly) will not be moving,
the base object can be left unassigned. Give the joint a clear name.
Angular Spring Joint
The 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 the latche. 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 the 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
.
Fig. 4.5 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 IMS3 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 latche will be physically controlled by the latch cylinder. As the cylinder phyically pushes onto the latche, it induces the separating motion for the bottom parts magazined in the part tunnel. As the cylinder retracts back, the latch latches back to its original position under the effect of the torsion springs.
4.3.4. Mounting Mechanism - Cylinders (Latch Cylinders and Stopper Cylinder)
A cylinder is used to push the latch and to perform the separation mechanism. When the cylinder is retracted, the latch swings back to its original positions through a torsion spring attached to it.
Fig. 4.6 A cylinder is used to push the latch. Another cylinder is used to stop the workpiece carrier.
Note
The torsion spring is not shown in the CAD Model.
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 rubber object around it can be selected together.
Joints
Each cylinder should be constrained in all directions but one. Since every rod 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 an attachment object, the rods 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 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 |
|
bSwing_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
.
Fig. 4.7 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 2 more operations to control the latch cylinder: 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.
4.3.5. Sensing Mechanism - Entry and Exit Sensors
Collision Sensor
The IMS3 has entry and exit sensors at the start and end of the conveyor belt (see section on IMS3 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
he 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
.
4.4. The Physical Layer – PLC Program
A program to control the IMS3 station can be found in the downloads. In this module, a PLC will be simulated to control the station.
4.4.1. TIA Portal
The following figure shows a state machine diagram for the IMS3 station. This state machine is implemented in the program.

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