© Siemens AG 2011. All Rights Reserved.
SIMOTION
Example for Beginners
© Siemens AG 2011. All Rights Reserved.Industry Sector
SIMOTION -Programming
SIMOTION -Configuration
SINAMICS -Configuration
Create Project
Program -Conception
SIMOTION - Basic Information
Task
Introductory Information
Example for BeginnersDisclaimer of liability
The application examples and the associated documentation contained on this DVD are made available without cost. The customer receives for the software the non-exclusive, non transferable, free right to use the software; this includes the right to change the software, to copy it changed or unchanged, and to combine it with the customer's own software.
Siemens AG has not subjected the software to the normal system test otherwise usual for software.
Any liability – irrespective of the legal reason – in particular because of software errors or the associated documentation or damages resulting from consulting is excluded, unless, for example, because of premeditation, gross negligence, risk to life, injury or health, acceptance of suitability guarantee, malicious concealment of a fault or a violation of significant contractual obligations, would force liability. A reversal of the burden of proof to the customer's disadvantage is thus not included.
German legal right applies. Place of jurisdiction is Erlangen.
© Siemens AG 2011. All Rights Reserved.Industry Sector
SIMOTION -Programming
SIMOTION -Configuration
SINAMICS -Configuration
Create Project
Program -Conception
SIMOTION - Basic Information
Task
Introductory Information
Example for Beginners Some preliminary comments
Before processing the Example for Beginners, it is advisable to study ”Getting Started with SIMOTION SCOUT" (Menu Help Getting Started).
In the example, some elements have been extended more than necessary in order to demonstrate as many different aspects of SIMOTION as possible (e.g. a virtual axis as master).
Menu- and context menu commands are shown in italic type as well as the names of dialogs and tabs etc.. Menu Sub menu are separated by an arrow.
The screenshots were created with SIMOTION Version 4.2 (05/2011). Under some circumstances there may be minor changes for future versions.
The firmware version on the SIMOTION D435 should agree with the SIMOTION SCOUT version.
© Siemens AG 2011. All Rights Reserved.Industry Sector
SIMOTION -Programming
SIMOTION -Configuration
SINAMICS -Configuration
Create Project
Program -Conception
SIMOTION - Basic Information
Task
Introductory Information
Example for Beginners Machine diagrams
Carton erector
Product feed
Palletizer
Sensor
Conveyor belt
Package (full)Package (empty)
Extractor- Electrical travel- Eject pneumatically
Procedure notes are contained in the Program Design section
© Siemens AG 2011. All Rights Reserved.Industry Sector
SIMOTION -Programming
SIMOTION -Configuration
SINAMICS -Configuration
Create Project
Program -Conception
SIMOTION - Basic Information
Task
Introductory Information
Example for Beginners Task
Task:Packages with a protruding machine part are used on a conveyor belt (drive 1). An empty package is detected by a sensor and should be removed with an extractor (drive 2). The removal itself is performed pneumatically. When an emergency off switch is pressed, all drives should be stopped immediately. The current position of the conveyor belt should be displayed on the operator panel.
The machine diagrams show a machine part, the implementation in SIMOTION is shown in the following slides.The solution concept shows only one of many possible solutions. This particular solution was selected to use as many different SIMOTION functions as possible:
Cam with CamToolGearbox synchronismCammingOutput camsVirtual master axis etc.
© Siemens AG 2011. All Rights Reserved.Industry Sector
SIMOTION -Programming
SIMOTION -Configuration
SINAMICS -Configuration
Create Project
Program -Conception
SIMOTION - Basic Information
Task
Introductory Information
Example for BeginnersTopology of the automation solution
SIMOTION SCOUT
ET 200 *
MICROMASTER 420 *
Profibus DP
D435
1 FK7
HMI
Carton erector *Feed *
* Not considered in the example, but part of the complete plant
Transport
Extractor
© Siemens AG 2011. All Rights Reserved.Industry Sector
SIMOTION -Programming
SIMOTION -Configuration
SINAMICS -Configuration
Create Project
Program -Conception
SIMOTION - Basic Information
Task
Introductory Information
Example for Beginners Execution system
Time triggered Tasks Task 1 Task 2 Task 5
Motion Tasks Motion Task 1 Motion Task 2 Motion Task 20
Run
Startup TaskStop Run
Background Task Background TaskCall Motion Tasks (se-quentialtasks)
1
Synchronous Tasks IPO - sync Task 1 IPO - sync Task 2 Monitor the emergency off criteria
2
System Int TasksSystem Int TasksInterrupt Tasks User Int Task 1 User Int Task 2 System Int TasksResponse to
process signals
3
Shutdown Task
Run Stop
© Siemens AG 2011. All Rights Reserved.Industry Sector
SIMOTION -Programming
SIMOTION -Configuration
SINAMICS -Configuration
Create Project
Program -Conception
SIMOTION - Basic Information
Task
Introductory Information
Example for Beginners Execution system / cyclical and sequential programming
Central topic for SIMOTION: Which job do I solve in which task or which tasks are particularly suitable for specific jobs.In the example, the background task is used to start sequential tasks (MotionTasks). The sequential tasks are used to implement processes and to start movements. The UserInterruptTask initiates an incorrect part handling depending on an external signal. The IPOsynchronousTask task monitors a protective door.
Another central question in SIMOTION: Which program sections are programmed cyclically and which are programmed sequentially. The same result can often be achieved in both ways. For motion commands, SIMOTION supports the programming in the cyclical context. The monitoring of the status of a motion command is performed by the system when sequential programming is used (nextCommand:=WHEN_MOTION_DONE).
© Siemens AG 2011. All Rights Reserved.Industry Sector
SIMOTION -Programming
SIMOTION -Configuration
SINAMICS -Configuration
Create Project
Program -Conception
SIMOTION - Basic Information
Task
Introductory Information
Example for Beginners Comparison of cyclical and sequential programming
To simplify the understanding, the comparison on a sample task follows: ”Pos “ should move to “Target”; the “Finished“ variable is set to TRUE when the position is reached.
_pos ( axis:= Pos, position:= Ziel, nextCommand:= WHEN_MOTION_DONE)
Fertig:= TRUE;
Sequential Task: Cyclical Task:
Program processing stops until the target position is reached
Pos_status:=_getStateOfAxisCommand ( Pos,
PosCommandID)
IF (Pos_status <> ACTIVE ANDFertig = FALSE ) THEN_pos ( axis:= Pos,
position:= Ziel, nextCommand:= IMMEDIATELY,commandID:= PosCommandID);
END_IF
IF Pos.motionstatedata.motioncommand =MOTION_DONE THENFertig:= TRUE;
END_IFCyclical program section continued
Advance command
Query status pos. command
Pos. command
Advance command
Query position
© Siemens AG 2011. All Rights Reserved.Industry Sector
SIMOTION -Programming
SIMOTION -Configuration
SINAMICS -Configuration
Create Project
Program -Conception
SIMOTION - Basic Information
Task
Introductory Information
Example for Beginners Variable model
System variables
Technology objects
SIMOTION device
Global user variables
I/O variables
Device global variables
Unit variables
Local user variables
Program variables
FC variables
FB variables
SIMOTION always differentiates between three types of variable groups:
System variables are automatically provided by the system or from technological objects and do not need to be created by the user.
Global user variables are defined by the user and have a wide scope: device global, project global or unit global.
Local user variables have a limited scope. They are always valid only within the defining program unit (program, function or function block).
© Siemens AG 2011. All Rights Reserved.Industry Sector
SIMOTION -Programming
SIMOTION -Configuration
SINAMICS -Configuration
Create Project
Program -Conception
SIMOTION - Basic Information
Task
Introductory Information
Example for Beginners Variable model
System variables
Technology objects
SIMOTION device
Global user variables
I/O variables
Device global variables
Unit variables
Local user variables
Program variables
FC variables
FB variables
Variable is assigned to a TO (e.g. actual position of an axis)
Variable is assigned to the SIMOTION device (e.g. system clock)
Variable indicates an input/output area (e.g. Startpos -> P10.1)
Variable can be accessed from anywhere on the device
1. A variable can only be used in programs, functions and function blocks.
2. A specially exported variable can also be used in other units.
Variable can only be used within the declaring program
Variable can only be used within the declaring function (FC)
Variable can only be used in the declaring function block (FB)
© Siemens AG 2011. All Rights Reserved.Industry Sector
SIMOTION -Programming
SIMOTION -Configuration
SINAMICS -Configuration
Create Project
Program -Conception
SIMOTION - Basic Information
Task
Introductory Information
Example for Beginners Solution guide
Current situationTask (machine diagram)
Topology concept with SIMOTION
Program conceptTechnology objects
Task structure
Task relationships
Variables
System environmentCreate device
Specification of the possible DP cycle clock
Creation of a hardware configuration
DrivesParameterization SINAMICS
Axis configurationMaster axis
Conveyorbelt
Extractor
Output cam configurationCam configuration
Form
Parameterization
Programming, parameterization and test
WinCC flexible connection
© Siemens AG 2011. All Rights Reserved.Industry Sector
SIMOTION -Programming
SIMOTION -Configuration
SINAMICS -Configuration
Create Project
Program -Conception
SIMOTION - Basic Information
Task
Introductory Information
Example for Beginners Technology objects
Virtual master axis
Positioning axis
Rotary axis (modulo)
Real axis - conveyorbelt
Following axis
Rotary axis (modulo)
Gearbox synchronism
Real axis - pusher
Following axis
Linear axis
Camming
Cam - extractor
Not cyclical
Cam controller – pneumatic extractor
Position-based cams
Interpolator
© Siemens AG 2011. All Rights Reserved.Industry Sector
SIMOTION -Programming
SIMOTION -Configuration
SINAMICS -Configuration
Create Project
Program -Conception
SIMOTION - Basic Information
Task
Introductory Information
Example for Beginners Task structure
Startup Task
Initialization - ST
Background Task
Execution control - FUP
Call the homing task / initial setting travel - FBD
Call the automatic operation -FBD
Motion Task 2 (Homing)
Homing (incremental encoder) and possibly initial setting travel of the associated axes -MCC
Motion Task 3 (Automatic operation)
Start the master axis - MCC
Synchronize the conveyorbelt -MCCTrigger the pneumatic valve -MCC
Motion Task 4Call the extractor task - MCC
User Interrupt Task 1 (stock outage detection)
Call the extractor task - MCC
IPO sync Task (Emergency stop monitoring)
Test protective door - MCC
Tech Fault / Peripheral Fault Task (fault handling)
Acknowledge error - MCC
© Siemens AG 2011. All Rights Reserved.Industry Sector
SIMOTION -Programming
SIMOTION -Configuration
SINAMICS -Configuration
Create Project
Program -Conception
SIMOTION - Basic Information
Task
Introductory Information
Example for Beginners Task relationship / Program start
User Interrupt
IPO Sync Task
Start program pEject
Motion Task 2
Motion Task 3
Interrupts the Task
Startup
BackgroundMotion Task 3
Motion Task 4
Motion Task 2
© Siemens AG 2011. All Rights Reserved.Industry Sector
SIMOTION -Programming
SIMOTION -Configuration
SINAMICS -Configuration
Create Project
Program -Conception
SIMOTION - Basic Information
Task
Introductory Information
Device-global variablesNone
Unit-global variablesVelocity of the leading axis
Open protective door
Program end
Operating mode
Local variablesNone
I/O-variables (symbol browser)Onboard inputs (CU)
ib16DigCU (all inputs)WORD (DI_0_15)
iboEject (Sensor)BOOL (DI_2)
iboProtDoorBOOL (DI_0)
iboStartBeltBOOL (DI_1)
Onboard outputs (output cam object)
Onboard outputs (CU)
Extractor activeoutput cam (DO_8)
Example for Beginners Variables
Variables are named in accordance with the instructions from the applications style guide V1.01 for SIMOTION
© Siemens AG 2011. All Rights Reserved.Industry Sector
SIMOTION -Programming
SIMOTION -Configuration
SINAMICS -Configuration
Create Project
Program -Conception
SIMOTION - Basic Information
Task
Introductory Information
Example for Beginners SIMOTION create device
1. Create new SIMOTION SCOUT project
2. Create new device (D435 V4.2)
3. Set the interface for PG to IE2/NETThe networking for PG in NetPro
will be created automatically
© Siemens AG 2011. All Rights Reserved.Industry Sector
SIMOTION -Programming
SIMOTION -Configuration
SINAMICS -Configuration
Create Project
Program -Conception
SIMOTION - Basic Information
Task
Introductory Information
Example for Beginners HW configuration
Set system clock for integrated drive interface
Context menu SINAMICS_INTEGRATED
Object Properties...
The value of Tdp determines the basic cycle of the SIMOTION task system
Via each factors the settings can be fine tuned
© Siemens AG 2011. All Rights Reserved.Industry Sector
SIMOTION -Programming
SIMOTION -Configuration
SINAMICS -Configuration
Create Project
Program -Conception
SIMOTION - Basic Information
Task
Introductory Information
The network configuration for PG is created automatically
Use the properties of the PG (Object properties) to
change the access address of the logical PG interface (e.g. IP-address) (Tab Interfaces) or
change the physical mapping of the logical PG interface (Tab Assignment)
Example for Beginners NetPro
© Siemens AG 2011. All Rights Reserved.Industry Sector
SIMOTION -Programming
SIMOTION -Configuration
SINAMICS -Configuration
Create Project
Program -Conception
SIMOTION - Basic Information
Task
Introductory Information
Start drive configuration
The configuration assistant (wizard) obtained all necessary information
No option module
Example for Beginners Configure drives
© Siemens AG 2011. All Rights Reserved.Industry Sector
SIMOTION -Programming
SIMOTION -Configuration
SINAMICS -Configuration
Create Project
Program -Conception
SIMOTION - Basic Information
Task
Introductory Information
Use unregulated Infeed
Create first drive
Example for BeginnersConfigure drives
© Siemens AG 2011. All Rights Reserved.Industry Sector
SIMOTION -Programming
SIMOTION -Configuration
SINAMICS -Configuration
Create Project
Program -Conception
SIMOTION - Basic Information
Task
Introductory Information
Set drive name for conveyorbelt („conveyor“)
No function modules will enabled in the drive
Example for Beginners Configure Drive 1 (Conveyorbelt)
© Siemens AG 2011. All Rights Reserved.Industry Sector
SIMOTION -Programming
SIMOTION -Configuration
SINAMICS -Configuration
Create Project
Program -Conception
SIMOTION - Basic Information
Task
Introductory Information
Select Power unit (dual-axis module) according to the rating plate
Wiring operation signal
Note: The drive parameter p0864 at power units with DRIVE-CLiQ have to be wired to the operation signal of the infeed. In all other cases the operating signal have to be wired to a digital input (e.g. CU). The chosen DI is now linked with p0864 via BICO.
Example for Beginners Configure Drive 1 (Conveyorbelt)
© Siemens AG 2011. All Rights Reserved.Industry Sector
SIMOTION -Programming
SIMOTION -Configuration
SINAMICS -Configuration
Create Project
Program -Conception
SIMOTION - Basic Information
Task
Introductory Information
Drive 1 to Connection X1
Drive with DRIVE-CLiQ interfaceNo further details for motor type required
Example for Beginners Configure Drive 1 (Conveyorbelt)
© Siemens AG 2011. All Rights Reserved.Industry Sector
SIMOTION -Programming
SIMOTION -Configuration
SINAMICS -Configuration
Create Project
Program -Conception
SIMOTION - Basic Information
Task
Introductory Information
Drive without holding break
Choose encoder for drive control
Example for Beginners Configure Drive 1 (Conveyorbelt)
© Siemens AG 2011. All Rights Reserved.Industry Sector
SIMOTION -Programming
SIMOTION -Configuration
SINAMICS -Configuration
Create Project
Program -Conception
SIMOTION - Basic Information
Task
Introductory Information
Standard communication with drive
Summary
Example for Beginners Configure Drive 1 (Conveyorbelt)
© Siemens AG 2011. All Rights Reserved.Industry Sector
SIMOTION -Programming
SIMOTION -Configuration
SINAMICS -Configuration
Create Project
Program -Conception
SIMOTION - Basic Information
Task
Introductory Information
Insert drive
After entering the name of the extractor (“eject”) the configuration wizard has to be repeated for drive 2. Shown below are just the dialogs that differ in comparison to drive 1.
Example for Beginners Configure Drive 2 (Extractor)
© Siemens AG 2011. All Rights Reserved.Industry Sector
SIMOTION -Programming
SIMOTION -Configuration
SINAMICS -Configuration
Create Project
Program -Conception
SIMOTION - Basic Information
Task
Introductory Information
Select the already added dual-axis module
Only Connection X2 is available
Example for Beginners Configure Drive 2 (Extractor)
© Siemens AG 2011. All Rights Reserved.Industry Sector
SIMOTION -Programming
SIMOTION -Configuration
SINAMICS -Configuration
Create Project
Program -Conception
SIMOTION - Basic Information
Task
Introductory Information
Motor with SMC motor type and speed in accordance with rating plate
Encoder in accordance with rating plate
Example for Beginners Configure Drive 2 (Extractor)
© Siemens AG 2011. All Rights Reserved.Industry Sector
SIMOTION -Programming
SIMOTION -Configuration
SINAMICS -Configuration
Create Project
Program -Conception
SIMOTION - Basic Information
Task
Introductory Information
The wiring must be made for both drives (exemplarily to DI7).
Example for BeginnersWiring of an input for infeed
© Siemens AG 2011. All Rights Reserved.Industry Sector
SIMOTION -Programming
SIMOTION -Configuration
SINAMICS -Configuration
Create Project
Program -Conception
SIMOTION - Basic Information
Task
Introductory Information
For the SIMOTION D training case (single phase connection) the drive parameter p0210 has to be set from 600V to 345V.
Access via expert list.
This must be carried out for both drives.
Example for BeginnersTraining case specific line supply voltage
© Siemens AG 2011. All Rights Reserved.Industry Sector
SIMOTION -Programming
SIMOTION -Configuration
SINAMICS -Configuration
Create Project
Program -Conception
SIMOTION - Basic Information
Task
Introductory Information
The ratio of bus data cycle clock to servo cycle clock to interpolator cycle clock (IPO) should be 1 : 1 : 1.
The bus data cycle clock is given by HW config.(here: DP cycle Tdp).
The reduction of interpolator 2 (IPO_2) can be chosen freely.
Example for BeginnersSystem cycle clocks
© Siemens AG 2011. All Rights Reserved.Industry Sector
SIMOTION -Programming
SIMOTION -Configuration
SINAMICS -Configuration
Create Project
Program -Conception
SIMOTION - Basic Information
Task
Introductory Information
Create a virtual leading axis („MasterAxis“) as positioning axis
Rotary axis
Virtual axis
Example for BeginnersAxis configuration – Master Axis
© Siemens AG 2011. All Rights Reserved.Industry Sector
SIMOTION -Programming
SIMOTION -Configuration
SINAMICS -Configuration
Create Project
Program -Conception
SIMOTION - Basic Information
Task
Introductory Information
Create a real slave axis („Conveyorbelt“)
Including synchronous operation
Rotary axis
Electrical axis
Example for BeginnersAxis configuration – Conveyorbelt
© Siemens AG 2011. All Rights Reserved.Industry Sector
SIMOTION -Programming
SIMOTION -Configuration
SINAMICS -Configuration
Create Project
Program -Conception
SIMOTION - Basic Information
Task
Introductory Information
Connect the slave axis („Conveyorbelt“) to drive 1 („conveyor“)
Assign encoder for the positioning controller
Note for the offline configuration: Encoder type (incremental orabsolute) by motors with DRIVE-CLiQ interface have to be determined from the motor order number.
Example for BeginnersAxis configuration – Conveyorbelt
© Siemens AG 2011. All Rights Reserved.Industry Sector
SIMOTION -Programming
SIMOTION -Configuration
SINAMICS -Configuration
Create Project
Program -Conception
SIMOTION - Basic Information
Task
Introductory Information
Create a real slave axis („Ejector“)
Including synchronous operation
Linear axis
Electrical axis
Example for BeginnersAxis configuration – Extractor
© Siemens AG 2011. All Rights Reserved.Industry Sector
SIMOTION -Programming
SIMOTION -Configuration
SINAMICS -Configuration
Create Project
Program -Conception
SIMOTION - Basic Information
Task
Introductory Information
Connect the slave axis („Ejector“) to drive 2 („eject“)
Assign encoder for the positioning controller
Example for BeginnersAxis configuration – Extractor
© Siemens AG 2011. All Rights Reserved.Industry Sector
SIMOTION -Programming
SIMOTION -Configuration
SINAMICS -Configuration
Create Project
Program -Conception
SIMOTION - Basic Information
Task
Introductory Information
Synchronous operation between leading axis and conveyorbeltVia the synchronous object of the axis
Example for BeginnersAxis configuration – Interconnections
© Siemens AG 2011. All Rights Reserved.Industry Sector
SIMOTION -Programming
SIMOTION -Configuration
SINAMICS -Configuration
Create Project
Program -Conception
SIMOTION - Basic Information
Task
Introductory Information
Synchronous operation between conveyorbelt and extractorBy real leading axis (e.g. conveyorbelt) you can choose the setpoint or the actual value as the set value.
Example for BeginnersAxis configuration – Interconnection
© Siemens AG 2011. All Rights Reserved.Industry Sector
SIMOTION -Programming
SIMOTION -Configuration
SINAMICS -Configuration
Create Project
Program -Conception
SIMOTION - Basic Information
Task
Introductory Information
MasterAxisNo modifications
ConveyorbeltPosition control
Speed precontrol activated
DSC activated; Kv = 50
EjectorPosition control
Speed precontrol activated
DSC activated; Kv = 50
Automatic controller setting
Via „Controller setting…“you can reach the automatic controller setting
Note: The parameterization in this masks has to be done offline.
Example for BeginnersAxis configuration – Parameterization
© Siemens AG 2011. All Rights Reserved.Industry Sector
SIMOTION -Programming
SIMOTION -Configuration
SINAMICS -Configuration
Create Project
Program -Conception
SIMOTION - Basic Information
Task
Introductory Information
ConveyorbeltNo homing because absolute encoder
EjectorHoming mode: Encoder zero mark only
Example for BeginnersAxis configuration – Parameterization
© Siemens AG 2011. All Rights Reserved.Industry Sector
SIMOTION -Programming
SIMOTION -Configuration
SINAMICS -Configuration
Create Project
Program -Conception
SIMOTION - Basic Information
Task
Introductory Information
Save and compile projectEither via menu Project Save and compile all or viathe Toolbar.
Detailed view shows the compile resultsThe tab Compile / check output shows the results of compiling and checking.
The tab Address setup output shows the automatic performed address assignments.The set standard settings from the drives and axis were evaluated and suitable message frame types were chosen (Message frame type 105 and 390 for the Control Unit). Also the associated address ranges were set.
Example for BeginnersSave and compile all
© Siemens AG 2011. All Rights Reserved.Industry Sector
SIMOTION -Programming
SIMOTION -Configuration
SINAMICS -Configuration
Create Project
Program -Conception
SIMOTION - Basic Information
Task
Introductory Information
Insert output cam to the axis EjectorBefore an output cam can be insert, an I/O of the control unit has to be configured as output. (DO 8)
Example for BeginnersOutput cam configuration at the ejector valve
© Siemens AG 2011. All Rights Reserved.Industry Sector
SIMOTION -Programming
SIMOTION -Configuration
SINAMICS -Configuration
Create Project
Program -Conception
SIMOTION - Basic Information
Task
Introductory Information
Insert output cam to the axis EjectorOutput cam and track will be added in the directory Output Cam under the relevant axis (Ejector).
One output cam were created by Insert output cam.
Set name of the output cam and activate Open editor automatically.
Example for BeginnersOutput cam configuration at the ejector valve
© Siemens AG 2011. All Rights Reserved.Industry Sector
SIMOTION -Programming
SIMOTION -Configuration
SINAMICS -Configuration
Create Project
Program -Conception
SIMOTION - Basic Information
Task
Introductory Information
Configure the output camProc. cycle clock: IPO
Output cam type: Position based cam (related to the axis Ejector)
Type of output cam values: Setpoints
Advantage: Symbolic AccessNo absolute address entry
Example for BeginnersOutput cam configuration at the ejector valve
Activate output
Set Cam output to: Fast digital output
Set digital output DO 8 at the control unit.This output won't be added to the symbol browser.
© Siemens AG 2011. All Rights Reserved.Industry Sector
SIMOTION -Programming
SIMOTION -Configuration
SINAMICS -Configuration
Create Project
Program -Conception
SIMOTION - Basic Information
Task
Introductory Information
Create I/O-Variables at the symbol browseriboProtDoor protection door contact
(input 0 on the switch box of the training case)
iboStartBelt start conveyorbelt(input 1)
iboEject sensor detect bad part(input 2)
ib16DigCU Image of the onboard-inputs of the control unit
Note: The input in the symbol browser is done offline.
Example for BeginnersProgramming – I/O-Variables
© Siemens AG 2011. All Rights Reserved.Industry Sector
SIMOTION -Programming
SIMOTION -Configuration
SINAMICS -Configuration
Create Project
Program -Conception
SIMOTION - Basic Information
Task
Introductory Information
In the general settings of the project is set, that programs generally can be observed.
MCC-units can additional be observed in single step mode.
In the properties of each unit you can overload this basic settings if necessary.
Example for BeginnersProgramming – Settings for program testing
When you insert a source a properties dialog displays. In this you can set the name and if necessary the compiler settings.
Later this settings can be changed by the properties of the existing source.
© Siemens AG 2011. All Rights Reserved.Industry Sector
SIMOTION -Programming
SIMOTION -Configuration
SINAMICS -Configuration
Create Project
Program -Conception
SIMOTION - Basic Information
Task
Introductory Information
Function
Definition of all unit global variables in the INTERFACE field only in one ST-unit.
Ensures easy exportability of global variables.
Prevent confusing cross-references (“links” or “USES”).
Retain variables and HMI variables are also declared on a separate source.
Example for BeginnersProgramming – variable definition in ST („pDefInit“)
Programming
Insert ST-unit „pDefInit“
Insert keywords VAR_GLOBAL and END_VAR
Definition of the variables and default values
Insert keyword PROGRAM „pInit“
© Siemens AG 2011. All Rights Reserved.Industry Sector
SIMOTION -Programming
SIMOTION -Configuration
SINAMICS -Configuration
Create Project
Program -Conception
SIMOTION - Basic Information
Task
Introductory Information
Example for BeginnersProgramming – variable initialization in ST („pDefInit“)
Programming
Insert keywords PROGRAM „pInit“ and END_PROGRAM
Initialization of the variables at STOP – RUN transition
Save and compile
Function
With the program “pInit” in the ST-unit “pDefInit” the variables will be set to a defined value at startup.
The ST-unit “pInit” is to assign to the StartupTask.The StartupTask is executed at every change of the operating state of the SIMOTION control from STOP to RUN.
© Siemens AG 2011. All Rights Reserved.Industry Sector
SIMOTION -Programming
SIMOTION -Configuration
SINAMICS -Configuration
Create Project
Program -Conception
SIMOTION - Basic Information
Task
Introductory Information
Example for BeginnersProgramming – connection to an other unit
Basic Procedure
Always when variables from “pDefInit” are used in an other source (e.g. “pAuto”), “pDefInit” have to be assign to this source.
This connection can be configured in the tab “Connections”.
© Siemens AG 2011. All Rights Reserved.Industry Sector
SIMOTION -Programming
SIMOTION -Configuration
SINAMICS -Configuration
Create Project
Program -Conception
SIMOTION - Basic Information
Task
Introductory Information
Insert MCC-unit “pTecFault” and add it to the TechnologicalFaultTask after programming.
All alarms of a technological object can be quit (e.g. Ejector).
Also you can quit a specific alarm (e.g. 30002) of a technological object (conveyorbelt).
Example for BeginnersProgramming – TechnologicalFaultTask
FunctionFor fault handling of technological objects(e.g. axis).
In principle, an empty program can be used. Thus, the SIMOTION control won’t STOP if errors occurs.
Note: During the commissioning and troubleshooting, it is advisable to acknowledge as few alarms directly. These alarms often give clues of misconduct.
© Siemens AG 2011. All Rights Reserved.Industry Sector
SIMOTION -Programming
SIMOTION -Configuration
SINAMICS -Configuration
Create Project
Program -Conception
SIMOTION - Basic Information
Task
Introductory Information
Access to I/Os of the drives only when the drive components have also been ramped up (after Power On)
e.g. onboard inputs of the CU
Test in the program for valid accesses of the I/O variables
Is to be done in all cyclic tasks (e.g. via the variable “gboDriveActive”)
Alternatively, you can work directly with replacement values of the I/O variables
Example for BeginnersProgramming – Access to I/O-variables in cyclical tasks
© Siemens AG 2011. All Rights Reserved.Industry Sector
SIMOTION -Programming
SIMOTION -Configuration
SINAMICS -Configuration
Create Project
Program -Conception
SIMOTION - Basic Information
Task
Introductory Information
Example for BeginnersProgramming – BackgroundTask in LAD/FBD
Programming of the BackgroundTaskInsert LAD/FBD-unit “pBckFBD”
Insert a LAD/FBD-program “pLADFBD” in the LAD/FBD-unit
The homing and the automatic operation are started depending on the contents of the gi16Mode variable.
gi16Mode = 0 hominggi16Mode = 1 automatic
This occurs only whenThe protection door is closed andMotionTask_1 or MotionTask_2
Stopped (performed),Waiting and has been suspended (emergency stop)Suspended (emergency stop)
In a LAD/FBD-program you can always switch between the views LAD and FBD. This is done via the menu or the toolbar.
© Siemens AG 2011. All Rights Reserved.Industry Sector
SIMOTION -Programming
SIMOTION -Configuration
SINAMICS -Configuration
Create Project
Program -Conception
SIMOTION - Basic Information
Task
Introductory Information
Example for BeginnersProgramming – BackgroundTask in LAD/FBD
Create local variablesb32TaskState : State of MotionTask_2 or MotionTask_3
b32RetStart : Return value of the function „_startTaskID“
boResult : Resultbit of the LAD/FBD-Networks
b32ResAnd : Result of the task state evaluation
boGo: Taskstartbit (TRUE if MotionTask_2 or MotionTask_3 have to be restarted)
sTaskSel : Structure that can contain TaskIDs (e.g. MotionTask_2 or MotionTask_3)
Network 1 – Drives readyJump to the end if the drives have notbeen ramped up yet
No access possibly toI/O-variables from SINAMICS.
Jump label “end” is created in the last network.
© Siemens AG 2011. All Rights Reserved.Industry Sector
SIMOTION -Programming
SIMOTION -Configuration
SINAMICS -Configuration
Create Project
Program -Conception
SIMOTION - Basic Information
Task
Introductory Information
Network 2 – query protection door contactJump to the end, if protection door is open
Networks 3 and 4 – selection of the taskDepending on the gi16Mode variable, the sTaskSel variable will be assigned the value “MotionTask_1“ or “MotionTask_2“, respectively.
The task stored in the sTaskSel variable can be started in network 9.
The block “MOVE” is insert via the command library - LAD/FBD elements.Alternatively, an empty box is used. Then the empty box is filled with the module name.
Example for BeginnersProgramming – BackgroundTask in LAD/FBD
© Siemens AG 2011. All Rights Reserved.Industry Sector
SIMOTION -Programming
SIMOTION -Configuration
SINAMICS -Configuration
Create Project
Program -Conception
SIMOTION - Basic Information
Task
Introductory Information
Network 5 and 6 – query task stateYou can query the task state with the system function “_GetStateOfTaskId”(command library – task system). The reported state is always clearly and consistently.
This is a significant advantage over an application-locking by using boolean variables.The variable “sTaskSel” contains the task whose state is to be queried.The return value is a DWORD (“b32TaskState”) that can be processed bitwise.
In Network 6 is a bitwise AND link of the return value with the value 16#0022. This corresponds to the OR link of the two states “TASK_STATE_STOPPED” and “TASK_STATE_SUSPENDED”.
Note: The different task state information can be found in the manual SIMOTION SCOUT basic functions.
Example for BeginnersProgramming – BackgroundTask in LAD/FBD
© Siemens AG 2011. All Rights Reserved.Industry Sector
SIMOTION -Programming
SIMOTION -Configuration
SINAMICS -Configuration
Create Project
Program -Conception
SIMOTION - Basic Information
Task
Introductory Information
Network 7 and 8 – evaluate task stateThe result of the bit AND logical operation is evaluated in this network.
If the return value is larger than 16#0000, the associated task must be restarted (boGo = TRUE).
If the return value matches 16#0000, boGo becomes FALSE. This bypasses restarting the task. Jump label is “end“ (network 9).
Example for BeginnersProgramming – BackgroundTask in LAD/FBD
© Siemens AG 2011. All Rights Reserved.Industry Sector
SIMOTION -Programming
SIMOTION -Configuration
SINAMICS -Configuration
Create Project
Program -Conception
SIMOTION - Basic Information
Task
Introductory Information
Network 9 and 10 – start taskThis network becomes active as soon as a task needs to be restarted.
To start the task the system function “_restartTaskId” (command library – task system) is used. This function can only be used to MotionTasks.
The return value is a DWORD (“b32RetStart”), which reports about success or failure.
In Network 10 is a jump label “end”. This jump label is at the end of the block, so that jumps to this position will end the block.
A jump label can be switched on or off. To do this you have to select the label and switch it on or off via the toolbar or the menu.
Example for BeginnersProgramming – BackgroundTask in LAD/FBD
© Siemens AG 2011. All Rights Reserved.Industry Sector
SIMOTION -Programming
SIMOTION -Configuration
SINAMICS -Configuration
Create Project
Program -Conception
SIMOTION - Basic Information
Task
Introductory Information
Example for BeginnersProgramming - BackgroundTask (FBD)
The status of the FBD program can be monitored in this snapshot (monitor online).
Network 2: The protection door is closed.
Network 3 and 4: The operating mode is “automatic“ (gi16Mode = 1). Consequently, Motiontask_3 is stored in the sTaskSel variable.
Aktueller Wert zur Laufzeit
© Siemens AG 2011. All Rights Reserved.Industry Sector
SIMOTION -Programming
SIMOTION -Configuration
SINAMICS -Configuration
Create Project
Program -Conception
SIMOTION - Basic Information
Task
Introductory Information
Example for BeginnersProgramming – Homing (Motion Task 2 MCC) 1/2
Insert MCC Chart „pHoming“
Connect with “pDefInit”
Declare a local variable “i32RetResetAxis” (Variable type VAR, Data type DINT)
Reset axes in the “ST-Zoom” (after emergency stop):
„i32RetResetAxis := _resetAxis (Axis := MasterAxis);“
„i32RetResetAxis := _resetAxis (Axis := Conveyorbelt);“
„i32RetResetAxis := _resetAxis (Axis := Ejector);“
Alternatively, the axis enable can also be removed and reapplied.
Set gboProtDoorOpen to “false”
Set gr64VMasterAxisOld to 0
© Siemens AG 2011. All Rights Reserved.Industry Sector
SIMOTION -Programming
SIMOTION -Configuration
SINAMICS -Configuration
Create Project
Program -Conception
SIMOTION - Basic Information
Task
Introductory Information
Example for BeginnersProgramming – Homing (Motion Task 2 MCC) 2/2
Homing:Zeros on the “MasterAxis”
Enable “Conveyorbelt”
Enable “Ejector”
Deactivate “Valve” output cam
If necessary: active homing conveyorbelt (if an incremental encoder is used). Command can be displayed in case of need again.
Active homing ejector
Use default settings
Optionally, an initial position motion can also be connected here
Set variable gi16Mode to 1
© Siemens AG 2011. All Rights Reserved.Industry Sector
SIMOTION -Programming
SIMOTION -Configuration
SINAMICS -Configuration
Create Project
Program -Conception
SIMOTION - Basic Information
Task
Introductory Information
Example for BeginnersProgramming – Assignment to the executing system
Open executing system with a double click
Use the arrow buttons to assign previously created programs to the execution levels
© Siemens AG 2011. All Rights Reserved.Industry Sector
SIMOTION -Programming
SIMOTION -Configuration
SINAMICS -Configuration
Create Project
Program -Conception
SIMOTION - Basic Information
Task
Introductory Information
Example for BeginnersProgramming – First Test
Open the “Homing“ program (SCOUT must be online) and start monitoring
Switch SIMOTION D435 to RUN
Depending on the configuration either both or only one of these axes perform homing
Optionally, the program can also be run in single-step mode
The axes are homed after passage through the program
Note for the execution:
The “pBckFBD” program in the background task starts the automatic operation as soon as the “gi16Mode”variable is set to 1.
Note: There are additional comments on the “FAQ” slide
© Siemens AG 2011. All Rights Reserved.Industry Sector
SIMOTION -Programming
SIMOTION -Configuration
SINAMICS -Configuration
Create Project
Program -Conception
SIMOTION - Basic Information
Task
Introductory Information
Example for BeginnersProgramming – Automatic operation (MotionTask 3 in MCC)
Insert MCC Chart “pAuto”
Connect with “pDefInit”
Enable “MasterAxis”
The conveyor belt starts with the positive edge of the “iboStartBelt“ signal
Synchronize the conveyorbeltsee parameterization (following slides)
Activate the “Valve” output camsee parameterization (following slides)
If the set velocity changes, switch continuegr64VMasterAxis <> gr64VMasterAxisOld
Start master axis position-controlled with “gr64VMasterAxis” velocityFor comparison, save the current velocity in “gr64VMasterAxisOld := gr64VMasterAxis”Until-loop with “gboProgEnd” condition
© Siemens AG 2011. All Rights Reserved.Industry Sector
SIMOTION -Programming
SIMOTION -Configuration
SINAMICS -Configuration
Create Project
Program -Conception
SIMOTION - Basic Information
Task
Introductory Information
Example for BeginnersParameterization - Automatic (MCC)
Switch on the gearbox synchronism of the Conveyorbelt
“Synchronize immediately”
Synchronization length 1
Synchronization reference master axis
Relative to the start position (Parameters tab)
Activate the “Valve“ output cam
Switch-on position0.1 mm
Switch-off position 0.4 mm
© Siemens AG 2011. All Rights Reserved.Industry Sector
SIMOTION -Programming
SIMOTION -Configuration
SINAMICS -Configuration
Create Project
Program -Conception
SIMOTION - Basic Information
Task
Introductory Information
Example for BeginnersProgramming – Second Test
The “gr64VMasterAxis” set velocity can be controlled in the symbol browser or in a watch table (control immediately)The automatic program responds only to a change of the set velocity
The program „pAuto“ must now also be assigned to the execution systemAs previously, the monitoring is now activated
Operation:Once the axes have been homed, the “Conveyorbelt“ starts to turn as soon as a positive edge of “iboStartBelt“ is detected
© Siemens AG 2011. All Rights Reserved.Industry Sector
SIMOTION -Programming
SIMOTION -Configuration
SINAMICS -Configuration
Create Project
Program -Conception
SIMOTION - Basic Information
Task
Introductory Information
Example for BeginnersProgramming – Test using trace
Open the trace
Variables from the program and from technological objects (e.g. axes) can be recorded in the trace
Procedure:
Select trace D435
Select variables
Load Trace in the D435
Start D435
Start trace
iboStartBelt from 0 to 1
© Siemens AG 2011. All Rights Reserved.Industry Sector
SIMOTION -Programming
SIMOTION -Configuration
SINAMICS -Configuration
Create Project
Program -Conception
SIMOTION - Basic Information
Task
Introductory Information
Example for BeginnersCam – Form (with CAM-Tool)
Cam „Cam_Ejector“3 elements
1 interpolation point left1 straight line at 45°1 interpolation point right
Note: CAM Tool have to be installed
Function of the segmentsSegment 1: Synchronize to the conveyorbeltSegment 2: Synchronous operation with conveyorbeltSegment 3: Desynchronize and return to the initial position (wait for the next defect part)
Segment 1 Segment 2
Segment 3
© Siemens AG 2011. All Rights Reserved.Industry Sector
SIMOTION -Programming
SIMOTION -Configuration
SINAMICS -Configuration
Create Project
Program -Conception
SIMOTION - Basic Information
Task
Introductory Information
Example for BeginnersCam - Parameterization
Curve elements (straight line, interpolation point) are selected in the CAMtool function bar.Properties (right mouse click on the curve element)
Straight linex1 = y1 = 0.1x2 = y2 = 0.4
Interpolation point left (create with symbol)x = y = 0.0
Interpolation point right (create with symbol)x = 0.8y = 0.0
Scaling (Cam – “Target Device Parameter“ menuMaster
Base scaling 360Slave
Base scaling 10
Note: The mouse pointer must be active in order to move curve elements with the mouse. A decimal point must be used for floating point numbers.
© Siemens AG 2011. All Rights Reserved.Industry Sector
SIMOTION -Programming
SIMOTION -Configuration
SINAMICS -Configuration
Create Project
Program -Conception
SIMOTION - Basic Information
Task
Introductory Information
Example for BeginnersProgramming – Eject by cam
Insert MCC Chart “pEject”
Synchronize the cam
This motion task is started with a user interrupt
The cam is processed acyclically
© Siemens AG 2011. All Rights Reserved.Industry Sector
SIMOTION -Programming
SIMOTION -Configuration
SINAMICS -Configuration
Create Project
Program -Conception
SIMOTION - Basic Information
Task
Introductory Information
Example for BeginnersProgramming – Stock outage detection (user interrupt in MCC)
Stock outage detection:
Insert program “pEject”
Specify condition for user interrupt in the execution system
Sensor at DI 2 (iboEject) at TRUE means “eject” is coming (Input 2 on the switch box of the D435 training case)
© Siemens AG 2011. All Rights Reserved.Industry Sector
SIMOTION -Programming
SIMOTION -Configuration
SINAMICS -Configuration
Create Project
Program -Conception
SIMOTION - Basic Information
Task
Introductory Information
Example for BeginnersProgramming – Protection door (IPO synchronous in MCC) 1/2
Monitoring the protection door:
Insert MCC Chart “pProtDoor”
Connect with “pDefInit”
Query whether protection door is closed (true = closed)
If open , set “gboProtDoorOpen” bit, because axes must be explicitly reset after an emergency stop (see automatic operation (MotionTask 3 in MCC) 1/2)
Query all MotionTasks using “_GetStateOfTask (MotionTask_x) <> 16#0002“ (where x = 1 to 3) (test whether task “stopped”)
All running tasks will be interrupted
© Siemens AG 2011. All Rights Reserved.Industry Sector
SIMOTION -Programming
SIMOTION -Configuration
SINAMICS -Configuration
Create Project
Program -Conception
SIMOTION - Basic Information
Task
Introductory Information
Example for BeginnersProgramming – Protection door (IPO synchronous in MCC) 2/2
Monitoring the protection door:
Query the axes for stoppage using
„MasterAxis.motionstatedata.motionstate <> standstill“
„Conveyorbelt.motionstatedata.motionstate <> standstill“
„Ejector.motionstatedata.motionstate <> standstill“
If the axes are moving
Deactivate “Valve” output cam
Stop axes using “Fast stop with maximum deceleration”
© Siemens AG 2011. All Rights Reserved.Industry Sector
SIMOTION -Programming
SIMOTION -Configuration
SINAMICS -Configuration
Create Project
Program -Conception
SIMOTION - Basic Information
Task
Introductory Information
Example for BeginnersProgramming - Test and diagnostics - Possibilities
Test the program execution:
Create a “watch table“. The variable can be moved with a right click in the symbol browser.
Recording object variables such as actual position and actual velocity of an axis using “Trace“
Test the program execution of a Motion Task using “Monitor” and “Single Step”
© Siemens AG 2011. All Rights Reserved.Industry Sector
SIMOTION -Programming
SIMOTION -Configuration
SINAMICS -Configuration
Create Project
Program -Conception
SIMOTION - Basic Information
Task
Introductory Information
Example for BeginnersFAQ
After STOP-RUN transition nothing moves, what is the problem?
Have the tasks been correctly added to the execution system?
Is the protective door (DI 0) closed?
The extractor output cam does not come!
An output cam must be activated. Are the limits correctly parameterized in the “Switch on SW output cam“ mask ?
The homing task “hangs“ on the axis enable of the real axes. Why is this?
The axis enable does not arrive. Possible causes:
In the HW configuration, the “Master application cycle“ in the slave properties does not agree with the position control cycle in the SCOUT under “Execution system –Expert settings“. They must be identical!
The axes homing is not correct. What can be the error cause?
Check the settings in the “Homing Axes” mask
© Siemens AG 2011. All Rights Reserved.Industry Sector
SIMOTION -Programming
SIMOTION -Configuration
SINAMICS -Configuration
Create Project
Program -Conception
SIMOTION - Basic Information
Task
Introductory Information
Example for BeginnersWinCC flexible - Connection
Connectable variables:
Ethernet
HMI (WinCC flexible)
Data exchange
Global user variablesI/O-variables
Device global variables
Unit variables
System variablesTechnology objects
SIMOTION device
Example needs a display resolution of
1280x1024
D435
© Siemens AG 2011. All Rights Reserved.Industry Sector
SIMOTION -Programming
SIMOTION -Configuration
SINAMICS -Configuration
Create Project
Program -Conception
SIMOTION - Basic Information
Task
Introductory Information
Example for BeginnersAdd “pHMIaus” ST source
© Siemens AG 2011. All Rights Reserved.Industry Sector
SIMOTION -Programming
SIMOTION -Configuration
SINAMICS -Configuration
Create Project
Program -Conception
SIMOTION - Basic Information
Task
Introductory Information
Example for Beginners”pHMIaus” ST source in Background-Task
© Siemens AG 2011. All Rights Reserved.Industry Sector
SIMOTION -Programming
SIMOTION -Configuration
SINAMICS -Configuration
Create Project
Program -Conception
SIMOTION - Basic Information
Task
Introductory Information
Example for BeginnersWinCC flexible - Connection
Open NetPro
Insert a SIMATIC HMI Station
© Siemens AG 2011. All Rights Reserved.Industry Sector
SIMOTION -Programming
SIMOTION -Configuration
SINAMICS -Configuration
Create Project
Program -Conception
SIMOTION - Basic Information
Task
Introductory Information
Example for BeginnersWinCC flexible - Connection
Select PC WinCC flexible Runtime
© Siemens AG 2011. All Rights Reserved.Industry Sector
SIMOTION -Programming
SIMOTION -Configuration
SINAMICS -Configuration
Create Project
Program -Conception
SIMOTION - Basic Information
Task
Introductory Information
Example for BeginnersWinCC flexible - Connection
After selecting, the SIMATIC HMI Station appears in NetPro.
By double clicking on the station, the HW Config opens.
© Siemens AG 2011. All Rights Reserved.Industry Sector
SIMOTION -Programming
SIMOTION -Configuration
SINAMICS -Configuration
Create Project
Program -Conception
SIMOTION - Basic Information
Task
Introductory Information
Example for BeginnersWinCC flexible - Connection
Insert an Ethernet interface (HMI IE)
IP address: 169.254.11.1Subnet mask: 255.255.0.0Save and compileClose HW Config
© Siemens AG 2011. All Rights Reserved.Industry Sector
SIMOTION -Programming
SIMOTION -Configuration
SINAMICS -Configuration
Create Project
Program -Conception
SIMOTION - Basic Information
Task
Introductory Information
Example for BeginnersWinCC flexible - Connection
After inserting, the HMI IE interface appears in the station.
Save and compileClose NetPro
© Siemens AG 2011. All Rights Reserved.Industry Sector
SIMOTION -Programming
SIMOTION -Configuration
SINAMICS -Configuration
Create Project
Program -Conception
SIMOTION - Basic Information
Task
Introductory Information
Example for BeginnersWinCC flexible - Connection
Open WinCC flexibleOpen existing project double click on project
Select previously insert SIMATIC HMI Station
© Siemens AG 2011. All Rights Reserved.Industry Sector
SIMOTION -Programming
SIMOTION -Configuration
SINAMICS -Configuration
Create Project
Program -Conception
SIMOTION - Basic Information
Task
Introductory Information
Example for BeginnersWinCC flexible - Connection
WinCC flexible opens the project
At this point you can edit the WinCC flexible project.Hereafter the user interface of the sample project is shown.
© Siemens AG 2011. All Rights Reserved.Industry Sector
SIMOTION -Programming
SIMOTION -Configuration
SINAMICS -Configuration
Create Project
Program -Conception
SIMOTION - Basic Information
Task
Introductory Information
Example for BeginnersWinCC flexible - Connection (Picture)
© Siemens AG 2011. All Rights Reserved.
Thank you for your attention!