Motion Control
Basic Workshop
Unrestricted | © Siemens 2021 | Trần Văn Hiếu | SITRAIN | 2021/2022
Motion Control
• Basic 2
• Hardware
24
• Technology Object
33
• Program 53
Unrestricted | © Siemens 2021 | Trần Văn Hiếu | SITRAIN | 2021/2022
Introduction
Why Motion?
Motion Control
increasingly substitutes mechanical solutions
Motion Control becomes a more important factor
Introduction
Current systems
S7-300 CPU SINAMICS
request EPos No motion is integrated in the CPU
response
Communication with drives is possible
S7-300 CPU SINAMICS
Speed setpoint
Software based solution for motion
Easy Programming with PLCopen blocks
Motion Actual position
Control
S7-300 T-CPU SINAMICS
Speed setpoint
Additional processor for motion
Actual position
Programming with PLCopen blocks
Introduction
Motion in S7-1200 and S7-1500 S7-1500 S7-1200
Every S7-1200 and S7-1500 includes integrated motion functionality in the firmware!
S7-1200 / S7-1500 Easy insertion and configuration of drives
Easy programming using PLCopen blocks
Easy diagnostics in the TIA Portal
Functionality
S7-1200 S7-1500
Open loop speed control
Open loop position control
Closed loop speed control
Closed loop position control
Homing
Control loop
Basic structure of a positioning control
PLC Inverter
Positioning Inter- Position Speed Current Power
- Motor
control polator - controller - controller controller module
Actual current Encoder
Actual position Actual speed
Position controller: Calculation of the speed setpoint
Interpolator: Calculation of the position setpoint considering the dynamic values
Positioning control: Commanding a position or speed
System
Closed control loop in the S7-1500
S7-1500 SINAMICS
User- MC-Interpolator MC-Servo Control Unit (CU) Power Module
program [OB 92] [OB 91]
Positioning- Inter- Position Speed Current Power
- - controller
Motor
control polator controller - controller module
Evaluation Encoder
TM-Modul
Evaluation
MC-Interpolator [OB92]: Executes of the motion control instructions
Generates the position set point
MC-Servo [OB91]: Calculates the position controller
System
Technology OBs
Servo Event / PN IRT Cycle
PI Out Two possibilities to execute the OB:
OB Servo
PI IN
Input PIP
- Cyclic with a defined cycle time
- Synchronous to the bus
OB 1 MC-Servo
MC-Servo is always executed before MC-Interpolator
OB 91
OB Servo OB91 and OB92 are always executed with the ratio 1:1
Output PIP
IPO Event
Default priorities:
MC-Inter- - OB91: 25
polator
OB 1 - OB92: 24
OB 92
Content of the MC-OBs are not modifiable
Topology
Connection of drives to the S7-1500 S7-1500 S7-1200
S7-1500
Flexible drive connection:
PROFINET IO / PROFIBUS DP / Analog (V/I)
V/I Which devices are supported?
All GSD(ML) devices (Siemens and third-party supplier)
GSD(ML)-files of the Siemens drives are preinstalled
With installed Startdrive:
V/I SINAMICS G120 are insertable from the hardware catalogue
and parameterisable directly in TIA Portal by using Startdrive
In the futur all SINAMIC drives will be
integrated in TIA Portal with Startdrive!
Topology
Connection of encoder to the S7-1500 S7-1500 S7-1200
S7-1500
Flexible encoder connection:
Direcly to the drive
Via PROFINET IO / PROFIBUS DP
Via technology module (TM) V/I
(central or decentral)
Encoder at Encoder via Encoder via Encoder via
the drive PN or PB technology module technology module Encoder via technology module
Structure
Motion in the TIA Portal S7-1500 S7-1200
Where does motion appear in the TIA Portal?
Hardware configuration
Programming
Represent the drive in the PLC
Parameterization of the drive
Structure
Concept
Structure of a drive application with a S7-1500
PLC
User program
Motion control instructions
Technology object „axis“ (DB)
Represents the drive in the PLC
Firmware
Position controller, Interpolator, …
Drive
Inverter
(Speed controller, Monitoring, …)
Structure
User program S7-1500 S7-1200
Motion control instructions
PLC
User- Starting motion control instructions refering to a technology
program object by using PLCopen blocks
- Disable/enable axis
Technology - Acknowledging errors
object (TO) - Move axis in jog mode
Firmware - Motion with speed preset
- Stop axis
- Home/set axis
Drive /
- Relative positioning
External encoder
- Absolute positioning (Homing required)
Structure
Technology object
S7-1500 S7-1200
Properties of technology objects
PLC TOs…
… represent the real drives in the PLC
User- … are the interface between real drive and user program
program
Technology Data is saved in the Technology datablock
object (TO)
Firmware
Advantage:
Dimensioning and parameterization of the drive is
Drive / independant from user programm!
External encoder
Structure
Technology object
S7-1500 S7-1200
Available technology objects and quantity
PLC
S7-1200 S7-1500
User-
program
Available SpeedAxis
TOs for Axis_PTO PositioningAxis
motion
Technology External encoder
object (TO)
Firmware
Quantity 4 axes X TOs
Drive /
External encoder
Structure
Technology object
S7-1500 S7-1200
Technology objects in the TIA Portal
Configuration: Configuration of the drive data
Commissioning: Operating drive with control panel
(Using the drive without user program)
Diagnostics: Actual status and error information
Technology object
PositioningAxis
Structure
CPU firmware S7-1500 S7-1200
PLC
CPU firmware
User-
program
Communication with the drive
Technology
object (TO) Cyclic actualization of the TO-DBs
Firmware
Execution of the motion instructions
Drive /
External encoder
Structure
Drive S7-1500 S7-1200
Paramerization of the drive
PLC
User-
program The drive can be parameterized either via Startdrive or Starter
Current: separate Now: just one single
engineering software engineering platform
Technology
object (TO)
Firmware
Drive
Communication
Overview
Communication with the drive
Cyclic data channel: deterministic process value exchange
PLC to drive Drive to PLC PLC
- Control words - Status words
- Setpoint values - Actual values
cyclic Acyclic data
data exchange exchange
Acyclic data channel: non-deterministic parameter access Drive
Execution just on demand
Reading and writing of drive parameters
Communication
Cyclic data exchange
Control word 1 (STW1) and Status word 1 (ZSW1) are transferred always!
STW1 and ZSW1 are defined in the PROFIdrive specification:
STW1: PLC -> Drive ZSW1: Drive -> PLC
Additionally to STW1 and ZSW1, further process values can be exchanged.
Predefined PROFIdrive telegrams are used.
Communication
Available standard telegrams
Telegram PZD 1 PZD 2 PZD 3 PZD 4 PZD 5 PZD 6 PZD 7 PZD 8 PZD 9
STW1 NSOLL
1 Speed setpoint 16 bit
ZSW1 NIST
STW1 NSOLL STW2
2 Speed setpoint 32 bit PZD: Process data word
ZSW1 NIST ZSW2
Speed setpoint 32 bit, STW1 NSOLL STW2 G1_STW
3
Position encoder ZSW1 NIST STW2 G1_ZSW G1_XIST1 G1_XIST2
Speed setpoint 32 bit, STW1 NSOLL STW2 G1_STW XERR KPC
5
Position encoder, DSC ZSW1 NIST ZSW2 G1_ZSW G1_XIST1 G1_XIST2
STW1: Control word 1 STW2: Control word 2 G1_STW: Encoder 1 Control word
NSOLL: Speed setpoint ZSW2: Status word 2 G1_ZSW: Encoder 1 Status word
ZSW1: Status word 1 XERR: Position deviation G1_XIST1: Encoder 1 actual position 1
NIST: Speed actual value KPC: Position controller gain factor G1_XIST2: Encoder 1 actual position 2
Communication
Available encoder telegrams
Telegram PZD 1 PZD 2 PZD 3 PZD 4 PZD 5 PZD 6 PZD 7 PZD 8
STW2_ENC G1_STW
81 1 encoder channel
ZSW2_ENC G1_ZSW G1_XIST1 G1_XIST2
STW2_ENC G1_STW
1 encoder channel
83
Speed actual value ZSW2_ENC G1_ZSW G1_XIST1 G1_XIST2 NIST
STW2_ENC: Control word 2 ENCODER G1_XIST1: Encoder 1 actual position 1
PZD: Process data word
G1_STW: Encoder 1 Control word G1_XIST2: Encoder 1 actual position 2
ZSW2_ENC: Status word 2 ENCODER NIST: Speed actual value
G1_ZSW: Encoder 1 Status word
Interaction
Technology Motion with S7-1500
CPU S7-1500 TIA Portal
User interface
Configuration
Instruction
Commissioning
PLCopen- Technology library
blocks objects Diagnostics
Startdrive
Firmware
Motion handling
Position setpoint Position-
calculation controller
Inverter
Actual value handling Speed Current
controller controller
Communication
Further functions
Motion Control
• Basic 2
• Hardware
24
• Technology Object
33
• Program 53
Unrestricted | © Siemens 2021 | Trần Văn Hiếu | SITRAIN | 2021/2022
Overview
Add hardware in „devices & networks“
Adding a drive
TIA Portal TIA Portal
without Startdrive with Startdrive
Insertion via GSD(ML) file Insertion via hardware catalogue
Parameterization/Commissioning Parameterization/Commissioning
via STARTER via Startdrive in the TIA Portal
GSD(ML) drives
Add a drive via GSD(ML) file
Network view
Drives can be inserted using GSD(ML) files, Siemens drives are preinstalled.
Insert drive
Assign the
drive to a PLC
GSD(ML) drives
Telegram and configuration
Device view
Device view
1
Click on the
interface
3
4 Insert
Further telegram
settings
Drives with Startdrive
Overview
Startdrive: Integration of the engineering software STARTER in the TIA Portal
Features
Same look and feel for all drive settings
e.g. drive is been listed in the project tree as a device
Easy parameterization of the drives with wizards
Data consistency between Step7 and Startdrive
Use known STARTER editors directly in the TIA Portal
Drives with Startdrive
Configuration
Network view
View of a drive in the hardware configuration and project tree
All G120 drives are
insertable via the
hardware catalogue
Drives with Startdrive
Configuration
Device view
Adding a
power module
Configuration of the
device looks similar
to other devices
Drives with Startdrive
Parameterization
Offline/Online parameterization of a drive
1 2 3
1 Conduct basic settings with commissioning wizards
2 Functional view of the parameters
3 Parameter list (expert list)
Drives with Startdrive
Commissioning and diagnostics
Commissioning
and diagnostics
Integrated trace
Motion Control
• Basic 2
• Hardware
24
• Technology Object 33
• Program 53
Unrestricted | © Siemens 2021 | Trần Văn Hiếu | SITRAIN | 2021/2022
Overview
Workflow
For every drive, a technology object needs to
be added!
Workflow:
1 Insert technology object
2 Configuration
1 3 Commissioning
2
3
4
4 Diagnostics
Overview
Adding a new technology object
Assign name
2
Assign DB
number
Choose
TO type
1
Configuration
Overview
Arrangement of the configuration
Basic parameters & HW Interface
they need to be configured
Configure
axis
Extended parameters
they are predefined and
changeable if necessary
Configuration
Symbols
Status of the configuration
Configuration only contains predefined values and is complete
Configuration contains at least one manually changed value
and is complete
Configuration is either wrong or incomplete
Configuration
Basic parameters
Basic parameters Choose an
axis type
General settings for the
technology object
Unit settings
Selection of a rotary axis:
Graphics changes depending
the actual settings Modulo settings
Configuration
HW Interface
Drive
Special feature:
White background shows
the device, which can be
configured in this mask
Graphics changes depending
the actual settings
Choose an
available drive
Configuration
HW Interface
Encoder
Possibility1 3
Possibility 2
Possibility 1:
Connection to the drive
Possibility 2:
Connection via technology module (TM) Selectionofofana
Selection
TM modul
encoder
Possibility 3:
Connection via PROFINET/PROFIBUS
Configuration
HW Interface
Possibility 2
Communication
1 Between PLC and drive
• Select telegram (1, 2, 3, 5)
• Reference speed
2 Between PLC and TM module (or encoder)
• Select telegram (81, 83)
2
3 Encoder settings 1
3
• Encoder type
• Resolution
3
Configuration
Extended parameters
Extended parameters…
… are all predefined
… could be changed optionally
Categories:
- Mechanics
- Limits and default values
- Emergency stop
- Homing
- Position tracking
- Closed loop control
Commissioning
Overview
Technology object
Configuration
Commissioning
Diagnostics
Technology object
PositioningAxis
Commissioning
Control Panel
Overview
Controlling the drive manually 1
without an user program
2
Parts of the control panel:
1 Axis control
3
2 Motion control
3 Information
Commissioning
Control Panel
Workflow
Activate axis
2
Security warning
Commissioning
Control Panel
Workflow
Enable the axis
2 1
Select the
operation mode
Commissioning
Control Panel
Workflow
Start motion
Enter motion
values
Commissioning
Control Panel
Workflow
Online information
Diagnostics
Overview
Technology object
Configuration
Commissioning
Diagnostics
Technology object
PositioningAxis
Diagnostics
Status- and error bits
Diagnostics
Status and error bits
Diagnostics
Motion status and PROFIdrive interface
Diagnostics
Watch content of the
PROFIdrive telegrams
Watch online values
of the drive
DB editor
Technology datablock
Datablock of a technology object
Content:
Configuration data
Setpoint values
Actual values
Status information
2
Motion Control
• Basic 2
• Hardware
24
• Technology Object
33
• Program
53
Unrestricted | © Siemens 2021 | Trần Văn Hiếu | SITRAIN | 2021/2022
Overview
Adding a user program
Using technology instructions in the user program to
control the axis
Workflow:
1 Configure the MC_OBs
2 Add code block
2 3 Call added code block in the cyclic program (OB1)
3
1
4 Write user program (with PLCopen blocks)
4
Technology OBs
Configuration
MC-Servo & MC-Interpolator
2
User program
Adding first program parts
1 Add new code block (FB or FC)
2 Call code block in the cyclic program
1
User program
Programming with PLCopen
Programming motion instructions in the user program
Insertion of a
MC_block from
the library
3 2
1 Motion control library
with the MC_blocks
MC_blocks
Instruction library
Available MC_blocks
MC_Halt Stop axis
MC_Home Home/set axis
MC_MoveAbsolute Absolute positioning
MC_MoveJog Motion in jog mode
MC_MoveRelative Relative positioning
MC_MoveVelocityMotion with preset velocity
MC_Power Disable/enable drive
MC_Reset Acknowledging errors
MC_blocks
Overview
Basic functions Requirements
Types of
Enable function
MC_blocks For all motion functions, the axis
Motion functions needs to be enabled -> MC_Power
TO configured For MC_Absolute, the axis needs
to be homed -> MC_Home
MC_Power MC_Home
MC_Reset
(set position) MC_blocks can abort each other
Axis enabled
MC_Home
MC_Halt
(homing)
MC_MoveJog MC_MoveRelative MC_MoveVelocity MC_MoveAbsolute
MC_blocks
Overview
Basics of MC_blocks:
Every block has basic parameters
(not every block has all basic parameters)
Every block needs to be assigned to a TO Axis Technology object
(Drag&Drop of a TO to the block)
Execute Start instruction with a rising edge
Done Instruction was being executed
Busy Instruction is active
Command Instruction was aborted by another instruction
Aborted
Error Error pending
ErrorID Error information
Shortcut from the block to Besides the basic parameters, every block has
the corresponding TO specific parameters (e.g. velocity, position, …)
Example program
Enable axis
Acknowledging errors
Motion with velocity preset
Useful Links
Programming recommendations for S7-1200 and S7-1500 with STEP 7 (TIA Portal)
http://support.automation.siemens.com/WW/view/en/67582299
Programming guideline for S7-1200/1500 (also in PDF as customer workshop)
http://support.automation.siemens.com/WW/view/de/81318674
Migration:
Migration production plants– http://support.automation.siemens.com/WW/view/en/83558085
Migration PLC´s – http://support.automation.siemens.com/WW/view/en/83557459
Migration Vizualisation – http://support.automation.siemens.com/WW/view/en/76878921
Migration communication – http://support.automation.siemens.com/WW/view/en/83558087
Migration periphery – http://support.automation.siemens.com/WW/view/en/83558994
Let us know if there is anything
we can support you with!
For further information and support, please contact:
Mr. Tran Van Hieu
SITRAIN Manager – Digital Industry Academy
Siemens Vietnam
Email: [email protected]
www.siemens.com.vn
www.facebook.com/Siemens.Vietnam
Page 63 Restricted | © Siemens Vietnam 2021 | Digital Industries